]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blame - sound/pci/hda/patch_realtek.c
ALSA: hda/realtek: Fix silent output on Gigabyte X570 Aorus Xtreme after reboot from...
[mirror_ubuntu-jammy-kernel.git] / sound / pci / hda / patch_realtek.c
CommitLineData
d0fa1179 1// SPDX-License-Identifier: GPL-2.0-or-later
1da177e4
LT
2/*
3 * Universal Interface for Intel High Definition Audio Codec
4 *
1d045db9 5 * HD audio interface patch for Realtek ALC codecs
1da177e4 6 *
df694daa
KY
7 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
8 * PeiSen Hou <pshou@realtek.com.tw>
1da177e4 9 * Takashi Iwai <tiwai@suse.de>
409a3e98 10 * Jonathan Woithe <jwoithe@just42.net>
1da177e4
LT
11 */
12
1da177e4
LT
13#include <linux/init.h>
14#include <linux/delay.h>
15#include <linux/slab.h>
16#include <linux/pci.h>
08fb0d0e 17#include <linux/dmi.h>
da155d5b 18#include <linux/module.h>
33f4acd3 19#include <linux/input.h>
87dc3648 20#include <linux/leds.h>
1da177e4 21#include <sound/core.h>
9ad0e496 22#include <sound/jack.h>
be57bfff 23#include <sound/hda_codec.h>
1da177e4 24#include "hda_local.h"
23d30f28 25#include "hda_auto_parser.h"
1835a0f9 26#include "hda_jack.h"
08c189f2 27#include "hda_generic.h"
1da177e4 28
cd63a5ff
TI
29/* keep halting ALC5505 DSP, for power saving */
30#define HALT_REALTEK_ALC5505
31
4a79ba34
TI
32/* extra amp-initialization sequence types */
33enum {
1c76aa5f 34 ALC_INIT_UNDEFINED,
4a79ba34
TI
35 ALC_INIT_NONE,
36 ALC_INIT_DEFAULT,
4a79ba34
TI
37};
38
73bdd597
DH
39enum {
40 ALC_HEADSET_MODE_UNKNOWN,
41 ALC_HEADSET_MODE_UNPLUGGED,
42 ALC_HEADSET_MODE_HEADSET,
43 ALC_HEADSET_MODE_MIC,
44 ALC_HEADSET_MODE_HEADPHONE,
45};
46
47enum {
48 ALC_HEADSET_TYPE_UNKNOWN,
49 ALC_HEADSET_TYPE_CTIA,
50 ALC_HEADSET_TYPE_OMTP,
51};
52
c7b60a89
HW
53enum {
54 ALC_KEY_MICMUTE_INDEX,
55};
56
da00c244
KY
57struct alc_customize_define {
58 unsigned int sku_cfg;
59 unsigned char port_connectivity;
60 unsigned char check_sum;
61 unsigned char customization;
62 unsigned char external_amp;
63 unsigned int enable_pcbeep:1;
64 unsigned int platform_type:1;
65 unsigned int swap:1;
66 unsigned int override:1;
90622917 67 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
da00c244
KY
68};
69
766538ac
TI
70struct alc_coef_led {
71 unsigned int idx;
72 unsigned int mask;
73 unsigned int on;
74 unsigned int off;
75};
76
1da177e4 77struct alc_spec {
08c189f2 78 struct hda_gen_spec gen; /* must be at head */
23d30f28 79
1da177e4 80 /* codec parameterization */
da00c244 81 struct alc_customize_define cdefine;
08c189f2 82 unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
834be88d 83
5579cd6f
TI
84 /* GPIO bits */
85 unsigned int gpio_mask;
86 unsigned int gpio_dir;
87 unsigned int gpio_data;
215c850c 88 bool gpio_write_delay; /* add a delay before writing gpio_data */
5579cd6f 89
8d3d1ece 90 /* mute LED for HP laptops, see vref_mute_led_set() */
08fb0d0e 91 int mute_led_polarity;
dbd13179 92 int micmute_led_polarity;
08fb0d0e 93 hda_nid_t mute_led_nid;
9c5dc3bf 94 hda_nid_t cap_mute_led_nid;
08fb0d0e 95
0f32fd19
TI
96 unsigned int gpio_mute_led_mask;
97 unsigned int gpio_mic_led_mask;
766538ac
TI
98 struct alc_coef_led mute_led_coef;
99 struct alc_coef_led mic_led_coef;
1b35106e 100 struct mutex coef_mutex;
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];
df694daa
KY
130};
131
f2a227cd
TI
132/*
133 * COEF access helper functions
134 */
135
1b35106e
TI
136static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
137 unsigned int coef_idx)
f2a227cd
TI
138{
139 unsigned int val;
140
141 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
142 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
143 return val;
144}
145
1b35106e
TI
146static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
147 unsigned int coef_idx)
148{
149 struct alc_spec *spec = codec->spec;
150 unsigned int val;
151
152 mutex_lock(&spec->coef_mutex);
153 val = __alc_read_coefex_idx(codec, nid, coef_idx);
154 mutex_unlock(&spec->coef_mutex);
155 return val;
156}
157
f2a227cd
TI
158#define alc_read_coef_idx(codec, coef_idx) \
159 alc_read_coefex_idx(codec, 0x20, coef_idx)
160
1b35106e
TI
161static void __alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
162 unsigned int coef_idx, unsigned int coef_val)
f2a227cd
TI
163{
164 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
165 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
166}
167
1b35106e
TI
168static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
169 unsigned int coef_idx, unsigned int coef_val)
170{
171 struct alc_spec *spec = codec->spec;
172
173 mutex_lock(&spec->coef_mutex);
174 __alc_write_coefex_idx(codec, nid, coef_idx, coef_val);
175 mutex_unlock(&spec->coef_mutex);
176}
177
f2a227cd
TI
178#define alc_write_coef_idx(codec, coef_idx, coef_val) \
179 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
180
1b35106e
TI
181static void __alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
182 unsigned int coef_idx, unsigned int mask,
183 unsigned int bits_set)
184{
185 unsigned int val = __alc_read_coefex_idx(codec, nid, coef_idx);
186
187 if (val != -1)
188 __alc_write_coefex_idx(codec, nid, coef_idx,
189 (val & ~mask) | bits_set);
190}
191
98b24883
TI
192static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
193 unsigned int coef_idx, unsigned int mask,
194 unsigned int bits_set)
195{
1b35106e 196 struct alc_spec *spec = codec->spec;
98b24883 197
1b35106e
TI
198 mutex_lock(&spec->coef_mutex);
199 __alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set);
200 mutex_unlock(&spec->coef_mutex);
98b24883
TI
201}
202
203#define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
204 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
205
f2a227cd
TI
206/* a special bypass for COEF 0; read the cached value at the second time */
207static unsigned int alc_get_coef0(struct hda_codec *codec)
208{
209 struct alc_spec *spec = codec->spec;
210
211 if (!spec->coef0)
212 spec->coef0 = alc_read_coef_idx(codec, 0);
213 return spec->coef0;
214}
215
54db6c39
TI
216/* coef writes/updates batch */
217struct coef_fw {
218 unsigned char nid;
219 unsigned char idx;
220 unsigned short mask;
221 unsigned short val;
222};
223
224#define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
225 { .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
226#define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
227#define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
228#define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
229
230static void alc_process_coef_fw(struct hda_codec *codec,
231 const struct coef_fw *fw)
232{
1b35106e
TI
233 struct alc_spec *spec = codec->spec;
234
235 mutex_lock(&spec->coef_mutex);
54db6c39
TI
236 for (; fw->nid; fw++) {
237 if (fw->mask == (unsigned short)-1)
1b35106e 238 __alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
54db6c39 239 else
1b35106e
TI
240 __alc_update_coefex_idx(codec, fw->nid, fw->idx,
241 fw->mask, fw->val);
54db6c39 242 }
1b35106e 243 mutex_unlock(&spec->coef_mutex);
54db6c39
TI
244}
245
df694daa 246/*
1d045db9 247 * GPIO setup tables, used in initialization
df694daa 248 */
5579cd6f 249
bc9f98a9 250/* Enable GPIO mask and set output */
5579cd6f
TI
251static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
252{
253 struct alc_spec *spec = codec->spec;
bc9f98a9 254
5579cd6f
TI
255 spec->gpio_mask |= mask;
256 spec->gpio_dir |= mask;
257 spec->gpio_data |= mask;
258}
bc9f98a9 259
5579cd6f
TI
260static void alc_write_gpio_data(struct hda_codec *codec)
261{
262 struct alc_spec *spec = codec->spec;
263
264 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
265 spec->gpio_data);
266}
267
aaf312de
TI
268static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
269 bool on)
270{
271 struct alc_spec *spec = codec->spec;
272 unsigned int oldval = spec->gpio_data;
273
274 if (on)
275 spec->gpio_data |= mask;
276 else
277 spec->gpio_data &= ~mask;
278 if (oldval != spec->gpio_data)
279 alc_write_gpio_data(codec);
280}
281
5579cd6f
TI
282static void alc_write_gpio(struct hda_codec *codec)
283{
284 struct alc_spec *spec = codec->spec;
285
286 if (!spec->gpio_mask)
287 return;
288
289 snd_hda_codec_write(codec, codec->core.afg, 0,
290 AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
291 snd_hda_codec_write(codec, codec->core.afg, 0,
292 AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir);
215c850c
TI
293 if (spec->gpio_write_delay)
294 msleep(1);
5579cd6f
TI
295 alc_write_gpio_data(codec);
296}
297
298static void alc_fixup_gpio(struct hda_codec *codec, int action,
299 unsigned int mask)
300{
301 if (action == HDA_FIXUP_ACT_PRE_PROBE)
302 alc_setup_gpio(codec, mask);
303}
304
305static void alc_fixup_gpio1(struct hda_codec *codec,
306 const struct hda_fixup *fix, int action)
307{
308 alc_fixup_gpio(codec, action, 0x01);
309}
310
311static void alc_fixup_gpio2(struct hda_codec *codec,
312 const struct hda_fixup *fix, int action)
313{
314 alc_fixup_gpio(codec, action, 0x02);
315}
316
317static void alc_fixup_gpio3(struct hda_codec *codec,
318 const struct hda_fixup *fix, int action)
319{
320 alc_fixup_gpio(codec, action, 0x03);
321}
bdd148a3 322
ae065f1c
TI
323static void alc_fixup_gpio4(struct hda_codec *codec,
324 const struct hda_fixup *fix, int action)
325{
326 alc_fixup_gpio(codec, action, 0x04);
327}
328
8a503555
TI
329static void alc_fixup_micmute_led(struct hda_codec *codec,
330 const struct hda_fixup *fix, int action)
331{
e65bf997 332 if (action == HDA_FIXUP_ACT_PRE_PROBE)
8a503555
TI
333 snd_hda_gen_add_micmute_led_cdev(codec, NULL);
334}
335
2c3bf9ab
TI
336/*
337 * Fix hardware PLL issue
338 * On some codecs, the analog PLL gating control must be off while
339 * the default value is 1.
340 */
341static void alc_fix_pll(struct hda_codec *codec)
342{
343 struct alc_spec *spec = codec->spec;
2c3bf9ab 344
98b24883
TI
345 if (spec->pll_nid)
346 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
347 1 << spec->pll_coef_bit, 0);
2c3bf9ab
TI
348}
349
350static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
351 unsigned int coef_idx, unsigned int coef_bit)
352{
353 struct alc_spec *spec = codec->spec;
354 spec->pll_nid = nid;
355 spec->pll_coef_idx = coef_idx;
356 spec->pll_coef_bit = coef_bit;
357 alc_fix_pll(codec);
358}
359
cf5a2279 360/* update the master volume per volume-knob's unsol event */
1a4f69d5
TI
361static void alc_update_knob_master(struct hda_codec *codec,
362 struct hda_jack_callback *jack)
cf5a2279
TI
363{
364 unsigned int val;
365 struct snd_kcontrol *kctl;
366 struct snd_ctl_elem_value *uctl;
367
368 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
369 if (!kctl)
370 return;
371 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
372 if (!uctl)
373 return;
2ebab40e 374 val = snd_hda_codec_read(codec, jack->nid, 0,
cf5a2279
TI
375 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
376 val &= HDA_AMP_VOLMASK;
377 uctl->value.integer.value[0] = val;
378 uctl->value.integer.value[1] = val;
379 kctl->put(kctl, uctl);
380 kfree(uctl);
381}
382
29adc4b9 383static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
f21d78e2 384{
29adc4b9
DH
385 /* For some reason, the res given from ALC880 is broken.
386 Here we adjust it properly. */
387 snd_hda_jack_unsol_event(codec, res >> 2);
f21d78e2
TI
388}
389
394c97f8
KY
390/* Change EAPD to verb control */
391static void alc_fill_eapd_coef(struct hda_codec *codec)
392{
393 int coef;
394
395 coef = alc_get_coef0(codec);
396
7639a06c 397 switch (codec->core.vendor_id) {
394c97f8
KY
398 case 0x10ec0262:
399 alc_update_coef_idx(codec, 0x7, 0, 1<<5);
400 break;
401 case 0x10ec0267:
402 case 0x10ec0268:
403 alc_update_coef_idx(codec, 0x7, 0, 1<<13);
404 break;
405 case 0x10ec0269:
406 if ((coef & 0x00f0) == 0x0010)
407 alc_update_coef_idx(codec, 0xd, 0, 1<<14);
408 if ((coef & 0x00f0) == 0x0020)
409 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
410 if ((coef & 0x00f0) == 0x0030)
411 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
412 break;
413 case 0x10ec0280:
414 case 0x10ec0284:
415 case 0x10ec0290:
416 case 0x10ec0292:
417 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
418 break;
4231430d 419 case 0x10ec0225:
44be77c5
TI
420 case 0x10ec0295:
421 case 0x10ec0299:
422 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
c0dbbdad 423 fallthrough;
44be77c5 424 case 0x10ec0215:
1948fc06 425 case 0x10ec0230:
394c97f8 426 case 0x10ec0233:
ea04a1db 427 case 0x10ec0235:
c4473744 428 case 0x10ec0236:
7fbdcd83 429 case 0x10ec0245:
394c97f8 430 case 0x10ec0255:
c4473744 431 case 0x10ec0256:
f429e7e4 432 case 0x10ec0257:
394c97f8
KY
433 case 0x10ec0282:
434 case 0x10ec0283:
435 case 0x10ec0286:
436 case 0x10ec0288:
0a6f0600 437 case 0x10ec0285:
506b62c3 438 case 0x10ec0298:
0a6f0600 439 case 0x10ec0289:
1078bef0 440 case 0x10ec0300:
394c97f8
KY
441 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
442 break;
3aabf94c
KY
443 case 0x10ec0275:
444 alc_update_coef_idx(codec, 0xe, 0, 1<<0);
445 break;
8822702f
HW
446 case 0x10ec0287:
447 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
448 alc_write_coef_idx(codec, 0x8, 0x4ab7);
449 break;
394c97f8
KY
450 case 0x10ec0293:
451 alc_update_coef_idx(codec, 0xa, 1<<13, 0);
452 break;
dcd4f0db
KY
453 case 0x10ec0234:
454 case 0x10ec0274:
455 case 0x10ec0294:
6fbae35a
KY
456 case 0x10ec0700:
457 case 0x10ec0701:
458 case 0x10ec0703:
83629532 459 case 0x10ec0711:
dcd4f0db
KY
460 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
461 break;
394c97f8
KY
462 case 0x10ec0662:
463 if ((coef & 0x00f0) == 0x0030)
464 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
465 break;
466 case 0x10ec0272:
467 case 0x10ec0273:
468 case 0x10ec0663:
469 case 0x10ec0665:
470 case 0x10ec0670:
471 case 0x10ec0671:
472 case 0x10ec0672:
473 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
474 break;
9194a1eb 475 case 0x10ec0222:
f0778871
KY
476 case 0x10ec0623:
477 alc_update_coef_idx(codec, 0x19, 1<<13, 0);
478 break;
394c97f8
KY
479 case 0x10ec0668:
480 alc_update_coef_idx(codec, 0x7, 3<<13, 0);
481 break;
482 case 0x10ec0867:
483 alc_update_coef_idx(codec, 0x4, 1<<10, 0);
484 break;
485 case 0x10ec0888:
486 if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
487 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
488 break;
489 case 0x10ec0892:
e5782a5d 490 case 0x10ec0897:
394c97f8
KY
491 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
492 break;
493 case 0x10ec0899:
494 case 0x10ec0900:
6d9ffcff 495 case 0x10ec0b00:
65553b12 496 case 0x10ec1168:
a535ad57 497 case 0x10ec1220:
394c97f8
KY
498 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
499 break;
500 }
501}
502
f9423e7a
KY
503/* additional initialization for ALC888 variants */
504static void alc888_coef_init(struct hda_codec *codec)
505{
1df8874b
KY
506 switch (alc_get_coef0(codec) & 0x00f0) {
507 /* alc888-VA */
508 case 0x00:
509 /* alc888-VB */
510 case 0x10:
511 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
512 break;
513 }
87a8c370
JK
514}
515
3fb4a508
TI
516/* turn on/off EAPD control (only if available) */
517static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
518{
519 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
520 return;
521 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
522 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
523 on ? 2 : 0);
524}
525
691f1fcc
TI
526/* turn on/off EAPD controls of the codec */
527static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
528{
529 /* We currently only handle front, HP */
caf3c043 530 static const hda_nid_t pins[] = {
af95b414 531 0x0f, 0x10, 0x14, 0x15, 0x17, 0
39fa84e9 532 };
caf3c043 533 const hda_nid_t *p;
39fa84e9
TI
534 for (p = pins; *p; p++)
535 set_eapd(codec, *p, on);
691f1fcc
TI
536}
537
dad3197d
KY
538static int find_ext_mic_pin(struct hda_codec *codec);
539
540static void alc_headset_mic_no_shutup(struct hda_codec *codec)
541{
542 const struct hda_pincfg *pin;
543 int mic_pin = find_ext_mic_pin(codec);
544 int i;
545
546 /* don't shut up pins when unloading the driver; otherwise it breaks
547 * the default pin setup at the next load of the driver
548 */
549 if (codec->bus->shutdown)
550 return;
551
552 snd_array_for_each(&codec->init_pins, i, pin) {
553 /* use read here for syncing after issuing each verb */
554 if (pin->nid != mic_pin)
555 snd_hda_codec_read(codec, pin->nid, 0,
556 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
557 }
558
559 codec->pins_shutup = 1;
560}
561
c0ca5ece
TI
562static void alc_shutup_pins(struct hda_codec *codec)
563{
564 struct alc_spec *spec = codec->spec;
565
dad3197d 566 switch (codec->core.vendor_id) {
5aec9891
KY
567 case 0x10ec0236:
568 case 0x10ec0256:
66c5d718 569 case 0x10ec0283:
dad3197d
KY
570 case 0x10ec0286:
571 case 0x10ec0288:
572 case 0x10ec0298:
573 alc_headset_mic_no_shutup(codec);
574 break;
575 default:
576 if (!spec->no_shutup_pins)
577 snd_hda_shutup_pins(codec);
578 break;
579 }
c0ca5ece
TI
580}
581
1c716153 582/* generic shutup callback;
4ce8e6a5 583 * just turning off EAPD and a little pause for avoiding pop-noise
1c716153
TI
584 */
585static void alc_eapd_shutup(struct hda_codec *codec)
586{
97a26570
KY
587 struct alc_spec *spec = codec->spec;
588
1c716153 589 alc_auto_setup_eapd(codec, false);
97a26570
KY
590 if (!spec->no_depop_delay)
591 msleep(200);
c0ca5ece 592 alc_shutup_pins(codec);
1c716153
TI
593}
594
1d045db9 595/* generic EAPD initialization */
4a79ba34 596static void alc_auto_init_amp(struct hda_codec *codec, int type)
bc9f98a9 597{
39fa84e9 598 alc_auto_setup_eapd(codec, true);
5579cd6f 599 alc_write_gpio(codec);
4a79ba34 600 switch (type) {
4a79ba34 601 case ALC_INIT_DEFAULT:
7639a06c 602 switch (codec->core.vendor_id) {
c9b58006 603 case 0x10ec0260:
98b24883 604 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
c9b58006 605 break;
c9b58006
KY
606 case 0x10ec0880:
607 case 0x10ec0882:
608 case 0x10ec0883:
609 case 0x10ec0885:
1df8874b 610 alc_update_coef_idx(codec, 7, 0, 0x2030);
c9b58006 611 break;
f9423e7a 612 case 0x10ec0888:
4a79ba34 613 alc888_coef_init(codec);
f9423e7a 614 break;
bc9f98a9 615 }
4a79ba34
TI
616 break;
617 }
618}
619
35a39f98
TI
620/* get a primary headphone pin if available */
621static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
622{
623 if (spec->gen.autocfg.hp_pins[0])
624 return spec->gen.autocfg.hp_pins[0];
625 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
626 return spec->gen.autocfg.line_out_pins[0];
627 return 0;
628}
08c189f2 629
1d045db9 630/*
08c189f2 631 * Realtek SSID verification
1d045db9 632 */
42cf0d01 633
08c189f2
TI
634/* Could be any non-zero and even value. When used as fixup, tells
635 * the driver to ignore any present sku defines.
636 */
637#define ALC_FIXUP_SKU_IGNORE (2)
1a1455de 638
08c189f2
TI
639static void alc_fixup_sku_ignore(struct hda_codec *codec,
640 const struct hda_fixup *fix, int action)
1a1455de 641{
1a1455de 642 struct alc_spec *spec = codec->spec;
08c189f2
TI
643 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
644 spec->cdefine.fixup = 1;
645 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
1a1455de 646 }
1a1455de
TI
647}
648
b5c6611f
ML
649static void alc_fixup_no_depop_delay(struct hda_codec *codec,
650 const struct hda_fixup *fix, int action)
651{
652 struct alc_spec *spec = codec->spec;
653
84d2dc3e 654 if (action == HDA_FIXUP_ACT_PROBE) {
b5c6611f 655 spec->no_depop_delay = 1;
84d2dc3e
ML
656 codec->depop_delay = 0;
657 }
b5c6611f
ML
658}
659
08c189f2 660static int alc_auto_parse_customize_define(struct hda_codec *codec)
4a79ba34 661{
08c189f2
TI
662 unsigned int ass, tmp, i;
663 unsigned nid = 0;
4a79ba34
TI
664 struct alc_spec *spec = codec->spec;
665
08c189f2 666 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
4a79ba34 667
08c189f2
TI
668 if (spec->cdefine.fixup) {
669 ass = spec->cdefine.sku_cfg;
670 if (ass == ALC_FIXUP_SKU_IGNORE)
671 return -1;
672 goto do_sku;
bb35febd
TI
673 }
674
5100cd07
TI
675 if (!codec->bus->pci)
676 return -1;
7639a06c 677 ass = codec->core.subsystem_id & 0xffff;
08c189f2
TI
678 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
679 goto do_sku;
4a79ba34 680
08c189f2 681 nid = 0x1d;
7639a06c 682 if (codec->core.vendor_id == 0x10ec0260)
08c189f2
TI
683 nid = 0x17;
684 ass = snd_hda_codec_get_pincfg(codec, nid);
42cf0d01 685
08c189f2 686 if (!(ass & 1)) {
4e76a883 687 codec_info(codec, "%s: SKU not ready 0x%08x\n",
7639a06c 688 codec->core.chip_name, ass);
08c189f2 689 return -1;
42cf0d01
DH
690 }
691
08c189f2
TI
692 /* check sum */
693 tmp = 0;
694 for (i = 1; i < 16; i++) {
695 if ((ass >> i) & 1)
696 tmp++;
ae8a60a5 697 }
08c189f2
TI
698 if (((ass >> 16) & 0xf) != tmp)
699 return -1;
ae8a60a5 700
da00c244
KY
701 spec->cdefine.port_connectivity = ass >> 30;
702 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
703 spec->cdefine.check_sum = (ass >> 16) & 0xf;
704 spec->cdefine.customization = ass >> 8;
705do_sku:
706 spec->cdefine.sku_cfg = ass;
707 spec->cdefine.external_amp = (ass & 0x38) >> 3;
708 spec->cdefine.platform_type = (ass & 0x4) >> 2;
709 spec->cdefine.swap = (ass & 0x2) >> 1;
710 spec->cdefine.override = ass & 0x1;
711
4e76a883 712 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
da00c244 713 nid, spec->cdefine.sku_cfg);
4e76a883 714 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
da00c244 715 spec->cdefine.port_connectivity);
4e76a883
TI
716 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
717 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
718 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
719 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
720 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
721 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
722 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
da00c244
KY
723
724 return 0;
725}
726
08c189f2
TI
727/* return the position of NID in the list, or -1 if not found */
728static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
729{
730 int i;
731 for (i = 0; i < nums; i++)
732 if (list[i] == nid)
733 return i;
734 return -1;
735}
1d045db9 736/* return true if the given NID is found in the list */
3af9ee6b
TI
737static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
738{
21268961 739 return find_idx_in_nid_list(nid, list, nums) >= 0;
3af9ee6b
TI
740}
741
4a79ba34
TI
742/* check subsystem ID and set up device-specific initialization;
743 * return 1 if initialized, 0 if invalid SSID
744 */
745/* 32-bit subsystem ID for BIOS loading in HD Audio codec.
746 * 31 ~ 16 : Manufacture ID
747 * 15 ~ 8 : SKU ID
748 * 7 ~ 0 : Assembly ID
749 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
750 */
58c57cfa 751static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
4a79ba34
TI
752{
753 unsigned int ass, tmp, i;
754 unsigned nid;
755 struct alc_spec *spec = codec->spec;
756
90622917
DH
757 if (spec->cdefine.fixup) {
758 ass = spec->cdefine.sku_cfg;
759 if (ass == ALC_FIXUP_SKU_IGNORE)
760 return 0;
761 goto do_sku;
762 }
763
7639a06c 764 ass = codec->core.subsystem_id & 0xffff;
5100cd07
TI
765 if (codec->bus->pci &&
766 ass != codec->bus->pci->subsystem_device && (ass & 1))
4a79ba34
TI
767 goto do_sku;
768
769 /* invalid SSID, check the special NID pin defcfg instead */
770 /*
def319f9 771 * 31~30 : port connectivity
4a79ba34
TI
772 * 29~21 : reserve
773 * 20 : PCBEEP input
774 * 19~16 : Check sum (15:1)
775 * 15~1 : Custom
776 * 0 : override
777 */
778 nid = 0x1d;
7639a06c 779 if (codec->core.vendor_id == 0x10ec0260)
4a79ba34
TI
780 nid = 0x17;
781 ass = snd_hda_codec_get_pincfg(codec, nid);
4e76a883
TI
782 codec_dbg(codec,
783 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
cb6605c1 784 ass, nid);
6227cdce 785 if (!(ass & 1))
4a79ba34
TI
786 return 0;
787 if ((ass >> 30) != 1) /* no physical connection */
788 return 0;
789
790 /* check sum */
791 tmp = 0;
792 for (i = 1; i < 16; i++) {
793 if ((ass >> i) & 1)
794 tmp++;
795 }
796 if (((ass >> 16) & 0xf) != tmp)
797 return 0;
798do_sku:
4e76a883 799 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
7639a06c 800 ass & 0xffff, codec->core.vendor_id);
4a79ba34
TI
801 /*
802 * 0 : override
803 * 1 : Swap Jack
804 * 2 : 0 --> Desktop, 1 --> Laptop
805 * 3~5 : External Amplifier control
806 * 7~6 : Reserved
807 */
808 tmp = (ass & 0x38) >> 3; /* external Amp control */
1c76aa5f
TI
809 if (spec->init_amp == ALC_INIT_UNDEFINED) {
810 switch (tmp) {
811 case 1:
5579cd6f 812 alc_setup_gpio(codec, 0x01);
1c76aa5f
TI
813 break;
814 case 3:
5579cd6f 815 alc_setup_gpio(codec, 0x02);
1c76aa5f
TI
816 break;
817 case 7:
5579cd6f 818 alc_setup_gpio(codec, 0x03);
1c76aa5f
TI
819 break;
820 case 5:
821 default:
822 spec->init_amp = ALC_INIT_DEFAULT;
823 break;
824 }
bc9f98a9 825 }
ea1fb29a 826
8c427226 827 /* is laptop or Desktop and enable the function "Mute internal speaker
c9b58006
KY
828 * when the external headphone out jack is plugged"
829 */
8c427226 830 if (!(ass & 0x8000))
4a79ba34 831 return 1;
c9b58006
KY
832 /*
833 * 10~8 : Jack location
834 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
835 * 14~13: Resvered
836 * 15 : 1 --> enable the function "Mute internal speaker
837 * when the external headphone out jack is plugged"
838 */
35a39f98 839 if (!alc_get_hp_pin(spec)) {
01d4825d 840 hda_nid_t nid;
c9b58006 841 tmp = (ass >> 11) & 0x3; /* HP to chassis */
58c57cfa 842 nid = ports[tmp];
08c189f2
TI
843 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
844 spec->gen.autocfg.line_outs))
3af9ee6b 845 return 1;
08c189f2 846 spec->gen.autocfg.hp_pins[0] = nid;
c9b58006 847 }
4a79ba34
TI
848 return 1;
849}
ea1fb29a 850
3e6179b8
TI
851/* Check the validity of ALC subsystem-id
852 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
853static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
4a79ba34 854{
58c57cfa 855 if (!alc_subsystem_id(codec, ports)) {
4a79ba34 856 struct alc_spec *spec = codec->spec;
67791202
TI
857 if (spec->init_amp == ALC_INIT_UNDEFINED) {
858 codec_dbg(codec,
859 "realtek: Enable default setup for auto mode as fallback\n");
860 spec->init_amp = ALC_INIT_DEFAULT;
861 }
4a79ba34 862 }
21268961 863}
1a1455de 864
1d045db9 865/*
ef8ef5fb 866 */
f9e336f6 867
9d36a7dc
DH
868static void alc_fixup_inv_dmic(struct hda_codec *codec,
869 const struct hda_fixup *fix, int action)
125821ae
TI
870{
871 struct alc_spec *spec = codec->spec;
668d1e96 872
9d36a7dc 873 spec->gen.inv_dmic_split = 1;
6e72aa5f
TI
874}
875
e9edcee0 876
08c189f2 877static int alc_build_controls(struct hda_codec *codec)
1d045db9 878{
a5cb463a 879 int err;
e9427969 880
08c189f2
TI
881 err = snd_hda_gen_build_controls(codec);
882 if (err < 0)
883 return err;
1da177e4 884
1727a771 885 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
1c4a54b4 886 return 0;
a361d84b
KY
887}
888
a361d84b 889
df694daa 890/*
08c189f2 891 * Common callbacks
df694daa 892 */
a361d84b 893
c9af753f
TI
894static void alc_pre_init(struct hda_codec *codec)
895{
896 alc_fill_eapd_coef(codec);
897}
898
aeac1a0d
KY
899#define is_s3_resume(codec) \
900 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
c9af753f
TI
901#define is_s4_resume(codec) \
902 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
903
08c189f2 904static int alc_init(struct hda_codec *codec)
1d045db9
TI
905{
906 struct alc_spec *spec = codec->spec;
a361d84b 907
c9af753f
TI
908 /* hibernation resume needs the full chip initialization */
909 if (is_s4_resume(codec))
910 alc_pre_init(codec);
911
08c189f2
TI
912 if (spec->init_hook)
913 spec->init_hook(codec);
a361d84b 914
89781d08 915 spec->gen.skip_verbs = 1; /* applied in below */
607ca3bd 916 snd_hda_gen_init(codec);
08c189f2
TI
917 alc_fix_pll(codec);
918 alc_auto_init_amp(codec, spec->init_amp);
89781d08 919 snd_hda_apply_verbs(codec); /* apply verbs here after own init */
3abf2f36 920
1727a771 921 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
a361d84b 922
1d045db9
TI
923 return 0;
924}
a361d84b 925
08c189f2 926static inline void alc_shutup(struct hda_codec *codec)
1d045db9
TI
927{
928 struct alc_spec *spec = codec->spec;
a361d84b 929
c7273bd6
TI
930 if (!snd_hda_get_bool_hint(codec, "shutup"))
931 return; /* disabled explicitly by hints */
932
08c189f2
TI
933 if (spec && spec->shutup)
934 spec->shutup(codec);
9bfb2844 935 else
c0ca5ece 936 alc_shutup_pins(codec);
1d045db9
TI
937}
938
8a02c0cc 939#define alc_free snd_hda_gen_free
2134ea4f 940
08c189f2
TI
941#ifdef CONFIG_PM
942static void alc_power_eapd(struct hda_codec *codec)
1d045db9 943{
08c189f2 944 alc_auto_setup_eapd(codec, false);
1d045db9 945}
2134ea4f 946
08c189f2 947static int alc_suspend(struct hda_codec *codec)
1d045db9
TI
948{
949 struct alc_spec *spec = codec->spec;
08c189f2
TI
950 alc_shutup(codec);
951 if (spec && spec->power_hook)
952 spec->power_hook(codec);
a361d84b
KY
953 return 0;
954}
08c189f2 955#endif
a361d84b 956
08c189f2
TI
957#ifdef CONFIG_PM
958static int alc_resume(struct hda_codec *codec)
1d045db9 959{
97a26570
KY
960 struct alc_spec *spec = codec->spec;
961
962 if (!spec->no_depop_delay)
963 msleep(150); /* to avoid pop noise */
08c189f2 964 codec->patch_ops.init(codec);
1a462be5 965 snd_hda_regmap_sync(codec);
08c189f2
TI
966 hda_call_check_power_status(codec, 0x01);
967 return 0;
1d045db9 968}
08c189f2 969#endif
f6a92248 970
1d045db9 971/*
1d045db9 972 */
08c189f2
TI
973static const struct hda_codec_ops alc_patch_ops = {
974 .build_controls = alc_build_controls,
975 .build_pcms = snd_hda_gen_build_pcms,
976 .init = alc_init,
977 .free = alc_free,
978 .unsol_event = snd_hda_jack_unsol_event,
979#ifdef CONFIG_PM
980 .resume = alc_resume,
08c189f2 981 .suspend = alc_suspend,
fce52a3b 982 .check_power_status = snd_hda_gen_check_power_status,
08c189f2 983#endif
08c189f2 984};
f6a92248 985
f53281e6 986
ded255be 987#define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
e01bf509 988
e4770629 989/*
4b016931 990 * Rename codecs appropriately from COEF value or subvendor id
e4770629 991 */
08c189f2
TI
992struct alc_codec_rename_table {
993 unsigned int vendor_id;
994 unsigned short coef_mask;
995 unsigned short coef_bits;
996 const char *name;
997};
84898e87 998
4b016931
KY
999struct alc_codec_rename_pci_table {
1000 unsigned int codec_vendor_id;
1001 unsigned short pci_subvendor;
1002 unsigned short pci_subdevice;
1003 const char *name;
1004};
1005
6b0f95c4 1006static const struct alc_codec_rename_table rename_tbl[] = {
e6e5f7ad 1007 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
08c189f2
TI
1008 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
1009 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
1010 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
1011 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
1012 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
1013 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
1014 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
1015 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
e6e5f7ad 1016 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
08c189f2
TI
1017 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
1018 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
1019 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
1020 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
1021 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
1022 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
1023 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
1024 { } /* terminator */
1025};
84898e87 1026
6b0f95c4 1027static const struct alc_codec_rename_pci_table rename_pci_tbl[] = {
4b016931
KY
1028 { 0x10ec0280, 0x1028, 0, "ALC3220" },
1029 { 0x10ec0282, 0x1028, 0, "ALC3221" },
1030 { 0x10ec0283, 0x1028, 0, "ALC3223" },
193177de 1031 { 0x10ec0288, 0x1028, 0, "ALC3263" },
4b016931 1032 { 0x10ec0292, 0x1028, 0, "ALC3226" },
193177de 1033 { 0x10ec0293, 0x1028, 0, "ALC3235" },
4b016931
KY
1034 { 0x10ec0255, 0x1028, 0, "ALC3234" },
1035 { 0x10ec0668, 0x1028, 0, "ALC3661" },
e6e5f7ad
KY
1036 { 0x10ec0275, 0x1028, 0, "ALC3260" },
1037 { 0x10ec0899, 0x1028, 0, "ALC3861" },
2c674fac 1038 { 0x10ec0298, 0x1028, 0, "ALC3266" },
736f20a7 1039 { 0x10ec0236, 0x1028, 0, "ALC3204" },
82324502 1040 { 0x10ec0256, 0x1028, 0, "ALC3246" },
4231430d 1041 { 0x10ec0225, 0x1028, 0, "ALC3253" },
7d727869 1042 { 0x10ec0295, 0x1028, 0, "ALC3254" },
28f1f9b2 1043 { 0x10ec0299, 0x1028, 0, "ALC3271" },
e6e5f7ad
KY
1044 { 0x10ec0670, 0x1025, 0, "ALC669X" },
1045 { 0x10ec0676, 0x1025, 0, "ALC679X" },
1046 { 0x10ec0282, 0x1043, 0, "ALC3229" },
1047 { 0x10ec0233, 0x1043, 0, "ALC3236" },
1048 { 0x10ec0280, 0x103c, 0, "ALC3228" },
1049 { 0x10ec0282, 0x103c, 0, "ALC3227" },
1050 { 0x10ec0286, 0x103c, 0, "ALC3242" },
1051 { 0x10ec0290, 0x103c, 0, "ALC3241" },
1052 { 0x10ec0668, 0x103c, 0, "ALC3662" },
1053 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
1054 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
4b016931
KY
1055 { } /* terminator */
1056};
1057
08c189f2 1058static int alc_codec_rename_from_preset(struct hda_codec *codec)
1d045db9 1059{
08c189f2 1060 const struct alc_codec_rename_table *p;
4b016931 1061 const struct alc_codec_rename_pci_table *q;
60db6b53 1062
08c189f2 1063 for (p = rename_tbl; p->vendor_id; p++) {
7639a06c 1064 if (p->vendor_id != codec->core.vendor_id)
08c189f2
TI
1065 continue;
1066 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
1067 return alc_codec_rename(codec, p->name);
1d045db9 1068 }
4b016931 1069
5100cd07
TI
1070 if (!codec->bus->pci)
1071 return 0;
4b016931 1072 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
7639a06c 1073 if (q->codec_vendor_id != codec->core.vendor_id)
4b016931
KY
1074 continue;
1075 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1076 continue;
1077 if (!q->pci_subdevice ||
1078 q->pci_subdevice == codec->bus->pci->subsystem_device)
1079 return alc_codec_rename(codec, q->name);
1080 }
1081
08c189f2 1082 return 0;
1d045db9 1083}
f53281e6 1084
e4770629 1085
1d045db9
TI
1086/*
1087 * Digital-beep handlers
1088 */
1089#ifdef CONFIG_SND_HDA_INPUT_BEEP
fea80fae
TI
1090
1091/* additional beep mixers; private_value will be overwritten */
1092static const struct snd_kcontrol_new alc_beep_mixer[] = {
1093 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1094 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1095};
1096
1097/* set up and create beep controls */
1098static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1099 int idx, int dir)
1100{
1101 struct snd_kcontrol_new *knew;
1102 unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1103 int i;
1104
1105 for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1106 knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1107 &alc_beep_mixer[i]);
1108 if (!knew)
1109 return -ENOMEM;
1110 knew->private_value = beep_amp;
1111 }
1112 return 0;
1113}
84898e87 1114
6317e5eb 1115static const struct snd_pci_quirk beep_allow_list[] = {
7110005e 1116 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
a4b7f21d 1117 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
1d045db9 1118 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
8554ee40 1119 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
1d045db9
TI
1120 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1121 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1122 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
78f8baf1 1123 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
1d045db9 1124 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
6317e5eb 1125 /* denylist -- no beep available */
051c78af
TI
1126 SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
1127 SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
1d045db9 1128 {}
fe3eb0a7
KY
1129};
1130
1d045db9
TI
1131static inline int has_cdefine_beep(struct hda_codec *codec)
1132{
1133 struct alc_spec *spec = codec->spec;
1134 const struct snd_pci_quirk *q;
6317e5eb 1135 q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list);
1d045db9
TI
1136 if (q)
1137 return q->value;
1138 return spec->cdefine.enable_pcbeep;
1139}
1140#else
fea80fae 1141#define set_beep_amp(spec, nid, idx, dir) 0
1d045db9
TI
1142#define has_cdefine_beep(codec) 0
1143#endif
84898e87 1144
1d045db9
TI
1145/* parse the BIOS configuration and set up the alc_spec */
1146/* return 1 if successful, 0 if the proper config is not found,
1147 * or a negative error code
1148 */
3e6179b8
TI
1149static int alc_parse_auto_config(struct hda_codec *codec,
1150 const hda_nid_t *ignore_nids,
1151 const hda_nid_t *ssid_nids)
1d045db9
TI
1152{
1153 struct alc_spec *spec = codec->spec;
08c189f2 1154 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
1d045db9 1155 int err;
26f5df26 1156
53c334ad
TI
1157 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1158 spec->parse_flags);
1d045db9
TI
1159 if (err < 0)
1160 return err;
3e6179b8
TI
1161
1162 if (ssid_nids)
1163 alc_ssid_check(codec, ssid_nids);
64154835 1164
08c189f2
TI
1165 err = snd_hda_gen_parse_auto_config(codec, cfg);
1166 if (err < 0)
1167 return err;
070cff4c 1168
1d045db9 1169 return 1;
60db6b53 1170}
f6a92248 1171
3de95173
TI
1172/* common preparation job for alc_spec */
1173static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1174{
1175 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1176 int err;
1177
1178 if (!spec)
1179 return -ENOMEM;
1180 codec->spec = spec;
08c189f2
TI
1181 snd_hda_gen_spec_init(&spec->gen);
1182 spec->gen.mixer_nid = mixer_nid;
1183 spec->gen.own_eapd_ctl = 1;
1098b7c2 1184 codec->single_adc_amp = 1;
08c189f2
TI
1185 /* FIXME: do we need this for all Realtek codec models? */
1186 codec->spdif_status_reset = 1;
a6e7d0a4 1187 codec->forced_resume = 1;
225068ab 1188 codec->patch_ops = alc_patch_ops;
1b35106e 1189 mutex_init(&spec->coef_mutex);
3de95173
TI
1190
1191 err = alc_codec_rename_from_preset(codec);
1192 if (err < 0) {
1193 kfree(spec);
1194 return err;
1195 }
1196 return 0;
1197}
1198
3e6179b8
TI
1199static int alc880_parse_auto_config(struct hda_codec *codec)
1200{
1201 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
7d7eb9ea 1202 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3e6179b8
TI
1203 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1204}
1205
ee3b2969
TI
1206/*
1207 * ALC880 fix-ups
1208 */
1209enum {
411225a0 1210 ALC880_FIXUP_GPIO1,
ee3b2969
TI
1211 ALC880_FIXUP_GPIO2,
1212 ALC880_FIXUP_MEDION_RIM,
dc6af52d 1213 ALC880_FIXUP_LG,
db8a38e5 1214 ALC880_FIXUP_LG_LW25,
f02aab5d 1215 ALC880_FIXUP_W810,
27e917f8 1216 ALC880_FIXUP_EAPD_COEF,
b9368f5c 1217 ALC880_FIXUP_TCL_S700,
cf5a2279
TI
1218 ALC880_FIXUP_VOL_KNOB,
1219 ALC880_FIXUP_FUJITSU,
ba533818 1220 ALC880_FIXUP_F1734,
817de92f 1221 ALC880_FIXUP_UNIWILL,
967b88c4 1222 ALC880_FIXUP_UNIWILL_DIG,
96e225f6 1223 ALC880_FIXUP_Z71V,
487a588d 1224 ALC880_FIXUP_ASUS_W5A,
67b6ec31
TI
1225 ALC880_FIXUP_3ST_BASE,
1226 ALC880_FIXUP_3ST,
1227 ALC880_FIXUP_3ST_DIG,
1228 ALC880_FIXUP_5ST_BASE,
1229 ALC880_FIXUP_5ST,
1230 ALC880_FIXUP_5ST_DIG,
1231 ALC880_FIXUP_6ST_BASE,
1232 ALC880_FIXUP_6ST,
1233 ALC880_FIXUP_6ST_DIG,
5397145f 1234 ALC880_FIXUP_6ST_AUTOMUTE,
ee3b2969
TI
1235};
1236
cf5a2279
TI
1237/* enable the volume-knob widget support on NID 0x21 */
1238static void alc880_fixup_vol_knob(struct hda_codec *codec,
1727a771 1239 const struct hda_fixup *fix, int action)
cf5a2279 1240{
1727a771 1241 if (action == HDA_FIXUP_ACT_PROBE)
62f949bf
TI
1242 snd_hda_jack_detect_enable_callback(codec, 0x21,
1243 alc_update_knob_master);
cf5a2279
TI
1244}
1245
1727a771 1246static const struct hda_fixup alc880_fixups[] = {
411225a0 1247 [ALC880_FIXUP_GPIO1] = {
5579cd6f
TI
1248 .type = HDA_FIXUP_FUNC,
1249 .v.func = alc_fixup_gpio1,
411225a0 1250 },
ee3b2969 1251 [ALC880_FIXUP_GPIO2] = {
5579cd6f
TI
1252 .type = HDA_FIXUP_FUNC,
1253 .v.func = alc_fixup_gpio2,
ee3b2969
TI
1254 },
1255 [ALC880_FIXUP_MEDION_RIM] = {
1727a771 1256 .type = HDA_FIXUP_VERBS,
ee3b2969
TI
1257 .v.verbs = (const struct hda_verb[]) {
1258 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1259 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1260 { }
1261 },
1262 .chained = true,
1263 .chain_id = ALC880_FIXUP_GPIO2,
1264 },
dc6af52d 1265 [ALC880_FIXUP_LG] = {
1727a771
TI
1266 .type = HDA_FIXUP_PINS,
1267 .v.pins = (const struct hda_pintbl[]) {
dc6af52d
TI
1268 /* disable bogus unused pins */
1269 { 0x16, 0x411111f0 },
1270 { 0x18, 0x411111f0 },
1271 { 0x1a, 0x411111f0 },
1272 { }
1273 }
1274 },
db8a38e5
TI
1275 [ALC880_FIXUP_LG_LW25] = {
1276 .type = HDA_FIXUP_PINS,
1277 .v.pins = (const struct hda_pintbl[]) {
1278 { 0x1a, 0x0181344f }, /* line-in */
1279 { 0x1b, 0x0321403f }, /* headphone */
1280 { }
1281 }
1282 },
f02aab5d 1283 [ALC880_FIXUP_W810] = {
1727a771
TI
1284 .type = HDA_FIXUP_PINS,
1285 .v.pins = (const struct hda_pintbl[]) {
f02aab5d
TI
1286 /* disable bogus unused pins */
1287 { 0x17, 0x411111f0 },
1288 { }
1289 },
1290 .chained = true,
1291 .chain_id = ALC880_FIXUP_GPIO2,
1292 },
27e917f8 1293 [ALC880_FIXUP_EAPD_COEF] = {
1727a771 1294 .type = HDA_FIXUP_VERBS,
27e917f8
TI
1295 .v.verbs = (const struct hda_verb[]) {
1296 /* change to EAPD mode */
1297 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1298 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1299 {}
1300 },
1301 },
b9368f5c 1302 [ALC880_FIXUP_TCL_S700] = {
1727a771 1303 .type = HDA_FIXUP_VERBS,
b9368f5c
TI
1304 .v.verbs = (const struct hda_verb[]) {
1305 /* change to EAPD mode */
1306 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1307 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1308 {}
1309 },
1310 .chained = true,
1311 .chain_id = ALC880_FIXUP_GPIO2,
1312 },
cf5a2279 1313 [ALC880_FIXUP_VOL_KNOB] = {
1727a771 1314 .type = HDA_FIXUP_FUNC,
cf5a2279
TI
1315 .v.func = alc880_fixup_vol_knob,
1316 },
1317 [ALC880_FIXUP_FUJITSU] = {
1318 /* override all pins as BIOS on old Amilo is broken */
1727a771
TI
1319 .type = HDA_FIXUP_PINS,
1320 .v.pins = (const struct hda_pintbl[]) {
bb148bde 1321 { 0x14, 0x0121401f }, /* HP */
cf5a2279
TI
1322 { 0x15, 0x99030120 }, /* speaker */
1323 { 0x16, 0x99030130 }, /* bass speaker */
1324 { 0x17, 0x411111f0 }, /* N/A */
1325 { 0x18, 0x411111f0 }, /* N/A */
1326 { 0x19, 0x01a19950 }, /* mic-in */
1327 { 0x1a, 0x411111f0 }, /* N/A */
1328 { 0x1b, 0x411111f0 }, /* N/A */
1329 { 0x1c, 0x411111f0 }, /* N/A */
1330 { 0x1d, 0x411111f0 }, /* N/A */
1331 { 0x1e, 0x01454140 }, /* SPDIF out */
1332 { }
1333 },
1334 .chained = true,
1335 .chain_id = ALC880_FIXUP_VOL_KNOB,
1336 },
ba533818
TI
1337 [ALC880_FIXUP_F1734] = {
1338 /* almost compatible with FUJITSU, but no bass and SPDIF */
1727a771
TI
1339 .type = HDA_FIXUP_PINS,
1340 .v.pins = (const struct hda_pintbl[]) {
bb148bde 1341 { 0x14, 0x0121401f }, /* HP */
ba533818
TI
1342 { 0x15, 0x99030120 }, /* speaker */
1343 { 0x16, 0x411111f0 }, /* N/A */
1344 { 0x17, 0x411111f0 }, /* N/A */
1345 { 0x18, 0x411111f0 }, /* N/A */
1346 { 0x19, 0x01a19950 }, /* mic-in */
1347 { 0x1a, 0x411111f0 }, /* N/A */
1348 { 0x1b, 0x411111f0 }, /* N/A */
1349 { 0x1c, 0x411111f0 }, /* N/A */
1350 { 0x1d, 0x411111f0 }, /* N/A */
1351 { 0x1e, 0x411111f0 }, /* N/A */
1352 { }
1353 },
1354 .chained = true,
1355 .chain_id = ALC880_FIXUP_VOL_KNOB,
1356 },
817de92f
TI
1357 [ALC880_FIXUP_UNIWILL] = {
1358 /* need to fix HP and speaker pins to be parsed correctly */
1727a771
TI
1359 .type = HDA_FIXUP_PINS,
1360 .v.pins = (const struct hda_pintbl[]) {
817de92f
TI
1361 { 0x14, 0x0121411f }, /* HP */
1362 { 0x15, 0x99030120 }, /* speaker */
1363 { 0x16, 0x99030130 }, /* bass speaker */
1364 { }
1365 },
1366 },
967b88c4 1367 [ALC880_FIXUP_UNIWILL_DIG] = {
1727a771
TI
1368 .type = HDA_FIXUP_PINS,
1369 .v.pins = (const struct hda_pintbl[]) {
967b88c4
TI
1370 /* disable bogus unused pins */
1371 { 0x17, 0x411111f0 },
1372 { 0x19, 0x411111f0 },
1373 { 0x1b, 0x411111f0 },
1374 { 0x1f, 0x411111f0 },
1375 { }
1376 }
1377 },
96e225f6 1378 [ALC880_FIXUP_Z71V] = {
1727a771
TI
1379 .type = HDA_FIXUP_PINS,
1380 .v.pins = (const struct hda_pintbl[]) {
96e225f6
TI
1381 /* set up the whole pins as BIOS is utterly broken */
1382 { 0x14, 0x99030120 }, /* speaker */
1383 { 0x15, 0x0121411f }, /* HP */
1384 { 0x16, 0x411111f0 }, /* N/A */
1385 { 0x17, 0x411111f0 }, /* N/A */
1386 { 0x18, 0x01a19950 }, /* mic-in */
1387 { 0x19, 0x411111f0 }, /* N/A */
1388 { 0x1a, 0x01813031 }, /* line-in */
1389 { 0x1b, 0x411111f0 }, /* N/A */
1390 { 0x1c, 0x411111f0 }, /* N/A */
1391 { 0x1d, 0x411111f0 }, /* N/A */
1392 { 0x1e, 0x0144111e }, /* SPDIF */
1393 { }
1394 }
1395 },
487a588d
TI
1396 [ALC880_FIXUP_ASUS_W5A] = {
1397 .type = HDA_FIXUP_PINS,
1398 .v.pins = (const struct hda_pintbl[]) {
1399 /* set up the whole pins as BIOS is utterly broken */
1400 { 0x14, 0x0121411f }, /* HP */
1401 { 0x15, 0x411111f0 }, /* N/A */
1402 { 0x16, 0x411111f0 }, /* N/A */
1403 { 0x17, 0x411111f0 }, /* N/A */
1404 { 0x18, 0x90a60160 }, /* mic */
1405 { 0x19, 0x411111f0 }, /* N/A */
1406 { 0x1a, 0x411111f0 }, /* N/A */
1407 { 0x1b, 0x411111f0 }, /* N/A */
1408 { 0x1c, 0x411111f0 }, /* N/A */
1409 { 0x1d, 0x411111f0 }, /* N/A */
1410 { 0x1e, 0xb743111e }, /* SPDIF out */
1411 { }
1412 },
1413 .chained = true,
1414 .chain_id = ALC880_FIXUP_GPIO1,
1415 },
67b6ec31 1416 [ALC880_FIXUP_3ST_BASE] = {
1727a771
TI
1417 .type = HDA_FIXUP_PINS,
1418 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1419 { 0x14, 0x01014010 }, /* line-out */
1420 { 0x15, 0x411111f0 }, /* N/A */
1421 { 0x16, 0x411111f0 }, /* N/A */
1422 { 0x17, 0x411111f0 }, /* N/A */
1423 { 0x18, 0x01a19c30 }, /* mic-in */
1424 { 0x19, 0x0121411f }, /* HP */
1425 { 0x1a, 0x01813031 }, /* line-in */
1426 { 0x1b, 0x02a19c40 }, /* front-mic */
1427 { 0x1c, 0x411111f0 }, /* N/A */
1428 { 0x1d, 0x411111f0 }, /* N/A */
1429 /* 0x1e is filled in below */
1430 { 0x1f, 0x411111f0 }, /* N/A */
1431 { }
1432 }
1433 },
1434 [ALC880_FIXUP_3ST] = {
1727a771
TI
1435 .type = HDA_FIXUP_PINS,
1436 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1437 { 0x1e, 0x411111f0 }, /* N/A */
1438 { }
1439 },
1440 .chained = true,
1441 .chain_id = ALC880_FIXUP_3ST_BASE,
1442 },
1443 [ALC880_FIXUP_3ST_DIG] = {
1727a771
TI
1444 .type = HDA_FIXUP_PINS,
1445 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1446 { 0x1e, 0x0144111e }, /* SPDIF */
1447 { }
1448 },
1449 .chained = true,
1450 .chain_id = ALC880_FIXUP_3ST_BASE,
1451 },
1452 [ALC880_FIXUP_5ST_BASE] = {
1727a771
TI
1453 .type = HDA_FIXUP_PINS,
1454 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1455 { 0x14, 0x01014010 }, /* front */
1456 { 0x15, 0x411111f0 }, /* N/A */
1457 { 0x16, 0x01011411 }, /* CLFE */
1458 { 0x17, 0x01016412 }, /* surr */
1459 { 0x18, 0x01a19c30 }, /* mic-in */
1460 { 0x19, 0x0121411f }, /* HP */
1461 { 0x1a, 0x01813031 }, /* line-in */
1462 { 0x1b, 0x02a19c40 }, /* front-mic */
1463 { 0x1c, 0x411111f0 }, /* N/A */
1464 { 0x1d, 0x411111f0 }, /* N/A */
1465 /* 0x1e is filled in below */
1466 { 0x1f, 0x411111f0 }, /* N/A */
1467 { }
1468 }
1469 },
1470 [ALC880_FIXUP_5ST] = {
1727a771
TI
1471 .type = HDA_FIXUP_PINS,
1472 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1473 { 0x1e, 0x411111f0 }, /* N/A */
1474 { }
1475 },
1476 .chained = true,
1477 .chain_id = ALC880_FIXUP_5ST_BASE,
1478 },
1479 [ALC880_FIXUP_5ST_DIG] = {
1727a771
TI
1480 .type = HDA_FIXUP_PINS,
1481 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1482 { 0x1e, 0x0144111e }, /* SPDIF */
1483 { }
1484 },
1485 .chained = true,
1486 .chain_id = ALC880_FIXUP_5ST_BASE,
1487 },
1488 [ALC880_FIXUP_6ST_BASE] = {
1727a771
TI
1489 .type = HDA_FIXUP_PINS,
1490 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1491 { 0x14, 0x01014010 }, /* front */
1492 { 0x15, 0x01016412 }, /* surr */
1493 { 0x16, 0x01011411 }, /* CLFE */
1494 { 0x17, 0x01012414 }, /* side */
1495 { 0x18, 0x01a19c30 }, /* mic-in */
1496 { 0x19, 0x02a19c40 }, /* front-mic */
1497 { 0x1a, 0x01813031 }, /* line-in */
1498 { 0x1b, 0x0121411f }, /* HP */
1499 { 0x1c, 0x411111f0 }, /* N/A */
1500 { 0x1d, 0x411111f0 }, /* N/A */
1501 /* 0x1e is filled in below */
1502 { 0x1f, 0x411111f0 }, /* N/A */
1503 { }
1504 }
1505 },
1506 [ALC880_FIXUP_6ST] = {
1727a771
TI
1507 .type = HDA_FIXUP_PINS,
1508 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1509 { 0x1e, 0x411111f0 }, /* N/A */
1510 { }
1511 },
1512 .chained = true,
1513 .chain_id = ALC880_FIXUP_6ST_BASE,
1514 },
1515 [ALC880_FIXUP_6ST_DIG] = {
1727a771
TI
1516 .type = HDA_FIXUP_PINS,
1517 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1518 { 0x1e, 0x0144111e }, /* SPDIF */
1519 { }
1520 },
1521 .chained = true,
1522 .chain_id = ALC880_FIXUP_6ST_BASE,
1523 },
5397145f
TI
1524 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1525 .type = HDA_FIXUP_PINS,
1526 .v.pins = (const struct hda_pintbl[]) {
1527 { 0x1b, 0x0121401f }, /* HP with jack detect */
1528 { }
1529 },
1530 .chained_before = true,
1531 .chain_id = ALC880_FIXUP_6ST_BASE,
1532 },
ee3b2969
TI
1533};
1534
1535static const struct snd_pci_quirk alc880_fixup_tbl[] = {
f02aab5d 1536 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
487a588d 1537 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
96e225f6 1538 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
29e3fdcc 1539 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
6538de03 1540 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
29e3fdcc 1541 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
27e917f8 1542 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
967b88c4 1543 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
ba533818 1544 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
817de92f 1545 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
7833c7e8 1546 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
f02aab5d 1547 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
ee3b2969 1548 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
5397145f 1549 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
a161574e 1550 SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
cf5a2279 1551 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
ba533818 1552 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
cf5a2279 1553 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
dc6af52d
TI
1554 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1555 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1556 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
db8a38e5 1557 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
b9368f5c 1558 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
67b6ec31
TI
1559
1560 /* Below is the copied entries from alc880_quirks.c.
1561 * It's not quite sure whether BIOS sets the correct pin-config table
1562 * on these machines, thus they are kept to be compatible with
1563 * the old static quirks. Once when it's confirmed to work without
1564 * these overrides, it'd be better to remove.
1565 */
1566 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1567 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1568 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1569 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1570 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1571 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1572 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1573 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1574 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1575 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1576 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1577 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1578 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1579 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1580 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1581 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1582 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1583 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1584 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1585 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1586 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1587 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1588 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1589 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1590 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1591 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1592 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1593 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1594 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1595 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1596 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1597 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1598 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1599 /* default Intel */
1600 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1601 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1602 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1603 {}
1604};
1605
1727a771 1606static const struct hda_model_fixup alc880_fixup_models[] = {
67b6ec31
TI
1607 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1608 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1609 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1610 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1611 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1612 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
5397145f 1613 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
ee3b2969
TI
1614 {}
1615};
1616
1617
1d045db9
TI
1618/*
1619 * OK, here we have finally the patch for ALC880
1620 */
1d045db9 1621static int patch_alc880(struct hda_codec *codec)
60db6b53 1622{
1d045db9 1623 struct alc_spec *spec;
1d045db9 1624 int err;
f6a92248 1625
3de95173
TI
1626 err = alc_alloc_spec(codec, 0x0b);
1627 if (err < 0)
1628 return err;
64154835 1629
3de95173 1630 spec = codec->spec;
08c189f2 1631 spec->gen.need_dac_fix = 1;
7504b6cd 1632 spec->gen.beep_nid = 0x01;
f53281e6 1633
225068ab
TI
1634 codec->patch_ops.unsol_event = alc880_unsol_event;
1635
c9af753f
TI
1636 alc_pre_init(codec);
1637
1727a771 1638 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
67b6ec31 1639 alc880_fixups);
1727a771 1640 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
ee3b2969 1641
67b6ec31
TI
1642 /* automatic parse from the BIOS config */
1643 err = alc880_parse_auto_config(codec);
1644 if (err < 0)
1645 goto error;
fe3eb0a7 1646
fea80fae
TI
1647 if (!spec->gen.no_analog) {
1648 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1649 if (err < 0)
1650 goto error;
1651 }
f53281e6 1652
1727a771 1653 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 1654
1d045db9 1655 return 0;
e16fb6d1
TI
1656
1657 error:
1658 alc_free(codec);
1659 return err;
226b1ec8
KY
1660}
1661
1d045db9 1662
60db6b53 1663/*
1d045db9 1664 * ALC260 support
60db6b53 1665 */
1d045db9 1666static int alc260_parse_auto_config(struct hda_codec *codec)
f6a92248 1667{
1d045db9 1668 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
3e6179b8
TI
1669 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1670 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
f6a92248
KY
1671}
1672
1d045db9
TI
1673/*
1674 * Pin config fixes
1675 */
1676enum {
ca8f0424
TI
1677 ALC260_FIXUP_HP_DC5750,
1678 ALC260_FIXUP_HP_PIN_0F,
1679 ALC260_FIXUP_COEF,
15317ab2 1680 ALC260_FIXUP_GPIO1,
20f7d928
TI
1681 ALC260_FIXUP_GPIO1_TOGGLE,
1682 ALC260_FIXUP_REPLACER,
0a1c4fa2 1683 ALC260_FIXUP_HP_B1900,
118cb4a4 1684 ALC260_FIXUP_KN1,
39aedee7 1685 ALC260_FIXUP_FSC_S7020,
5ebd3bbd 1686 ALC260_FIXUP_FSC_S7020_JWSE,
d08c5ef2 1687 ALC260_FIXUP_VAIO_PINS,
1d045db9
TI
1688};
1689
20f7d928
TI
1690static void alc260_gpio1_automute(struct hda_codec *codec)
1691{
1692 struct alc_spec *spec = codec->spec;
aaf312de
TI
1693
1694 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
20f7d928
TI
1695}
1696
1697static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1727a771 1698 const struct hda_fixup *fix, int action)
20f7d928
TI
1699{
1700 struct alc_spec *spec = codec->spec;
1727a771 1701 if (action == HDA_FIXUP_ACT_PROBE) {
20f7d928
TI
1702 /* although the machine has only one output pin, we need to
1703 * toggle GPIO1 according to the jack state
1704 */
08c189f2
TI
1705 spec->gen.automute_hook = alc260_gpio1_automute;
1706 spec->gen.detect_hp = 1;
1707 spec->gen.automute_speaker = 1;
1708 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
62f949bf 1709 snd_hda_jack_detect_enable_callback(codec, 0x0f,
08c189f2 1710 snd_hda_gen_hp_automute);
5579cd6f 1711 alc_setup_gpio(codec, 0x01);
20f7d928
TI
1712 }
1713}
1714
118cb4a4 1715static void alc260_fixup_kn1(struct hda_codec *codec,
1727a771 1716 const struct hda_fixup *fix, int action)
118cb4a4
TI
1717{
1718 struct alc_spec *spec = codec->spec;
1727a771 1719 static const struct hda_pintbl pincfgs[] = {
118cb4a4
TI
1720 { 0x0f, 0x02214000 }, /* HP/speaker */
1721 { 0x12, 0x90a60160 }, /* int mic */
1722 { 0x13, 0x02a19000 }, /* ext mic */
1723 { 0x18, 0x01446000 }, /* SPDIF out */
1724 /* disable bogus I/O pins */
1725 { 0x10, 0x411111f0 },
1726 { 0x11, 0x411111f0 },
1727 { 0x14, 0x411111f0 },
1728 { 0x15, 0x411111f0 },
1729 { 0x16, 0x411111f0 },
1730 { 0x17, 0x411111f0 },
1731 { 0x19, 0x411111f0 },
1732 { }
1733 };
1734
1735 switch (action) {
1727a771
TI
1736 case HDA_FIXUP_ACT_PRE_PROBE:
1737 snd_hda_apply_pincfgs(codec, pincfgs);
118cb4a4
TI
1738 spec->init_amp = ALC_INIT_NONE;
1739 break;
1740 }
1741}
1742
39aedee7
TI
1743static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1744 const struct hda_fixup *fix, int action)
1745{
1746 struct alc_spec *spec = codec->spec;
1c76aa5f 1747 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5ebd3bbd
TI
1748 spec->init_amp = ALC_INIT_NONE;
1749}
39aedee7 1750
5ebd3bbd
TI
1751static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1752 const struct hda_fixup *fix, int action)
1753{
1754 struct alc_spec *spec = codec->spec;
1755 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
f811c3cf 1756 spec->gen.add_jack_modes = 1;
5ebd3bbd 1757 spec->gen.hp_mic = 1;
e6e0ee50 1758 }
39aedee7
TI
1759}
1760
1727a771 1761static const struct hda_fixup alc260_fixups[] = {
ca8f0424 1762 [ALC260_FIXUP_HP_DC5750] = {
1727a771
TI
1763 .type = HDA_FIXUP_PINS,
1764 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
1765 { 0x11, 0x90130110 }, /* speaker */
1766 { }
1767 }
1768 },
ca8f0424 1769 [ALC260_FIXUP_HP_PIN_0F] = {
1727a771
TI
1770 .type = HDA_FIXUP_PINS,
1771 .v.pins = (const struct hda_pintbl[]) {
ca8f0424
TI
1772 { 0x0f, 0x01214000 }, /* HP */
1773 { }
1774 }
1775 },
1776 [ALC260_FIXUP_COEF] = {
1727a771 1777 .type = HDA_FIXUP_VERBS,
ca8f0424 1778 .v.verbs = (const struct hda_verb[]) {
e30cf2d2
RM
1779 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1780 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
ca8f0424
TI
1781 { }
1782 },
ca8f0424 1783 },
15317ab2 1784 [ALC260_FIXUP_GPIO1] = {
5579cd6f
TI
1785 .type = HDA_FIXUP_FUNC,
1786 .v.func = alc_fixup_gpio1,
15317ab2 1787 },
20f7d928 1788 [ALC260_FIXUP_GPIO1_TOGGLE] = {
1727a771 1789 .type = HDA_FIXUP_FUNC,
20f7d928
TI
1790 .v.func = alc260_fixup_gpio1_toggle,
1791 .chained = true,
1792 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1793 },
1794 [ALC260_FIXUP_REPLACER] = {
1727a771 1795 .type = HDA_FIXUP_VERBS,
20f7d928 1796 .v.verbs = (const struct hda_verb[]) {
192a98e2
TI
1797 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1798 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
20f7d928
TI
1799 { }
1800 },
1801 .chained = true,
1802 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1803 },
0a1c4fa2 1804 [ALC260_FIXUP_HP_B1900] = {
1727a771 1805 .type = HDA_FIXUP_FUNC,
0a1c4fa2
TI
1806 .v.func = alc260_fixup_gpio1_toggle,
1807 .chained = true,
1808 .chain_id = ALC260_FIXUP_COEF,
118cb4a4
TI
1809 },
1810 [ALC260_FIXUP_KN1] = {
1727a771 1811 .type = HDA_FIXUP_FUNC,
118cb4a4
TI
1812 .v.func = alc260_fixup_kn1,
1813 },
39aedee7
TI
1814 [ALC260_FIXUP_FSC_S7020] = {
1815 .type = HDA_FIXUP_FUNC,
1816 .v.func = alc260_fixup_fsc_s7020,
1817 },
5ebd3bbd
TI
1818 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1819 .type = HDA_FIXUP_FUNC,
1820 .v.func = alc260_fixup_fsc_s7020_jwse,
1821 .chained = true,
1822 .chain_id = ALC260_FIXUP_FSC_S7020,
1823 },
d08c5ef2
TI
1824 [ALC260_FIXUP_VAIO_PINS] = {
1825 .type = HDA_FIXUP_PINS,
1826 .v.pins = (const struct hda_pintbl[]) {
1827 /* Pin configs are missing completely on some VAIOs */
1828 { 0x0f, 0x01211020 },
1829 { 0x10, 0x0001003f },
1830 { 0x11, 0x411111f0 },
1831 { 0x12, 0x01a15930 },
1832 { 0x13, 0x411111f0 },
1833 { 0x14, 0x411111f0 },
1834 { 0x15, 0x411111f0 },
1835 { 0x16, 0x411111f0 },
1836 { 0x17, 0x411111f0 },
1837 { 0x18, 0x411111f0 },
1838 { 0x19, 0x411111f0 },
1839 { }
1840 }
1841 },
1d045db9
TI
1842};
1843
1844static const struct snd_pci_quirk alc260_fixup_tbl[] = {
15317ab2 1845 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
ca8f0424 1846 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
15317ab2 1847 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
ca8f0424 1848 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
0a1c4fa2 1849 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
d08c5ef2 1850 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
0f5a5b85 1851 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
39aedee7 1852 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
b1f58085 1853 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
118cb4a4 1854 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
20f7d928 1855 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
ca8f0424 1856 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
1d045db9
TI
1857 {}
1858};
1859
5ebd3bbd
TI
1860static const struct hda_model_fixup alc260_fixup_models[] = {
1861 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1862 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1863 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1864 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1865 {}
1866};
1867
1d045db9
TI
1868/*
1869 */
1d045db9 1870static int patch_alc260(struct hda_codec *codec)
977ddd6b 1871{
1d045db9 1872 struct alc_spec *spec;
c3c2c9e7 1873 int err;
1d045db9 1874
3de95173
TI
1875 err = alc_alloc_spec(codec, 0x07);
1876 if (err < 0)
1877 return err;
1d045db9 1878
3de95173 1879 spec = codec->spec;
ea46c3c8
TI
1880 /* as quite a few machines require HP amp for speaker outputs,
1881 * it's easier to enable it unconditionally; even if it's unneeded,
1882 * it's almost harmless.
1883 */
1884 spec->gen.prefer_hp_amp = 1;
7504b6cd 1885 spec->gen.beep_nid = 0x01;
1d045db9 1886
225068ab
TI
1887 spec->shutup = alc_eapd_shutup;
1888
c9af753f
TI
1889 alc_pre_init(codec);
1890
5ebd3bbd
TI
1891 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1892 alc260_fixups);
1727a771 1893 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
977ddd6b 1894
c3c2c9e7
TI
1895 /* automatic parse from the BIOS config */
1896 err = alc260_parse_auto_config(codec);
1897 if (err < 0)
1898 goto error;
977ddd6b 1899
fea80fae
TI
1900 if (!spec->gen.no_analog) {
1901 err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1902 if (err < 0)
1903 goto error;
1904 }
977ddd6b 1905
1727a771 1906 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 1907
1d045db9 1908 return 0;
e16fb6d1
TI
1909
1910 error:
1911 alc_free(codec);
1912 return err;
6981d184
TI
1913}
1914
1d045db9
TI
1915
1916/*
1917 * ALC882/883/885/888/889 support
1918 *
1919 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1920 * configuration. Each pin widget can choose any input DACs and a mixer.
1921 * Each ADC is connected from a mixer of all inputs. This makes possible
1922 * 6-channel independent captures.
1923 *
1924 * In addition, an independent DAC for the multi-playback (not used in this
1925 * driver yet).
1926 */
1d045db9
TI
1927
1928/*
1929 * Pin config fixes
1930 */
ff818c24 1931enum {
5c0ebfbe
TI
1932 ALC882_FIXUP_ABIT_AW9D_MAX,
1933 ALC882_FIXUP_LENOVO_Y530,
1934 ALC882_FIXUP_PB_M5210,
1935 ALC882_FIXUP_ACER_ASPIRE_7736,
1936 ALC882_FIXUP_ASUS_W90V,
8f239214 1937 ALC889_FIXUP_CD,
b2c53e20 1938 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
5c0ebfbe 1939 ALC889_FIXUP_VAIO_TT,
0e7cc2e7 1940 ALC888_FIXUP_EEE1601,
4841b8e6 1941 ALC886_FIXUP_EAPD,
177943a3 1942 ALC882_FIXUP_EAPD,
7a6069bf 1943 ALC883_FIXUP_EAPD,
8812c4f9 1944 ALC883_FIXUP_ACER_EAPD,
1a97b7f2
TI
1945 ALC882_FIXUP_GPIO1,
1946 ALC882_FIXUP_GPIO2,
eb844d51 1947 ALC882_FIXUP_GPIO3,
68ef0561
TI
1948 ALC889_FIXUP_COEF,
1949 ALC882_FIXUP_ASUS_W2JC,
c3e837bb
TI
1950 ALC882_FIXUP_ACER_ASPIRE_4930G,
1951 ALC882_FIXUP_ACER_ASPIRE_8930G,
1952 ALC882_FIXUP_ASPIRE_8930G_VERBS,
5671087f 1953 ALC885_FIXUP_MACPRO_GPIO,
02a237b2 1954 ALC889_FIXUP_DAC_ROUTE,
1a97b7f2
TI
1955 ALC889_FIXUP_MBP_VREF,
1956 ALC889_FIXUP_IMAC91_VREF,
e7729a41 1957 ALC889_FIXUP_MBA11_VREF,
0756f09c 1958 ALC889_FIXUP_MBA21_VREF,
c20f31ec 1959 ALC889_FIXUP_MP11_VREF,
9f660a1c 1960 ALC889_FIXUP_MP41_VREF,
6e72aa5f 1961 ALC882_FIXUP_INV_DMIC,
e427c237 1962 ALC882_FIXUP_NO_PRIMARY_HP,
1f0bbf03 1963 ALC887_FIXUP_ASUS_BASS,
eb9ca3ab 1964 ALC887_FIXUP_BASS_CHMAP,
7beb3a6e 1965 ALC1220_FIXUP_GB_DUAL_CODECS,
5853e364 1966 ALC1220_FIXUP_GB_X570,
0202f5cd 1967 ALC1220_FIXUP_CLEVO_P950,
80690a27
RS
1968 ALC1220_FIXUP_CLEVO_PB51ED,
1969 ALC1220_FIXUP_CLEVO_PB51ED_PINS,
ca184355
JHP
1970 ALC887_FIXUP_ASUS_AUDIO,
1971 ALC887_FIXUP_ASUS_HMIC,
ff818c24
TI
1972};
1973
68ef0561 1974static void alc889_fixup_coef(struct hda_codec *codec,
1727a771 1975 const struct hda_fixup *fix, int action)
68ef0561 1976{
1727a771 1977 if (action != HDA_FIXUP_ACT_INIT)
68ef0561 1978 return;
1df8874b 1979 alc_update_coef_idx(codec, 7, 0, 0x2030);
68ef0561
TI
1980}
1981
5671087f
TI
1982/* set up GPIO at initialization */
1983static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
1727a771 1984 const struct hda_fixup *fix, int action)
5671087f 1985{
215c850c
TI
1986 struct alc_spec *spec = codec->spec;
1987
1988 spec->gpio_write_delay = true;
1989 alc_fixup_gpio3(codec, fix, action);
5671087f
TI
1990}
1991
02a237b2
TI
1992/* Fix the connection of some pins for ALC889:
1993 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
1994 * work correctly (bko#42740)
1995 */
1996static void alc889_fixup_dac_route(struct hda_codec *codec,
1727a771 1997 const struct hda_fixup *fix, int action)
02a237b2 1998{
1727a771 1999 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
ef8d60fb 2000 /* fake the connections during parsing the tree */
caf3c043
MM
2001 static const hda_nid_t conn1[] = { 0x0c, 0x0d };
2002 static const hda_nid_t conn2[] = { 0x0e, 0x0f };
2003 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2004 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
2005 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
2006 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
1727a771 2007 } else if (action == HDA_FIXUP_ACT_PROBE) {
ef8d60fb 2008 /* restore the connections */
caf3c043
MM
2009 static const hda_nid_t conn[] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
2010 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
2011 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
2012 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
2013 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
02a237b2
TI
2014 }
2015}
2016
1a97b7f2
TI
2017/* Set VREF on HP pin */
2018static void alc889_fixup_mbp_vref(struct hda_codec *codec,
1727a771 2019 const struct hda_fixup *fix, int action)
1a97b7f2 2020{
caf3c043 2021 static const hda_nid_t nids[] = { 0x14, 0x15, 0x19 };
1a97b7f2 2022 struct alc_spec *spec = codec->spec;
1a97b7f2
TI
2023 int i;
2024
1727a771 2025 if (action != HDA_FIXUP_ACT_INIT)
1a97b7f2
TI
2026 return;
2027 for (i = 0; i < ARRAY_SIZE(nids); i++) {
2028 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
2029 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
2030 continue;
d3f02d60 2031 val = snd_hda_codec_get_pin_target(codec, nids[i]);
1a97b7f2 2032 val |= AC_PINCTL_VREF_80;
cdd03ced 2033 snd_hda_set_pin_ctl(codec, nids[i], val);
08c189f2 2034 spec->gen.keep_vref_in_automute = 1;
1a97b7f2
TI
2035 break;
2036 }
2037}
2038
0756f09c
TI
2039static void alc889_fixup_mac_pins(struct hda_codec *codec,
2040 const hda_nid_t *nids, int num_nids)
1a97b7f2
TI
2041{
2042 struct alc_spec *spec = codec->spec;
1a97b7f2
TI
2043 int i;
2044
0756f09c 2045 for (i = 0; i < num_nids; i++) {
1a97b7f2 2046 unsigned int val;
d3f02d60 2047 val = snd_hda_codec_get_pin_target(codec, nids[i]);
1a97b7f2 2048 val |= AC_PINCTL_VREF_50;
cdd03ced 2049 snd_hda_set_pin_ctl(codec, nids[i], val);
1a97b7f2 2050 }
08c189f2 2051 spec->gen.keep_vref_in_automute = 1;
1a97b7f2
TI
2052}
2053
0756f09c
TI
2054/* Set VREF on speaker pins on imac91 */
2055static void alc889_fixup_imac91_vref(struct hda_codec *codec,
2056 const struct hda_fixup *fix, int action)
2057{
caf3c043 2058 static const hda_nid_t nids[] = { 0x18, 0x1a };
0756f09c
TI
2059
2060 if (action == HDA_FIXUP_ACT_INIT)
2061 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2062}
2063
e7729a41
AV
2064/* Set VREF on speaker pins on mba11 */
2065static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2066 const struct hda_fixup *fix, int action)
2067{
caf3c043 2068 static const hda_nid_t nids[] = { 0x18 };
e7729a41
AV
2069
2070 if (action == HDA_FIXUP_ACT_INIT)
2071 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2072}
2073
0756f09c
TI
2074/* Set VREF on speaker pins on mba21 */
2075static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2076 const struct hda_fixup *fix, int action)
2077{
caf3c043 2078 static const hda_nid_t nids[] = { 0x18, 0x19 };
0756f09c
TI
2079
2080 if (action == HDA_FIXUP_ACT_INIT)
2081 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2082}
2083
e427c237 2084/* Don't take HP output as primary
d9111496
FLVC
2085 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2086 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
e427c237
TI
2087 */
2088static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
1727a771 2089 const struct hda_fixup *fix, int action)
e427c237
TI
2090{
2091 struct alc_spec *spec = codec->spec;
da96fb5b 2092 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
08c189f2 2093 spec->gen.no_primary_hp = 1;
da96fb5b
TI
2094 spec->gen.no_multi_io = 1;
2095 }
e427c237
TI
2096}
2097
eb9ca3ab
TI
2098static void alc_fixup_bass_chmap(struct hda_codec *codec,
2099 const struct hda_fixup *fix, int action);
2100
7beb3a6e
TI
2101/* For dual-codec configuration, we need to disable some features to avoid
2102 * conflicts of kctls and PCM streams
2103 */
2104static void alc_fixup_dual_codecs(struct hda_codec *codec,
2105 const struct hda_fixup *fix, int action)
2106{
2107 struct alc_spec *spec = codec->spec;
2108
2109 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2110 return;
2111 /* disable vmaster */
2112 spec->gen.suppress_vmaster = 1;
2113 /* auto-mute and auto-mic switch don't work with multiple codecs */
2114 spec->gen.suppress_auto_mute = 1;
2115 spec->gen.suppress_auto_mic = 1;
2116 /* disable aamix as well */
2117 spec->gen.mixer_nid = 0;
2118 /* add location prefix to avoid conflicts */
2119 codec->force_pin_prefix = 1;
2120}
2121
2122static void rename_ctl(struct hda_codec *codec, const char *oldname,
2123 const char *newname)
2124{
2125 struct snd_kcontrol *kctl;
2126
2127 kctl = snd_hda_find_mixer_ctl(codec, oldname);
2128 if (kctl)
2129 strcpy(kctl->id.name, newname);
2130}
2131
2132static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2133 const struct hda_fixup *fix,
2134 int action)
2135{
2136 alc_fixup_dual_codecs(codec, fix, action);
2137 switch (action) {
2138 case HDA_FIXUP_ACT_PRE_PROBE:
2139 /* override card longname to provide a unique UCM profile */
2140 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2141 break;
2142 case HDA_FIXUP_ACT_BUILD:
2143 /* rename Capture controls depending on the codec */
2144 rename_ctl(codec, "Capture Volume",
2145 codec->addr == 0 ?
2146 "Rear-Panel Capture Volume" :
2147 "Front-Panel Capture Volume");
2148 rename_ctl(codec, "Capture Switch",
2149 codec->addr == 0 ?
2150 "Rear-Panel Capture Switch" :
2151 "Front-Panel Capture Switch");
2152 break;
2153 }
2154}
2155
5853e364
CL
2156static void alc1220_fixup_gb_x570(struct hda_codec *codec,
2157 const struct hda_fixup *fix,
2158 int action)
2159{
2160 static const hda_nid_t conn1[] = { 0x0c };
2161 static const struct coef_fw gb_x570_coefs[] = {
37b950ed 2162 WRITE_COEF(0x07, 0x03c0),
5853e364
CL
2163 WRITE_COEF(0x1a, 0x01c1),
2164 WRITE_COEF(0x1b, 0x0202),
2165 WRITE_COEF(0x43, 0x3005),
2166 {}
2167 };
2168
2169 switch (action) {
2170 case HDA_FIXUP_ACT_PRE_PROBE:
2171 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2172 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2173 break;
2174 case HDA_FIXUP_ACT_INIT:
2175 alc_process_coef_fw(codec, gb_x570_coefs);
2176 break;
2177 }
2178}
2179
0202f5cd
P
2180static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2181 const struct hda_fixup *fix,
2182 int action)
2183{
caf3c043 2184 static const hda_nid_t conn1[] = { 0x0c };
0202f5cd
P
2185
2186 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2187 return;
2188
2189 alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2190 /* We therefore want to make sure 0x14 (front headphone) and
2191 * 0x1b (speakers) use the stereo DAC 0x02
2192 */
caf3c043
MM
2193 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2194 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
0202f5cd
P
2195}
2196
7f665b1c
JS
2197static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2198 const struct hda_fixup *fix, int action);
2199
80690a27 2200static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
7f665b1c
JS
2201 const struct hda_fixup *fix,
2202 int action)
2203{
2204 alc1220_fixup_clevo_p950(codec, fix, action);
2205 alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2206}
2207
ca184355
JHP
2208static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
2209 struct hda_jack_callback *jack)
2210{
2211 struct alc_spec *spec = codec->spec;
2212 unsigned int vref;
2213
2214 snd_hda_gen_hp_automute(codec, jack);
2215
2216 if (spec->gen.hp_jack_present)
2217 vref = AC_PINCTL_VREF_80;
2218 else
2219 vref = AC_PINCTL_VREF_HIZ;
2220 snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
2221}
2222
2223static void alc887_fixup_asus_jack(struct hda_codec *codec,
2224 const struct hda_fixup *fix, int action)
2225{
2226 struct alc_spec *spec = codec->spec;
2227 if (action != HDA_FIXUP_ACT_PROBE)
2228 return;
2229 snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
2230 spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook;
2231}
2232
1727a771 2233static const struct hda_fixup alc882_fixups[] = {
5c0ebfbe 2234 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
1727a771
TI
2235 .type = HDA_FIXUP_PINS,
2236 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
2237 { 0x15, 0x01080104 }, /* side */
2238 { 0x16, 0x01011012 }, /* rear */
2239 { 0x17, 0x01016011 }, /* clfe */
2785591a 2240 { }
145a902b
DH
2241 }
2242 },
5c0ebfbe 2243 [ALC882_FIXUP_LENOVO_Y530] = {
1727a771
TI
2244 .type = HDA_FIXUP_PINS,
2245 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
2246 { 0x15, 0x99130112 }, /* rear int speakers */
2247 { 0x16, 0x99130111 }, /* subwoofer */
ac612407
DH
2248 { }
2249 }
2250 },
5c0ebfbe 2251 [ALC882_FIXUP_PB_M5210] = {
fd108215
TI
2252 .type = HDA_FIXUP_PINCTLS,
2253 .v.pins = (const struct hda_pintbl[]) {
2254 { 0x19, PIN_VREF50 },
357f915e
KY
2255 {}
2256 }
2257 },
5c0ebfbe 2258 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
1727a771 2259 .type = HDA_FIXUP_FUNC,
23d30f28 2260 .v.func = alc_fixup_sku_ignore,
6981d184 2261 },
5c0ebfbe 2262 [ALC882_FIXUP_ASUS_W90V] = {
1727a771
TI
2263 .type = HDA_FIXUP_PINS,
2264 .v.pins = (const struct hda_pintbl[]) {
5cdf745e
TI
2265 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
2266 { }
2267 }
2268 },
8f239214 2269 [ALC889_FIXUP_CD] = {
1727a771
TI
2270 .type = HDA_FIXUP_PINS,
2271 .v.pins = (const struct hda_pintbl[]) {
8f239214
MB
2272 { 0x1c, 0x993301f0 }, /* CD */
2273 { }
2274 }
2275 },
b2c53e20
DH
2276 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2277 .type = HDA_FIXUP_PINS,
2278 .v.pins = (const struct hda_pintbl[]) {
2279 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2280 { }
2281 },
2282 .chained = true,
2283 .chain_id = ALC889_FIXUP_CD,
2284 },
5c0ebfbe 2285 [ALC889_FIXUP_VAIO_TT] = {
1727a771
TI
2286 .type = HDA_FIXUP_PINS,
2287 .v.pins = (const struct hda_pintbl[]) {
5c0ebfbe
TI
2288 { 0x17, 0x90170111 }, /* hidden surround speaker */
2289 { }
2290 }
2291 },
0e7cc2e7 2292 [ALC888_FIXUP_EEE1601] = {
1727a771 2293 .type = HDA_FIXUP_VERBS,
0e7cc2e7
TI
2294 .v.verbs = (const struct hda_verb[]) {
2295 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2296 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
2297 { }
2298 }
177943a3 2299 },
4841b8e6
PH
2300 [ALC886_FIXUP_EAPD] = {
2301 .type = HDA_FIXUP_VERBS,
2302 .v.verbs = (const struct hda_verb[]) {
2303 /* change to EAPD mode */
2304 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2305 { 0x20, AC_VERB_SET_PROC_COEF, 0x0068 },
2306 { }
2307 }
2308 },
177943a3 2309 [ALC882_FIXUP_EAPD] = {
1727a771 2310 .type = HDA_FIXUP_VERBS,
177943a3
TI
2311 .v.verbs = (const struct hda_verb[]) {
2312 /* change to EAPD mode */
2313 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2314 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2315 { }
2316 }
2317 },
7a6069bf 2318 [ALC883_FIXUP_EAPD] = {
1727a771 2319 .type = HDA_FIXUP_VERBS,
7a6069bf
TI
2320 .v.verbs = (const struct hda_verb[]) {
2321 /* change to EAPD mode */
2322 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2323 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2324 { }
2325 }
2326 },
8812c4f9 2327 [ALC883_FIXUP_ACER_EAPD] = {
1727a771 2328 .type = HDA_FIXUP_VERBS,
8812c4f9
TI
2329 .v.verbs = (const struct hda_verb[]) {
2330 /* eanable EAPD on Acer laptops */
2331 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2332 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2333 { }
2334 }
2335 },
1a97b7f2 2336 [ALC882_FIXUP_GPIO1] = {
5579cd6f
TI
2337 .type = HDA_FIXUP_FUNC,
2338 .v.func = alc_fixup_gpio1,
1a97b7f2
TI
2339 },
2340 [ALC882_FIXUP_GPIO2] = {
5579cd6f
TI
2341 .type = HDA_FIXUP_FUNC,
2342 .v.func = alc_fixup_gpio2,
1a97b7f2 2343 },
eb844d51 2344 [ALC882_FIXUP_GPIO3] = {
5579cd6f
TI
2345 .type = HDA_FIXUP_FUNC,
2346 .v.func = alc_fixup_gpio3,
eb844d51 2347 },
68ef0561 2348 [ALC882_FIXUP_ASUS_W2JC] = {
5579cd6f
TI
2349 .type = HDA_FIXUP_FUNC,
2350 .v.func = alc_fixup_gpio1,
68ef0561
TI
2351 .chained = true,
2352 .chain_id = ALC882_FIXUP_EAPD,
2353 },
2354 [ALC889_FIXUP_COEF] = {
1727a771 2355 .type = HDA_FIXUP_FUNC,
68ef0561
TI
2356 .v.func = alc889_fixup_coef,
2357 },
c3e837bb 2358 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
1727a771
TI
2359 .type = HDA_FIXUP_PINS,
2360 .v.pins = (const struct hda_pintbl[]) {
c3e837bb
TI
2361 { 0x16, 0x99130111 }, /* CLFE speaker */
2362 { 0x17, 0x99130112 }, /* surround speaker */
2363 { }
038d4fef
TI
2364 },
2365 .chained = true,
2366 .chain_id = ALC882_FIXUP_GPIO1,
c3e837bb
TI
2367 },
2368 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
1727a771
TI
2369 .type = HDA_FIXUP_PINS,
2370 .v.pins = (const struct hda_pintbl[]) {
c3e837bb
TI
2371 { 0x16, 0x99130111 }, /* CLFE speaker */
2372 { 0x1b, 0x99130112 }, /* surround speaker */
2373 { }
2374 },
2375 .chained = true,
2376 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2377 },
2378 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2379 /* additional init verbs for Acer Aspire 8930G */
1727a771 2380 .type = HDA_FIXUP_VERBS,
c3e837bb
TI
2381 .v.verbs = (const struct hda_verb[]) {
2382 /* Enable all DACs */
2383 /* DAC DISABLE/MUTE 1? */
2384 /* setting bits 1-5 disables DAC nids 0x02-0x06
2385 * apparently. Init=0x38 */
2386 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2387 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2388 /* DAC DISABLE/MUTE 2? */
2389 /* some bit here disables the other DACs.
2390 * Init=0x4900 */
2391 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2392 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2393 /* DMIC fix
2394 * This laptop has a stereo digital microphone.
2395 * The mics are only 1cm apart which makes the stereo
2396 * useless. However, either the mic or the ALC889
2397 * makes the signal become a difference/sum signal
2398 * instead of standard stereo, which is annoying.
2399 * So instead we flip this bit which makes the
2400 * codec replicate the sum signal to both channels,
2401 * turning it into a normal mono mic.
2402 */
2403 /* DMIC_CONTROL? Init value = 0x0001 */
2404 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2405 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2406 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2407 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2408 { }
038d4fef
TI
2409 },
2410 .chained = true,
2411 .chain_id = ALC882_FIXUP_GPIO1,
c3e837bb 2412 },
5671087f 2413 [ALC885_FIXUP_MACPRO_GPIO] = {
1727a771 2414 .type = HDA_FIXUP_FUNC,
5671087f
TI
2415 .v.func = alc885_fixup_macpro_gpio,
2416 },
02a237b2 2417 [ALC889_FIXUP_DAC_ROUTE] = {
1727a771 2418 .type = HDA_FIXUP_FUNC,
02a237b2
TI
2419 .v.func = alc889_fixup_dac_route,
2420 },
1a97b7f2 2421 [ALC889_FIXUP_MBP_VREF] = {
1727a771 2422 .type = HDA_FIXUP_FUNC,
1a97b7f2
TI
2423 .v.func = alc889_fixup_mbp_vref,
2424 .chained = true,
2425 .chain_id = ALC882_FIXUP_GPIO1,
2426 },
2427 [ALC889_FIXUP_IMAC91_VREF] = {
1727a771 2428 .type = HDA_FIXUP_FUNC,
1a97b7f2
TI
2429 .v.func = alc889_fixup_imac91_vref,
2430 .chained = true,
2431 .chain_id = ALC882_FIXUP_GPIO1,
2432 },
e7729a41
AV
2433 [ALC889_FIXUP_MBA11_VREF] = {
2434 .type = HDA_FIXUP_FUNC,
2435 .v.func = alc889_fixup_mba11_vref,
2436 .chained = true,
2437 .chain_id = ALC889_FIXUP_MBP_VREF,
2438 },
0756f09c
TI
2439 [ALC889_FIXUP_MBA21_VREF] = {
2440 .type = HDA_FIXUP_FUNC,
2441 .v.func = alc889_fixup_mba21_vref,
2442 .chained = true,
2443 .chain_id = ALC889_FIXUP_MBP_VREF,
2444 },
c20f31ec
TI
2445 [ALC889_FIXUP_MP11_VREF] = {
2446 .type = HDA_FIXUP_FUNC,
2447 .v.func = alc889_fixup_mba11_vref,
2448 .chained = true,
2449 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2450 },
9f660a1c
MK
2451 [ALC889_FIXUP_MP41_VREF] = {
2452 .type = HDA_FIXUP_FUNC,
2453 .v.func = alc889_fixup_mbp_vref,
2454 .chained = true,
2455 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2456 },
6e72aa5f 2457 [ALC882_FIXUP_INV_DMIC] = {
1727a771 2458 .type = HDA_FIXUP_FUNC,
9d36a7dc 2459 .v.func = alc_fixup_inv_dmic,
6e72aa5f 2460 },
e427c237 2461 [ALC882_FIXUP_NO_PRIMARY_HP] = {
1727a771 2462 .type = HDA_FIXUP_FUNC,
e427c237
TI
2463 .v.func = alc882_fixup_no_primary_hp,
2464 },
1f0bbf03
TI
2465 [ALC887_FIXUP_ASUS_BASS] = {
2466 .type = HDA_FIXUP_PINS,
2467 .v.pins = (const struct hda_pintbl[]) {
2468 {0x16, 0x99130130}, /* bass speaker */
2469 {}
2470 },
eb9ca3ab
TI
2471 .chained = true,
2472 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2473 },
2474 [ALC887_FIXUP_BASS_CHMAP] = {
2475 .type = HDA_FIXUP_FUNC,
2476 .v.func = alc_fixup_bass_chmap,
1f0bbf03 2477 },
7beb3a6e
TI
2478 [ALC1220_FIXUP_GB_DUAL_CODECS] = {
2479 .type = HDA_FIXUP_FUNC,
2480 .v.func = alc1220_fixup_gb_dual_codecs,
2481 },
5853e364
CL
2482 [ALC1220_FIXUP_GB_X570] = {
2483 .type = HDA_FIXUP_FUNC,
2484 .v.func = alc1220_fixup_gb_x570,
2485 },
0202f5cd
P
2486 [ALC1220_FIXUP_CLEVO_P950] = {
2487 .type = HDA_FIXUP_FUNC,
2488 .v.func = alc1220_fixup_clevo_p950,
2489 },
80690a27 2490 [ALC1220_FIXUP_CLEVO_PB51ED] = {
7f665b1c 2491 .type = HDA_FIXUP_FUNC,
80690a27 2492 .v.func = alc1220_fixup_clevo_pb51ed,
7f665b1c 2493 },
80690a27 2494 [ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
7f665b1c
JS
2495 .type = HDA_FIXUP_PINS,
2496 .v.pins = (const struct hda_pintbl[]) {
2497 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2498 {}
2499 },
2500 .chained = true,
80690a27 2501 .chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
7f665b1c 2502 },
ca184355
JHP
2503 [ALC887_FIXUP_ASUS_AUDIO] = {
2504 .type = HDA_FIXUP_PINS,
2505 .v.pins = (const struct hda_pintbl[]) {
2506 { 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */
2507 { 0x19, 0x22219420 },
2508 {}
2509 },
2510 },
2511 [ALC887_FIXUP_ASUS_HMIC] = {
2512 .type = HDA_FIXUP_FUNC,
2513 .v.func = alc887_fixup_asus_jack,
2514 .chained = true,
2515 .chain_id = ALC887_FIXUP_ASUS_AUDIO,
2516 },
ff818c24
TI
2517};
2518
1d045db9 2519static const struct snd_pci_quirk alc882_fixup_tbl[] = {
8812c4f9
TI
2520 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2521 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
b5d724b1 2522 SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
8812c4f9
TI
2523 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2524 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2525 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2526 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
c3e837bb
TI
2527 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2528 ALC882_FIXUP_ACER_ASPIRE_4930G),
2529 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2530 ALC882_FIXUP_ACER_ASPIRE_4930G),
2531 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2532 ALC882_FIXUP_ACER_ASPIRE_8930G),
2533 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2534 ALC882_FIXUP_ACER_ASPIRE_8930G),
b265047a
TI
2535 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2536 ALC882_FIXUP_ACER_ASPIRE_4930G),
2537 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
c3e837bb
TI
2538 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2539 ALC882_FIXUP_ACER_ASPIRE_4930G),
2540 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2541 ALC882_FIXUP_ACER_ASPIRE_4930G),
f5c53d89
TI
2542 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2543 ALC882_FIXUP_ACER_ASPIRE_4930G),
02a237b2 2544 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
fe97da1f 2545 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
ac9b1cdd 2546 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
177943a3 2547 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
5c0ebfbe 2548 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
68ef0561 2549 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
ca184355 2550 SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC),
0e7cc2e7 2551 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
1f0bbf03 2552 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
85bcf96c 2553 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
b7529c18
TI
2554 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2555 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
ac9b1cdd 2556 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
e427c237 2557 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
3f3c3714 2558 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
5671087f
TI
2559
2560 /* All Apple entries are in codec SSIDs */
1a97b7f2
TI
2561 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2562 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2563 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
c20f31ec 2564 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
5671087f
TI
2565 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2566 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
1a97b7f2
TI
2567 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2568 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
5671087f 2569 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
e7729a41 2570 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
0756f09c 2571 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
1a97b7f2
TI
2572 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2573 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
5671087f 2574 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
1a97b7f2
TI
2575 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2576 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2577 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
9f660a1c 2578 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
05193639 2579 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
1a97b7f2
TI
2580 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2581 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
649ccd08 2582 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
5671087f 2583
7a6069bf 2584 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
4841b8e6 2585 SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
b2c53e20 2586 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
7beb3a6e 2587 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
5853e364 2588 SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570),
e6ff6e2c 2589 SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_GB_X570),
37b950ed 2590 SND_PCI_QUIRK(0x1458, 0xa0d5, "Gigabyte X570S Aorus Master", ALC1220_FIXUP_GB_X570),
a0b03952 2591 SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
a655e2b1 2592 SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
09926202 2593 SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
1d3aa4a5 2594 SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
7dafba37 2595 SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
cc5049ae 2596 SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
d2c3b14e 2597 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
26af1772 2598 SND_PCI_QUIRK(0x1462, 0xcc34, "MSI Godlike X570", ALC1220_FIXUP_GB_DUAL_CODECS),
63691587 2599 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
d2c3b14e 2600 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
5c0ebfbe 2601 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
13e1a4cd
TI
2602 SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2603 SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2604 SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2605 SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2606 SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
aef454b4 2607 SND_PCI_QUIRK(0x1558, 0x65f1, "Clevo PC50HS", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
13e1a4cd
TI
2608 SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2609 SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2610 SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
a7182ce8 2611 SND_PCI_QUIRK(0x1558, 0x67f1, "Clevo PC70H[PRS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
13e1a4cd 2612 SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
1f8d398e 2613 SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170SM", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
cc03069a 2614 SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED),
0202f5cd 2615 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
b5acfe15 2616 SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
13e1a4cd 2617 SND_PCI_QUIRK(0x1558, 0x950a, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
f3d737b6 2618 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2f0d520a 2619 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
b5acfe15
PH
2620 SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
2621 SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950),
2622 SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950),
2623 SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950),
503d90b3
RS
2624 SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2625 SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
b5acfe15 2626 SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
7a6069bf
TI
2627 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2628 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
ac9b1cdd 2629 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
68ef0561 2630 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
ff818c24
TI
2631 {}
2632};
2633
1727a771 2634static const struct hda_model_fixup alc882_fixup_models[] = {
772c2917
TI
2635 {.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2636 {.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2637 {.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2638 {.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2639 {.id = ALC889_FIXUP_CD, .name = "cd"},
2640 {.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2641 {.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2642 {.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2643 {.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2644 {.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2645 {.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2646 {.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2647 {.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2648 {.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2649 {.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
912093bc
TI
2650 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2651 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2652 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
772c2917
TI
2653 {.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2654 {.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2655 {.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2656 {.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2657 {.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2658 {.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2659 {.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2660 {.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
6e72aa5f 2661 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
e427c237 2662 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
772c2917 2663 {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
ba90d6a6 2664 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
f05b4fdb 2665 {.id = ALC1220_FIXUP_GB_X570, .name = "gb-x570"},
772c2917 2666 {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
912093bc
TI
2667 {}
2668};
2669
119b75c1
HW
2670static const struct snd_hda_pin_quirk alc882_pin_fixup_tbl[] = {
2671 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1043, "ASUS", ALC1220_FIXUP_CLEVO_P950,
2672 {0x14, 0x01014010},
2673 {0x15, 0x01011012},
2674 {0x16, 0x01016011},
2675 {0x18, 0x01a19040},
2676 {0x19, 0x02a19050},
2677 {0x1a, 0x0181304f},
2678 {0x1b, 0x0221401f},
2679 {0x1e, 0x01456130}),
2680 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1462, "MS-7C35", ALC1220_FIXUP_CLEVO_P950,
2681 {0x14, 0x01015010},
2682 {0x15, 0x01011012},
2683 {0x16, 0x01011011},
2684 {0x18, 0x01a11040},
2685 {0x19, 0x02a19050},
2686 {0x1a, 0x0181104f},
2687 {0x1b, 0x0221401f},
2688 {0x1e, 0x01451130}),
2689 {}
2690};
2691
f6a92248 2692/*
1d045db9 2693 * BIOS auto configuration
f6a92248 2694 */
1d045db9
TI
2695/* almost identical with ALC880 parser... */
2696static int alc882_parse_auto_config(struct hda_codec *codec)
2697{
1d045db9 2698 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
3e6179b8
TI
2699 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2700 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
1d045db9 2701}
b896b4eb 2702
1d045db9
TI
2703/*
2704 */
1d045db9 2705static int patch_alc882(struct hda_codec *codec)
f6a92248
KY
2706{
2707 struct alc_spec *spec;
1a97b7f2 2708 int err;
f6a92248 2709
3de95173
TI
2710 err = alc_alloc_spec(codec, 0x0b);
2711 if (err < 0)
2712 return err;
f6a92248 2713
3de95173 2714 spec = codec->spec;
1f0f4b80 2715
7639a06c 2716 switch (codec->core.vendor_id) {
1d045db9
TI
2717 case 0x10ec0882:
2718 case 0x10ec0885:
acf08081 2719 case 0x10ec0900:
6d9ffcff 2720 case 0x10ec0b00:
a535ad57 2721 case 0x10ec1220:
1d045db9
TI
2722 break;
2723 default:
2724 /* ALC883 and variants */
2725 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2726 break;
c793bec5 2727 }
977ddd6b 2728
c9af753f
TI
2729 alc_pre_init(codec);
2730
1727a771 2731 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
912093bc 2732 alc882_fixups);
119b75c1 2733 snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true);
1727a771 2734 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
ff818c24 2735
1d045db9
TI
2736 alc_auto_parse_customize_define(codec);
2737
7504b6cd
TI
2738 if (has_cdefine_beep(codec))
2739 spec->gen.beep_nid = 0x01;
2740
1a97b7f2
TI
2741 /* automatic parse from the BIOS config */
2742 err = alc882_parse_auto_config(codec);
2743 if (err < 0)
2744 goto error;
f6a92248 2745
fea80fae
TI
2746 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2747 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2748 if (err < 0)
2749 goto error;
2750 }
f6a92248 2751
1727a771 2752 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 2753
f6a92248 2754 return 0;
e16fb6d1
TI
2755
2756 error:
2757 alc_free(codec);
2758 return err;
f6a92248
KY
2759}
2760
df694daa 2761
df694daa 2762/*
1d045db9 2763 * ALC262 support
df694daa 2764 */
1d045db9 2765static int alc262_parse_auto_config(struct hda_codec *codec)
df694daa 2766{
1d045db9 2767 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
3e6179b8
TI
2768 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2769 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
df694daa
KY
2770}
2771
df694daa 2772/*
1d045db9 2773 * Pin config fixes
df694daa 2774 */
cfc9b06f 2775enum {
ea4e7af1 2776 ALC262_FIXUP_FSC_H270,
7513e6da 2777 ALC262_FIXUP_FSC_S7110,
ea4e7af1
TI
2778 ALC262_FIXUP_HP_Z200,
2779 ALC262_FIXUP_TYAN,
c470150c 2780 ALC262_FIXUP_LENOVO_3000,
b42590b8
TI
2781 ALC262_FIXUP_BENQ,
2782 ALC262_FIXUP_BENQ_T31,
6e72aa5f 2783 ALC262_FIXUP_INV_DMIC,
b5c6611f 2784 ALC262_FIXUP_INTEL_BAYLEYBAY,
cfc9b06f
TI
2785};
2786
1727a771 2787static const struct hda_fixup alc262_fixups[] = {
ea4e7af1 2788 [ALC262_FIXUP_FSC_H270] = {
1727a771
TI
2789 .type = HDA_FIXUP_PINS,
2790 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
2791 { 0x14, 0x99130110 }, /* speaker */
2792 { 0x15, 0x0221142f }, /* front HP */
2793 { 0x1b, 0x0121141f }, /* rear HP */
2794 { }
2795 }
2796 },
7513e6da
TI
2797 [ALC262_FIXUP_FSC_S7110] = {
2798 .type = HDA_FIXUP_PINS,
2799 .v.pins = (const struct hda_pintbl[]) {
2800 { 0x15, 0x90170110 }, /* speaker */
2801 { }
2802 },
2803 .chained = true,
2804 .chain_id = ALC262_FIXUP_BENQ,
2805 },
ea4e7af1 2806 [ALC262_FIXUP_HP_Z200] = {
1727a771
TI
2807 .type = HDA_FIXUP_PINS,
2808 .v.pins = (const struct hda_pintbl[]) {
1d045db9 2809 { 0x16, 0x99130120 }, /* internal speaker */
73413b12
TI
2810 { }
2811 }
cfc9b06f 2812 },
ea4e7af1 2813 [ALC262_FIXUP_TYAN] = {
1727a771
TI
2814 .type = HDA_FIXUP_PINS,
2815 .v.pins = (const struct hda_pintbl[]) {
ea4e7af1
TI
2816 { 0x14, 0x1993e1f0 }, /* int AUX */
2817 { }
2818 }
2819 },
c470150c 2820 [ALC262_FIXUP_LENOVO_3000] = {
fd108215
TI
2821 .type = HDA_FIXUP_PINCTLS,
2822 .v.pins = (const struct hda_pintbl[]) {
2823 { 0x19, PIN_VREF50 },
b42590b8
TI
2824 {}
2825 },
2826 .chained = true,
2827 .chain_id = ALC262_FIXUP_BENQ,
2828 },
2829 [ALC262_FIXUP_BENQ] = {
1727a771 2830 .type = HDA_FIXUP_VERBS,
b42590b8 2831 .v.verbs = (const struct hda_verb[]) {
c470150c
TI
2832 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2833 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2834 {}
2835 }
2836 },
b42590b8 2837 [ALC262_FIXUP_BENQ_T31] = {
1727a771 2838 .type = HDA_FIXUP_VERBS,
b42590b8
TI
2839 .v.verbs = (const struct hda_verb[]) {
2840 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2841 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2842 {}
2843 }
2844 },
6e72aa5f 2845 [ALC262_FIXUP_INV_DMIC] = {
1727a771 2846 .type = HDA_FIXUP_FUNC,
9d36a7dc 2847 .v.func = alc_fixup_inv_dmic,
6e72aa5f 2848 },
b5c6611f
ML
2849 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2850 .type = HDA_FIXUP_FUNC,
2851 .v.func = alc_fixup_no_depop_delay,
2852 },
cfc9b06f
TI
2853};
2854
1d045db9 2855static const struct snd_pci_quirk alc262_fixup_tbl[] = {
ea4e7af1 2856 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
7513e6da 2857 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
3dcd3be3 2858 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
ea4e7af1 2859 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
275ec0cb 2860 SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
ea4e7af1 2861 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
c470150c 2862 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
b42590b8
TI
2863 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2864 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
b5c6611f 2865 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
cfc9b06f
TI
2866 {}
2867};
df694daa 2868
1727a771 2869static const struct hda_model_fixup alc262_fixup_models[] = {
6e72aa5f 2870 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
e43c44d6
TI
2871 {.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2872 {.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2873 {.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2874 {.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2875 {.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2876 {.id = ALC262_FIXUP_BENQ, .name = "benq"},
2877 {.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2878 {.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
6e72aa5f
TI
2879 {}
2880};
1d045db9 2881
1d045db9
TI
2882/*
2883 */
1d045db9 2884static int patch_alc262(struct hda_codec *codec)
df694daa
KY
2885{
2886 struct alc_spec *spec;
df694daa
KY
2887 int err;
2888
3de95173
TI
2889 err = alc_alloc_spec(codec, 0x0b);
2890 if (err < 0)
2891 return err;
df694daa 2892
3de95173 2893 spec = codec->spec;
08c189f2 2894 spec->gen.shared_mic_vref_pin = 0x18;
1d045db9 2895
225068ab
TI
2896 spec->shutup = alc_eapd_shutup;
2897
1d045db9
TI
2898#if 0
2899 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2900 * under-run
2901 */
98b24883 2902 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
1d045db9 2903#endif
1d045db9
TI
2904 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2905
c9af753f
TI
2906 alc_pre_init(codec);
2907
1727a771 2908 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
6e72aa5f 2909 alc262_fixups);
1727a771 2910 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
9c7f852e 2911
af741c15
TI
2912 alc_auto_parse_customize_define(codec);
2913
7504b6cd
TI
2914 if (has_cdefine_beep(codec))
2915 spec->gen.beep_nid = 0x01;
2916
42399f7a
TI
2917 /* automatic parse from the BIOS config */
2918 err = alc262_parse_auto_config(codec);
2919 if (err < 0)
2920 goto error;
df694daa 2921
fea80fae
TI
2922 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2923 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2924 if (err < 0)
2925 goto error;
2926 }
2134ea4f 2927
1727a771 2928 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 2929
1da177e4 2930 return 0;
e16fb6d1
TI
2931
2932 error:
2933 alc_free(codec);
2934 return err;
1da177e4
LT
2935}
2936
f32610ed 2937/*
1d045db9 2938 * ALC268
f32610ed 2939 */
1d045db9 2940/* bind Beep switches of both NID 0x0f and 0x10 */
a717777d
TI
2941static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2942 struct snd_ctl_elem_value *ucontrol)
2943{
2944 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2945 unsigned long pval;
2946 int err;
2947
2948 mutex_lock(&codec->control_mutex);
2949 pval = kcontrol->private_value;
2950 kcontrol->private_value = (pval & ~0xff) | 0x0f;
2951 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2952 if (err >= 0) {
2953 kcontrol->private_value = (pval & ~0xff) | 0x10;
2954 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2955 }
2956 kcontrol->private_value = pval;
2957 mutex_unlock(&codec->control_mutex);
2958 return err;
2959}
f32610ed 2960
1d045db9
TI
2961static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2962 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
a717777d
TI
2963 {
2964 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2965 .name = "Beep Playback Switch",
2966 .subdevice = HDA_SUBDEV_AMP_FLAG,
2967 .info = snd_hda_mixer_amp_switch_info,
2968 .get = snd_hda_mixer_amp_switch_get,
2969 .put = alc268_beep_switch_put,
2970 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
2971 },
f32610ed
JS
2972};
2973
1d045db9
TI
2974/* set PCBEEP vol = 0, mute connections */
2975static const struct hda_verb alc268_beep_init_verbs[] = {
2976 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2977 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2978 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2979 { }
f32610ed
JS
2980};
2981
6e72aa5f
TI
2982enum {
2983 ALC268_FIXUP_INV_DMIC,
cb766404 2984 ALC268_FIXUP_HP_EAPD,
24eff328 2985 ALC268_FIXUP_SPDIF,
6e72aa5f
TI
2986};
2987
1727a771 2988static const struct hda_fixup alc268_fixups[] = {
6e72aa5f 2989 [ALC268_FIXUP_INV_DMIC] = {
1727a771 2990 .type = HDA_FIXUP_FUNC,
9d36a7dc 2991 .v.func = alc_fixup_inv_dmic,
6e72aa5f 2992 },
cb766404 2993 [ALC268_FIXUP_HP_EAPD] = {
1727a771 2994 .type = HDA_FIXUP_VERBS,
cb766404
TI
2995 .v.verbs = (const struct hda_verb[]) {
2996 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
2997 {}
2998 }
2999 },
24eff328
TI
3000 [ALC268_FIXUP_SPDIF] = {
3001 .type = HDA_FIXUP_PINS,
3002 .v.pins = (const struct hda_pintbl[]) {
3003 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
3004 {}
3005 }
3006 },
6e72aa5f
TI
3007};
3008
1727a771 3009static const struct hda_model_fixup alc268_fixup_models[] = {
6e72aa5f 3010 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
cb766404 3011 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
03bf11c9 3012 {.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
cb766404
TI
3013 {}
3014};
3015
3016static const struct snd_pci_quirk alc268_fixup_tbl[] = {
24eff328 3017 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
fcd8f3b1 3018 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
cb766404
TI
3019 /* below is codec SSID since multiple Toshiba laptops have the
3020 * same PCI SSID 1179:ff00
3021 */
3022 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
6e72aa5f
TI
3023 {}
3024};
3025
f32610ed
JS
3026/*
3027 * BIOS auto configuration
3028 */
1d045db9 3029static int alc268_parse_auto_config(struct hda_codec *codec)
f32610ed 3030{
3e6179b8 3031 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
7504b6cd 3032 return alc_parse_auto_config(codec, NULL, alc268_ssids);
f32610ed
JS
3033}
3034
1d045db9
TI
3035/*
3036 */
1d045db9 3037static int patch_alc268(struct hda_codec *codec)
f32610ed
JS
3038{
3039 struct alc_spec *spec;
a5cb463a 3040 int i, err;
f32610ed 3041
1d045db9 3042 /* ALC268 has no aa-loopback mixer */
3de95173
TI
3043 err = alc_alloc_spec(codec, 0);
3044 if (err < 0)
3045 return err;
3046
3047 spec = codec->spec;
2722b535
TI
3048 if (has_cdefine_beep(codec))
3049 spec->gen.beep_nid = 0x01;
1f0f4b80 3050
225068ab
TI
3051 spec->shutup = alc_eapd_shutup;
3052
c9af753f
TI
3053 alc_pre_init(codec);
3054
1727a771
TI
3055 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
3056 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
6e72aa5f 3057
6ebb8053
TI
3058 /* automatic parse from the BIOS config */
3059 err = alc268_parse_auto_config(codec);
e16fb6d1
TI
3060 if (err < 0)
3061 goto error;
f32610ed 3062
7504b6cd
TI
3063 if (err > 0 && !spec->gen.no_analog &&
3064 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
a5cb463a
TI
3065 for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
3066 if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
3067 &alc268_beep_mixer[i])) {
3068 err = -ENOMEM;
3069 goto error;
3070 }
3071 }
7504b6cd 3072 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
1d045db9
TI
3073 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
3074 /* override the amp caps for beep generator */
3075 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
3076 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
3077 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
3078 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
3079 (0 << AC_AMPCAP_MUTE_SHIFT));
2f893286
KY
3080 }
3081
1727a771 3082 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
6e72aa5f 3083
f32610ed 3084 return 0;
e16fb6d1
TI
3085
3086 error:
3087 alc_free(codec);
3088 return err;
f32610ed
JS
3089}
3090
bc9f98a9 3091/*
1d045db9 3092 * ALC269
bc9f98a9 3093 */
08c189f2 3094
1d045db9 3095static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
1d045db9 3096 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
bc9f98a9
KY
3097};
3098
1d045db9 3099static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
1d045db9 3100 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
bc9f98a9 3101};
291702f0 3102
1d045db9
TI
3103/* different alc269-variants */
3104enum {
3105 ALC269_TYPE_ALC269VA,
3106 ALC269_TYPE_ALC269VB,
3107 ALC269_TYPE_ALC269VC,
adcc70b2 3108 ALC269_TYPE_ALC269VD,
065380f0
KY
3109 ALC269_TYPE_ALC280,
3110 ALC269_TYPE_ALC282,
2af02be7 3111 ALC269_TYPE_ALC283,
065380f0 3112 ALC269_TYPE_ALC284,
4731d5de 3113 ALC269_TYPE_ALC293,
7fc7d047 3114 ALC269_TYPE_ALC286,
506b62c3 3115 ALC269_TYPE_ALC298,
1d04c9de 3116 ALC269_TYPE_ALC255,
4344aec8 3117 ALC269_TYPE_ALC256,
f429e7e4 3118 ALC269_TYPE_ALC257,
0a6f0600 3119 ALC269_TYPE_ALC215,
4231430d 3120 ALC269_TYPE_ALC225,
99cee034 3121 ALC269_TYPE_ALC287,
dcd4f0db 3122 ALC269_TYPE_ALC294,
1078bef0 3123 ALC269_TYPE_ALC300,
f0778871 3124 ALC269_TYPE_ALC623,
6fbae35a 3125 ALC269_TYPE_ALC700,
bc9f98a9
KY
3126};
3127
3128/*
1d045db9 3129 * BIOS auto configuration
bc9f98a9 3130 */
1d045db9
TI
3131static int alc269_parse_auto_config(struct hda_codec *codec)
3132{
1d045db9 3133 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
3e6179b8
TI
3134 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
3135 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3136 struct alc_spec *spec = codec->spec;
adcc70b2
KY
3137 const hda_nid_t *ssids;
3138
3139 switch (spec->codec_variant) {
3140 case ALC269_TYPE_ALC269VA:
3141 case ALC269_TYPE_ALC269VC:
065380f0
KY
3142 case ALC269_TYPE_ALC280:
3143 case ALC269_TYPE_ALC284:
4731d5de 3144 case ALC269_TYPE_ALC293:
adcc70b2
KY
3145 ssids = alc269va_ssids;
3146 break;
3147 case ALC269_TYPE_ALC269VB:
3148 case ALC269_TYPE_ALC269VD:
065380f0 3149 case ALC269_TYPE_ALC282:
2af02be7 3150 case ALC269_TYPE_ALC283:
7fc7d047 3151 case ALC269_TYPE_ALC286:
506b62c3 3152 case ALC269_TYPE_ALC298:
1d04c9de 3153 case ALC269_TYPE_ALC255:
4344aec8 3154 case ALC269_TYPE_ALC256:
f429e7e4 3155 case ALC269_TYPE_ALC257:
0a6f0600 3156 case ALC269_TYPE_ALC215:
4231430d 3157 case ALC269_TYPE_ALC225:
99cee034 3158 case ALC269_TYPE_ALC287:
dcd4f0db 3159 case ALC269_TYPE_ALC294:
1078bef0 3160 case ALC269_TYPE_ALC300:
f0778871 3161 case ALC269_TYPE_ALC623:
6fbae35a 3162 case ALC269_TYPE_ALC700:
adcc70b2
KY
3163 ssids = alc269_ssids;
3164 break;
3165 default:
3166 ssids = alc269_ssids;
3167 break;
3168 }
bc9f98a9 3169
3e6179b8 3170 return alc_parse_auto_config(codec, alc269_ignore, ssids);
1d045db9 3171}
bc9f98a9 3172
476c02e0
HW
3173static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
3174 { SND_JACK_BTN_0, KEY_PLAYPAUSE },
3175 { SND_JACK_BTN_1, KEY_VOICECOMMAND },
3176 { SND_JACK_BTN_2, KEY_VOLUMEUP },
3177 { SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3178 {}
3179};
3180
3181static void alc_headset_btn_callback(struct hda_codec *codec,
3182 struct hda_jack_callback *jack)
3183{
3184 int report = 0;
3185
3186 if (jack->unsol_res & (7 << 13))
3187 report |= SND_JACK_BTN_0;
3188
3189 if (jack->unsol_res & (1 << 16 | 3 << 8))
3190 report |= SND_JACK_BTN_1;
3191
3192 /* Volume up key */
3193 if (jack->unsol_res & (7 << 23))
3194 report |= SND_JACK_BTN_2;
3195
3196 /* Volume down key */
3197 if (jack->unsol_res & (7 << 10))
3198 report |= SND_JACK_BTN_3;
3199
04f7791b 3200 snd_hda_jack_set_button_state(codec, jack->nid, report);
476c02e0
HW
3201}
3202
3203static void alc_disable_headset_jack_key(struct hda_codec *codec)
3204{
3205 struct alc_spec *spec = codec->spec;
3206
3207 if (!spec->has_hs_key)
3208 return;
3209
3210 switch (codec->core.vendor_id) {
3211 case 0x10ec0215:
3212 case 0x10ec0225:
3213 case 0x10ec0285:
c72b9bfe 3214 case 0x10ec0287:
476c02e0
HW
3215 case 0x10ec0295:
3216 case 0x10ec0289:
3217 case 0x10ec0299:
3218 alc_write_coef_idx(codec, 0x48, 0x0);
3219 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3220 alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3221 break;
1948fc06 3222 case 0x10ec0230:
476c02e0
HW
3223 case 0x10ec0236:
3224 case 0x10ec0256:
3225 alc_write_coef_idx(codec, 0x48, 0x0);
3226 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3227 break;
3228 }
3229}
3230
3231static void alc_enable_headset_jack_key(struct hda_codec *codec)
3232{
3233 struct alc_spec *spec = codec->spec;
3234
3235 if (!spec->has_hs_key)
3236 return;
3237
3238 switch (codec->core.vendor_id) {
3239 case 0x10ec0215:
3240 case 0x10ec0225:
3241 case 0x10ec0285:
c72b9bfe 3242 case 0x10ec0287:
476c02e0
HW
3243 case 0x10ec0295:
3244 case 0x10ec0289:
3245 case 0x10ec0299:
3246 alc_write_coef_idx(codec, 0x48, 0xd011);
3247 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3248 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3249 break;
1948fc06 3250 case 0x10ec0230:
476c02e0
HW
3251 case 0x10ec0236:
3252 case 0x10ec0256:
3253 alc_write_coef_idx(codec, 0x48, 0xd011);
3254 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3255 break;
3256 }
3257}
3258
3259static void alc_fixup_headset_jack(struct hda_codec *codec,
3260 const struct hda_fixup *fix, int action)
3261{
3262 struct alc_spec *spec = codec->spec;
04f7791b 3263 hda_nid_t hp_pin;
476c02e0
HW
3264
3265 switch (action) {
3266 case HDA_FIXUP_ACT_PRE_PROBE:
3267 spec->has_hs_key = 1;
3268 snd_hda_jack_detect_enable_callback(codec, 0x55,
3269 alc_headset_btn_callback);
476c02e0 3270 break;
04f7791b
HW
3271 case HDA_FIXUP_ACT_BUILD:
3272 hp_pin = alc_get_hp_pin(spec);
3273 if (!hp_pin || snd_hda_jack_bind_keymap(codec, 0x55,
3274 alc_headset_btn_keymap,
3275 hp_pin))
3276 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack",
3277 false, SND_JACK_HEADSET,
3278 alc_headset_btn_keymap);
3279
476c02e0
HW
3280 alc_enable_headset_jack_key(codec);
3281 break;
3282 }
3283}
3284
1387e2d1 3285static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
1d045db9 3286{
98b24883 3287 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
1d045db9 3288}
291702f0 3289
1d045db9
TI
3290static void alc269_shutup(struct hda_codec *codec)
3291{
adcc70b2
KY
3292 struct alc_spec *spec = codec->spec;
3293
1387e2d1
KY
3294 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3295 alc269vb_toggle_power_output(codec, 0);
3296 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3297 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
1d045db9
TI
3298 msleep(150);
3299 }
c0ca5ece 3300 alc_shutup_pins(codec);
1d045db9 3301}
291702f0 3302
6b0f95c4 3303static const struct coef_fw alc282_coefs[] = {
54db6c39 3304 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
32fa7e49 3305 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
54db6c39
TI
3306 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3307 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3308 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3309 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3310 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3311 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3312 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3313 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3314 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3315 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3316 WRITE_COEF(0x34, 0xa0c0), /* ANC */
3317 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3318 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3319 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3320 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3321 WRITE_COEF(0x63, 0x2902), /* PLL */
3322 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3323 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3324 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3325 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3326 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3327 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3328 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3329 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3330 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3331 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3332 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3333 {}
3334};
3335
cb149cb3
KY
3336static void alc282_restore_default_value(struct hda_codec *codec)
3337{
54db6c39 3338 alc_process_coef_fw(codec, alc282_coefs);
cb149cb3
KY
3339}
3340
7b5c7a02
KY
3341static void alc282_init(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
cb149cb3
KY
3348 alc282_restore_default_value(codec);
3349
7b5c7a02
KY
3350 if (!hp_pin)
3351 return;
3352 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3353 coef78 = alc_read_coef_idx(codec, 0x78);
3354
3355 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3356 /* Headphone capless set to high power mode */
3357 alc_write_coef_idx(codec, 0x78, 0x9004);
3358
3359 if (hp_pin_sense)
3360 msleep(2);
3361
3362 snd_hda_codec_write(codec, hp_pin, 0,
3363 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3364
3365 if (hp_pin_sense)
3366 msleep(85);
3367
3368 snd_hda_codec_write(codec, hp_pin, 0,
3369 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3370
3371 if (hp_pin_sense)
3372 msleep(100);
3373
3374 /* Headphone capless set to normal mode */
3375 alc_write_coef_idx(codec, 0x78, coef78);
3376}
3377
3378static void alc282_shutup(struct hda_codec *codec)
3379{
3380 struct alc_spec *spec = codec->spec;
35a39f98 3381 hda_nid_t hp_pin = alc_get_hp_pin(spec);
7b5c7a02
KY
3382 bool hp_pin_sense;
3383 int coef78;
3384
3385 if (!hp_pin) {
3386 alc269_shutup(codec);
3387 return;
3388 }
3389
3390 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3391 coef78 = alc_read_coef_idx(codec, 0x78);
3392 alc_write_coef_idx(codec, 0x78, 0x9004);
3393
3394 if (hp_pin_sense)
3395 msleep(2);
3396
3397 snd_hda_codec_write(codec, hp_pin, 0,
3398 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3399
3400 if (hp_pin_sense)
3401 msleep(85);
3402
c0ca5ece
TI
3403 if (!spec->no_shutup_pins)
3404 snd_hda_codec_write(codec, hp_pin, 0,
3405 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
7b5c7a02
KY
3406
3407 if (hp_pin_sense)
3408 msleep(100);
3409
3410 alc_auto_setup_eapd(codec, false);
c0ca5ece 3411 alc_shutup_pins(codec);
7b5c7a02
KY
3412 alc_write_coef_idx(codec, 0x78, coef78);
3413}
3414
6b0f95c4 3415static const struct coef_fw alc283_coefs[] = {
54db6c39 3416 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
56779864 3417 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
54db6c39
TI
3418 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3419 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3420 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3421 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3422 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3423 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3424 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3425 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3426 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3427 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3428 WRITE_COEF(0x22, 0xa0c0), /* ANC */
3429 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3430 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3431 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3432 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3433 WRITE_COEF(0x2e, 0x2902), /* PLL */
3434 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3435 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3436 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3437 WRITE_COEF(0x36, 0x0), /* capless control 5 */
3438 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3439 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3440 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3441 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3442 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3443 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3444 WRITE_COEF(0x49, 0x0), /* test mode */
3445 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3446 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3447 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
56779864 3448 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
54db6c39
TI
3449 {}
3450};
3451
6bd55b04
KY
3452static void alc283_restore_default_value(struct hda_codec *codec)
3453{
54db6c39 3454 alc_process_coef_fw(codec, alc283_coefs);
6bd55b04
KY
3455}
3456
2af02be7
KY
3457static void alc283_init(struct hda_codec *codec)
3458{
3459 struct alc_spec *spec = codec->spec;
35a39f98 3460 hda_nid_t hp_pin = alc_get_hp_pin(spec);
2af02be7 3461 bool hp_pin_sense;
2af02be7 3462
6bd55b04
KY
3463 alc283_restore_default_value(codec);
3464
2af02be7
KY
3465 if (!hp_pin)
3466 return;
a59d7199
KY
3467
3468 msleep(30);
2af02be7
KY
3469 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3470
3471 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3472 /* Headphone capless set to high power mode */
3473 alc_write_coef_idx(codec, 0x43, 0x9004);
3474
3475 snd_hda_codec_write(codec, hp_pin, 0,
3476 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3477
3478 if (hp_pin_sense)
3479 msleep(85);
3480
3481 snd_hda_codec_write(codec, hp_pin, 0,
3482 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3483
3484 if (hp_pin_sense)
3485 msleep(85);
3486 /* Index 0x46 Combo jack auto switch control 2 */
3487 /* 3k pull low control for Headset jack. */
98b24883 3488 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
2af02be7
KY
3489 /* Headphone capless set to normal mode */
3490 alc_write_coef_idx(codec, 0x43, 0x9614);
3491}
3492
3493static void alc283_shutup(struct hda_codec *codec)
3494{
3495 struct alc_spec *spec = codec->spec;
35a39f98 3496 hda_nid_t hp_pin = alc_get_hp_pin(spec);
2af02be7 3497 bool hp_pin_sense;
2af02be7
KY
3498
3499 if (!hp_pin) {
3500 alc269_shutup(codec);
3501 return;
3502 }
3503
3504 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3505
3506 alc_write_coef_idx(codec, 0x43, 0x9004);
3507
b450b17c
HP
3508 /*depop hp during suspend*/
3509 alc_write_coef_idx(codec, 0x06, 0x2100);
3510
2af02be7
KY
3511 snd_hda_codec_write(codec, hp_pin, 0,
3512 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3513
3514 if (hp_pin_sense)
88011c09 3515 msleep(100);
2af02be7 3516
c0ca5ece
TI
3517 if (!spec->no_shutup_pins)
3518 snd_hda_codec_write(codec, hp_pin, 0,
3519 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
2af02be7 3520
98b24883 3521 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
2af02be7
KY
3522
3523 if (hp_pin_sense)
88011c09 3524 msleep(100);
0435b3ff 3525 alc_auto_setup_eapd(codec, false);
c0ca5ece 3526 alc_shutup_pins(codec);
2af02be7
KY
3527 alc_write_coef_idx(codec, 0x43, 0x9614);
3528}
3529
4a219ef8
KY
3530static void alc256_init(struct hda_codec *codec)
3531{
3532 struct alc_spec *spec = codec->spec;
35a39f98 3533 hda_nid_t hp_pin = alc_get_hp_pin(spec);
4a219ef8
KY
3534 bool hp_pin_sense;
3535
3536 if (!hp_pin)
6447c962 3537 hp_pin = 0x21;
4a219ef8
KY
3538
3539 msleep(30);
3540
3541 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3542
3543 if (hp_pin_sense)
3544 msleep(2);
3545
3546 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
6447c962
KY
3547 if (spec->ultra_low_power) {
3548 alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3549 alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3550 alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3551 alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3552 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3553 msleep(30);
3554 }
4a219ef8
KY
3555
3556 snd_hda_codec_write(codec, hp_pin, 0,
3557 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3558
6447c962 3559 if (hp_pin_sense || spec->ultra_low_power)
4a219ef8
KY
3560 msleep(85);
3561
3562 snd_hda_codec_write(codec, hp_pin, 0,
3563 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3564
6447c962 3565 if (hp_pin_sense || spec->ultra_low_power)
4a219ef8
KY
3566 msleep(100);
3567
3568 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3569 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
88d42b2b
KY
3570 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3571 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
c4473744
TH
3572 /*
3573 * Expose headphone mic (or possibly Line In on some machines) instead
3574 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3575 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3576 * this register.
3577 */
3578 alc_write_coef_idx(codec, 0x36, 0x5757);
4a219ef8
KY
3579}
3580
3581static void alc256_shutup(struct hda_codec *codec)
3582{
3583 struct alc_spec *spec = codec->spec;
35a39f98 3584 hda_nid_t hp_pin = alc_get_hp_pin(spec);
4a219ef8
KY
3585 bool hp_pin_sense;
3586
6447c962
KY
3587 if (!hp_pin)
3588 hp_pin = 0x21;
4a219ef8
KY
3589
3590 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3591
3592 if (hp_pin_sense)
3593 msleep(2);
3594
3595 snd_hda_codec_write(codec, hp_pin, 0,
3596 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3597
6447c962 3598 if (hp_pin_sense || spec->ultra_low_power)
4a219ef8
KY
3599 msleep(85);
3600
1c9609e3
TI
3601 /* 3k pull low control for Headset jack. */
3602 /* NOTE: call this before clearing the pin, otherwise codec stalls */
3f742490
HW
3603 /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
3604 * when booting with headset plugged. So skip setting it for the codec alc257
3605 */
5aec9891
KY
3606 if (spec->codec_variant != ALC269_TYPE_ALC257 &&
3607 spec->codec_variant != ALC269_TYPE_ALC256)
3f742490 3608 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
1c9609e3 3609
c0ca5ece
TI
3610 if (!spec->no_shutup_pins)
3611 snd_hda_codec_write(codec, hp_pin, 0,
3612 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4a219ef8 3613
6447c962 3614 if (hp_pin_sense || spec->ultra_low_power)
4a219ef8
KY
3615 msleep(100);
3616
3617 alc_auto_setup_eapd(codec, false);
c0ca5ece 3618 alc_shutup_pins(codec);
6447c962
KY
3619 if (spec->ultra_low_power) {
3620 msleep(50);
3621 alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3622 alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3623 alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3624 alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3625 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3626 msleep(30);
3627 }
4a219ef8
KY
3628}
3629
3c24e483
KY
3630static void alc285_hp_init(struct hda_codec *codec)
3631{
3632 struct alc_spec *spec = codec->spec;
3633 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3634 int i, val;
3635 int coef38, coef0d, coef36;
3636
3637 alc_update_coef_idx(codec, 0x4a, 1<<15, 1<<15); /* Reset HP JD */
3638 coef38 = alc_read_coef_idx(codec, 0x38); /* Amp control */
3639 coef0d = alc_read_coef_idx(codec, 0x0d); /* Digital Misc control */
3640 coef36 = alc_read_coef_idx(codec, 0x36); /* Passthrough Control */
3641 alc_update_coef_idx(codec, 0x38, 1<<4, 0x0);
3642 alc_update_coef_idx(codec, 0x0d, 0x110, 0x0);
3643
3644 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
3645
3646 if (hp_pin)
3647 snd_hda_codec_write(codec, hp_pin, 0,
3648 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3649
3650 msleep(130);
3651 alc_update_coef_idx(codec, 0x36, 1<<14, 1<<14);
3652 alc_update_coef_idx(codec, 0x36, 1<<13, 0x0);
3653
3654 if (hp_pin)
3655 snd_hda_codec_write(codec, hp_pin, 0,
3656 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3657 msleep(10);
3658 alc_write_coef_idx(codec, 0x67, 0x0); /* Set HP depop to manual mode */
3659 alc_write_coefex_idx(codec, 0x58, 0x00, 0x7880);
3660 alc_write_coefex_idx(codec, 0x58, 0x0f, 0xf049);
3661 alc_update_coefex_idx(codec, 0x58, 0x03, 0x00f0, 0x00c0);
3662
3663 alc_write_coefex_idx(codec, 0x58, 0x00, 0xf888); /* HP depop procedure start */
3664 val = alc_read_coefex_idx(codec, 0x58, 0x00);
3665 for (i = 0; i < 20 && val & 0x8000; i++) {
3666 msleep(50);
3667 val = alc_read_coefex_idx(codec, 0x58, 0x00);
3668 } /* Wait for depop procedure finish */
3669
3670 alc_write_coefex_idx(codec, 0x58, 0x00, val); /* write back the result */
3671 alc_update_coef_idx(codec, 0x38, 1<<4, coef38);
3672 alc_update_coef_idx(codec, 0x0d, 0x110, coef0d);
3673 alc_update_coef_idx(codec, 0x36, 3<<13, coef36);
3674
3675 msleep(50);
3676 alc_update_coef_idx(codec, 0x4a, 1<<15, 0);
3677}
3678
da911b1f
KY
3679static void alc225_init(struct hda_codec *codec)
3680{
3681 struct alc_spec *spec = codec->spec;
35a39f98 3682 hda_nid_t hp_pin = alc_get_hp_pin(spec);
da911b1f
KY
3683 bool hp1_pin_sense, hp2_pin_sense;
3684
3c24e483
KY
3685 if (spec->codec_variant != ALC269_TYPE_ALC287)
3686 /* required only at boot or S3 and S4 resume time */
3687 if (!spec->done_hp_init ||
3688 is_s3_resume(codec) ||
3689 is_s4_resume(codec)) {
3690 alc285_hp_init(codec);
3691 spec->done_hp_init = true;
3692 }
3693
da911b1f 3694 if (!hp_pin)
d3ba58bb 3695 hp_pin = 0x21;
da911b1f
KY
3696 msleep(30);
3697
3698 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3699 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3700
3701 if (hp1_pin_sense || hp2_pin_sense)
3702 msleep(2);
3703
3704 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
d3ba58bb
KY
3705 if (spec->ultra_low_power) {
3706 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3707 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3708 alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3709 msleep(30);
3710 }
da911b1f 3711
d3ba58bb 3712 if (hp1_pin_sense || spec->ultra_low_power)
da911b1f
KY
3713 snd_hda_codec_write(codec, hp_pin, 0,
3714 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3715 if (hp2_pin_sense)
3716 snd_hda_codec_write(codec, 0x16, 0,
3717 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3718
d3ba58bb 3719 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
da911b1f
KY
3720 msleep(85);
3721
d3ba58bb 3722 if (hp1_pin_sense || spec->ultra_low_power)
da911b1f
KY
3723 snd_hda_codec_write(codec, hp_pin, 0,
3724 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3725 if (hp2_pin_sense)
3726 snd_hda_codec_write(codec, 0x16, 0,
3727 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3728
d3ba58bb 3729 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
da911b1f
KY
3730 msleep(100);
3731
3732 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3733 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3734}
3735
3736static void alc225_shutup(struct hda_codec *codec)
3737{
3738 struct alc_spec *spec = codec->spec;
35a39f98 3739 hda_nid_t hp_pin = alc_get_hp_pin(spec);
da911b1f
KY
3740 bool hp1_pin_sense, hp2_pin_sense;
3741
d3ba58bb
KY
3742 if (!hp_pin)
3743 hp_pin = 0x21;
476c02e0
HW
3744
3745 alc_disable_headset_jack_key(codec);
da911b1f
KY
3746 /* 3k pull low control for Headset jack. */
3747 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3748
3749 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3750 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3751
3752 if (hp1_pin_sense || hp2_pin_sense)
3753 msleep(2);
3754
d3ba58bb 3755 if (hp1_pin_sense || spec->ultra_low_power)
da911b1f
KY
3756 snd_hda_codec_write(codec, hp_pin, 0,
3757 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3758 if (hp2_pin_sense)
3759 snd_hda_codec_write(codec, 0x16, 0,
3760 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3761
d3ba58bb 3762 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
da911b1f
KY
3763 msleep(85);
3764
d3ba58bb 3765 if (hp1_pin_sense || spec->ultra_low_power)
da911b1f
KY
3766 snd_hda_codec_write(codec, hp_pin, 0,
3767 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3768 if (hp2_pin_sense)
3769 snd_hda_codec_write(codec, 0x16, 0,
3770 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3771
d3ba58bb 3772 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
da911b1f
KY
3773 msleep(100);
3774
3775 alc_auto_setup_eapd(codec, false);
c0ca5ece 3776 alc_shutup_pins(codec);
d3ba58bb
KY
3777 if (spec->ultra_low_power) {
3778 msleep(50);
3779 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3780 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3781 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3782 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3783 msleep(30);
3784 }
476c02e0
HW
3785
3786 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3787 alc_enable_headset_jack_key(codec);
da911b1f
KY
3788}
3789
c2d6af53
KY
3790static void alc_default_init(struct hda_codec *codec)
3791{
3792 struct alc_spec *spec = codec->spec;
35a39f98 3793 hda_nid_t hp_pin = alc_get_hp_pin(spec);
c2d6af53
KY
3794 bool hp_pin_sense;
3795
3796 if (!hp_pin)
3797 return;
3798
3799 msleep(30);
3800
3801 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3802
3803 if (hp_pin_sense)
3804 msleep(2);
3805
3806 snd_hda_codec_write(codec, hp_pin, 0,
3807 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3808
3809 if (hp_pin_sense)
3810 msleep(85);
3811
3812 snd_hda_codec_write(codec, hp_pin, 0,
3813 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3814
3815 if (hp_pin_sense)
3816 msleep(100);
3817}
3818
3819static void alc_default_shutup(struct hda_codec *codec)
3820{
3821 struct alc_spec *spec = codec->spec;
35a39f98 3822 hda_nid_t hp_pin = alc_get_hp_pin(spec);
c2d6af53
KY
3823 bool hp_pin_sense;
3824
3825 if (!hp_pin) {
3826 alc269_shutup(codec);
3827 return;
3828 }
3829
3830 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3831
3832 if (hp_pin_sense)
3833 msleep(2);
3834
3835 snd_hda_codec_write(codec, hp_pin, 0,
3836 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3837
3838 if (hp_pin_sense)
3839 msleep(85);
3840
c0ca5ece
TI
3841 if (!spec->no_shutup_pins)
3842 snd_hda_codec_write(codec, hp_pin, 0,
3843 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
c2d6af53
KY
3844
3845 if (hp_pin_sense)
3846 msleep(100);
3847
3848 alc_auto_setup_eapd(codec, false);
c0ca5ece 3849 alc_shutup_pins(codec);
c2d6af53
KY
3850}
3851
693abe11
KY
3852static void alc294_hp_init(struct hda_codec *codec)
3853{
3854 struct alc_spec *spec = codec->spec;
35a39f98 3855 hda_nid_t hp_pin = alc_get_hp_pin(spec);
693abe11
KY
3856 int i, val;
3857
3858 if (!hp_pin)
3859 return;
3860
3861 snd_hda_codec_write(codec, hp_pin, 0,
3862 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3863
3864 msleep(100);
3865
c0ca5ece
TI
3866 if (!spec->no_shutup_pins)
3867 snd_hda_codec_write(codec, hp_pin, 0,
3868 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
693abe11
KY
3869
3870 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3871 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3872
3873 /* Wait for depop procedure finish */
3874 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3875 for (i = 0; i < 20 && val & 0x0080; i++) {
3876 msleep(50);
3877 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3878 }
3879 /* Set HP depop to auto mode */
3880 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3881 msleep(50);
3882}
3883
3884static void alc294_init(struct hda_codec *codec)
3885{
3886 struct alc_spec *spec = codec->spec;
3887
f6ef4e0e
TI
3888 /* required only at boot or S4 resume time */
3889 if (!spec->done_hp_init ||
3890 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
693abe11
KY
3891 alc294_hp_init(codec);
3892 spec->done_hp_init = true;
3893 }
3894 alc_default_init(codec);
3895}
3896
ad60d502
KY
3897static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3898 unsigned int val)
3899{
3900 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3901 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3902 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3903}
3904
3905static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3906{
3907 unsigned int val;
3908
3909 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3910 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3911 & 0xffff;
3912 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3913 << 16;
3914 return val;
3915}
3916
3917static void alc5505_dsp_halt(struct hda_codec *codec)
3918{
3919 unsigned int val;
3920
3921 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3922 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3923 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3924 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3925 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3926 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3927 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3928 val = alc5505_coef_get(codec, 0x6220);
3929 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3930}
3931
3932static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3933{
3934 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3935 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3936 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3937 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3938 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3939 alc5505_coef_set(codec, 0x880c, 0x00000004);
3940}
3941
3942static void alc5505_dsp_init(struct hda_codec *codec)
3943{
3944 unsigned int val;
3945
3946 alc5505_dsp_halt(codec);
3947 alc5505_dsp_back_from_halt(codec);
3948 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3949 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3950 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3951 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3952 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3953 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3954 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3955 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3956 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3957 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3958 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3959 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3960 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3961
3962 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3963 if (val <= 3)
3964 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3965 else
3966 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3967
3968 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3969 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3970 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3971 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3972 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3973 alc5505_coef_set(codec, 0x880c, 0x00000003);
3974 alc5505_coef_set(codec, 0x880c, 0x00000010);
cd63a5ff
TI
3975
3976#ifdef HALT_REALTEK_ALC5505
3977 alc5505_dsp_halt(codec);
3978#endif
ad60d502
KY
3979}
3980
cd63a5ff 3981#ifdef HALT_REALTEK_ALC5505
8a71821f
PLB
3982#define alc5505_dsp_suspend(codec) do { } while (0) /* NOP */
3983#define alc5505_dsp_resume(codec) do { } while (0) /* NOP */
cd63a5ff
TI
3984#else
3985#define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
3986#define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
3987#endif
3988
2a43952a 3989#ifdef CONFIG_PM
ad60d502
KY
3990static int alc269_suspend(struct hda_codec *codec)
3991{
3992 struct alc_spec *spec = codec->spec;
3993
3994 if (spec->has_alc5505_dsp)
cd63a5ff 3995 alc5505_dsp_suspend(codec);
ad60d502
KY
3996 return alc_suspend(codec);
3997}
3998
1d045db9
TI
3999static int alc269_resume(struct hda_codec *codec)
4000{
adcc70b2
KY
4001 struct alc_spec *spec = codec->spec;
4002
1387e2d1
KY
4003 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4004 alc269vb_toggle_power_output(codec, 0);
4005 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
adcc70b2 4006 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
1d045db9
TI
4007 msleep(150);
4008 }
8c427226 4009
1d045db9 4010 codec->patch_ops.init(codec);
f1d4e28b 4011
1387e2d1
KY
4012 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4013 alc269vb_toggle_power_output(codec, 1);
4014 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
adcc70b2 4015 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
1d045db9
TI
4016 msleep(200);
4017 }
f1d4e28b 4018
1a462be5 4019 snd_hda_regmap_sync(codec);
1d045db9 4020 hda_call_check_power_status(codec, 0x01);
f475371a
HW
4021
4022 /* on some machine, the BIOS will clear the codec gpio data when enter
4023 * suspend, and won't restore the data after resume, so we restore it
4024 * in the driver.
4025 */
d261eec8
TI
4026 if (spec->gpio_data)
4027 alc_write_gpio_data(codec);
f475371a 4028
ad60d502 4029 if (spec->has_alc5505_dsp)
cd63a5ff 4030 alc5505_dsp_resume(codec);
c5177c86 4031
1d045db9
TI
4032 return 0;
4033}
2a43952a 4034#endif /* CONFIG_PM */
f1d4e28b 4035
108cc108 4036static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
1727a771 4037 const struct hda_fixup *fix, int action)
108cc108
DH
4038{
4039 struct alc_spec *spec = codec->spec;
4040
1727a771 4041 if (action == HDA_FIXUP_ACT_PRE_PROBE)
108cc108
DH
4042 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
4043}
4044
fdcc968a
JMG
4045static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
4046 const struct hda_fixup *fix,
4047 int action)
4048{
4049 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
4050 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
4051
4052 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
4053 snd_hda_codec_set_pincfg(codec, 0x19,
4054 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
4055 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
4056}
4057
1d045db9 4058static void alc269_fixup_hweq(struct hda_codec *codec,
1727a771 4059 const struct hda_fixup *fix, int action)
1d045db9 4060{
98b24883
TI
4061 if (action == HDA_FIXUP_ACT_INIT)
4062 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
1d045db9 4063}
f1d4e28b 4064
7c478f03
DH
4065static void alc269_fixup_headset_mic(struct hda_codec *codec,
4066 const struct hda_fixup *fix, int action)
4067{
4068 struct alc_spec *spec = codec->spec;
4069
4070 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4071 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4072}
4073
1d045db9 4074static void alc271_fixup_dmic(struct hda_codec *codec,
1727a771 4075 const struct hda_fixup *fix, int action)
1d045db9
TI
4076{
4077 static const struct hda_verb verbs[] = {
4078 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
4079 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
4080 {}
4081 };
4082 unsigned int cfg;
f1d4e28b 4083
7639a06c
TI
4084 if (strcmp(codec->core.chip_name, "ALC271X") &&
4085 strcmp(codec->core.chip_name, "ALC269VB"))
1d045db9
TI
4086 return;
4087 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
4088 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
4089 snd_hda_sequence_write(codec, verbs);
4090}
f1d4e28b 4091
c8426b27
TI
4092/* Fix the speaker amp after resume, etc */
4093static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec,
4094 const struct hda_fixup *fix,
4095 int action)
4096{
4097 if (action == HDA_FIXUP_ACT_INIT)
4098 alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000);
4099}
4100
017f2a10 4101static void alc269_fixup_pcm_44k(struct hda_codec *codec,
1727a771 4102 const struct hda_fixup *fix, int action)
017f2a10
TI
4103{
4104 struct alc_spec *spec = codec->spec;
4105
1727a771 4106 if (action != HDA_FIXUP_ACT_PROBE)
017f2a10
TI
4107 return;
4108
4109 /* Due to a hardware problem on Lenovo Ideadpad, we need to
4110 * fix the sample rate of analog I/O to 44.1kHz
4111 */
08c189f2
TI
4112 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
4113 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
017f2a10
TI
4114}
4115
adabb3ec 4116static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
1727a771 4117 const struct hda_fixup *fix, int action)
adabb3ec 4118{
adabb3ec
TI
4119 /* The digital-mic unit sends PDM (differential signal) instead of
4120 * the standard PCM, thus you can't record a valid mono stream as is.
4121 * Below is a workaround specific to ALC269 to control the dmic
4122 * signal source as mono.
4123 */
98b24883
TI
4124 if (action == HDA_FIXUP_ACT_INIT)
4125 alc_update_coef_idx(codec, 0x07, 0, 0x80);
adabb3ec
TI
4126}
4127
24519911
TI
4128static void alc269_quanta_automute(struct hda_codec *codec)
4129{
08c189f2 4130 snd_hda_gen_update_outputs(codec);
24519911 4131
1687ccc8
TI
4132 alc_write_coef_idx(codec, 0x0c, 0x680);
4133 alc_write_coef_idx(codec, 0x0c, 0x480);
24519911
TI
4134}
4135
4136static void alc269_fixup_quanta_mute(struct hda_codec *codec,
1727a771 4137 const struct hda_fixup *fix, int action)
24519911
TI
4138{
4139 struct alc_spec *spec = codec->spec;
1727a771 4140 if (action != HDA_FIXUP_ACT_PROBE)
24519911 4141 return;
08c189f2 4142 spec->gen.automute_hook = alc269_quanta_automute;
24519911
TI
4143}
4144
d240d1dc 4145static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
1a4f69d5 4146 struct hda_jack_callback *jack)
d240d1dc
DH
4147{
4148 struct alc_spec *spec = codec->spec;
4149 int vref;
4150 msleep(200);
4151 snd_hda_gen_hp_automute(codec, jack);
4152
4153 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4154 msleep(100);
4155 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4156 vref);
4157 msleep(500);
4158 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4159 vref);
4160}
4161
a2ef03fe
TE
4162/*
4163 * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
4164 */
4165struct hda_alc298_mbxinit {
4166 unsigned char value_0x23;
4167 unsigned char value_0x25;
4168};
4169
4170static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
4171 const struct hda_alc298_mbxinit *initval,
4172 bool first)
4173{
4174 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
4175 alc_write_coef_idx(codec, 0x26, 0xb000);
4176
4177 if (first)
4178 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
4179
4180 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4181 alc_write_coef_idx(codec, 0x26, 0xf000);
4182 alc_write_coef_idx(codec, 0x23, initval->value_0x23);
4183
4184 if (initval->value_0x23 != 0x1e)
4185 alc_write_coef_idx(codec, 0x25, initval->value_0x25);
4186
4187 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4188 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4189}
4190
4191static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
4192 const struct hda_fixup *fix,
4193 int action)
4194{
4195 /* Initialization magic */
4196 static const struct hda_alc298_mbxinit dac_init[] = {
4197 {0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
4198 {0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
4199 {0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
4200 {0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
4201 {0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
4202 {0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
4203 {0x2f, 0x00},
4204 {0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
4205 {0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
4206 {0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
4207 {}
4208 };
4209 const struct hda_alc298_mbxinit *seq;
4210
4211 if (action != HDA_FIXUP_ACT_INIT)
4212 return;
4213
4214 /* Start */
4215 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4216 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4217 alc_write_coef_idx(codec, 0x26, 0xf000);
4218 alc_write_coef_idx(codec, 0x22, 0x31);
4219 alc_write_coef_idx(codec, 0x23, 0x0b);
4220 alc_write_coef_idx(codec, 0x25, 0x00);
4221 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4222 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4223
4224 for (seq = dac_init; seq->value_0x23; seq++)
4225 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4226}
4227
d240d1dc
DH
4228static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4229 const struct hda_fixup *fix, int action)
4230{
4231 struct alc_spec *spec = codec->spec;
4232 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4233 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4234 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
4235 }
4236}
4237
766538ac
TI
4238static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4239 bool polarity, bool on)
4240{
4241 unsigned int pinval;
4242
4243 if (!pin)
4244 return;
4245 if (polarity)
4246 on = !on;
4247 pinval = snd_hda_codec_get_pin_target(codec, pin);
4248 pinval &= ~AC_PINCTL_VREFEN;
4249 pinval |= on ? AC_PINCTL_VREF_80 : AC_PINCTL_VREF_HIZ;
4250 /* temporarily power up/down for setting VREF */
4251 snd_hda_power_up_pm(codec);
4252 snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4253 snd_hda_power_down_pm(codec);
4254}
d240d1dc 4255
08fb0d0e 4256/* update mute-LED according to the speaker mute state via mic VREF pin */
8d3d1ece
TI
4257static int vref_mute_led_set(struct led_classdev *led_cdev,
4258 enum led_brightness brightness)
6d3cd5d4 4259{
8d3d1ece 4260 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
08fb0d0e 4261 struct alc_spec *spec = codec->spec;
08fb0d0e 4262
766538ac
TI
4263 alc_update_vref_led(codec, spec->mute_led_nid,
4264 spec->mute_led_polarity, brightness);
8d3d1ece 4265 return 0;
6d3cd5d4
DH
4266}
4267
d5b6b65e
DH
4268/* Make sure the led works even in runtime suspend */
4269static unsigned int led_power_filter(struct hda_codec *codec,
4270 hda_nid_t nid,
4271 unsigned int power_state)
4272{
4273 struct alc_spec *spec = codec->spec;
4274
50dd9050
HW
4275 if (power_state != AC_PWRST_D3 || nid == 0 ||
4276 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
d5b6b65e
DH
4277 return power_state;
4278
4279 /* Set pin ctl again, it might have just been set to 0 */
4280 snd_hda_set_pin_ctl(codec, nid,
4281 snd_hda_codec_get_pin_target(codec, nid));
4282
cffd3966 4283 return snd_hda_gen_path_power_filter(codec, nid, power_state);
d5b6b65e
DH
4284}
4285
08fb0d0e
TI
4286static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4287 const struct hda_fixup *fix, int action)
6d3cd5d4
DH
4288{
4289 struct alc_spec *spec = codec->spec;
08fb0d0e
TI
4290 const struct dmi_device *dev = NULL;
4291
4292 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4293 return;
4294
4295 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4296 int pol, pin;
4297 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4298 continue;
4299 if (pin < 0x0a || pin >= 0x10)
4300 break;
4301 spec->mute_led_polarity = pol;
4302 spec->mute_led_nid = pin - 0x0a + 0x18;
8d3d1ece 4303 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
d5b6b65e 4304 codec->power_filter = led_power_filter;
4e76a883
TI
4305 codec_dbg(codec,
4306 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
08fb0d0e 4307 spec->mute_led_polarity);
6d3cd5d4
DH
4308 break;
4309 }
4310}
4311
85c467dc
TI
4312static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4313 const struct hda_fixup *fix,
4314 int action, hda_nid_t pin)
d06ac143
DH
4315{
4316 struct alc_spec *spec = codec->spec;
85c467dc 4317
d06ac143
DH
4318 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4319 spec->mute_led_polarity = 0;
85c467dc 4320 spec->mute_led_nid = pin;
8d3d1ece 4321 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
d5b6b65e 4322 codec->power_filter = led_power_filter;
d06ac143
DH
4323 }
4324}
4325
85c467dc
TI
4326static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4327 const struct hda_fixup *fix, int action)
4328{
4329 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4330}
4331
08fb0d0e
TI
4332static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4333 const struct hda_fixup *fix, int action)
420b0feb 4334{
85c467dc 4335 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
420b0feb
TI
4336}
4337
7f783bd5
TB
4338static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4339 const struct hda_fixup *fix, int action)
4340{
85c467dc 4341 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
7f783bd5
TB
4342}
4343
0f32fd19
TI
4344/* update LED status via GPIO */
4345static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
dbd13179 4346 int polarity, bool enabled)
9f5c6faf 4347{
dbd13179 4348 if (polarity)
0f32fd19 4349 enabled = !enabled;
d261eec8 4350 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
9f5c6faf
TI
4351}
4352
0f32fd19 4353/* turn on/off mute LED via GPIO per vmaster hook */
8d3d1ece
TI
4354static int gpio_mute_led_set(struct led_classdev *led_cdev,
4355 enum led_brightness brightness)
9f5c6faf 4356{
8d3d1ece 4357 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
9f5c6faf 4358 struct alc_spec *spec = codec->spec;
9f5c6faf 4359
dbd13179 4360 alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
8d3d1ece
TI
4361 spec->mute_led_polarity, !brightness);
4362 return 0;
0f32fd19 4363}
9f5c6faf 4364
0f32fd19 4365/* turn on/off mic-mute LED via GPIO per capture hook */
87dc3648
KHF
4366static int micmute_led_set(struct led_classdev *led_cdev,
4367 enum led_brightness brightness)
4368{
4369 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4370 struct alc_spec *spec = codec->spec;
4371
4372 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
40469064 4373 spec->micmute_led_polarity, !brightness);
87dc3648
KHF
4374 return 0;
4375}
4376
01e4a275
TI
4377/* setup mute and mic-mute GPIO bits, add hooks appropriately */
4378static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4379 int action,
4380 unsigned int mute_mask,
4381 unsigned int micmute_mask)
9f5c6faf
TI
4382{
4383 struct alc_spec *spec = codec->spec;
9f5c6faf 4384
01e4a275
TI
4385 alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4386
4387 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4388 return;
4389 if (mute_mask) {
4390 spec->gpio_mute_led_mask = mute_mask;
8d3d1ece 4391 snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
01e4a275
TI
4392 }
4393 if (micmute_mask) {
4394 spec->gpio_mic_led_mask = micmute_mask;
7cdf8c49 4395 snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
9f5c6faf
TI
4396 }
4397}
4398
e7d66cf7
JS
4399static void alc236_fixup_hp_gpio_led(struct hda_codec *codec,
4400 const struct hda_fixup *fix, int action)
4401{
4402 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01);
4403}
4404
01e4a275 4405static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
eaa8e5ef
KY
4406 const struct hda_fixup *fix, int action)
4407{
01e4a275
TI
4408 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4409}
eaa8e5ef 4410
f5a88b0a
KHF
4411static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4412 const struct hda_fixup *fix, int action)
4413{
3e0650ab 4414 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
f5a88b0a
KHF
4415}
4416
01e4a275
TI
4417static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4418 const struct hda_fixup *fix, int action)
4419{
4420 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
9f5c6faf
TI
4421}
4422
a0ccbc53
KY
4423static void alc287_fixup_hp_gpio_led(struct hda_codec *codec,
4424 const struct hda_fixup *fix, int action)
4425{
4426 alc_fixup_hp_gpio_led(codec, action, 0x10, 0);
4427}
4428
c47b3112
JC
4429static void alc245_fixup_hp_gpio_led(struct hda_codec *codec,
4430 const struct hda_fixup *fix, int action)
4431{
4432 struct alc_spec *spec = codec->spec;
4433
4434 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4435 spec->micmute_led_polarity = 1;
4436 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4437}
4438
8a503555
TI
4439/* turn on/off mic-mute LED per capture hook via VREF change */
4440static int vref_micmute_led_set(struct led_classdev *led_cdev,
4441 enum led_brightness brightness)
9c5dc3bf 4442{
8a503555 4443 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
9c5dc3bf 4444 struct alc_spec *spec = codec->spec;
9c5dc3bf 4445
766538ac
TI
4446 alc_update_vref_led(codec, spec->cap_mute_led_nid,
4447 spec->micmute_led_polarity, brightness);
8a503555 4448 return 0;
9c5dc3bf
KY
4449}
4450
4451static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4452 const struct hda_fixup *fix, int action)
4453{
4454 struct alc_spec *spec = codec->spec;
9c5dc3bf 4455
01e4a275 4456 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
9c5dc3bf 4457 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
01e4a275
TI
4458 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4459 * enable headphone amp
4460 */
4461 spec->gpio_mask |= 0x10;
4462 spec->gpio_dir |= 0x10;
9c5dc3bf 4463 spec->cap_mute_led_nid = 0x18;
8a503555 4464 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
50dd9050 4465 codec->power_filter = led_power_filter;
9c5dc3bf
KY
4466 }
4467}
4468
7a5255f1
DH
4469static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4470 const struct hda_fixup *fix, int action)
4471{
7a5255f1 4472 struct alc_spec *spec = codec->spec;
7a5255f1 4473
01e4a275 4474 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
7a5255f1 4475 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
7a5255f1 4476 spec->cap_mute_led_nid = 0x18;
8a503555 4477 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
7a5255f1
DH
4478 codec->power_filter = led_power_filter;
4479 }
4480}
4481
c3bb2b52
TI
4482/* HP Spectre x360 14 model needs a unique workaround for enabling the amp;
4483 * it needs to toggle the GPIO0 once on and off at each time (bko#210633)
4484 */
4485static void alc245_fixup_hp_x360_amp(struct hda_codec *codec,
4486 const struct hda_fixup *fix, int action)
4487{
4488 struct alc_spec *spec = codec->spec;
4489
4490 switch (action) {
4491 case HDA_FIXUP_ACT_PRE_PROBE:
4492 spec->gpio_mask |= 0x01;
4493 spec->gpio_dir |= 0x01;
4494 break;
4495 case HDA_FIXUP_ACT_INIT:
4496 /* need to toggle GPIO to enable the amp */
4497 alc_update_gpio_data(codec, 0x01, true);
4498 msleep(100);
4499 alc_update_gpio_data(codec, 0x01, false);
4500 break;
4501 }
4502}
4503
622464c8
TI
4504/* toggle GPIO2 at each time stream is started; we use PREPARE state instead */
4505static void alc274_hp_envy_pcm_hook(struct hda_pcm_stream *hinfo,
4506 struct hda_codec *codec,
4507 struct snd_pcm_substream *substream,
4508 int action)
4509{
4510 switch (action) {
4511 case HDA_GEN_PCM_ACT_PREPARE:
4512 alc_update_gpio_data(codec, 0x04, true);
4513 break;
4514 case HDA_GEN_PCM_ACT_CLEANUP:
4515 alc_update_gpio_data(codec, 0x04, false);
4516 break;
4517 }
4518}
4519
4520static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
4521 const struct hda_fixup *fix,
4522 int action)
4523{
4524 struct alc_spec *spec = codec->spec;
4525
4526 if (action == HDA_FIXUP_ACT_PROBE) {
4527 spec->gpio_mask |= 0x04;
4528 spec->gpio_dir |= 0x04;
4529 spec->gen.pcm_playback_hook = alc274_hp_envy_pcm_hook;
4530 }
4531}
4532
766538ac
TI
4533static void alc_update_coef_led(struct hda_codec *codec,
4534 struct alc_coef_led *led,
4535 bool polarity, bool on)
4536{
4537 if (polarity)
4538 on = !on;
4539 /* temporarily power up/down for setting COEF bit */
4540 alc_update_coef_idx(codec, led->idx, led->mask,
4541 on ? led->on : led->off);
4542}
4543
431e76c3 4544/* update mute-LED according to the speaker mute state via COEF bit */
8d3d1ece
TI
4545static int coef_mute_led_set(struct led_classdev *led_cdev,
4546 enum led_brightness brightness)
431e76c3 4547{
8d3d1ece 4548 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
431e76c3
KY
4549 struct alc_spec *spec = codec->spec;
4550
766538ac
TI
4551 alc_update_coef_led(codec, &spec->mute_led_coef,
4552 spec->mute_led_polarity, brightness);
8d3d1ece 4553 return 0;
431e76c3
KY
4554}
4555
4556static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4557 const struct hda_fixup *fix,
4558 int action)
4559{
4560 struct alc_spec *spec = codec->spec;
4561
4562 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4563 spec->mute_led_polarity = 0;
766538ac
TI
4564 spec->mute_led_coef.idx = 0x0b;
4565 spec->mute_led_coef.mask = 1 << 3;
4566 spec->mute_led_coef.on = 1 << 3;
4567 spec->mute_led_coef.off = 0;
8d3d1ece 4568 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
431e76c3
KY
4569 }
4570}
4571
24164f43
KY
4572static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4573 const struct hda_fixup *fix,
4574 int action)
4575{
4576 struct alc_spec *spec = codec->spec;
4577
4578 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4579 spec->mute_led_polarity = 0;
766538ac
TI
4580 spec->mute_led_coef.idx = 0x34;
4581 spec->mute_led_coef.mask = 1 << 5;
4582 spec->mute_led_coef.on = 0;
4583 spec->mute_led_coef.off = 1 << 5;
8d3d1ece 4584 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
24164f43
KY
4585 }
4586}
4587
431e76c3 4588/* turn on/off mic-mute LED per capture hook by coef bit */
8a503555
TI
4589static int coef_micmute_led_set(struct led_classdev *led_cdev,
4590 enum led_brightness brightness)
431e76c3 4591{
8a503555 4592 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
431e76c3
KY
4593 struct alc_spec *spec = codec->spec;
4594
766538ac
TI
4595 alc_update_coef_led(codec, &spec->mic_led_coef,
4596 spec->micmute_led_polarity, brightness);
8a503555 4597 return 0;
431e76c3
KY
4598}
4599
4600static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4601 const struct hda_fixup *fix, int action)
4602{
4603 struct alc_spec *spec = codec->spec;
4604
4605 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
766538ac
TI
4606 spec->mic_led_coef.idx = 0x19;
4607 spec->mic_led_coef.mask = 1 << 13;
4608 spec->mic_led_coef.on = 1 << 13;
4609 spec->mic_led_coef.off = 0;
8a503555 4610 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
431e76c3
KY
4611 }
4612}
4613
24164f43
KY
4614static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4615 const struct hda_fixup *fix, int action)
4616{
4617 struct alc_spec *spec = codec->spec;
4618
4619 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
766538ac
TI
4620 spec->mic_led_coef.idx = 0x35;
4621 spec->mic_led_coef.mask = 3 << 2;
4622 spec->mic_led_coef.on = 2 << 2;
4623 spec->mic_led_coef.off = 1 << 2;
8a503555 4624 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
24164f43
KY
4625 }
4626}
4627
431e76c3
KY
4628static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4629 const struct hda_fixup *fix, int action)
4630{
4631 alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4632 alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4633}
4634
24164f43
KY
4635static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4636 const struct hda_fixup *fix, int action)
4637{
4638 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4639 alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4640}
4641
75b62ab6
JW
4642static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec,
4643 const struct hda_fixup *fix, int action)
4644{
4645 struct alc_spec *spec = codec->spec;
4646
4647 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4648 spec->cap_mute_led_nid = 0x1a;
4649 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4650 codec->power_filter = led_power_filter;
4651 }
4652}
4653
4654static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec,
4655 const struct hda_fixup *fix, int action)
4656{
4657 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4658 alc236_fixup_hp_micmute_led_vref(codec, fix, action);
4659}
4660
6a30abaa 4661#if IS_REACHABLE(CONFIG_INPUT)
33f4acd3
DH
4662static void gpio2_mic_hotkey_event(struct hda_codec *codec,
4663 struct hda_jack_callback *event)
4664{
4665 struct alc_spec *spec = codec->spec;
4666
4667 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
4668 send both key on and key off event for every interrupt. */
c7b60a89 4669 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
33f4acd3 4670 input_sync(spec->kb_dev);
c7b60a89 4671 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
33f4acd3
DH
4672 input_sync(spec->kb_dev);
4673}
33f4acd3 4674
3694cb29
K
4675static int alc_register_micmute_input_device(struct hda_codec *codec)
4676{
4677 struct alc_spec *spec = codec->spec;
c7b60a89 4678 int i;
3694cb29
K
4679
4680 spec->kb_dev = input_allocate_device();
4681 if (!spec->kb_dev) {
4682 codec_err(codec, "Out of memory (input_allocate_device)\n");
4683 return -ENOMEM;
4684 }
c7b60a89
HW
4685
4686 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
4687
3694cb29
K
4688 spec->kb_dev->name = "Microphone Mute Button";
4689 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
c7b60a89
HW
4690 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
4691 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
4692 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
4693 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
4694 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
3694cb29
K
4695
4696 if (input_register_device(spec->kb_dev)) {
4697 codec_err(codec, "input_register_device failed\n");
4698 input_free_device(spec->kb_dev);
4699 spec->kb_dev = NULL;
4700 return -ENOMEM;
4701 }
4702
4703 return 0;
4704}
4705
01e4a275
TI
4706/* GPIO1 = set according to SKU external amp
4707 * GPIO2 = mic mute hotkey
4708 * GPIO3 = mute LED
4709 * GPIO4 = mic mute LED
4710 */
33f4acd3
DH
4711static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4712 const struct hda_fixup *fix, int action)
4713{
33f4acd3
DH
4714 struct alc_spec *spec = codec->spec;
4715
01e4a275 4716 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
33f4acd3 4717 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1c76aa5f 4718 spec->init_amp = ALC_INIT_DEFAULT;
3694cb29 4719 if (alc_register_micmute_input_device(codec) != 0)
33f4acd3 4720 return;
33f4acd3 4721
01e4a275
TI
4722 spec->gpio_mask |= 0x06;
4723 spec->gpio_dir |= 0x02;
4724 spec->gpio_data |= 0x02;
7639a06c 4725 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
33f4acd3 4726 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
7639a06c 4727 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
33f4acd3 4728 gpio2_mic_hotkey_event);
33f4acd3
DH
4729 return;
4730 }
4731
4732 if (!spec->kb_dev)
4733 return;
4734
4735 switch (action) {
33f4acd3
DH
4736 case HDA_FIXUP_ACT_FREE:
4737 input_unregister_device(spec->kb_dev);
33f4acd3
DH
4738 spec->kb_dev = NULL;
4739 }
33f4acd3
DH
4740}
4741
01e4a275
TI
4742/* Line2 = mic mute hotkey
4743 * GPIO2 = mic mute LED
4744 */
3694cb29
K
4745static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4746 const struct hda_fixup *fix, int action)
4747{
3694cb29
K
4748 struct alc_spec *spec = codec->spec;
4749
01e4a275 4750 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
3694cb29 4751 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1c76aa5f 4752 spec->init_amp = ALC_INIT_DEFAULT;
3694cb29
K
4753 if (alc_register_micmute_input_device(codec) != 0)
4754 return;
4755
3694cb29
K
4756 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4757 gpio2_mic_hotkey_event);
3694cb29
K
4758 return;
4759 }
4760
4761 if (!spec->kb_dev)
4762 return;
4763
4764 switch (action) {
3694cb29
K
4765 case HDA_FIXUP_ACT_FREE:
4766 input_unregister_device(spec->kb_dev);
4767 spec->kb_dev = NULL;
4768 }
4769}
c469652b
TI
4770#else /* INPUT */
4771#define alc280_fixup_hp_gpio2_mic_hotkey NULL
4772#define alc233_fixup_lenovo_line2_mic_hotkey NULL
4773#endif /* INPUT */
3694cb29 4774
9c5dc3bf
KY
4775static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4776 const struct hda_fixup *fix, int action)
4777{
4778 struct alc_spec *spec = codec->spec;
4779
1bce62a6 4780 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
9c5dc3bf 4781 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
9c5dc3bf 4782 spec->cap_mute_led_nid = 0x18;
8a503555 4783 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
9c5dc3bf
KY
4784 }
4785}
4786
6b0f95c4 4787static const struct coef_fw alc225_pre_hsmode[] = {
5a36767a
KY
4788 UPDATE_COEF(0x4a, 1<<8, 0),
4789 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4790 UPDATE_COEF(0x63, 3<<14, 3<<14),
4791 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4792 UPDATE_COEF(0x4a, 3<<10, 3<<10),
4793 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4794 UPDATE_COEF(0x4a, 3<<10, 0),
4795 {}
4796};
4797
73bdd597
DH
4798static void alc_headset_mode_unplugged(struct hda_codec *codec)
4799{
92666d45 4800 struct alc_spec *spec = codec->spec;
6b0f95c4 4801 static const struct coef_fw coef0255[] = {
717f43d8 4802 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
54db6c39
TI
4803 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4804 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4805 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4806 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4807 {}
4808 };
6b0f95c4 4809 static const struct coef_fw coef0256[] = {
e69e7e03 4810 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
717f43d8
KY
4811 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4812 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4813 WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
4814 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
e69e7e03
KY
4815 {}
4816 };
6b0f95c4 4817 static const struct coef_fw coef0233[] = {
54db6c39
TI
4818 WRITE_COEF(0x1b, 0x0c0b),
4819 WRITE_COEF(0x45, 0xc429),
4820 UPDATE_COEF(0x35, 0x4000, 0),
4821 WRITE_COEF(0x06, 0x2104),
4822 WRITE_COEF(0x1a, 0x0001),
4823 WRITE_COEF(0x26, 0x0004),
4824 WRITE_COEF(0x32, 0x42a3),
4825 {}
4826 };
6b0f95c4 4827 static const struct coef_fw coef0288[] = {
f3b70332
KY
4828 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4829 UPDATE_COEF(0x50, 0x2000, 0x2000),
4830 UPDATE_COEF(0x56, 0x0006, 0x0006),
4831 UPDATE_COEF(0x66, 0x0008, 0),
4832 UPDATE_COEF(0x67, 0x2000, 0),
4833 {}
4834 };
6b0f95c4 4835 static const struct coef_fw coef0298[] = {
89542936
KY
4836 UPDATE_COEF(0x19, 0x1300, 0x0300),
4837 {}
4838 };
6b0f95c4 4839 static const struct coef_fw coef0292[] = {
54db6c39
TI
4840 WRITE_COEF(0x76, 0x000e),
4841 WRITE_COEF(0x6c, 0x2400),
4842 WRITE_COEF(0x18, 0x7308),
4843 WRITE_COEF(0x6b, 0xc429),
4844 {}
4845 };
6b0f95c4 4846 static const struct coef_fw coef0293[] = {
54db6c39
TI
4847 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
4848 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
4849 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
4850 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
4851 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
4852 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4853 {}
4854 };
6b0f95c4 4855 static const struct coef_fw coef0668[] = {
54db6c39
TI
4856 WRITE_COEF(0x15, 0x0d40),
4857 WRITE_COEF(0xb7, 0x802b),
4858 {}
4859 };
6b0f95c4 4860 static const struct coef_fw coef0225[] = {
5a36767a 4861 UPDATE_COEF(0x63, 3<<14, 0),
4cc9b9d6
KY
4862 {}
4863 };
6b0f95c4 4864 static const struct coef_fw coef0274[] = {
71683c32
KY
4865 UPDATE_COEF(0x4a, 0x0100, 0),
4866 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
4867 UPDATE_COEF(0x6b, 0xf000, 0x5000),
4868 UPDATE_COEF(0x4a, 0x0010, 0),
4869 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
4870 WRITE_COEF(0x45, 0x5289),
4871 UPDATE_COEF(0x4a, 0x0c00, 0),
4872 {}
4873 };
54db6c39 4874
92666d45
KY
4875 if (spec->no_internal_mic_pin) {
4876 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
4877 return;
4878 }
4879
7639a06c 4880 switch (codec->core.vendor_id) {
9a22a8f5 4881 case 0x10ec0255:
e69e7e03
KY
4882 alc_process_coef_fw(codec, coef0255);
4883 break;
1948fc06 4884 case 0x10ec0230:
736f20a7 4885 case 0x10ec0236:
7081adf3 4886 case 0x10ec0256:
e69e7e03 4887 alc_process_coef_fw(codec, coef0256);
9a22a8f5 4888 break;
71683c32
KY
4889 case 0x10ec0234:
4890 case 0x10ec0274:
4891 case 0x10ec0294:
4892 alc_process_coef_fw(codec, coef0274);
4893 break;
13fd08a3 4894 case 0x10ec0233:
73bdd597 4895 case 0x10ec0283:
54db6c39 4896 alc_process_coef_fw(codec, coef0233);
73bdd597 4897 break;
f3b70332
KY
4898 case 0x10ec0286:
4899 case 0x10ec0288:
89542936
KY
4900 alc_process_coef_fw(codec, coef0288);
4901 break;
1a5bc8d9 4902 case 0x10ec0298:
89542936 4903 alc_process_coef_fw(codec, coef0298);
f3b70332
KY
4904 alc_process_coef_fw(codec, coef0288);
4905 break;
73bdd597 4906 case 0x10ec0292:
54db6c39 4907 alc_process_coef_fw(codec, coef0292);
73bdd597 4908 break;
a22aa26f 4909 case 0x10ec0293:
54db6c39 4910 alc_process_coef_fw(codec, coef0293);
a22aa26f 4911 break;
73bdd597 4912 case 0x10ec0668:
54db6c39 4913 alc_process_coef_fw(codec, coef0668);
73bdd597 4914 break;
c2b691ee 4915 case 0x10ec0215:
4cc9b9d6 4916 case 0x10ec0225:
c2b691ee 4917 case 0x10ec0285:
7d727869 4918 case 0x10ec0295:
c2b691ee 4919 case 0x10ec0289:
28f1f9b2 4920 case 0x10ec0299:
4d4b0c52 4921 alc_process_coef_fw(codec, alc225_pre_hsmode);
4cc9b9d6
KY
4922 alc_process_coef_fw(codec, coef0225);
4923 break;
78f4f7c2
KY
4924 case 0x10ec0867:
4925 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4926 break;
73bdd597 4927 }
4e76a883 4928 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
73bdd597
DH
4929}
4930
4931
4932static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
4933 hda_nid_t mic_pin)
4934{
6b0f95c4 4935 static const struct coef_fw coef0255[] = {
54db6c39
TI
4936 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
4937 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4938 {}
4939 };
6b0f95c4 4940 static const struct coef_fw coef0256[] = {
717f43d8
KY
4941 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
4942 WRITE_COEFEX(0x57, 0x03, 0x09a3),
4943 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4944 {}
4945 };
6b0f95c4 4946 static const struct coef_fw coef0233[] = {
54db6c39
TI
4947 UPDATE_COEF(0x35, 0, 1<<14),
4948 WRITE_COEF(0x06, 0x2100),
4949 WRITE_COEF(0x1a, 0x0021),
4950 WRITE_COEF(0x26, 0x008c),
4951 {}
4952 };
6b0f95c4 4953 static const struct coef_fw coef0288[] = {
89542936 4954 UPDATE_COEF(0x4f, 0x00c0, 0),
f3b70332
KY
4955 UPDATE_COEF(0x50, 0x2000, 0),
4956 UPDATE_COEF(0x56, 0x0006, 0),
4957 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4958 UPDATE_COEF(0x66, 0x0008, 0x0008),
4959 UPDATE_COEF(0x67, 0x2000, 0x2000),
4960 {}
4961 };
6b0f95c4 4962 static const struct coef_fw coef0292[] = {
54db6c39
TI
4963 WRITE_COEF(0x19, 0xa208),
4964 WRITE_COEF(0x2e, 0xacf0),
4965 {}
4966 };
6b0f95c4 4967 static const struct coef_fw coef0293[] = {
54db6c39
TI
4968 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
4969 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
4970 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4971 {}
4972 };
6b0f95c4 4973 static const struct coef_fw coef0688[] = {
54db6c39
TI
4974 WRITE_COEF(0xb7, 0x802b),
4975 WRITE_COEF(0xb5, 0x1040),
4976 UPDATE_COEF(0xc3, 0, 1<<12),
4977 {}
4978 };
6b0f95c4 4979 static const struct coef_fw coef0225[] = {
4cc9b9d6
KY
4980 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
4981 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4982 UPDATE_COEF(0x63, 3<<14, 0),
4983 {}
4984 };
6b0f95c4 4985 static const struct coef_fw coef0274[] = {
71683c32
KY
4986 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
4987 UPDATE_COEF(0x4a, 0x0010, 0),
4988 UPDATE_COEF(0x6b, 0xf000, 0),
4989 {}
4990 };
54db6c39 4991
7639a06c 4992 switch (codec->core.vendor_id) {
9a22a8f5
KY
4993 case 0x10ec0255:
4994 alc_write_coef_idx(codec, 0x45, 0xc489);
4995 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 4996 alc_process_coef_fw(codec, coef0255);
9a22a8f5
KY
4997 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4998 break;
1948fc06 4999 case 0x10ec0230:
717f43d8
KY
5000 case 0x10ec0236:
5001 case 0x10ec0256:
5002 alc_write_coef_idx(codec, 0x45, 0xc489);
5003 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5004 alc_process_coef_fw(codec, coef0256);
5005 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5006 break;
71683c32
KY
5007 case 0x10ec0234:
5008 case 0x10ec0274:
5009 case 0x10ec0294:
5010 alc_write_coef_idx(codec, 0x45, 0x4689);
5011 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5012 alc_process_coef_fw(codec, coef0274);
5013 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5014 break;
13fd08a3 5015 case 0x10ec0233:
73bdd597
DH
5016 case 0x10ec0283:
5017 alc_write_coef_idx(codec, 0x45, 0xc429);
5018 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 5019 alc_process_coef_fw(codec, coef0233);
73bdd597
DH
5020 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5021 break;
f3b70332
KY
5022 case 0x10ec0286:
5023 case 0x10ec0288:
1a5bc8d9 5024 case 0x10ec0298:
f3b70332
KY
5025 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5026 alc_process_coef_fw(codec, coef0288);
5027 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5028 break;
73bdd597
DH
5029 case 0x10ec0292:
5030 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 5031 alc_process_coef_fw(codec, coef0292);
73bdd597 5032 break;
a22aa26f
KY
5033 case 0x10ec0293:
5034 /* Set to TRS mode */
5035 alc_write_coef_idx(codec, 0x45, 0xc429);
5036 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 5037 alc_process_coef_fw(codec, coef0293);
a22aa26f
KY
5038 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5039 break;
78f4f7c2
KY
5040 case 0x10ec0867:
5041 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
c0dbbdad 5042 fallthrough;
9eb5d0e6 5043 case 0x10ec0221:
1f8b46cd
DH
5044 case 0x10ec0662:
5045 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5046 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5047 break;
73bdd597
DH
5048 case 0x10ec0668:
5049 alc_write_coef_idx(codec, 0x11, 0x0001);
5050 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 5051 alc_process_coef_fw(codec, coef0688);
73bdd597
DH
5052 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5053 break;
c2b691ee 5054 case 0x10ec0215:
4cc9b9d6 5055 case 0x10ec0225:
c2b691ee 5056 case 0x10ec0285:
7d727869 5057 case 0x10ec0295:
c2b691ee 5058 case 0x10ec0289:
28f1f9b2 5059 case 0x10ec0299:
5a36767a 5060 alc_process_coef_fw(codec, alc225_pre_hsmode);
4cc9b9d6
KY
5061 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
5062 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5063 alc_process_coef_fw(codec, coef0225);
5064 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5065 break;
73bdd597 5066 }
4e76a883 5067 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
73bdd597
DH
5068}
5069
5070static void alc_headset_mode_default(struct hda_codec *codec)
5071{
6b0f95c4 5072 static const struct coef_fw coef0225[] = {
5a36767a
KY
5073 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
5074 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
5075 UPDATE_COEF(0x49, 3<<8, 0<<8),
5076 UPDATE_COEF(0x4a, 3<<4, 3<<4),
5077 UPDATE_COEF(0x63, 3<<14, 0),
5078 UPDATE_COEF(0x67, 0xf000, 0x3000),
2ae95577
DH
5079 {}
5080 };
6b0f95c4 5081 static const struct coef_fw coef0255[] = {
54db6c39
TI
5082 WRITE_COEF(0x45, 0xc089),
5083 WRITE_COEF(0x45, 0xc489),
5084 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5085 WRITE_COEF(0x49, 0x0049),
5086 {}
5087 };
6b0f95c4 5088 static const struct coef_fw coef0256[] = {
717f43d8
KY
5089 WRITE_COEF(0x45, 0xc489),
5090 WRITE_COEFEX(0x57, 0x03, 0x0da3),
5091 WRITE_COEF(0x49, 0x0049),
5092 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5093 WRITE_COEF(0x06, 0x6100),
5094 {}
5095 };
6b0f95c4 5096 static const struct coef_fw coef0233[] = {
54db6c39
TI
5097 WRITE_COEF(0x06, 0x2100),
5098 WRITE_COEF(0x32, 0x4ea3),
5099 {}
5100 };
6b0f95c4 5101 static const struct coef_fw coef0288[] = {
f3b70332
KY
5102 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
5103 UPDATE_COEF(0x50, 0x2000, 0x2000),
5104 UPDATE_COEF(0x56, 0x0006, 0x0006),
5105 UPDATE_COEF(0x66, 0x0008, 0),
5106 UPDATE_COEF(0x67, 0x2000, 0),
5107 {}
5108 };
6b0f95c4 5109 static const struct coef_fw coef0292[] = {
54db6c39
TI
5110 WRITE_COEF(0x76, 0x000e),
5111 WRITE_COEF(0x6c, 0x2400),
5112 WRITE_COEF(0x6b, 0xc429),
5113 WRITE_COEF(0x18, 0x7308),
5114 {}
5115 };
6b0f95c4 5116 static const struct coef_fw coef0293[] = {
54db6c39
TI
5117 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5118 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
5119 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5120 {}
5121 };
6b0f95c4 5122 static const struct coef_fw coef0688[] = {
54db6c39
TI
5123 WRITE_COEF(0x11, 0x0041),
5124 WRITE_COEF(0x15, 0x0d40),
5125 WRITE_COEF(0xb7, 0x802b),
5126 {}
5127 };
6b0f95c4 5128 static const struct coef_fw coef0274[] = {
71683c32
KY
5129 WRITE_COEF(0x45, 0x4289),
5130 UPDATE_COEF(0x4a, 0x0010, 0x0010),
5131 UPDATE_COEF(0x6b, 0x0f00, 0),
5132 UPDATE_COEF(0x49, 0x0300, 0x0300),
5133 {}
5134 };
54db6c39 5135
7639a06c 5136 switch (codec->core.vendor_id) {
c2b691ee 5137 case 0x10ec0215:
2ae95577 5138 case 0x10ec0225:
c2b691ee 5139 case 0x10ec0285:
7d727869 5140 case 0x10ec0295:
c2b691ee 5141 case 0x10ec0289:
28f1f9b2 5142 case 0x10ec0299:
5a36767a 5143 alc_process_coef_fw(codec, alc225_pre_hsmode);
2ae95577
DH
5144 alc_process_coef_fw(codec, coef0225);
5145 break;
9a22a8f5 5146 case 0x10ec0255:
54db6c39 5147 alc_process_coef_fw(codec, coef0255);
9a22a8f5 5148 break;
1948fc06 5149 case 0x10ec0230:
717f43d8
KY
5150 case 0x10ec0236:
5151 case 0x10ec0256:
5152 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5153 alc_write_coef_idx(codec, 0x45, 0xc089);
5154 msleep(50);
5155 alc_process_coef_fw(codec, coef0256);
5156 break;
71683c32
KY
5157 case 0x10ec0234:
5158 case 0x10ec0274:
5159 case 0x10ec0294:
5160 alc_process_coef_fw(codec, coef0274);
5161 break;
13fd08a3 5162 case 0x10ec0233:
73bdd597 5163 case 0x10ec0283:
54db6c39 5164 alc_process_coef_fw(codec, coef0233);
73bdd597 5165 break;
f3b70332
KY
5166 case 0x10ec0286:
5167 case 0x10ec0288:
1a5bc8d9 5168 case 0x10ec0298:
f3b70332
KY
5169 alc_process_coef_fw(codec, coef0288);
5170 break;
73bdd597 5171 case 0x10ec0292:
54db6c39 5172 alc_process_coef_fw(codec, coef0292);
73bdd597 5173 break;
a22aa26f 5174 case 0x10ec0293:
54db6c39 5175 alc_process_coef_fw(codec, coef0293);
a22aa26f 5176 break;
73bdd597 5177 case 0x10ec0668:
54db6c39 5178 alc_process_coef_fw(codec, coef0688);
73bdd597 5179 break;
78f4f7c2
KY
5180 case 0x10ec0867:
5181 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5182 break;
73bdd597 5183 }
4e76a883 5184 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
73bdd597
DH
5185}
5186
5187/* Iphone type */
5188static void alc_headset_mode_ctia(struct hda_codec *codec)
5189{
89542936
KY
5190 int val;
5191
6b0f95c4 5192 static const struct coef_fw coef0255[] = {
54db6c39
TI
5193 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5194 WRITE_COEF(0x1b, 0x0c2b),
5195 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5196 {}
5197 };
6b0f95c4 5198 static const struct coef_fw coef0256[] = {
e69e7e03 5199 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
717f43d8 5200 WRITE_COEF(0x1b, 0x0e6b),
e69e7e03
KY
5201 {}
5202 };
6b0f95c4 5203 static const struct coef_fw coef0233[] = {
54db6c39
TI
5204 WRITE_COEF(0x45, 0xd429),
5205 WRITE_COEF(0x1b, 0x0c2b),
5206 WRITE_COEF(0x32, 0x4ea3),
5207 {}
5208 };
6b0f95c4 5209 static const struct coef_fw coef0288[] = {
f3b70332
KY
5210 UPDATE_COEF(0x50, 0x2000, 0x2000),
5211 UPDATE_COEF(0x56, 0x0006, 0x0006),
5212 UPDATE_COEF(0x66, 0x0008, 0),
5213 UPDATE_COEF(0x67, 0x2000, 0),
5214 {}
5215 };
6b0f95c4 5216 static const struct coef_fw coef0292[] = {
54db6c39
TI
5217 WRITE_COEF(0x6b, 0xd429),
5218 WRITE_COEF(0x76, 0x0008),
5219 WRITE_COEF(0x18, 0x7388),
5220 {}
5221 };
6b0f95c4 5222 static const struct coef_fw coef0293[] = {
54db6c39
TI
5223 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
5224 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5225 {}
5226 };
6b0f95c4 5227 static const struct coef_fw coef0688[] = {
54db6c39
TI
5228 WRITE_COEF(0x11, 0x0001),
5229 WRITE_COEF(0x15, 0x0d60),
5230 WRITE_COEF(0xc3, 0x0000),
5231 {}
5232 };
6b0f95c4 5233 static const struct coef_fw coef0225_1[] = {
4cc9b9d6 5234 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5a36767a
KY
5235 UPDATE_COEF(0x63, 3<<14, 2<<14),
5236 {}
5237 };
6b0f95c4 5238 static const struct coef_fw coef0225_2[] = {
5a36767a
KY
5239 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5240 UPDATE_COEF(0x63, 3<<14, 1<<14),
4cc9b9d6
KY
5241 {}
5242 };
54db6c39 5243
7639a06c 5244 switch (codec->core.vendor_id) {
9a22a8f5 5245 case 0x10ec0255:
54db6c39 5246 alc_process_coef_fw(codec, coef0255);
9a22a8f5 5247 break;
1948fc06 5248 case 0x10ec0230:
736f20a7 5249 case 0x10ec0236:
e69e7e03
KY
5250 case 0x10ec0256:
5251 alc_process_coef_fw(codec, coef0256);
5252 break;
71683c32
KY
5253 case 0x10ec0234:
5254 case 0x10ec0274:
5255 case 0x10ec0294:
5256 alc_write_coef_idx(codec, 0x45, 0xd689);
5257 break;
13fd08a3 5258 case 0x10ec0233:
73bdd597 5259 case 0x10ec0283:
54db6c39 5260 alc_process_coef_fw(codec, coef0233);
73bdd597 5261 break;
1a5bc8d9 5262 case 0x10ec0298:
89542936
KY
5263 val = alc_read_coef_idx(codec, 0x50);
5264 if (val & (1 << 12)) {
5265 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5266 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5267 msleep(300);
5268 } else {
5269 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5270 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5271 msleep(300);
5272 }
5273 break;
f3b70332
KY
5274 case 0x10ec0286:
5275 case 0x10ec0288:
5276 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5277 msleep(300);
5278 alc_process_coef_fw(codec, coef0288);
5279 break;
73bdd597 5280 case 0x10ec0292:
54db6c39 5281 alc_process_coef_fw(codec, coef0292);
73bdd597 5282 break;
a22aa26f 5283 case 0x10ec0293:
54db6c39 5284 alc_process_coef_fw(codec, coef0293);
a22aa26f 5285 break;
73bdd597 5286 case 0x10ec0668:
54db6c39 5287 alc_process_coef_fw(codec, coef0688);
73bdd597 5288 break;
c2b691ee 5289 case 0x10ec0215:
4cc9b9d6 5290 case 0x10ec0225:
c2b691ee 5291 case 0x10ec0285:
7d727869 5292 case 0x10ec0295:
c2b691ee 5293 case 0x10ec0289:
28f1f9b2 5294 case 0x10ec0299:
5a36767a
KY
5295 val = alc_read_coef_idx(codec, 0x45);
5296 if (val & (1 << 9))
5297 alc_process_coef_fw(codec, coef0225_2);
5298 else
5299 alc_process_coef_fw(codec, coef0225_1);
4cc9b9d6 5300 break;
78f4f7c2
KY
5301 case 0x10ec0867:
5302 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5303 break;
73bdd597 5304 }
4e76a883 5305 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
73bdd597
DH
5306}
5307
5308/* Nokia type */
5309static void alc_headset_mode_omtp(struct hda_codec *codec)
5310{
6b0f95c4 5311 static const struct coef_fw coef0255[] = {
54db6c39
TI
5312 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5313 WRITE_COEF(0x1b, 0x0c2b),
5314 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5315 {}
5316 };
6b0f95c4 5317 static const struct coef_fw coef0256[] = {
e69e7e03 5318 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
717f43d8 5319 WRITE_COEF(0x1b, 0x0e6b),
e69e7e03
KY
5320 {}
5321 };
6b0f95c4 5322 static const struct coef_fw coef0233[] = {
54db6c39
TI
5323 WRITE_COEF(0x45, 0xe429),
5324 WRITE_COEF(0x1b, 0x0c2b),
5325 WRITE_COEF(0x32, 0x4ea3),
5326 {}
5327 };
6b0f95c4 5328 static const struct coef_fw coef0288[] = {
f3b70332
KY
5329 UPDATE_COEF(0x50, 0x2000, 0x2000),
5330 UPDATE_COEF(0x56, 0x0006, 0x0006),
5331 UPDATE_COEF(0x66, 0x0008, 0),
5332 UPDATE_COEF(0x67, 0x2000, 0),
5333 {}
5334 };
6b0f95c4 5335 static const struct coef_fw coef0292[] = {
54db6c39
TI
5336 WRITE_COEF(0x6b, 0xe429),
5337 WRITE_COEF(0x76, 0x0008),
5338 WRITE_COEF(0x18, 0x7388),
5339 {}
5340 };
6b0f95c4 5341 static const struct coef_fw coef0293[] = {
54db6c39
TI
5342 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5343 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5344 {}
5345 };
6b0f95c4 5346 static const struct coef_fw coef0688[] = {
54db6c39
TI
5347 WRITE_COEF(0x11, 0x0001),
5348 WRITE_COEF(0x15, 0x0d50),
5349 WRITE_COEF(0xc3, 0x0000),
5350 {}
5351 };
6b0f95c4 5352 static const struct coef_fw coef0225[] = {
4cc9b9d6 5353 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
5a36767a 5354 UPDATE_COEF(0x63, 3<<14, 2<<14),
4cc9b9d6
KY
5355 {}
5356 };
54db6c39 5357
7639a06c 5358 switch (codec->core.vendor_id) {
9a22a8f5 5359 case 0x10ec0255:
54db6c39 5360 alc_process_coef_fw(codec, coef0255);
9a22a8f5 5361 break;
1948fc06 5362 case 0x10ec0230:
736f20a7 5363 case 0x10ec0236:
e69e7e03
KY
5364 case 0x10ec0256:
5365 alc_process_coef_fw(codec, coef0256);
5366 break;
71683c32
KY
5367 case 0x10ec0234:
5368 case 0x10ec0274:
5369 case 0x10ec0294:
5370 alc_write_coef_idx(codec, 0x45, 0xe689);
5371 break;
13fd08a3 5372 case 0x10ec0233:
73bdd597 5373 case 0x10ec0283:
54db6c39 5374 alc_process_coef_fw(codec, coef0233);
73bdd597 5375 break;
1a5bc8d9
KY
5376 case 0x10ec0298:
5377 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
89542936
KY
5378 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5379 msleep(300);
5380 break;
f3b70332
KY
5381 case 0x10ec0286:
5382 case 0x10ec0288:
5383 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5384 msleep(300);
5385 alc_process_coef_fw(codec, coef0288);
5386 break;
73bdd597 5387 case 0x10ec0292:
54db6c39 5388 alc_process_coef_fw(codec, coef0292);
73bdd597 5389 break;
a22aa26f 5390 case 0x10ec0293:
54db6c39 5391 alc_process_coef_fw(codec, coef0293);
a22aa26f 5392 break;
73bdd597 5393 case 0x10ec0668:
54db6c39 5394 alc_process_coef_fw(codec, coef0688);
73bdd597 5395 break;
c2b691ee 5396 case 0x10ec0215:
4cc9b9d6 5397 case 0x10ec0225:
c2b691ee 5398 case 0x10ec0285:
7d727869 5399 case 0x10ec0295:
c2b691ee 5400 case 0x10ec0289:
28f1f9b2 5401 case 0x10ec0299:
4cc9b9d6
KY
5402 alc_process_coef_fw(codec, coef0225);
5403 break;
73bdd597 5404 }
4e76a883 5405 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
73bdd597
DH
5406}
5407
5408static void alc_determine_headset_type(struct hda_codec *codec)
5409{
5410 int val;
5411 bool is_ctia = false;
5412 struct alc_spec *spec = codec->spec;
6b0f95c4 5413 static const struct coef_fw coef0255[] = {
54db6c39
TI
5414 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5415 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5416 conteol) */
5417 {}
5418 };
6b0f95c4 5419 static const struct coef_fw coef0288[] = {
f3b70332
KY
5420 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5421 {}
5422 };
6b0f95c4 5423 static const struct coef_fw coef0298[] = {
89542936
KY
5424 UPDATE_COEF(0x50, 0x2000, 0x2000),
5425 UPDATE_COEF(0x56, 0x0006, 0x0006),
5426 UPDATE_COEF(0x66, 0x0008, 0),
5427 UPDATE_COEF(0x67, 0x2000, 0),
5428 UPDATE_COEF(0x19, 0x1300, 0x1300),
5429 {}
5430 };
6b0f95c4 5431 static const struct coef_fw coef0293[] = {
54db6c39
TI
5432 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5433 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5434 {}
5435 };
6b0f95c4 5436 static const struct coef_fw coef0688[] = {
54db6c39
TI
5437 WRITE_COEF(0x11, 0x0001),
5438 WRITE_COEF(0xb7, 0x802b),
5439 WRITE_COEF(0x15, 0x0d60),
5440 WRITE_COEF(0xc3, 0x0c00),
5441 {}
5442 };
6b0f95c4 5443 static const struct coef_fw coef0274[] = {
71683c32
KY
5444 UPDATE_COEF(0x4a, 0x0010, 0),
5445 UPDATE_COEF(0x4a, 0x8000, 0),
5446 WRITE_COEF(0x45, 0xd289),
5447 UPDATE_COEF(0x49, 0x0300, 0x0300),
5448 {}
5449 };
73bdd597 5450
92666d45
KY
5451 if (spec->no_internal_mic_pin) {
5452 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5453 return;
5454 }
5455
7639a06c 5456 switch (codec->core.vendor_id) {
9a22a8f5 5457 case 0x10ec0255:
717f43d8
KY
5458 alc_process_coef_fw(codec, coef0255);
5459 msleep(300);
5460 val = alc_read_coef_idx(codec, 0x46);
5461 is_ctia = (val & 0x0070) == 0x0070;
5462 break;
1948fc06 5463 case 0x10ec0230:
717f43d8 5464 case 0x10ec0236:
7081adf3 5465 case 0x10ec0256:
717f43d8
KY
5466 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5467 alc_write_coef_idx(codec, 0x06, 0x6104);
5468 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5469
5470 snd_hda_codec_write(codec, 0x21, 0,
5471 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5472 msleep(80);
5473 snd_hda_codec_write(codec, 0x21, 0,
5474 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5475
54db6c39 5476 alc_process_coef_fw(codec, coef0255);
9a22a8f5
KY
5477 msleep(300);
5478 val = alc_read_coef_idx(codec, 0x46);
5479 is_ctia = (val & 0x0070) == 0x0070;
717f43d8
KY
5480
5481 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5482 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5483
5484 snd_hda_codec_write(codec, 0x21, 0,
5485 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5486 msleep(80);
5487 snd_hda_codec_write(codec, 0x21, 0,
5488 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
9a22a8f5 5489 break;
71683c32
KY
5490 case 0x10ec0234:
5491 case 0x10ec0274:
5492 case 0x10ec0294:
5493 alc_process_coef_fw(codec, coef0274);
febf2256 5494 msleep(850);
71683c32
KY
5495 val = alc_read_coef_idx(codec, 0x46);
5496 is_ctia = (val & 0x00f0) == 0x00f0;
5497 break;
13fd08a3 5498 case 0x10ec0233:
73bdd597
DH
5499 case 0x10ec0283:
5500 alc_write_coef_idx(codec, 0x45, 0xd029);
5501 msleep(300);
5502 val = alc_read_coef_idx(codec, 0x46);
5503 is_ctia = (val & 0x0070) == 0x0070;
5504 break;
1a5bc8d9 5505 case 0x10ec0298:
89542936
KY
5506 snd_hda_codec_write(codec, 0x21, 0,
5507 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5508 msleep(100);
5509 snd_hda_codec_write(codec, 0x21, 0,
5510 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5511 msleep(200);
5512
5513 val = alc_read_coef_idx(codec, 0x50);
5514 if (val & (1 << 12)) {
5515 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5516 alc_process_coef_fw(codec, coef0288);
5517 msleep(350);
5518 val = alc_read_coef_idx(codec, 0x50);
5519 is_ctia = (val & 0x0070) == 0x0070;
5520 } else {
5521 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5522 alc_process_coef_fw(codec, coef0288);
5523 msleep(350);
5524 val = alc_read_coef_idx(codec, 0x50);
5525 is_ctia = (val & 0x0070) == 0x0070;
5526 }
5527 alc_process_coef_fw(codec, coef0298);
5528 snd_hda_codec_write(codec, 0x21, 0,
5529 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5530 msleep(75);
5531 snd_hda_codec_write(codec, 0x21, 0,
5532 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5533 break;
f3b70332
KY
5534 case 0x10ec0286:
5535 case 0x10ec0288:
5536 alc_process_coef_fw(codec, coef0288);
5537 msleep(350);
5538 val = alc_read_coef_idx(codec, 0x50);
5539 is_ctia = (val & 0x0070) == 0x0070;
5540 break;
73bdd597
DH
5541 case 0x10ec0292:
5542 alc_write_coef_idx(codec, 0x6b, 0xd429);
5543 msleep(300);
5544 val = alc_read_coef_idx(codec, 0x6c);
5545 is_ctia = (val & 0x001c) == 0x001c;
5546 break;
a22aa26f 5547 case 0x10ec0293:
54db6c39 5548 alc_process_coef_fw(codec, coef0293);
a22aa26f
KY
5549 msleep(300);
5550 val = alc_read_coef_idx(codec, 0x46);
5551 is_ctia = (val & 0x0070) == 0x0070;
5552 break;
73bdd597 5553 case 0x10ec0668:
54db6c39 5554 alc_process_coef_fw(codec, coef0688);
73bdd597
DH
5555 msleep(300);
5556 val = alc_read_coef_idx(codec, 0xbe);
5557 is_ctia = (val & 0x1c02) == 0x1c02;
5558 break;
c2b691ee 5559 case 0x10ec0215:
4cc9b9d6 5560 case 0x10ec0225:
c2b691ee 5561 case 0x10ec0285:
7d727869 5562 case 0x10ec0295:
c2b691ee 5563 case 0x10ec0289:
28f1f9b2 5564 case 0x10ec0299:
da911b1f
KY
5565 snd_hda_codec_write(codec, 0x21, 0,
5566 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5567 msleep(80);
5568 snd_hda_codec_write(codec, 0x21, 0,
5569 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5570
5a36767a
KY
5571 alc_process_coef_fw(codec, alc225_pre_hsmode);
5572 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5573 val = alc_read_coef_idx(codec, 0x45);
5574 if (val & (1 << 9)) {
5575 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5576 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5577 msleep(800);
5578 val = alc_read_coef_idx(codec, 0x46);
5579 is_ctia = (val & 0x00f0) == 0x00f0;
5580 } else {
5581 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5582 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5583 msleep(800);
5584 val = alc_read_coef_idx(codec, 0x46);
5585 is_ctia = (val & 0x00f0) == 0x00f0;
5586 }
5587 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
5588 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
5589 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
da911b1f
KY
5590
5591 snd_hda_codec_write(codec, 0x21, 0,
5592 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5593 msleep(80);
5594 snd_hda_codec_write(codec, 0x21, 0,
5595 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
4cc9b9d6 5596 break;
78f4f7c2
KY
5597 case 0x10ec0867:
5598 is_ctia = true;
5599 break;
73bdd597
DH
5600 }
5601
4e76a883 5602 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
73bdd597
DH
5603 is_ctia ? "yes" : "no");
5604 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
5605}
5606
5607static void alc_update_headset_mode(struct hda_codec *codec)
5608{
5609 struct alc_spec *spec = codec->spec;
5610
5611 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
35a39f98 5612 hda_nid_t hp_pin = alc_get_hp_pin(spec);
73bdd597
DH
5613
5614 int new_headset_mode;
5615
5616 if (!snd_hda_jack_detect(codec, hp_pin))
5617 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
5618 else if (mux_pin == spec->headset_mic_pin)
5619 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
5620 else if (mux_pin == spec->headphone_mic_pin)
5621 new_headset_mode = ALC_HEADSET_MODE_MIC;
5622 else
5623 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
5624
5959a6bc
DH
5625 if (new_headset_mode == spec->current_headset_mode) {
5626 snd_hda_gen_update_outputs(codec);
73bdd597 5627 return;
5959a6bc 5628 }
73bdd597
DH
5629
5630 switch (new_headset_mode) {
5631 case ALC_HEADSET_MODE_UNPLUGGED:
5632 alc_headset_mode_unplugged(codec);
aeac1a0d
KY
5633 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5634 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
73bdd597
DH
5635 spec->gen.hp_jack_present = false;
5636 break;
5637 case ALC_HEADSET_MODE_HEADSET:
5638 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
5639 alc_determine_headset_type(codec);
5640 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
5641 alc_headset_mode_ctia(codec);
5642 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
5643 alc_headset_mode_omtp(codec);
5644 spec->gen.hp_jack_present = true;
5645 break;
5646 case ALC_HEADSET_MODE_MIC:
5647 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
5648 spec->gen.hp_jack_present = false;
5649 break;
5650 case ALC_HEADSET_MODE_HEADPHONE:
5651 alc_headset_mode_default(codec);
5652 spec->gen.hp_jack_present = true;
5653 break;
5654 }
5655 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
5656 snd_hda_set_pin_ctl_cache(codec, hp_pin,
5657 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
1f8b46cd 5658 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
73bdd597
DH
5659 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
5660 PIN_VREFHIZ);
5661 }
5662 spec->current_headset_mode = new_headset_mode;
5663
5664 snd_hda_gen_update_outputs(codec);
5665}
5666
5667static void alc_update_headset_mode_hook(struct hda_codec *codec,
7fe30711
TI
5668 struct snd_kcontrol *kcontrol,
5669 struct snd_ctl_elem_value *ucontrol)
73bdd597
DH
5670{
5671 alc_update_headset_mode(codec);
5672}
5673
1a4f69d5
TI
5674static void alc_update_headset_jack_cb(struct hda_codec *codec,
5675 struct hda_jack_callback *jack)
73bdd597 5676{
73bdd597 5677 snd_hda_gen_hp_automute(codec, jack);
e54f30be 5678 alc_update_headset_mode(codec);
73bdd597
DH
5679}
5680
5681static void alc_probe_headset_mode(struct hda_codec *codec)
5682{
5683 int i;
5684 struct alc_spec *spec = codec->spec;
5685 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5686
5687 /* Find mic pins */
5688 for (i = 0; i < cfg->num_inputs; i++) {
5689 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
5690 spec->headset_mic_pin = cfg->inputs[i].pin;
5691 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
5692 spec->headphone_mic_pin = cfg->inputs[i].pin;
5693 }
5694
0bed2aa3 5695 WARN_ON(spec->gen.cap_sync_hook);
73bdd597
DH
5696 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
5697 spec->gen.automute_hook = alc_update_headset_mode;
5698 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
5699}
5700
5701static void alc_fixup_headset_mode(struct hda_codec *codec,
5702 const struct hda_fixup *fix, int action)
5703{
5704 struct alc_spec *spec = codec->spec;
5705
5706 switch (action) {
5707 case HDA_FIXUP_ACT_PRE_PROBE:
5708 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
5709 break;
5710 case HDA_FIXUP_ACT_PROBE:
5711 alc_probe_headset_mode(codec);
5712 break;
5713 case HDA_FIXUP_ACT_INIT:
aeac1a0d
KY
5714 if (is_s3_resume(codec) || is_s4_resume(codec)) {
5715 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5716 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5717 }
73bdd597
DH
5718 alc_update_headset_mode(codec);
5719 break;
5720 }
5721}
5722
5723static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
5724 const struct hda_fixup *fix, int action)
5725{
5726 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5727 struct alc_spec *spec = codec->spec;
5728 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5729 }
5730 else
5731 alc_fixup_headset_mode(codec, fix, action);
5732}
5733
31278997
KY
5734static void alc255_set_default_jack_type(struct hda_codec *codec)
5735{
5736 /* Set to iphone type */
6b0f95c4 5737 static const struct coef_fw alc255fw[] = {
54db6c39
TI
5738 WRITE_COEF(0x1b, 0x880b),
5739 WRITE_COEF(0x45, 0xd089),
5740 WRITE_COEF(0x1b, 0x080b),
5741 WRITE_COEF(0x46, 0x0004),
5742 WRITE_COEF(0x1b, 0x0c0b),
5743 {}
5744 };
6b0f95c4 5745 static const struct coef_fw alc256fw[] = {
e69e7e03
KY
5746 WRITE_COEF(0x1b, 0x884b),
5747 WRITE_COEF(0x45, 0xd089),
5748 WRITE_COEF(0x1b, 0x084b),
5749 WRITE_COEF(0x46, 0x0004),
5750 WRITE_COEF(0x1b, 0x0c4b),
5751 {}
5752 };
5753 switch (codec->core.vendor_id) {
5754 case 0x10ec0255:
5755 alc_process_coef_fw(codec, alc255fw);
5756 break;
1948fc06 5757 case 0x10ec0230:
736f20a7 5758 case 0x10ec0236:
e69e7e03
KY
5759 case 0x10ec0256:
5760 alc_process_coef_fw(codec, alc256fw);
5761 break;
5762 }
31278997
KY
5763 msleep(30);
5764}
5765
9a22a8f5
KY
5766static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
5767 const struct hda_fixup *fix, int action)
5768{
5769 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
31278997 5770 alc255_set_default_jack_type(codec);
9a22a8f5
KY
5771 }
5772 alc_fixup_headset_mode(codec, fix, action);
5773}
5774
31278997
KY
5775static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
5776 const struct hda_fixup *fix, int action)
5777{
5778 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5779 struct alc_spec *spec = codec->spec;
5780 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5781 alc255_set_default_jack_type(codec);
5782 }
5783 else
5784 alc_fixup_headset_mode(codec, fix, action);
5785}
5786
e1e62b98
KY
5787static void alc288_update_headset_jack_cb(struct hda_codec *codec,
5788 struct hda_jack_callback *jack)
5789{
5790 struct alc_spec *spec = codec->spec;
e1e62b98
KY
5791
5792 alc_update_headset_jack_cb(codec, jack);
5793 /* Headset Mic enable or disable, only for Dell Dino */
d44a6864 5794 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
e1e62b98
KY
5795}
5796
5797static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5798 const struct hda_fixup *fix, int action)
5799{
5800 alc_fixup_headset_mode(codec, fix, action);
5801 if (action == HDA_FIXUP_ACT_PROBE) {
5802 struct alc_spec *spec = codec->spec;
d44a6864
TI
5803 /* toggled via hp_automute_hook */
5804 spec->gpio_mask |= 0x40;
5805 spec->gpio_dir |= 0x40;
e1e62b98
KY
5806 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
5807 }
5808}
5809
493a52a9
HW
5810static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5811 const struct hda_fixup *fix, int action)
5812{
5813 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5814 struct alc_spec *spec = codec->spec;
5815 spec->gen.auto_mute_via_amp = 1;
5816 }
5817}
5818
9b745ab8
TI
5819static void alc_fixup_no_shutup(struct hda_codec *codec,
5820 const struct hda_fixup *fix, int action)
5821{
efe55732 5822 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
9b745ab8 5823 struct alc_spec *spec = codec->spec;
c0ca5ece 5824 spec->no_shutup_pins = 1;
9b745ab8
TI
5825 }
5826}
5827
5e6db669
GM
5828static void alc_fixup_disable_aamix(struct hda_codec *codec,
5829 const struct hda_fixup *fix, int action)
5830{
5831 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5832 struct alc_spec *spec = codec->spec;
5833 /* Disable AA-loopback as it causes white noise */
5834 spec->gen.mixer_nid = 0;
5835 }
5836}
5837
7f57d803
TI
5838/* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
5839static void alc_fixup_tpt440_dock(struct hda_codec *codec,
5840 const struct hda_fixup *fix, int action)
5841{
5842 static const struct hda_pintbl pincfgs[] = {
5843 { 0x16, 0x21211010 }, /* dock headphone */
5844 { 0x19, 0x21a11010 }, /* dock mic */
5845 { }
5846 };
5847 struct alc_spec *spec = codec->spec;
5848
5849 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5850 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5851 codec->power_save_node = 0; /* avoid click noises */
5852 snd_hda_apply_pincfgs(codec, pincfgs);
5853 }
5854}
5855
61fcf8ec
KY
5856static void alc_fixup_tpt470_dock(struct hda_codec *codec,
5857 const struct hda_fixup *fix, int action)
5858{
5859 static const struct hda_pintbl pincfgs[] = {
5860 { 0x17, 0x21211010 }, /* dock headphone */
5861 { 0x19, 0x21a11010 }, /* dock mic */
5862 { }
5863 };
5864 struct alc_spec *spec = codec->spec;
5865
5866 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5867 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
71db96dd
TI
5868 snd_hda_apply_pincfgs(codec, pincfgs);
5869 } else if (action == HDA_FIXUP_ACT_INIT) {
61fcf8ec
KY
5870 /* Enable DOCK device */
5871 snd_hda_codec_write(codec, 0x17, 0,
5872 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5873 /* Enable DOCK device */
5874 snd_hda_codec_write(codec, 0x19, 0,
5875 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
61fcf8ec
KY
5876 }
5877}
5878
399c01aa
TI
5879static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
5880 const struct hda_fixup *fix, int action)
5881{
5882 /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
5883 * the speaker output becomes too low by some reason on Thinkpads with
5884 * ALC298 codec
5885 */
5886 static const hda_nid_t preferred_pairs[] = {
5887 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
5888 0
5889 };
5890 struct alc_spec *spec = codec->spec;
5891
5892 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5893 spec->gen.preferred_dacs = preferred_pairs;
5894}
5895
8eedd3a7
TI
5896static void alc295_fixup_asus_dacs(struct hda_codec *codec,
5897 const struct hda_fixup *fix, int action)
5898{
5899 static const hda_nid_t preferred_pairs[] = {
5900 0x17, 0x02, 0x21, 0x03, 0
5901 };
5902 struct alc_spec *spec = codec->spec;
5903
5904 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5905 spec->gen.preferred_dacs = preferred_pairs;
5906}
5907
9476d369 5908static void alc_shutup_dell_xps13(struct hda_codec *codec)
033b0a7c
GM
5909{
5910 struct alc_spec *spec = codec->spec;
35a39f98 5911 int hp_pin = alc_get_hp_pin(spec);
033b0a7c 5912
9476d369
GM
5913 /* Prevent pop noises when headphones are plugged in */
5914 snd_hda_codec_write(codec, hp_pin, 0,
5915 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5916 msleep(20);
033b0a7c
GM
5917}
5918
5919static void alc_fixup_dell_xps13(struct hda_codec *codec,
5920 const struct hda_fixup *fix, int action)
5921{
3e1b0c4a
TI
5922 struct alc_spec *spec = codec->spec;
5923 struct hda_input_mux *imux = &spec->gen.input_mux;
5924 int i;
f38663ab 5925
3e1b0c4a
TI
5926 switch (action) {
5927 case HDA_FIXUP_ACT_PRE_PROBE:
5928 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
5929 * it causes a click noise at start up
5930 */
5931 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
efe55732 5932 spec->shutup = alc_shutup_dell_xps13;
3e1b0c4a
TI
5933 break;
5934 case HDA_FIXUP_ACT_PROBE:
f38663ab
GM
5935 /* Make the internal mic the default input source. */
5936 for (i = 0; i < imux->num_items; i++) {
5937 if (spec->gen.imux_pins[i] == 0x12) {
5938 spec->gen.cur_mux[0] = i;
5939 break;
5940 }
5941 }
3e1b0c4a 5942 break;
033b0a7c
GM
5943 }
5944}
5945
1f8b46cd
DH
5946static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
5947 const struct hda_fixup *fix, int action)
5948{
5949 struct alc_spec *spec = codec->spec;
5950
5951 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5952 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5953 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
b40eda64
DH
5954
5955 /* Disable boost for mic-in permanently. (This code is only called
5956 from quirks that guarantee that the headphone is at NID 0x1b.) */
5957 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
5958 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
1f8b46cd
DH
5959 } else
5960 alc_fixup_headset_mode(codec, fix, action);
5961}
5962
73bdd597
DH
5963static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
5964 const struct hda_fixup *fix, int action)
5965{
5966 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
73bdd597 5967 alc_write_coef_idx(codec, 0xc4, 0x8000);
98b24883 5968 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
73bdd597
DH
5969 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
5970 }
5971 alc_fixup_headset_mode(codec, fix, action);
5972}
5973
bde7bc60
CCC
5974/* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
5975static int find_ext_mic_pin(struct hda_codec *codec)
5976{
5977 struct alc_spec *spec = codec->spec;
5978 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5979 hda_nid_t nid;
5980 unsigned int defcfg;
5981 int i;
5982
5983 for (i = 0; i < cfg->num_inputs; i++) {
5984 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5985 continue;
5986 nid = cfg->inputs[i].pin;
5987 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5988 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
5989 continue;
5990 return nid;
5991 }
5992
5993 return 0;
5994}
5995
08a978db 5996static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
1727a771 5997 const struct hda_fixup *fix,
08a978db
DR
5998 int action)
5999{
6000 struct alc_spec *spec = codec->spec;
6001
0db75790 6002 if (action == HDA_FIXUP_ACT_PROBE) {
bde7bc60 6003 int mic_pin = find_ext_mic_pin(codec);
35a39f98 6004 int hp_pin = alc_get_hp_pin(spec);
bde7bc60
CCC
6005
6006 if (snd_BUG_ON(!mic_pin || !hp_pin))
0db75790 6007 return;
bde7bc60 6008 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
0db75790 6009 }
08a978db 6010}
693b613d 6011
3e0d611b
DH
6012static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
6013 const struct hda_fixup *fix,
6014 int action)
6015{
6016 struct alc_spec *spec = codec->spec;
6017 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6018 int i;
6019
6020 /* The mic boosts on level 2 and 3 are too noisy
6021 on the internal mic input.
6022 Therefore limit the boost to 0 or 1. */
6023
6024 if (action != HDA_FIXUP_ACT_PROBE)
6025 return;
6026
6027 for (i = 0; i < cfg->num_inputs; i++) {
6028 hda_nid_t nid = cfg->inputs[i].pin;
6029 unsigned int defcfg;
6030 if (cfg->inputs[i].type != AUTO_PIN_MIC)
6031 continue;
6032 defcfg = snd_hda_codec_get_pincfg(codec, nid);
6033 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
6034 continue;
6035
6036 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
6037 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
6038 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
6039 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
6040 (0 << AC_AMPCAP_MUTE_SHIFT));
6041 }
6042}
6043
cd217a63 6044static void alc283_hp_automute_hook(struct hda_codec *codec,
1a4f69d5 6045 struct hda_jack_callback *jack)
cd217a63
KY
6046{
6047 struct alc_spec *spec = codec->spec;
6048 int vref;
6049
6050 msleep(200);
6051 snd_hda_gen_hp_automute(codec, jack);
6052
6053 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
6054
6055 msleep(600);
6056 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6057 vref);
6058}
6059
cd217a63
KY
6060static void alc283_fixup_chromebook(struct hda_codec *codec,
6061 const struct hda_fixup *fix, int action)
6062{
6063 struct alc_spec *spec = codec->spec;
cd217a63
KY
6064
6065 switch (action) {
6066 case HDA_FIXUP_ACT_PRE_PROBE:
0202e99c 6067 snd_hda_override_wcaps(codec, 0x03, 0);
d2e92709
TI
6068 /* Disable AA-loopback as it causes white noise */
6069 spec->gen.mixer_nid = 0;
38070219 6070 break;
0202e99c 6071 case HDA_FIXUP_ACT_INIT:
de9481cb
KY
6072 /* MIC2-VREF control */
6073 /* Set to manual mode */
98b24883 6074 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
0202e99c 6075 /* Enable Line1 input control by verb */
98b24883 6076 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
0202e99c
KY
6077 break;
6078 }
6079}
6080
6081static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
6082 const struct hda_fixup *fix, int action)
6083{
6084 struct alc_spec *spec = codec->spec;
0202e99c
KY
6085
6086 switch (action) {
6087 case HDA_FIXUP_ACT_PRE_PROBE:
cd217a63 6088 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
38070219
KY
6089 break;
6090 case HDA_FIXUP_ACT_INIT:
cd217a63
KY
6091 /* MIC2-VREF control */
6092 /* Set to manual mode */
98b24883 6093 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
cd217a63
KY
6094 break;
6095 }
6096}
6097
7bba2157
TI
6098/* mute tablet speaker pin (0x14) via dock plugging in addition */
6099static void asus_tx300_automute(struct hda_codec *codec)
6100{
6101 struct alc_spec *spec = codec->spec;
6102 snd_hda_gen_update_outputs(codec);
6103 if (snd_hda_jack_detect(codec, 0x1b))
6104 spec->gen.mute_bits |= (1ULL << 0x14);
6105}
6106
6107static void alc282_fixup_asus_tx300(struct hda_codec *codec,
6108 const struct hda_fixup *fix, int action)
6109{
6110 struct alc_spec *spec = codec->spec;
7bba2157
TI
6111 static const struct hda_pintbl dock_pins[] = {
6112 { 0x1b, 0x21114000 }, /* dock speaker pin */
6113 {}
6114 };
7bba2157
TI
6115
6116 switch (action) {
6117 case HDA_FIXUP_ACT_PRE_PROBE:
1c76aa5f 6118 spec->init_amp = ALC_INIT_DEFAULT;
ae065f1c
TI
6119 /* TX300 needs to set up GPIO2 for the speaker amp */
6120 alc_setup_gpio(codec, 0x04);
7bba2157
TI
6121 snd_hda_apply_pincfgs(codec, dock_pins);
6122 spec->gen.auto_mute_via_amp = 1;
6123 spec->gen.automute_hook = asus_tx300_automute;
6124 snd_hda_jack_detect_enable_callback(codec, 0x1b,
7bba2157
TI
6125 snd_hda_gen_hp_automute);
6126 break;
5579cd6f
TI
6127 case HDA_FIXUP_ACT_PROBE:
6128 spec->init_amp = ALC_INIT_DEFAULT;
6129 break;
7bba2157
TI
6130 case HDA_FIXUP_ACT_BUILD:
6131 /* this is a bit tricky; give more sane names for the main
6132 * (tablet) speaker and the dock speaker, respectively
6133 */
56798e6b
TI
6134 rename_ctl(codec, "Speaker Playback Switch",
6135 "Dock Speaker Playback Switch");
6136 rename_ctl(codec, "Bass Speaker Playback Switch",
6137 "Speaker Playback Switch");
7bba2157
TI
6138 break;
6139 }
6140}
6141
338cae56
DH
6142static void alc290_fixup_mono_speakers(struct hda_codec *codec,
6143 const struct hda_fixup *fix, int action)
6144{
0f4881dc
DH
6145 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6146 /* DAC node 0x03 is giving mono output. We therefore want to
6147 make sure 0x14 (front speaker) and 0x15 (headphones) use the
6148 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
caf3c043
MM
6149 static const hda_nid_t conn1[] = { 0x0c };
6150 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
6151 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
0f4881dc 6152 }
338cae56
DH
6153}
6154
dd9aa335
HW
6155static void alc298_fixup_speaker_volume(struct hda_codec *codec,
6156 const struct hda_fixup *fix, int action)
6157{
6158 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6159 /* The speaker is routed to the Node 0x06 by a mistake, as a result
6160 we can't adjust the speaker's volume since this node does not has
6161 Amp-out capability. we change the speaker's route to:
6162 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
6163 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
6164 speaker's volume now. */
6165
caf3c043
MM
6166 static const hda_nid_t conn1[] = { 0x0c };
6167 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
dd9aa335
HW
6168 }
6169}
6170
e312a869
TI
6171/* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
6172static void alc295_fixup_disable_dac3(struct hda_codec *codec,
6173 const struct hda_fixup *fix, int action)
6174{
6175 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
caf3c043
MM
6176 static const hda_nid_t conn[] = { 0x02, 0x03 };
6177 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
e312a869
TI
6178 }
6179}
6180
d2cd795c
JK
6181/* force NID 0x17 (Bass Speaker) to DAC1 to share it with the main speaker */
6182static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
6183 const struct hda_fixup *fix, int action)
6184{
6185 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
caf3c043
MM
6186 static const hda_nid_t conn[] = { 0x02 };
6187 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
d2cd795c
JK
6188 }
6189}
6190
98973f2f
KP
6191/* Hook to update amp GPIO4 for automute */
6192static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
6193 struct hda_jack_callback *jack)
6194{
6195 struct alc_spec *spec = codec->spec;
6196
6197 snd_hda_gen_hp_automute(codec, jack);
6198 /* mute_led_polarity is set to 0, so we pass inverted value here */
dbd13179
KHF
6199 alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
6200 !spec->gen.hp_jack_present);
98973f2f
KP
6201}
6202
6203/* Manage GPIOs for HP EliteBook Folio 9480m.
6204 *
6205 * GPIO4 is the headphone amplifier power control
6206 * GPIO3 is the audio output mute indicator LED
6207 */
6208
6209static void alc280_fixup_hp_9480m(struct hda_codec *codec,
6210 const struct hda_fixup *fix,
6211 int action)
6212{
6213 struct alc_spec *spec = codec->spec;
98973f2f 6214
01e4a275 6215 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
98973f2f 6216 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
01e4a275
TI
6217 /* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
6218 spec->gpio_mask |= 0x10;
6219 spec->gpio_dir |= 0x10;
98973f2f 6220 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
98973f2f
KP
6221 }
6222}
6223
ae065f1c
TI
6224static void alc275_fixup_gpio4_off(struct hda_codec *codec,
6225 const struct hda_fixup *fix,
6226 int action)
6227{
6228 struct alc_spec *spec = codec->spec;
6229
6230 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6231 spec->gpio_mask |= 0x04;
6232 spec->gpio_dir |= 0x04;
6233 /* set data bit low */
6234 }
6235}
6236
6a6660d0
TI
6237/* Quirk for Thinkpad X1 7th and 8th Gen
6238 * The following fixed routing needed
6239 * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
6240 * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
6241 * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
6242 */
6243static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
6244 const struct hda_fixup *fix, int action)
6245{
6246 static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
6247 static const hda_nid_t preferred_pairs[] = {
6248 0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
6249 };
6250 struct alc_spec *spec = codec->spec;
6251
6252 switch (action) {
6253 case HDA_FIXUP_ACT_PRE_PROBE:
6254 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6255 spec->gen.preferred_dacs = preferred_pairs;
6256 break;
6257 case HDA_FIXUP_ACT_BUILD:
6258 /* The generic parser creates somewhat unintuitive volume ctls
6259 * with the fixed routing above, and the shared DAC2 may be
6260 * confusing for PA.
6261 * Rename those to unique names so that PA doesn't touch them
6262 * and use only Master volume.
6263 */
6264 rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
6265 rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
6266 break;
6267 }
6268}
6269
ca169cc2
KY
6270static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
6271 const struct hda_fixup *fix,
6272 int action)
6273{
6274 alc_fixup_dual_codecs(codec, fix, action);
6275 switch (action) {
6276 case HDA_FIXUP_ACT_PRE_PROBE:
6277 /* override card longname to provide a unique UCM profile */
6278 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
6279 break;
6280 case HDA_FIXUP_ACT_BUILD:
6281 /* rename Capture controls depending on the codec */
6282 rename_ctl(codec, "Capture Volume",
6283 codec->addr == 0 ?
6284 "Rear-Panel Capture Volume" :
6285 "Front-Panel Capture Volume");
6286 rename_ctl(codec, "Capture Switch",
6287 codec->addr == 0 ?
6288 "Rear-Panel Capture Switch" :
6289 "Front-Panel Capture Switch");
6290 break;
6291 }
6292}
6293
52e4e368
KHF
6294static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
6295 const struct hda_fixup *fix, int action)
6296{
6297 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6298 return;
6299
6300 codec->power_save_node = 1;
6301}
6302
92266651
KY
6303/* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
6304static void alc274_fixup_bind_dacs(struct hda_codec *codec,
6305 const struct hda_fixup *fix, int action)
6306{
6307 struct alc_spec *spec = codec->spec;
caf3c043 6308 static const hda_nid_t preferred_pairs[] = {
92266651
KY
6309 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
6310 0
6311 };
6312
6313 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6314 return;
6315
6316 spec->gen.preferred_dacs = preferred_pairs;
0700d3d1
KY
6317 spec->gen.auto_mute_via_amp = 1;
6318 codec->power_save_node = 0;
92266651
KY
6319}
6320
c84bfedc
TI
6321/* avoid DAC 0x06 for bass speaker 0x17; it has no volume control */
6322static void alc289_fixup_asus_ga401(struct hda_codec *codec,
6323 const struct hda_fixup *fix, int action)
6324{
6325 static const hda_nid_t preferred_pairs[] = {
6326 0x14, 0x02, 0x17, 0x02, 0x21, 0x03, 0
6327 };
6328 struct alc_spec *spec = codec->spec;
6329
6330 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6331 spec->gen.preferred_dacs = preferred_pairs;
6332 spec->gen.obey_preferred_dacs = 1;
6333 }
6334}
6335
c4cfcf6f
HW
6336/* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */
6337static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6338 const struct hda_fixup *fix, int action)
6339{
6340 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6341 return;
6342
6343 snd_hda_override_wcaps(codec, 0x03, 0);
6344}
6345
8a8de09c
KY
6346static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6347{
6348 switch (codec->core.vendor_id) {
6349 case 0x10ec0274:
6350 case 0x10ec0294:
6351 case 0x10ec0225:
6352 case 0x10ec0295:
6353 case 0x10ec0299:
6354 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6355 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6356 break;
1948fc06 6357 case 0x10ec0230:
8a8de09c
KY
6358 case 0x10ec0235:
6359 case 0x10ec0236:
6360 case 0x10ec0255:
6361 case 0x10ec0256:
6362 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6363 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6364 break;
6365 }
6366}
6367
8983eb60
KY
6368static void alc295_fixup_chromebook(struct hda_codec *codec,
6369 const struct hda_fixup *fix, int action)
6370{
d3ba58bb
KY
6371 struct alc_spec *spec = codec->spec;
6372
8983eb60 6373 switch (action) {
d3ba58bb
KY
6374 case HDA_FIXUP_ACT_PRE_PROBE:
6375 spec->ultra_low_power = true;
6376 break;
8983eb60 6377 case HDA_FIXUP_ACT_INIT:
8a8de09c 6378 alc_combo_jack_hp_jd_restart(codec);
8983eb60
KY
6379 break;
6380 }
6381}
6382
d1dd4211
KY
6383static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6384 const struct hda_fixup *fix, int action)
6385{
6386 if (action == HDA_FIXUP_ACT_PRE_PROBE)
6387 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6388}
6389
c3cdf189
LJ
6390
6391static void alc294_gx502_toggle_output(struct hda_codec *codec,
6392 struct hda_jack_callback *cb)
6393{
6394 /* The Windows driver sets the codec up in a very different way where
6395 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6396 */
6397 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6398 alc_write_coef_idx(codec, 0x10, 0x8a20);
6399 else
6400 alc_write_coef_idx(codec, 0x10, 0x0a20);
6401}
6402
6403static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6404 const struct hda_fixup *fix, int action)
6405{
6406 /* Pin 0x21: headphones/headset mic */
6407 if (!is_jack_detectable(codec, 0x21))
6408 return;
6409
6410 switch (action) {
6411 case HDA_FIXUP_ACT_PRE_PROBE:
6412 snd_hda_jack_detect_enable_callback(codec, 0x21,
6413 alc294_gx502_toggle_output);
6414 break;
6415 case HDA_FIXUP_ACT_INIT:
6416 /* Make sure to start in a correct state, i.e. if
6417 * headphones have been plugged in before powering up the system
6418 */
6419 alc294_gx502_toggle_output(codec, NULL);
6420 break;
6421 }
6422}
6423
c1b55029
DC
6424static void alc294_gu502_toggle_output(struct hda_codec *codec,
6425 struct hda_jack_callback *cb)
6426{
6427 /* Windows sets 0x10 to 0x8420 for Node 0x20 which is
6428 * responsible from changes between speakers and headphones
6429 */
6430 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6431 alc_write_coef_idx(codec, 0x10, 0x8420);
6432 else
6433 alc_write_coef_idx(codec, 0x10, 0x0a20);
6434}
6435
6436static void alc294_fixup_gu502_hp(struct hda_codec *codec,
6437 const struct hda_fixup *fix, int action)
6438{
6439 if (!is_jack_detectable(codec, 0x21))
6440 return;
6441
6442 switch (action) {
6443 case HDA_FIXUP_ACT_PRE_PROBE:
6444 snd_hda_jack_detect_enable_callback(codec, 0x21,
6445 alc294_gu502_toggle_output);
6446 break;
6447 case HDA_FIXUP_ACT_INIT:
6448 alc294_gu502_toggle_output(codec, NULL);
6449 break;
6450 }
6451}
6452
56496253
KY
6453static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6454 const struct hda_fixup *fix, int action)
6455{
6456 if (action != HDA_FIXUP_ACT_INIT)
6457 return;
6458
6459 msleep(100);
6460 alc_write_coef_idx(codec, 0x65, 0x0);
6461}
6462
8a8de09c
KY
6463static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6464 const struct hda_fixup *fix, int action)
6465{
6466 switch (action) {
6467 case HDA_FIXUP_ACT_INIT:
6468 alc_combo_jack_hp_jd_restart(codec);
6469 break;
6470 }
6471}
6472
92666d45
KY
6473static void alc_fixup_no_int_mic(struct hda_codec *codec,
6474 const struct hda_fixup *fix, int action)
6475{
6476 struct alc_spec *spec = codec->spec;
6477
6478 switch (action) {
6479 case HDA_FIXUP_ACT_PRE_PROBE:
6480 /* Mic RING SLEEVE swap for combo jack */
6481 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
6482 spec->no_internal_mic_pin = true;
6483 break;
6484 case HDA_FIXUP_ACT_INIT:
6485 alc_combo_jack_hp_jd_restart(codec);
6486 break;
6487 }
6488}
6489
d94befbb
DB
6490/* GPIO1 = amplifier on/off
6491 * GPIO3 = mic mute LED
6492 */
6493static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec,
6494 const struct hda_fixup *fix, int action)
6495{
6496 static const hda_nid_t conn[] = { 0x02 };
6497
6498 struct alc_spec *spec = codec->spec;
6499 static const struct hda_pintbl pincfgs[] = {
6500 { 0x14, 0x90170110 }, /* front/high speakers */
6501 { 0x17, 0x90170130 }, /* back/bass speakers */
6502 { }
6503 };
6504
6505 //enable micmute led
6506 alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04);
6507
6508 switch (action) {
6509 case HDA_FIXUP_ACT_PRE_PROBE:
6510 spec->micmute_led_polarity = 1;
6511 /* needed for amp of back speakers */
6512 spec->gpio_mask |= 0x01;
6513 spec->gpio_dir |= 0x01;
6514 snd_hda_apply_pincfgs(codec, pincfgs);
6515 /* share DAC to have unified volume control */
6516 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
6517 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6518 break;
6519 case HDA_FIXUP_ACT_INIT:
6520 /* need to toggle GPIO to enable the amp of back speakers */
6521 alc_update_gpio_data(codec, 0x01, true);
6522 msleep(100);
6523 alc_update_gpio_data(codec, 0x01, false);
6524 break;
6525 }
6526}
6527
434591b2
ED
6528static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec,
6529 const struct hda_fixup *fix, int action)
6530{
6531 static const hda_nid_t conn[] = { 0x02 };
6532 static const struct hda_pintbl pincfgs[] = {
6533 { 0x14, 0x90170110 }, /* rear speaker */
6534 { }
6535 };
6536
6537 switch (action) {
6538 case HDA_FIXUP_ACT_PRE_PROBE:
6539 snd_hda_apply_pincfgs(codec, pincfgs);
6540 /* force front speaker to DAC1 */
6541 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6542 break;
6543 }
6544}
6545
b317b032
TI
6546/* for hda_fixup_thinkpad_acpi() */
6547#include "thinkpad_helper.c"
b67ae3f1 6548
d5a6cabf
TI
6549static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
6550 const struct hda_fixup *fix, int action)
6551{
6552 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
6553 hda_fixup_thinkpad_acpi(codec, fix, action);
6554}
6555
ad7cc2d4
CB
6556/* Fixup for Lenovo Legion 15IMHg05 speaker output on headset removal. */
6557static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec,
6558 const struct hda_fixup *fix,
6559 int action)
6560{
6561 struct alc_spec *spec = codec->spec;
6562
6563 switch (action) {
6564 case HDA_FIXUP_ACT_PRE_PROBE:
6565 spec->gen.suppress_auto_mute = 1;
6566 break;
6567 }
6568}
6569
bbf8ff6b
TB
6570/* for alc295_fixup_hp_top_speakers */
6571#include "hp_x360_helper.c"
6572
26928ca1
TI
6573/* for alc285_fixup_ideapad_s740_coef() */
6574#include "ideapad_s740_helper.c"
6575
b9145ede
WS
6576static const struct coef_fw alc256_fixup_set_coef_defaults_coefs[] = {
6577 WRITE_COEF(0x10, 0x0020), WRITE_COEF(0x24, 0x0000),
6578 WRITE_COEF(0x26, 0x0000), WRITE_COEF(0x29, 0x3000),
6579 WRITE_COEF(0x37, 0xfe05), WRITE_COEF(0x45, 0x5089),
6580 {}
6581};
6582
6583static void alc256_fixup_set_coef_defaults(struct hda_codec *codec,
6584 const struct hda_fixup *fix,
6585 int action)
dd6dd6e3
WS
6586{
6587 /*
b9145ede
WS
6588 * A certain other OS sets these coeffs to different values. On at least
6589 * one TongFang barebone these settings might survive even a cold
6590 * reboot. So to restore a clean slate the values are explicitly reset
6591 * to default here. Without this, the external microphone is always in a
6592 * plugged-in state, while the internal microphone is always in an
6593 * unplugged state, breaking the ability to use the internal microphone.
6594 */
6595 alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs);
dd6dd6e3
WS
6596}
6597
e1abacd3
WS
6598static const struct coef_fw alc233_fixup_no_audio_jack_coefs[] = {
6599 WRITE_COEF(0x1a, 0x9003), WRITE_COEF(0x1b, 0x0e2b), WRITE_COEF(0x37, 0xfe06),
6600 WRITE_COEF(0x38, 0x4981), WRITE_COEF(0x45, 0xd489), WRITE_COEF(0x46, 0x0074),
6601 WRITE_COEF(0x49, 0x0149),
6602 {}
6603};
6604
6605static void alc233_fixup_no_audio_jack(struct hda_codec *codec,
6606 const struct hda_fixup *fix,
6607 int action)
6608{
6609 /*
6610 * The audio jack input and output is not detected on the ASRock NUC Box
6611 * 1100 series when cold booting without this fix. Warm rebooting from a
6612 * certain other OS makes the audio functional, as COEF settings are
6613 * preserved in this case. This fix sets these altered COEF values as
6614 * the default.
6615 */
6616 alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs);
6617}
6618
f2ca7e35
WS
6619static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec,
6620 const struct hda_fixup *fix,
6621 int action)
6622{
6623 /*
6624 * The Clevo NJ51CU comes either with the ALC293 or the ALC256 codec,
6625 * but uses the 0x8686 subproduct id in both cases. The ALC256 codec
6626 * needs an additional quirk for sound working after suspend and resume.
6627 */
6628 if (codec->core.vendor_id == 0x10ec0256) {
6629 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
6630 snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120);
6631 } else {
6632 snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c);
6633 }
6634}
6635
1d045db9 6636enum {
f73bbf63 6637 ALC269_FIXUP_GPIO2,
1d045db9
TI
6638 ALC269_FIXUP_SONY_VAIO,
6639 ALC275_FIXUP_SONY_VAIO_GPIO2,
6640 ALC269_FIXUP_DELL_M101Z,
6641 ALC269_FIXUP_SKU_IGNORE,
6642 ALC269_FIXUP_ASUS_G73JW,
6643 ALC269_FIXUP_LENOVO_EAPD,
6644 ALC275_FIXUP_SONY_HWEQ,
e9bd7d5c 6645 ALC275_FIXUP_SONY_DISABLE_AAMIX,
1d045db9 6646 ALC271_FIXUP_DMIC,
017f2a10 6647 ALC269_FIXUP_PCM_44K,
adabb3ec 6648 ALC269_FIXUP_STEREO_DMIC,
7c478f03 6649 ALC269_FIXUP_HEADSET_MIC,
24519911
TI
6650 ALC269_FIXUP_QUANTA_MUTE,
6651 ALC269_FIXUP_LIFEBOOK,
2041d564 6652 ALC269_FIXUP_LIFEBOOK_EXTMIC,
cc7016ab 6653 ALC269_FIXUP_LIFEBOOK_HP_PIN,
4df3fd17 6654 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
fdcc968a 6655 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
a4297b5d
TI
6656 ALC269_FIXUP_AMIC,
6657 ALC269_FIXUP_DMIC,
6658 ALC269VB_FIXUP_AMIC,
6659 ALC269VB_FIXUP_DMIC,
08fb0d0e 6660 ALC269_FIXUP_HP_MUTE_LED,
d06ac143 6661 ALC269_FIXUP_HP_MUTE_LED_MIC1,
08fb0d0e 6662 ALC269_FIXUP_HP_MUTE_LED_MIC2,
7f783bd5 6663 ALC269_FIXUP_HP_MUTE_LED_MIC3,
9f5c6faf 6664 ALC269_FIXUP_HP_GPIO_LED,
9c5dc3bf
KY
6665 ALC269_FIXUP_HP_GPIO_MIC1_LED,
6666 ALC269_FIXUP_HP_LINE1_MIC1_LED,
693b613d 6667 ALC269_FIXUP_INV_DMIC,
108cc108 6668 ALC269_FIXUP_LENOVO_DOCK,
b590b38c 6669 ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
9b745ab8 6670 ALC269_FIXUP_NO_SHUTUP,
88cfcf86 6671 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
108cc108 6672 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
73bdd597
DH
6673 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6674 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
338cae56 6675 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
fcc6c877 6676 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
73bdd597
DH
6677 ALC269_FIXUP_HEADSET_MODE,
6678 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
7819717b 6679 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
d240d1dc
DH
6680 ALC269_FIXUP_ASUS_X101_FUNC,
6681 ALC269_FIXUP_ASUS_X101_VERB,
6682 ALC269_FIXUP_ASUS_X101,
08a978db
DR
6683 ALC271_FIXUP_AMIC_MIC2,
6684 ALC271_FIXUP_HP_GATE_MIC_JACK,
b1e8972e 6685 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
42397004 6686 ALC269_FIXUP_ACER_AC700,
3e0d611b 6687 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
2cede303 6688 ALC269VB_FIXUP_ASUS_ZENBOOK,
23870831 6689 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
8e35cd4a 6690 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
02b504d9 6691 ALC269VB_FIXUP_ORDISSIMO_EVE2,
cd217a63 6692 ALC283_FIXUP_CHROME_BOOK,
0202e99c 6693 ALC283_FIXUP_SENSE_COMBO_JACK,
7bba2157 6694 ALC282_FIXUP_ASUS_TX300,
1bb3e062 6695 ALC283_FIXUP_INT_MIC,
338cae56 6696 ALC290_FIXUP_MONO_SPEAKERS,
0f4881dc
DH
6697 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6698 ALC290_FIXUP_SUBWOOFER,
6699 ALC290_FIXUP_SUBWOOFER_HSJACK,
b67ae3f1 6700 ALC269_FIXUP_THINKPAD_ACPI,
56f27013 6701 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
5824ce8d 6702 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
615966ad 6703 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9a22a8f5 6704 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
31278997 6705 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
9a22a8f5 6706 ALC255_FIXUP_HEADSET_MODE,
31278997 6707 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
a22aa26f 6708 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
1c37c223 6709 ALC292_FIXUP_TPT440_DOCK,
9a811230 6710 ALC292_FIXUP_TPT440,
abaa2274 6711 ALC283_FIXUP_HEADSET_MIC,
b3802783 6712 ALC255_FIXUP_MIC_MUTE_LED,
1a22e775 6713 ALC282_FIXUP_ASPIRE_V5_PINS,
c8426b27 6714 ALC269VB_FIXUP_ASPIRE_E1_COEF,
7a5255f1 6715 ALC280_FIXUP_HP_GPIO4,
eaa8e5ef 6716 ALC286_FIXUP_HP_GPIO_LED,
33f4acd3 6717 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
b4b33f9d 6718 ALC280_FIXUP_HP_DOCK_PINS,
04d5466a 6719 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
98973f2f 6720 ALC280_FIXUP_HP_9480M,
c3bb2b52 6721 ALC245_FIXUP_HP_X360_AMP,
d94befbb 6722 ALC285_FIXUP_HP_SPECTRE_X360_EB1,
e1e62b98
KY
6723 ALC288_FIXUP_DELL_HEADSET_MODE,
6724 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
831bfdf9
HW
6725 ALC288_FIXUP_DELL_XPS_13,
6726 ALC288_FIXUP_DISABLE_AAMIX,
5fab5829 6727 ALC292_FIXUP_DELL_E7X_AAMIX,
8b99aba7
TI
6728 ALC292_FIXUP_DELL_E7X,
6729 ALC292_FIXUP_DISABLE_AAMIX,
c04017ea 6730 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
54324221 6731 ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
977e6276 6732 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
2f726aec 6733 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
6ed1131f 6734 ALC275_FIXUP_DELL_XPS,
23adc192 6735 ALC293_FIXUP_LENOVO_SPK_NOISE,
3694cb29 6736 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
3b43b71f 6737 ALC255_FIXUP_DELL_SPK_NOISE,
d1dd4211 6738 ALC225_FIXUP_DISABLE_MIC_VREF,
2ae95577 6739 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
e312a869 6740 ALC295_FIXUP_DISABLE_DAC3,
d2cd795c 6741 ALC285_FIXUP_SPEAKER2_TO_DAC1,
f883982d 6742 ALC280_FIXUP_HP_HEADSET_MIC,
e549d190 6743 ALC221_FIXUP_HP_FRONT_MIC,
c636b95e 6744 ALC292_FIXUP_TPT460,
dd9aa335 6745 ALC298_FIXUP_SPK_VOLUME,
f86de9b1 6746 ALC298_FIXUP_LENOVO_SPK_VOLUME,
fd06c77e 6747 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
823ff161 6748 ALC269_FIXUP_ATIV_BOOK_8,
9eb5d0e6 6749 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
c1732ede
CC
6750 ALC256_FIXUP_ASUS_HEADSET_MODE,
6751 ALC256_FIXUP_ASUS_MIC,
eeed4cd1 6752 ALC256_FIXUP_ASUS_AIO_GPIO2,
216d7aeb
CC
6753 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
6754 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
ca169cc2 6755 ALC233_FIXUP_LENOVO_MULTI_CODECS,
ea5c7eba 6756 ALC233_FIXUP_ACER_HEADSET_MIC,
f33f79f3 6757 ALC294_FIXUP_LENOVO_MIC_LOCATION,
5f364135 6758 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
52e4e368 6759 ALC225_FIXUP_S3_POP_NOISE,
b84e8436 6760 ALC700_FIXUP_INTEL_REFERENCE,
92266651
KY
6761 ALC274_FIXUP_DELL_BIND_DACS,
6762 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
399c01aa 6763 ALC298_FIXUP_TPT470_DOCK_FIX,
61fcf8ec 6764 ALC298_FIXUP_TPT470_DOCK,
ae104a21 6765 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
f0ba9d69 6766 ALC255_FIXUP_DELL_HEADSET_MIC,
0fbf21c3 6767 ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
a2ef03fe 6768 ALC298_FIXUP_HUAWEI_MBX_STEREO,
bbf8ff6b 6769 ALC295_FIXUP_HP_X360,
8a328ac1 6770 ALC221_FIXUP_HP_HEADSET_MIC,
c4cfcf6f 6771 ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
e8ed64b0 6772 ALC295_FIXUP_HP_AUTO_MUTE,
33aaebd4 6773 ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
d8ae458e 6774 ALC294_FIXUP_ASUS_MIC,
4e051106
JHP
6775 ALC294_FIXUP_ASUS_HEADSET_MIC,
6776 ALC294_FIXUP_ASUS_SPK,
89e3a568 6777 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
c8c6ee61 6778 ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
cbc05fd6 6779 ALC255_FIXUP_ACER_HEADSET_MIC,
10f5b1b8 6780 ALC295_FIXUP_CHROME_BOOK,
8983eb60 6781 ALC225_FIXUP_HEADSET_JACK,
136824ef
KY
6782 ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
6783 ALC225_FIXUP_WYSE_AUTO_MUTE,
6784 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
667a8f73 6785 ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
8c8967a7 6786 ALC256_FIXUP_ASUS_HEADSET_MIC,
e1037354 6787 ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
e2a829b3 6788 ALC299_FIXUP_PREDATOR_SPK,
bd9c10bc 6789 ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
e79c2269
KY
6790 ALC289_FIXUP_DELL_SPK2,
6791 ALC289_FIXUP_DUAL_SPK,
48e01504
CC
6792 ALC294_FIXUP_SPK2_TO_DAC1,
6793 ALC294_FIXUP_ASUS_DUAL_SPK,
6a6660d0 6794 ALC285_FIXUP_THINKPAD_X1_GEN7,
76f7dec0 6795 ALC285_FIXUP_THINKPAD_HEADSET_JACK,
8b33a134 6796 ALC294_FIXUP_ASUS_HPE,
1b94e59d 6797 ALC294_FIXUP_ASUS_COEF_1B,
c3cdf189
LJ
6798 ALC294_FIXUP_ASUS_GX502_HP,
6799 ALC294_FIXUP_ASUS_GX502_PINS,
6800 ALC294_FIXUP_ASUS_GX502_VERBS,
c1b55029
DC
6801 ALC294_FIXUP_ASUS_GU502_HP,
6802 ALC294_FIXUP_ASUS_GU502_PINS,
6803 ALC294_FIXUP_ASUS_GU502_VERBS,
f5a88b0a 6804 ALC285_FIXUP_HP_GPIO_LED,
431e76c3 6805 ALC285_FIXUP_HP_MUTE_LED,
e7d66cf7 6806 ALC236_FIXUP_HP_GPIO_LED,
24164f43 6807 ALC236_FIXUP_HP_MUTE_LED,
75b62ab6 6808 ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
14425f1f 6809 ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
9e43342b 6810 ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
8eae7e9b 6811 ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
6e15d126 6812 ALC269VC_FIXUP_ACER_HEADSET_MIC,
781c90c0 6813 ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
293a92c1 6814 ALC289_FIXUP_ASUS_GA401,
4b43d05a 6815 ALC289_FIXUP_ASUS_GA502,
f50a121d 6816 ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
56496253 6817 ALC285_FIXUP_HP_GPIO_AMP_INIT,
f1ec5be1
HC
6818 ALC269_FIXUP_CZC_B20,
6819 ALC269_FIXUP_CZC_TMI,
6820 ALC269_FIXUP_CZC_L101,
6821 ALC269_FIXUP_LEMOTE_A1802,
6822 ALC269_FIXUP_LEMOTE_A190X,
e2d2fded 6823 ALC256_FIXUP_INTEL_NUC8_RUGGED,
d1ee66c5
PC
6824 ALC233_FIXUP_INTEL_NUC8_DMIC,
6825 ALC233_FIXUP_INTEL_NUC8_BOOST,
73e7161e 6826 ALC256_FIXUP_INTEL_NUC10,
fc19d559 6827 ALC255_FIXUP_XIAOMI_HEADSET_MIC,
13468bfa 6828 ALC274_FIXUP_HP_MIC,
8a8de09c 6829 ALC274_FIXUP_HP_HEADSET_MIC,
622464c8 6830 ALC274_FIXUP_HP_ENVY_GPIO,
ef9ce66f 6831 ALC256_FIXUP_ASUS_HPE,
446b8185 6832 ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
a0ccbc53 6833 ALC287_FIXUP_HP_GPIO_LED,
9e885770 6834 ALC256_FIXUP_HP_HEADSET_MIC,
c47b3112 6835 ALC245_FIXUP_HP_GPIO_LED,
92666d45 6836 ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
34cdf405 6837 ALC282_FIXUP_ACER_DISABLE_LINEOUT,
495dc763 6838 ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST,
d0e18561 6839 ALC256_FIXUP_ACER_HEADSET_MIC,
26928ca1 6840 ALC285_FIXUP_IDEAPAD_S740_COEF,
bd15b155 6841 ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST,
8eedd3a7 6842 ALC295_FIXUP_ASUS_DACS,
5d84b531 6843 ALC295_FIXUP_HP_OMEN,
f2be77fe 6844 ALC285_FIXUP_HP_SPECTRE_X360,
9ebaef05 6845 ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP,
29c8f40b 6846 ALC623_FIXUP_LENOVO_THINKSTATION_P340,
57c9e21a 6847 ALC255_FIXUP_ACER_HEADPHONE_AND_MIC,
8903376d 6848 ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST,
ad7cc2d4
CB
6849 ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS,
6850 ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
6851 ALC287_FIXUP_YOGA7_14ITL_SPEAKERS,
dd6dd6e3 6852 ALC287_FIXUP_13S_GEN2_SPEAKERS,
b9145ede 6853 ALC256_FIXUP_SET_COEF_DEFAULTS,
4803b99a 6854 ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
e1abacd3 6855 ALC233_FIXUP_NO_AUDIO_JACK,
f2ca7e35 6856 ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME,
e7e2503a
BF
6857 ALC285_FIXUP_LEGION_Y9000X_SPEAKERS,
6858 ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
f1d4e28b
KY
6859};
6860
1727a771 6861static const struct hda_fixup alc269_fixups[] = {
f73bbf63
KHF
6862 [ALC269_FIXUP_GPIO2] = {
6863 .type = HDA_FIXUP_FUNC,
6864 .v.func = alc_fixup_gpio2,
6865 },
1d045db9 6866 [ALC269_FIXUP_SONY_VAIO] = {
fd108215
TI
6867 .type = HDA_FIXUP_PINCTLS,
6868 .v.pins = (const struct hda_pintbl[]) {
6869 {0x19, PIN_VREFGRD},
1d045db9
TI
6870 {}
6871 }
f1d4e28b 6872 },
1d045db9 6873 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
ae065f1c
TI
6874 .type = HDA_FIXUP_FUNC,
6875 .v.func = alc275_fixup_gpio4_off,
1d045db9
TI
6876 .chained = true,
6877 .chain_id = ALC269_FIXUP_SONY_VAIO
6878 },
6879 [ALC269_FIXUP_DELL_M101Z] = {
1727a771 6880 .type = HDA_FIXUP_VERBS,
1d045db9
TI
6881 .v.verbs = (const struct hda_verb[]) {
6882 /* Enables internal speaker */
6883 {0x20, AC_VERB_SET_COEF_INDEX, 13},
6884 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
6885 {}
6886 }
6887 },
6888 [ALC269_FIXUP_SKU_IGNORE] = {
1727a771 6889 .type = HDA_FIXUP_FUNC,
23d30f28 6890 .v.func = alc_fixup_sku_ignore,
1d045db9
TI
6891 },
6892 [ALC269_FIXUP_ASUS_G73JW] = {
1727a771
TI
6893 .type = HDA_FIXUP_PINS,
6894 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
6895 { 0x17, 0x99130111 }, /* subwoofer */
6896 { }
6897 }
6898 },
6899 [ALC269_FIXUP_LENOVO_EAPD] = {
1727a771 6900 .type = HDA_FIXUP_VERBS,
1d045db9
TI
6901 .v.verbs = (const struct hda_verb[]) {
6902 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
6903 {}
6904 }
6905 },
6906 [ALC275_FIXUP_SONY_HWEQ] = {
1727a771 6907 .type = HDA_FIXUP_FUNC,
1d045db9
TI
6908 .v.func = alc269_fixup_hweq,
6909 .chained = true,
6910 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
6911 },
e9bd7d5c
TI
6912 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
6913 .type = HDA_FIXUP_FUNC,
6914 .v.func = alc_fixup_disable_aamix,
6915 .chained = true,
6916 .chain_id = ALC269_FIXUP_SONY_VAIO
6917 },
1d045db9 6918 [ALC271_FIXUP_DMIC] = {
1727a771 6919 .type = HDA_FIXUP_FUNC,
1d045db9 6920 .v.func = alc271_fixup_dmic,
f1d4e28b 6921 },
017f2a10 6922 [ALC269_FIXUP_PCM_44K] = {
1727a771 6923 .type = HDA_FIXUP_FUNC,
017f2a10 6924 .v.func = alc269_fixup_pcm_44k,
012e7eb1
DH
6925 .chained = true,
6926 .chain_id = ALC269_FIXUP_QUANTA_MUTE
017f2a10 6927 },
adabb3ec 6928 [ALC269_FIXUP_STEREO_DMIC] = {
1727a771 6929 .type = HDA_FIXUP_FUNC,
adabb3ec
TI
6930 .v.func = alc269_fixup_stereo_dmic,
6931 },
7c478f03
DH
6932 [ALC269_FIXUP_HEADSET_MIC] = {
6933 .type = HDA_FIXUP_FUNC,
6934 .v.func = alc269_fixup_headset_mic,
6935 },
24519911 6936 [ALC269_FIXUP_QUANTA_MUTE] = {
1727a771 6937 .type = HDA_FIXUP_FUNC,
24519911
TI
6938 .v.func = alc269_fixup_quanta_mute,
6939 },
6940 [ALC269_FIXUP_LIFEBOOK] = {
1727a771
TI
6941 .type = HDA_FIXUP_PINS,
6942 .v.pins = (const struct hda_pintbl[]) {
24519911
TI
6943 { 0x1a, 0x2101103f }, /* dock line-out */
6944 { 0x1b, 0x23a11040 }, /* dock mic-in */
6945 { }
6946 },
6947 .chained = true,
6948 .chain_id = ALC269_FIXUP_QUANTA_MUTE
6949 },
2041d564
DH
6950 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
6951 .type = HDA_FIXUP_PINS,
6952 .v.pins = (const struct hda_pintbl[]) {
6953 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
6954 { }
6955 },
6956 },
cc7016ab
TI
6957 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
6958 .type = HDA_FIXUP_PINS,
6959 .v.pins = (const struct hda_pintbl[]) {
6960 { 0x21, 0x0221102f }, /* HP out */
6961 { }
6962 },
6963 },
4df3fd17
TI
6964 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
6965 .type = HDA_FIXUP_FUNC,
6966 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
6967 },
fdcc968a
JMG
6968 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
6969 .type = HDA_FIXUP_FUNC,
6970 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
6971 },
a4297b5d 6972 [ALC269_FIXUP_AMIC] = {
1727a771
TI
6973 .type = HDA_FIXUP_PINS,
6974 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
6975 { 0x14, 0x99130110 }, /* speaker */
6976 { 0x15, 0x0121401f }, /* HP out */
6977 { 0x18, 0x01a19c20 }, /* mic */
6978 { 0x19, 0x99a3092f }, /* int-mic */
6979 { }
6980 },
6981 },
6982 [ALC269_FIXUP_DMIC] = {
1727a771
TI
6983 .type = HDA_FIXUP_PINS,
6984 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
6985 { 0x12, 0x99a3092f }, /* int-mic */
6986 { 0x14, 0x99130110 }, /* speaker */
6987 { 0x15, 0x0121401f }, /* HP out */
6988 { 0x18, 0x01a19c20 }, /* mic */
6989 { }
6990 },
6991 },
6992 [ALC269VB_FIXUP_AMIC] = {
1727a771
TI
6993 .type = HDA_FIXUP_PINS,
6994 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
6995 { 0x14, 0x99130110 }, /* speaker */
6996 { 0x18, 0x01a19c20 }, /* mic */
6997 { 0x19, 0x99a3092f }, /* int-mic */
6998 { 0x21, 0x0121401f }, /* HP out */
6999 { }
7000 },
7001 },
2267ea97 7002 [ALC269VB_FIXUP_DMIC] = {
1727a771
TI
7003 .type = HDA_FIXUP_PINS,
7004 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
7005 { 0x12, 0x99a3092f }, /* int-mic */
7006 { 0x14, 0x99130110 }, /* speaker */
7007 { 0x18, 0x01a19c20 }, /* mic */
7008 { 0x21, 0x0121401f }, /* HP out */
7009 { }
7010 },
7011 },
08fb0d0e 7012 [ALC269_FIXUP_HP_MUTE_LED] = {
1727a771 7013 .type = HDA_FIXUP_FUNC,
08fb0d0e 7014 .v.func = alc269_fixup_hp_mute_led,
6d3cd5d4 7015 },
d06ac143
DH
7016 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
7017 .type = HDA_FIXUP_FUNC,
7018 .v.func = alc269_fixup_hp_mute_led_mic1,
7019 },
08fb0d0e 7020 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
1727a771 7021 .type = HDA_FIXUP_FUNC,
08fb0d0e 7022 .v.func = alc269_fixup_hp_mute_led_mic2,
420b0feb 7023 },
7f783bd5
TB
7024 [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
7025 .type = HDA_FIXUP_FUNC,
7026 .v.func = alc269_fixup_hp_mute_led_mic3,
e8ed64b0
GKK
7027 .chained = true,
7028 .chain_id = ALC295_FIXUP_HP_AUTO_MUTE
7f783bd5 7029 },
9f5c6faf
TI
7030 [ALC269_FIXUP_HP_GPIO_LED] = {
7031 .type = HDA_FIXUP_FUNC,
7032 .v.func = alc269_fixup_hp_gpio_led,
7033 },
9c5dc3bf
KY
7034 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
7035 .type = HDA_FIXUP_FUNC,
7036 .v.func = alc269_fixup_hp_gpio_mic1_led,
7037 },
7038 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
7039 .type = HDA_FIXUP_FUNC,
7040 .v.func = alc269_fixup_hp_line1_mic1_led,
7041 },
693b613d 7042 [ALC269_FIXUP_INV_DMIC] = {
1727a771 7043 .type = HDA_FIXUP_FUNC,
9d36a7dc 7044 .v.func = alc_fixup_inv_dmic,
693b613d 7045 },
9b745ab8
TI
7046 [ALC269_FIXUP_NO_SHUTUP] = {
7047 .type = HDA_FIXUP_FUNC,
7048 .v.func = alc_fixup_no_shutup,
7049 },
108cc108 7050 [ALC269_FIXUP_LENOVO_DOCK] = {
1727a771
TI
7051 .type = HDA_FIXUP_PINS,
7052 .v.pins = (const struct hda_pintbl[]) {
108cc108
DH
7053 { 0x19, 0x23a11040 }, /* dock mic */
7054 { 0x1b, 0x2121103f }, /* dock headphone */
7055 { }
7056 },
7057 .chained = true,
7058 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
7059 },
b590b38c
TI
7060 [ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
7061 .type = HDA_FIXUP_FUNC,
7062 .v.func = alc269_fixup_limit_int_mic_boost,
7063 .chained = true,
7064 .chain_id = ALC269_FIXUP_LENOVO_DOCK,
7065 },
108cc108 7066 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
1727a771 7067 .type = HDA_FIXUP_FUNC,
108cc108 7068 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
52129000
DH
7069 .chained = true,
7070 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
108cc108 7071 },
73bdd597
DH
7072 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7073 .type = HDA_FIXUP_PINS,
7074 .v.pins = (const struct hda_pintbl[]) {
7075 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7076 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7077 { }
7078 },
7079 .chained = true,
7080 .chain_id = ALC269_FIXUP_HEADSET_MODE
7081 },
7082 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7083 .type = HDA_FIXUP_PINS,
7084 .v.pins = (const struct hda_pintbl[]) {
7085 { 0x16, 0x21014020 }, /* dock line out */
7086 { 0x19, 0x21a19030 }, /* dock mic */
7087 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7088 { }
7089 },
7090 .chained = true,
7091 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7092 },
338cae56
DH
7093 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
7094 .type = HDA_FIXUP_PINS,
7095 .v.pins = (const struct hda_pintbl[]) {
7096 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7097 { }
7098 },
7099 .chained = true,
7100 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7101 },
fcc6c877
KY
7102 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
7103 .type = HDA_FIXUP_PINS,
7104 .v.pins = (const struct hda_pintbl[]) {
7105 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7106 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7107 { }
7108 },
7109 .chained = true,
7110 .chain_id = ALC269_FIXUP_HEADSET_MODE
7111 },
73bdd597
DH
7112 [ALC269_FIXUP_HEADSET_MODE] = {
7113 .type = HDA_FIXUP_FUNC,
7114 .v.func = alc_fixup_headset_mode,
6676f308 7115 .chained = true,
b3802783 7116 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
73bdd597
DH
7117 },
7118 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7119 .type = HDA_FIXUP_FUNC,
7120 .v.func = alc_fixup_headset_mode_no_hp_mic,
7121 },
7819717b
TI
7122 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
7123 .type = HDA_FIXUP_PINS,
7124 .v.pins = (const struct hda_pintbl[]) {
7125 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
7126 { }
7127 },
7128 .chained = true,
7129 .chain_id = ALC269_FIXUP_HEADSET_MODE,
7130 },
88cfcf86
DH
7131 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
7132 .type = HDA_FIXUP_PINS,
7133 .v.pins = (const struct hda_pintbl[]) {
7134 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7135 { }
7136 },
fbc78ad6
DH
7137 .chained = true,
7138 .chain_id = ALC269_FIXUP_HEADSET_MIC
88cfcf86 7139 },
0fbf21c3 7140 [ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
8ac51bbc
AB
7141 .type = HDA_FIXUP_PINS,
7142 .v.pins = (const struct hda_pintbl[]) {
7143 {0x12, 0x90a60130},
7144 {0x13, 0x40000000},
7145 {0x14, 0x90170110},
7146 {0x18, 0x411111f0},
7147 {0x19, 0x04a11040},
7148 {0x1a, 0x411111f0},
7149 {0x1b, 0x90170112},
7150 {0x1d, 0x40759a05},
7151 {0x1e, 0x411111f0},
7152 {0x21, 0x04211020},
7153 { }
7154 },
e2744fd7
AB
7155 .chained = true,
7156 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
8ac51bbc 7157 },
a2ef03fe
TE
7158 [ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
7159 .type = HDA_FIXUP_FUNC,
7160 .v.func = alc298_fixup_huawei_mbx_stereo,
7161 .chained = true,
7162 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
7163 },
d240d1dc
DH
7164 [ALC269_FIXUP_ASUS_X101_FUNC] = {
7165 .type = HDA_FIXUP_FUNC,
7166 .v.func = alc269_fixup_x101_headset_mic,
7167 },
7168 [ALC269_FIXUP_ASUS_X101_VERB] = {
7169 .type = HDA_FIXUP_VERBS,
7170 .v.verbs = (const struct hda_verb[]) {
7171 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
7172 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
7173 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
7174 { }
7175 },
7176 .chained = true,
7177 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
7178 },
7179 [ALC269_FIXUP_ASUS_X101] = {
7180 .type = HDA_FIXUP_PINS,
7181 .v.pins = (const struct hda_pintbl[]) {
7182 { 0x18, 0x04a1182c }, /* Headset mic */
7183 { }
7184 },
7185 .chained = true,
7186 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
7187 },
08a978db 7188 [ALC271_FIXUP_AMIC_MIC2] = {
1727a771
TI
7189 .type = HDA_FIXUP_PINS,
7190 .v.pins = (const struct hda_pintbl[]) {
08a978db
DR
7191 { 0x14, 0x99130110 }, /* speaker */
7192 { 0x19, 0x01a19c20 }, /* mic */
7193 { 0x1b, 0x99a7012f }, /* int-mic */
7194 { 0x21, 0x0121401f }, /* HP out */
7195 { }
7196 },
7197 },
7198 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
1727a771 7199 .type = HDA_FIXUP_FUNC,
08a978db
DR
7200 .v.func = alc271_hp_gate_mic_jack,
7201 .chained = true,
7202 .chain_id = ALC271_FIXUP_AMIC_MIC2,
7203 },
b1e8972e
OR
7204 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
7205 .type = HDA_FIXUP_FUNC,
7206 .v.func = alc269_fixup_limit_int_mic_boost,
7207 .chained = true,
7208 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
7209 },
42397004
DR
7210 [ALC269_FIXUP_ACER_AC700] = {
7211 .type = HDA_FIXUP_PINS,
7212 .v.pins = (const struct hda_pintbl[]) {
7213 { 0x12, 0x99a3092f }, /* int-mic */
7214 { 0x14, 0x99130110 }, /* speaker */
7215 { 0x18, 0x03a11c20 }, /* mic */
7216 { 0x1e, 0x0346101e }, /* SPDIF1 */
7217 { 0x21, 0x0321101f }, /* HP out */
7218 { }
7219 },
7220 .chained = true,
7221 .chain_id = ALC271_FIXUP_DMIC,
7222 },
3e0d611b
DH
7223 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
7224 .type = HDA_FIXUP_FUNC,
7225 .v.func = alc269_fixup_limit_int_mic_boost,
2793769f
DH
7226 .chained = true,
7227 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
3e0d611b 7228 },
2cede303
OR
7229 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
7230 .type = HDA_FIXUP_FUNC,
7231 .v.func = alc269_fixup_limit_int_mic_boost,
7232 .chained = true,
7233 .chain_id = ALC269VB_FIXUP_DMIC,
7234 },
23870831
TI
7235 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
7236 .type = HDA_FIXUP_VERBS,
7237 .v.verbs = (const struct hda_verb[]) {
7238 /* class-D output amp +5dB */
7239 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
7240 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
7241 {}
7242 },
7243 .chained = true,
7244 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
7245 },
8e35cd4a
DH
7246 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
7247 .type = HDA_FIXUP_FUNC,
7248 .v.func = alc269_fixup_limit_int_mic_boost,
7249 .chained = true,
7250 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
7251 },
02b504d9
AA
7252 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
7253 .type = HDA_FIXUP_PINS,
7254 .v.pins = (const struct hda_pintbl[]) {
7255 { 0x12, 0x99a3092f }, /* int-mic */
7256 { 0x18, 0x03a11d20 }, /* mic */
7257 { 0x19, 0x411111f0 }, /* Unused bogus pin */
7258 { }
7259 },
7260 },
cd217a63
KY
7261 [ALC283_FIXUP_CHROME_BOOK] = {
7262 .type = HDA_FIXUP_FUNC,
7263 .v.func = alc283_fixup_chromebook,
7264 },
0202e99c
KY
7265 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
7266 .type = HDA_FIXUP_FUNC,
7267 .v.func = alc283_fixup_sense_combo_jack,
7268 .chained = true,
7269 .chain_id = ALC283_FIXUP_CHROME_BOOK,
7270 },
7bba2157
TI
7271 [ALC282_FIXUP_ASUS_TX300] = {
7272 .type = HDA_FIXUP_FUNC,
7273 .v.func = alc282_fixup_asus_tx300,
7274 },
1bb3e062
KY
7275 [ALC283_FIXUP_INT_MIC] = {
7276 .type = HDA_FIXUP_VERBS,
7277 .v.verbs = (const struct hda_verb[]) {
7278 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
7279 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
7280 { }
7281 },
7282 .chained = true,
7283 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7284 },
0f4881dc
DH
7285 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
7286 .type = HDA_FIXUP_PINS,
7287 .v.pins = (const struct hda_pintbl[]) {
7288 { 0x17, 0x90170112 }, /* subwoofer */
7289 { }
7290 },
7291 .chained = true,
7292 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7293 },
7294 [ALC290_FIXUP_SUBWOOFER] = {
7295 .type = HDA_FIXUP_PINS,
7296 .v.pins = (const struct hda_pintbl[]) {
7297 { 0x17, 0x90170112 }, /* subwoofer */
7298 { }
7299 },
7300 .chained = true,
7301 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
7302 },
338cae56
DH
7303 [ALC290_FIXUP_MONO_SPEAKERS] = {
7304 .type = HDA_FIXUP_FUNC,
7305 .v.func = alc290_fixup_mono_speakers,
0f4881dc
DH
7306 },
7307 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
7308 .type = HDA_FIXUP_FUNC,
7309 .v.func = alc290_fixup_mono_speakers,
338cae56
DH
7310 .chained = true,
7311 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
7312 },
b67ae3f1
DH
7313 [ALC269_FIXUP_THINKPAD_ACPI] = {
7314 .type = HDA_FIXUP_FUNC,
d5a6cabf 7315 .v.func = alc_fixup_thinkpad_acpi,
09da111a
TI
7316 .chained = true,
7317 .chain_id = ALC269_FIXUP_SKU_IGNORE,
b67ae3f1 7318 },
56f27013
DH
7319 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
7320 .type = HDA_FIXUP_FUNC,
7321 .v.func = alc_fixup_inv_dmic,
7322 .chained = true,
7323 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7324 },
5824ce8d 7325 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
17d30460
HW
7326 .type = HDA_FIXUP_PINS,
7327 .v.pins = (const struct hda_pintbl[]) {
7328 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7329 { }
5824ce8d
CC
7330 },
7331 .chained = true,
17d30460 7332 .chain_id = ALC255_FIXUP_HEADSET_MODE
5824ce8d 7333 },
615966ad
CC
7334 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7335 .type = HDA_FIXUP_PINS,
7336 .v.pins = (const struct hda_pintbl[]) {
7337 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7338 { }
7339 },
7340 .chained = true,
7341 .chain_id = ALC255_FIXUP_HEADSET_MODE
7342 },
9a22a8f5
KY
7343 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7344 .type = HDA_FIXUP_PINS,
7345 .v.pins = (const struct hda_pintbl[]) {
7346 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7347 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7348 { }
7349 },
7350 .chained = true,
7351 .chain_id = ALC255_FIXUP_HEADSET_MODE
7352 },
31278997
KY
7353 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7354 .type = HDA_FIXUP_PINS,
7355 .v.pins = (const struct hda_pintbl[]) {
7356 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7357 { }
7358 },
7359 .chained = true,
7360 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
7361 },
9a22a8f5
KY
7362 [ALC255_FIXUP_HEADSET_MODE] = {
7363 .type = HDA_FIXUP_FUNC,
7364 .v.func = alc_fixup_headset_mode_alc255,
4a83d42a 7365 .chained = true,
b3802783 7366 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
9a22a8f5 7367 },
31278997
KY
7368 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7369 .type = HDA_FIXUP_FUNC,
7370 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
7371 },
a22aa26f
KY
7372 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7373 .type = HDA_FIXUP_PINS,
7374 .v.pins = (const struct hda_pintbl[]) {
7375 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7376 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7377 { }
7378 },
7379 .chained = true,
7380 .chain_id = ALC269_FIXUP_HEADSET_MODE
7381 },
1c37c223 7382 [ALC292_FIXUP_TPT440_DOCK] = {
ec56af67 7383 .type = HDA_FIXUP_FUNC,
7f57d803 7384 .v.func = alc_fixup_tpt440_dock,
1c37c223
TI
7385 .chained = true,
7386 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7387 },
9a811230
TI
7388 [ALC292_FIXUP_TPT440] = {
7389 .type = HDA_FIXUP_FUNC,
157f0b7f 7390 .v.func = alc_fixup_disable_aamix,
9a811230
TI
7391 .chained = true,
7392 .chain_id = ALC292_FIXUP_TPT440_DOCK,
7393 },
abaa2274 7394 [ALC283_FIXUP_HEADSET_MIC] = {
9dc12862
DD
7395 .type = HDA_FIXUP_PINS,
7396 .v.pins = (const struct hda_pintbl[]) {
7397 { 0x19, 0x04a110f0 },
7398 { },
7399 },
7400 },
b3802783 7401 [ALC255_FIXUP_MIC_MUTE_LED] = {
00ef9940 7402 .type = HDA_FIXUP_FUNC,
8a503555 7403 .v.func = alc_fixup_micmute_led,
00ef9940 7404 },
1a22e775
TI
7405 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
7406 .type = HDA_FIXUP_PINS,
7407 .v.pins = (const struct hda_pintbl[]) {
7408 { 0x12, 0x90a60130 },
7409 { 0x14, 0x90170110 },
7410 { 0x17, 0x40000008 },
7411 { 0x18, 0x411111f0 },
0420694d 7412 { 0x19, 0x01a1913c },
1a22e775
TI
7413 { 0x1a, 0x411111f0 },
7414 { 0x1b, 0x411111f0 },
7415 { 0x1d, 0x40f89b2d },
7416 { 0x1e, 0x411111f0 },
7417 { 0x21, 0x0321101f },
7418 { },
7419 },
7420 },
c8426b27
TI
7421 [ALC269VB_FIXUP_ASPIRE_E1_COEF] = {
7422 .type = HDA_FIXUP_FUNC,
7423 .v.func = alc269vb_fixup_aspire_e1_coef,
7424 },
7a5255f1
DH
7425 [ALC280_FIXUP_HP_GPIO4] = {
7426 .type = HDA_FIXUP_FUNC,
7427 .v.func = alc280_fixup_hp_gpio4,
7428 },
eaa8e5ef
KY
7429 [ALC286_FIXUP_HP_GPIO_LED] = {
7430 .type = HDA_FIXUP_FUNC,
7431 .v.func = alc286_fixup_hp_gpio_led,
7432 },
33f4acd3
DH
7433 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
7434 .type = HDA_FIXUP_FUNC,
7435 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
7436 },
b4b33f9d
TC
7437 [ALC280_FIXUP_HP_DOCK_PINS] = {
7438 .type = HDA_FIXUP_PINS,
7439 .v.pins = (const struct hda_pintbl[]) {
7440 { 0x1b, 0x21011020 }, /* line-out */
7441 { 0x1a, 0x01a1903c }, /* headset mic */
7442 { 0x18, 0x2181103f }, /* line-in */
7443 { },
7444 },
7445 .chained = true,
7446 .chain_id = ALC280_FIXUP_HP_GPIO4
7447 },
04d5466a
JK
7448 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
7449 .type = HDA_FIXUP_PINS,
7450 .v.pins = (const struct hda_pintbl[]) {
7451 { 0x1b, 0x21011020 }, /* line-out */
7452 { 0x18, 0x2181103f }, /* line-in */
7453 { },
7454 },
7455 .chained = true,
7456 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
7457 },
98973f2f
KP
7458 [ALC280_FIXUP_HP_9480M] = {
7459 .type = HDA_FIXUP_FUNC,
7460 .v.func = alc280_fixup_hp_9480m,
7461 },
c3bb2b52
TI
7462 [ALC245_FIXUP_HP_X360_AMP] = {
7463 .type = HDA_FIXUP_FUNC,
7464 .v.func = alc245_fixup_hp_x360_amp,
c47b3112
JC
7465 .chained = true,
7466 .chain_id = ALC245_FIXUP_HP_GPIO_LED
c3bb2b52 7467 },
e1e62b98
KY
7468 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
7469 .type = HDA_FIXUP_FUNC,
7470 .v.func = alc_fixup_headset_mode_dell_alc288,
7471 .chained = true,
b3802783 7472 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
e1e62b98
KY
7473 },
7474 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7475 .type = HDA_FIXUP_PINS,
7476 .v.pins = (const struct hda_pintbl[]) {
7477 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7478 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7479 { }
7480 },
7481 .chained = true,
7482 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
7483 },
831bfdf9
HW
7484 [ALC288_FIXUP_DISABLE_AAMIX] = {
7485 .type = HDA_FIXUP_FUNC,
7486 .v.func = alc_fixup_disable_aamix,
7487 .chained = true,
d44a6864 7488 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
831bfdf9
HW
7489 },
7490 [ALC288_FIXUP_DELL_XPS_13] = {
7491 .type = HDA_FIXUP_FUNC,
7492 .v.func = alc_fixup_dell_xps13,
7493 .chained = true,
7494 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
7495 },
8b99aba7
TI
7496 [ALC292_FIXUP_DISABLE_AAMIX] = {
7497 .type = HDA_FIXUP_FUNC,
7498 .v.func = alc_fixup_disable_aamix,
831bfdf9
HW
7499 .chained = true,
7500 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
8b99aba7 7501 },
c04017ea
DH
7502 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
7503 .type = HDA_FIXUP_FUNC,
7504 .v.func = alc_fixup_disable_aamix,
7505 .chained = true,
7506 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
7507 },
5fab5829 7508 [ALC292_FIXUP_DELL_E7X_AAMIX] = {
8b99aba7
TI
7509 .type = HDA_FIXUP_FUNC,
7510 .v.func = alc_fixup_dell_xps13,
7511 .chained = true,
7512 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
7513 },
5fab5829
TI
7514 [ALC292_FIXUP_DELL_E7X] = {
7515 .type = HDA_FIXUP_FUNC,
8a503555 7516 .v.func = alc_fixup_micmute_led,
5fab5829
TI
7517 /* micmute fixup must be applied at last */
7518 .chained_before = true,
7519 .chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
7520 },
54324221
JM
7521 [ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
7522 .type = HDA_FIXUP_PINS,
7523 .v.pins = (const struct hda_pintbl[]) {
7524 { 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
7525 { }
7526 },
7527 .chained_before = true,
7528 .chain_id = ALC269_FIXUP_HEADSET_MODE,
7529 },
977e6276
KY
7530 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7531 .type = HDA_FIXUP_PINS,
7532 .v.pins = (const struct hda_pintbl[]) {
7533 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7534 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7535 { }
7536 },
7537 .chained = true,
7538 .chain_id = ALC269_FIXUP_HEADSET_MODE
7539 },
2f726aec
HW
7540 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
7541 .type = HDA_FIXUP_PINS,
7542 .v.pins = (const struct hda_pintbl[]) {
7543 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7544 { }
7545 },
7546 .chained = true,
7547 .chain_id = ALC269_FIXUP_HEADSET_MODE
7548 },
6ed1131f
KY
7549 [ALC275_FIXUP_DELL_XPS] = {
7550 .type = HDA_FIXUP_VERBS,
7551 .v.verbs = (const struct hda_verb[]) {
7552 /* Enables internal speaker */
7553 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
7554 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
7555 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
7556 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
7557 {}
7558 }
7559 },
23adc192
HW
7560 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
7561 .type = HDA_FIXUP_FUNC,
7562 .v.func = alc_fixup_disable_aamix,
7563 .chained = true,
7564 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7565 },
3694cb29
K
7566 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
7567 .type = HDA_FIXUP_FUNC,
7568 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
7569 },
d1ee66c5
PC
7570 [ALC233_FIXUP_INTEL_NUC8_DMIC] = {
7571 .type = HDA_FIXUP_FUNC,
7572 .v.func = alc_fixup_inv_dmic,
7573 .chained = true,
7574 .chain_id = ALC233_FIXUP_INTEL_NUC8_BOOST,
7575 },
7576 [ALC233_FIXUP_INTEL_NUC8_BOOST] = {
7577 .type = HDA_FIXUP_FUNC,
7578 .v.func = alc269_fixup_limit_int_mic_boost
7579 },
3b43b71f
KHF
7580 [ALC255_FIXUP_DELL_SPK_NOISE] = {
7581 .type = HDA_FIXUP_FUNC,
7582 .v.func = alc_fixup_disable_aamix,
7583 .chained = true,
7584 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7585 },
d1dd4211
KY
7586 [ALC225_FIXUP_DISABLE_MIC_VREF] = {
7587 .type = HDA_FIXUP_FUNC,
7588 .v.func = alc_fixup_disable_mic_vref,
7589 .chained = true,
7590 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7591 },
2ae95577
DH
7592 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7593 .type = HDA_FIXUP_VERBS,
7594 .v.verbs = (const struct hda_verb[]) {
7595 /* Disable pass-through path for FRONT 14h */
7596 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7597 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7598 {}
7599 },
7600 .chained = true,
d1dd4211 7601 .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
2ae95577 7602 },
f883982d
TI
7603 [ALC280_FIXUP_HP_HEADSET_MIC] = {
7604 .type = HDA_FIXUP_FUNC,
7605 .v.func = alc_fixup_disable_aamix,
7606 .chained = true,
7607 .chain_id = ALC269_FIXUP_HEADSET_MIC,
7608 },
e549d190
HW
7609 [ALC221_FIXUP_HP_FRONT_MIC] = {
7610 .type = HDA_FIXUP_PINS,
7611 .v.pins = (const struct hda_pintbl[]) {
7612 { 0x19, 0x02a19020 }, /* Front Mic */
7613 { }
7614 },
7615 },
c636b95e
SE
7616 [ALC292_FIXUP_TPT460] = {
7617 .type = HDA_FIXUP_FUNC,
7618 .v.func = alc_fixup_tpt440_dock,
7619 .chained = true,
7620 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
7621 },
dd9aa335
HW
7622 [ALC298_FIXUP_SPK_VOLUME] = {
7623 .type = HDA_FIXUP_FUNC,
7624 .v.func = alc298_fixup_speaker_volume,
59ec4b57 7625 .chained = true,
2f726aec 7626 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
dd9aa335 7627 },
f86de9b1
KY
7628 [ALC298_FIXUP_LENOVO_SPK_VOLUME] = {
7629 .type = HDA_FIXUP_FUNC,
7630 .v.func = alc298_fixup_speaker_volume,
7631 },
e312a869
TI
7632 [ALC295_FIXUP_DISABLE_DAC3] = {
7633 .type = HDA_FIXUP_FUNC,
7634 .v.func = alc295_fixup_disable_dac3,
7635 },
d2cd795c
JK
7636 [ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
7637 .type = HDA_FIXUP_FUNC,
7638 .v.func = alc285_fixup_speaker2_to_dac1,
c37c0ab0
HW
7639 .chained = true,
7640 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
d2cd795c 7641 },
fd06c77e
KHF
7642 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
7643 .type = HDA_FIXUP_PINS,
7644 .v.pins = (const struct hda_pintbl[]) {
7645 { 0x1b, 0x90170151 },
7646 { }
7647 },
7648 .chained = true,
7649 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7650 },
823ff161
GM
7651 [ALC269_FIXUP_ATIV_BOOK_8] = {
7652 .type = HDA_FIXUP_FUNC,
7653 .v.func = alc_fixup_auto_mute_via_amp,
7654 .chained = true,
7655 .chain_id = ALC269_FIXUP_NO_SHUTUP
7656 },
9eb5d0e6
KY
7657 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
7658 .type = HDA_FIXUP_PINS,
7659 .v.pins = (const struct hda_pintbl[]) {
7660 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7661 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7662 { }
7663 },
7664 .chained = true,
7665 .chain_id = ALC269_FIXUP_HEADSET_MODE
7666 },
c1732ede
CC
7667 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
7668 .type = HDA_FIXUP_FUNC,
7669 .v.func = alc_fixup_headset_mode,
7670 },
7671 [ALC256_FIXUP_ASUS_MIC] = {
7672 .type = HDA_FIXUP_PINS,
7673 .v.pins = (const struct hda_pintbl[]) {
7674 { 0x13, 0x90a60160 }, /* use as internal mic */
7675 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7676 { }
7677 },
7678 .chained = true,
7679 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7680 },
eeed4cd1 7681 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
ae065f1c
TI
7682 .type = HDA_FIXUP_FUNC,
7683 /* Set up GPIO2 for the speaker amp */
7684 .v.func = alc_fixup_gpio4,
eeed4cd1 7685 },
216d7aeb
CC
7686 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7687 .type = HDA_FIXUP_PINS,
7688 .v.pins = (const struct hda_pintbl[]) {
7689 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7690 { }
7691 },
7692 .chained = true,
7693 .chain_id = ALC269_FIXUP_HEADSET_MIC
7694 },
7695 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
7696 .type = HDA_FIXUP_VERBS,
7697 .v.verbs = (const struct hda_verb[]) {
7698 /* Enables internal speaker */
7699 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
7700 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
7701 {}
7702 },
7703 .chained = true,
7704 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7705 },
ca169cc2
KY
7706 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
7707 .type = HDA_FIXUP_FUNC,
7708 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
f73bbf63
KHF
7709 .chained = true,
7710 .chain_id = ALC269_FIXUP_GPIO2
ca169cc2 7711 },
ea5c7eba
JHP
7712 [ALC233_FIXUP_ACER_HEADSET_MIC] = {
7713 .type = HDA_FIXUP_VERBS,
7714 .v.verbs = (const struct hda_verb[]) {
7715 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
7716 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
7717 { }
7718 },
7719 .chained = true,
7720 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7721 },
f33f79f3
HW
7722 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
7723 .type = HDA_FIXUP_PINS,
7724 .v.pins = (const struct hda_pintbl[]) {
7725 /* Change the mic location from front to right, otherwise there are
7726 two front mics with the same name, pulseaudio can't handle them.
7727 This is just a temporary workaround, after applying this fixup,
7728 there will be one "Front Mic" and one "Mic" in this machine.
7729 */
7730 { 0x1a, 0x04a19040 },
7731 { }
7732 },
7733 },
5f364135
KY
7734 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
7735 .type = HDA_FIXUP_PINS,
7736 .v.pins = (const struct hda_pintbl[]) {
7737 { 0x16, 0x0101102f }, /* Rear Headset HP */
7738 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
7739 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
7740 { 0x1b, 0x02011020 },
7741 { }
7742 },
7743 .chained = true,
52e4e368
KHF
7744 .chain_id = ALC225_FIXUP_S3_POP_NOISE
7745 },
7746 [ALC225_FIXUP_S3_POP_NOISE] = {
7747 .type = HDA_FIXUP_FUNC,
7748 .v.func = alc225_fixup_s3_pop_noise,
7749 .chained = true,
5f364135
KY
7750 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7751 },
b84e8436
PH
7752 [ALC700_FIXUP_INTEL_REFERENCE] = {
7753 .type = HDA_FIXUP_VERBS,
7754 .v.verbs = (const struct hda_verb[]) {
7755 /* Enables internal speaker */
7756 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
7757 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
7758 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
7759 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
7760 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
7761 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
7762 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
7763 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
7764 {}
7765 }
7766 },
92266651
KY
7767 [ALC274_FIXUP_DELL_BIND_DACS] = {
7768 .type = HDA_FIXUP_FUNC,
7769 .v.func = alc274_fixup_bind_dacs,
7770 .chained = true,
7771 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7772 },
7773 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
7774 .type = HDA_FIXUP_PINS,
7775 .v.pins = (const struct hda_pintbl[]) {
7776 { 0x1b, 0x0401102f },
7777 { }
7778 },
7779 .chained = true,
7780 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
7781 },
399c01aa 7782 [ALC298_FIXUP_TPT470_DOCK_FIX] = {
61fcf8ec
KY
7783 .type = HDA_FIXUP_FUNC,
7784 .v.func = alc_fixup_tpt470_dock,
7785 .chained = true,
7786 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
7787 },
399c01aa
TI
7788 [ALC298_FIXUP_TPT470_DOCK] = {
7789 .type = HDA_FIXUP_FUNC,
7790 .v.func = alc_fixup_tpt470_dacs,
7791 .chained = true,
7792 .chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
7793 },
ae104a21
KY
7794 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
7795 .type = HDA_FIXUP_PINS,
7796 .v.pins = (const struct hda_pintbl[]) {
7797 { 0x14, 0x0201101f },
7798 { }
7799 },
7800 .chained = true,
7801 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7802 },
f0ba9d69
KY
7803 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
7804 .type = HDA_FIXUP_PINS,
7805 .v.pins = (const struct hda_pintbl[]) {
7806 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7807 { }
7808 },
3ce0d5aa
HW
7809 .chained = true,
7810 .chain_id = ALC269_FIXUP_HEADSET_MIC
f0ba9d69 7811 },
bbf8ff6b
TB
7812 [ALC295_FIXUP_HP_X360] = {
7813 .type = HDA_FIXUP_FUNC,
7814 .v.func = alc295_fixup_hp_top_speakers,
7815 .chained = true,
7816 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
8a328ac1
KY
7817 },
7818 [ALC221_FIXUP_HP_HEADSET_MIC] = {
7819 .type = HDA_FIXUP_PINS,
7820 .v.pins = (const struct hda_pintbl[]) {
7821 { 0x19, 0x0181313f},
7822 { }
7823 },
7824 .chained = true,
7825 .chain_id = ALC269_FIXUP_HEADSET_MIC
7826 },
c4cfcf6f
HW
7827 [ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
7828 .type = HDA_FIXUP_FUNC,
7829 .v.func = alc285_fixup_invalidate_dacs,
6ba189c5
HW
7830 .chained = true,
7831 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
c4cfcf6f 7832 },
e8ed64b0
GKK
7833 [ALC295_FIXUP_HP_AUTO_MUTE] = {
7834 .type = HDA_FIXUP_FUNC,
7835 .v.func = alc_fixup_auto_mute_via_amp,
7836 },
33aaebd4
CC
7837 [ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
7838 .type = HDA_FIXUP_PINS,
7839 .v.pins = (const struct hda_pintbl[]) {
7840 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7841 { }
7842 },
7843 .chained = true,
7844 .chain_id = ALC269_FIXUP_HEADSET_MIC
7845 },
d8ae458e
CC
7846 [ALC294_FIXUP_ASUS_MIC] = {
7847 .type = HDA_FIXUP_PINS,
7848 .v.pins = (const struct hda_pintbl[]) {
7849 { 0x13, 0x90a60160 }, /* use as internal mic */
7850 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7851 { }
7852 },
7853 .chained = true,
ef9ddb9d 7854 .chain_id = ALC269_FIXUP_HEADSET_MIC
d8ae458e 7855 },
4e051106
JHP
7856 [ALC294_FIXUP_ASUS_HEADSET_MIC] = {
7857 .type = HDA_FIXUP_PINS,
7858 .v.pins = (const struct hda_pintbl[]) {
82b01149 7859 { 0x19, 0x01a1103c }, /* use as headset mic */
4e051106
JHP
7860 { }
7861 },
7862 .chained = true,
ef9ddb9d 7863 .chain_id = ALC269_FIXUP_HEADSET_MIC
4e051106
JHP
7864 },
7865 [ALC294_FIXUP_ASUS_SPK] = {
7866 .type = HDA_FIXUP_VERBS,
7867 .v.verbs = (const struct hda_verb[]) {
7868 /* Set EAPD high */
7869 { 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
7870 { 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
473fbe13
KY
7871 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7872 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
4e051106
JHP
7873 { }
7874 },
7875 .chained = true,
7876 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7877 },
c8a9afa6 7878 [ALC295_FIXUP_CHROME_BOOK] = {
e854747d 7879 .type = HDA_FIXUP_FUNC,
c8a9afa6 7880 .v.func = alc295_fixup_chromebook,
8983eb60
KY
7881 .chained = true,
7882 .chain_id = ALC225_FIXUP_HEADSET_JACK
7883 },
7884 [ALC225_FIXUP_HEADSET_JACK] = {
7885 .type = HDA_FIXUP_FUNC,
7886 .v.func = alc_fixup_headset_jack,
e854747d 7887 },
89e3a568
JS
7888 [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
7889 .type = HDA_FIXUP_PINS,
7890 .v.pins = (const struct hda_pintbl[]) {
7891 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7892 { }
7893 },
7894 .chained = true,
7895 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7896 },
c8c6ee61
HW
7897 [ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
7898 .type = HDA_FIXUP_VERBS,
7899 .v.verbs = (const struct hda_verb[]) {
7900 /* Disable PCBEEP-IN passthrough */
7901 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7902 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7903 { }
7904 },
7905 .chained = true,
7906 .chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
7907 },
cbc05fd6
JHP
7908 [ALC255_FIXUP_ACER_HEADSET_MIC] = {
7909 .type = HDA_FIXUP_PINS,
7910 .v.pins = (const struct hda_pintbl[]) {
7911 { 0x19, 0x03a11130 },
7912 { 0x1a, 0x90a60140 }, /* use as internal mic */
7913 { }
7914 },
7915 .chained = true,
7916 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
7917 },
136824ef
KY
7918 [ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
7919 .type = HDA_FIXUP_PINS,
7920 .v.pins = (const struct hda_pintbl[]) {
7921 { 0x16, 0x01011020 }, /* Rear Line out */
7922 { 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
7923 { }
7924 },
7925 .chained = true,
7926 .chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
7927 },
7928 [ALC225_FIXUP_WYSE_AUTO_MUTE] = {
7929 .type = HDA_FIXUP_FUNC,
7930 .v.func = alc_fixup_auto_mute_via_amp,
7931 .chained = true,
7932 .chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
7933 },
7934 [ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
7935 .type = HDA_FIXUP_FUNC,
7936 .v.func = alc_fixup_disable_mic_vref,
7937 .chained = true,
7938 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7939 },
667a8f73
JHP
7940 [ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
7941 .type = HDA_FIXUP_VERBS,
7942 .v.verbs = (const struct hda_verb[]) {
7943 { 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
7944 { 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
7945 { }
7946 },
7947 .chained = true,
7948 .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
7949 },
8c8967a7
DD
7950 [ALC256_FIXUP_ASUS_HEADSET_MIC] = {
7951 .type = HDA_FIXUP_PINS,
7952 .v.pins = (const struct hda_pintbl[]) {
7953 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
7954 { }
7955 },
7956 .chained = true,
7957 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7958 },
e1037354
JHP
7959 [ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7960 .type = HDA_FIXUP_PINS,
7961 .v.pins = (const struct hda_pintbl[]) {
7962 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7963 { }
7964 },
7965 .chained = true,
7966 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7967 },
e2a829b3
BR
7968 [ALC299_FIXUP_PREDATOR_SPK] = {
7969 .type = HDA_FIXUP_PINS,
7970 .v.pins = (const struct hda_pintbl[]) {
7971 { 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
7972 { }
7973 }
7974 },
bd9c10bc 7975 [ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
60083f9e
JHP
7976 .type = HDA_FIXUP_PINS,
7977 .v.pins = (const struct hda_pintbl[]) {
bd9c10bc
JMG
7978 { 0x19, 0x04a11040 },
7979 { 0x21, 0x04211020 },
60083f9e
JHP
7980 { }
7981 },
7982 .chained = true,
bd9c10bc 7983 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
60083f9e 7984 },
e79c2269 7985 [ALC289_FIXUP_DELL_SPK2] = {
bd9c10bc
JMG
7986 .type = HDA_FIXUP_PINS,
7987 .v.pins = (const struct hda_pintbl[]) {
e79c2269 7988 { 0x17, 0x90170130 }, /* bass spk */
bd9c10bc
JMG
7989 { }
7990 },
7991 .chained = true,
e79c2269 7992 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
bd9c10bc 7993 },
e79c2269
KY
7994 [ALC289_FIXUP_DUAL_SPK] = {
7995 .type = HDA_FIXUP_FUNC,
7996 .v.func = alc285_fixup_speaker2_to_dac1,
7997 .chained = true,
7998 .chain_id = ALC289_FIXUP_DELL_SPK2
7999 },
48e01504
CC
8000 [ALC294_FIXUP_SPK2_TO_DAC1] = {
8001 .type = HDA_FIXUP_FUNC,
8002 .v.func = alc285_fixup_speaker2_to_dac1,
8003 .chained = true,
8004 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8005 },
8006 [ALC294_FIXUP_ASUS_DUAL_SPK] = {
436e2550
JHP
8007 .type = HDA_FIXUP_FUNC,
8008 /* The GPIO must be pulled to initialize the AMP */
8009 .v.func = alc_fixup_gpio4,
8010 .chained = true,
48e01504 8011 .chain_id = ALC294_FIXUP_SPK2_TO_DAC1
436e2550 8012 },
6a6660d0
TI
8013 [ALC285_FIXUP_THINKPAD_X1_GEN7] = {
8014 .type = HDA_FIXUP_FUNC,
8015 .v.func = alc285_fixup_thinkpad_x1_gen7,
8016 .chained = true,
8017 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8018 },
76f7dec0
KY
8019 [ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
8020 .type = HDA_FIXUP_FUNC,
8021 .v.func = alc_fixup_headset_jack,
8022 .chained = true,
6a6660d0 8023 .chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
76f7dec0 8024 },
8b33a134
JHP
8025 [ALC294_FIXUP_ASUS_HPE] = {
8026 .type = HDA_FIXUP_VERBS,
8027 .v.verbs = (const struct hda_verb[]) {
8028 /* Set EAPD high */
8029 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8030 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
8031 { }
8032 },
8033 .chained = true,
8034 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8035 },
c3cdf189
LJ
8036 [ALC294_FIXUP_ASUS_GX502_PINS] = {
8037 .type = HDA_FIXUP_PINS,
8038 .v.pins = (const struct hda_pintbl[]) {
8039 { 0x19, 0x03a11050 }, /* front HP mic */
8040 { 0x1a, 0x01a11830 }, /* rear external mic */
8041 { 0x21, 0x03211020 }, /* front HP out */
8042 { }
8043 },
8044 .chained = true,
8045 .chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
8046 },
8047 [ALC294_FIXUP_ASUS_GX502_VERBS] = {
8048 .type = HDA_FIXUP_VERBS,
8049 .v.verbs = (const struct hda_verb[]) {
8050 /* set 0x15 to HP-OUT ctrl */
8051 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8052 /* unmute the 0x15 amp */
8053 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8054 { }
8055 },
8056 .chained = true,
8057 .chain_id = ALC294_FIXUP_ASUS_GX502_HP
8058 },
8059 [ALC294_FIXUP_ASUS_GX502_HP] = {
8060 .type = HDA_FIXUP_FUNC,
8061 .v.func = alc294_fixup_gx502_hp,
8062 },
c1b55029
DC
8063 [ALC294_FIXUP_ASUS_GU502_PINS] = {
8064 .type = HDA_FIXUP_PINS,
8065 .v.pins = (const struct hda_pintbl[]) {
8066 { 0x19, 0x01a11050 }, /* rear HP mic */
8067 { 0x1a, 0x01a11830 }, /* rear external mic */
8068 { 0x21, 0x012110f0 }, /* rear HP out */
8069 { }
8070 },
8071 .chained = true,
8072 .chain_id = ALC294_FIXUP_ASUS_GU502_VERBS
8073 },
8074 [ALC294_FIXUP_ASUS_GU502_VERBS] = {
8075 .type = HDA_FIXUP_VERBS,
8076 .v.verbs = (const struct hda_verb[]) {
8077 /* set 0x15 to HP-OUT ctrl */
8078 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8079 /* unmute the 0x15 amp */
8080 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8081 /* set 0x1b to HP-OUT */
8082 { 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
8083 { }
8084 },
8085 .chained = true,
8086 .chain_id = ALC294_FIXUP_ASUS_GU502_HP
8087 },
8088 [ALC294_FIXUP_ASUS_GU502_HP] = {
8089 .type = HDA_FIXUP_FUNC,
8090 .v.func = alc294_fixup_gu502_hp,
8091 },
1b94e59d
TI
8092 [ALC294_FIXUP_ASUS_COEF_1B] = {
8093 .type = HDA_FIXUP_VERBS,
8094 .v.verbs = (const struct hda_verb[]) {
8095 /* Set bit 10 to correct noisy output after reboot from
8096 * Windows 10 (due to pop noise reduction?)
8097 */
8098 { 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
8099 { 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
8100 { }
8101 },
f8fbcdfb
TI
8102 .chained = true,
8103 .chain_id = ALC289_FIXUP_ASUS_GA401,
1b94e59d 8104 },
f5a88b0a
KHF
8105 [ALC285_FIXUP_HP_GPIO_LED] = {
8106 .type = HDA_FIXUP_FUNC,
8107 .v.func = alc285_fixup_hp_gpio_led,
8108 },
431e76c3
KY
8109 [ALC285_FIXUP_HP_MUTE_LED] = {
8110 .type = HDA_FIXUP_FUNC,
8111 .v.func = alc285_fixup_hp_mute_led,
8112 },
e7d66cf7
JS
8113 [ALC236_FIXUP_HP_GPIO_LED] = {
8114 .type = HDA_FIXUP_FUNC,
8115 .v.func = alc236_fixup_hp_gpio_led,
8116 },
24164f43
KY
8117 [ALC236_FIXUP_HP_MUTE_LED] = {
8118 .type = HDA_FIXUP_FUNC,
8119 .v.func = alc236_fixup_hp_mute_led,
8120 },
75b62ab6
JW
8121 [ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF] = {
8122 .type = HDA_FIXUP_FUNC,
8123 .v.func = alc236_fixup_hp_mute_led_micmute_vref,
8124 },
14425f1f
MP
8125 [ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
8126 .type = HDA_FIXUP_VERBS,
8127 .v.verbs = (const struct hda_verb[]) {
8128 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
8129 { }
8130 },
8131 },
9e43342b
CC
8132 [ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8133 .type = HDA_FIXUP_PINS,
8134 .v.pins = (const struct hda_pintbl[]) {
8135 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8136 { }
8137 },
8138 .chained = true,
8139 .chain_id = ALC269_FIXUP_HEADSET_MODE
8140 },
8eae7e9b
JHP
8141 [ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
8142 .type = HDA_FIXUP_PINS,
8143 .v.pins = (const struct hda_pintbl[]) {
8144 { 0x14, 0x90100120 }, /* use as internal speaker */
8145 { 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
8146 { 0x1a, 0x01011020 }, /* use as line out */
8147 { },
8148 },
8149 .chained = true,
8150 .chain_id = ALC269_FIXUP_HEADSET_MIC
8151 },
6e15d126
JHP
8152 [ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
8153 .type = HDA_FIXUP_PINS,
8154 .v.pins = (const struct hda_pintbl[]) {
8155 { 0x18, 0x02a11030 }, /* use as headset mic */
8156 { }
8157 },
8158 .chained = true,
8159 .chain_id = ALC269_FIXUP_HEADSET_MIC
8160 },
781c90c0
JHP
8161 [ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
8162 .type = HDA_FIXUP_PINS,
8163 .v.pins = (const struct hda_pintbl[]) {
8164 { 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
8165 { }
8166 },
8167 .chained = true,
8168 .chain_id = ALC269_FIXUP_HEADSET_MIC
8169 },
293a92c1 8170 [ALC289_FIXUP_ASUS_GA401] = {
c84bfedc
TI
8171 .type = HDA_FIXUP_FUNC,
8172 .v.func = alc289_fixup_asus_ga401,
8173 .chained = true,
8174 .chain_id = ALC289_FIXUP_ASUS_GA502,
ff53664d 8175 },
4b43d05a
AS
8176 [ALC289_FIXUP_ASUS_GA502] = {
8177 .type = HDA_FIXUP_PINS,
8178 .v.pins = (const struct hda_pintbl[]) {
8179 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
8180 { }
8181 },
8182 },
f50a121d
JHP
8183 [ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
8184 .type = HDA_FIXUP_PINS,
8185 .v.pins = (const struct hda_pintbl[]) {
8186 { 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
8187 { }
8188 },
8189 .chained = true,
8190 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8191 },
56496253
KY
8192 [ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
8193 .type = HDA_FIXUP_FUNC,
8194 .v.func = alc285_fixup_hp_gpio_amp_init,
8195 .chained = true,
8196 .chain_id = ALC285_FIXUP_HP_GPIO_LED
8197 },
f1ec5be1
HC
8198 [ALC269_FIXUP_CZC_B20] = {
8199 .type = HDA_FIXUP_PINS,
8200 .v.pins = (const struct hda_pintbl[]) {
8201 { 0x12, 0x411111f0 },
8202 { 0x14, 0x90170110 }, /* speaker */
8203 { 0x15, 0x032f1020 }, /* HP out */
8204 { 0x17, 0x411111f0 },
8205 { 0x18, 0x03ab1040 }, /* mic */
8206 { 0x19, 0xb7a7013f },
8207 { 0x1a, 0x0181305f },
8208 { 0x1b, 0x411111f0 },
8209 { 0x1d, 0x411111f0 },
8210 { 0x1e, 0x411111f0 },
8211 { }
8212 },
8213 .chain_id = ALC269_FIXUP_DMIC,
8214 },
8215 [ALC269_FIXUP_CZC_TMI] = {
8216 .type = HDA_FIXUP_PINS,
8217 .v.pins = (const struct hda_pintbl[]) {
8218 { 0x12, 0x4000c000 },
8219 { 0x14, 0x90170110 }, /* speaker */
8220 { 0x15, 0x0421401f }, /* HP out */
8221 { 0x17, 0x411111f0 },
8222 { 0x18, 0x04a19020 }, /* mic */
8223 { 0x19, 0x411111f0 },
8224 { 0x1a, 0x411111f0 },
8225 { 0x1b, 0x411111f0 },
8226 { 0x1d, 0x40448505 },
8227 { 0x1e, 0x411111f0 },
8228 { 0x20, 0x8000ffff },
8229 { }
8230 },
8231 .chain_id = ALC269_FIXUP_DMIC,
8232 },
8233 [ALC269_FIXUP_CZC_L101] = {
8234 .type = HDA_FIXUP_PINS,
8235 .v.pins = (const struct hda_pintbl[]) {
8236 { 0x12, 0x40000000 },
8237 { 0x14, 0x01014010 }, /* speaker */
8238 { 0x15, 0x411111f0 }, /* HP out */
8239 { 0x16, 0x411111f0 },
8240 { 0x18, 0x01a19020 }, /* mic */
8241 { 0x19, 0x02a19021 },
8242 { 0x1a, 0x0181302f },
8243 { 0x1b, 0x0221401f },
8244 { 0x1c, 0x411111f0 },
8245 { 0x1d, 0x4044c601 },
8246 { 0x1e, 0x411111f0 },
8247 { }
8248 },
8249 .chain_id = ALC269_FIXUP_DMIC,
8250 },
8251 [ALC269_FIXUP_LEMOTE_A1802] = {
8252 .type = HDA_FIXUP_PINS,
8253 .v.pins = (const struct hda_pintbl[]) {
8254 { 0x12, 0x40000000 },
8255 { 0x14, 0x90170110 }, /* speaker */
8256 { 0x17, 0x411111f0 },
8257 { 0x18, 0x03a19040 }, /* mic1 */
8258 { 0x19, 0x90a70130 }, /* mic2 */
8259 { 0x1a, 0x411111f0 },
8260 { 0x1b, 0x411111f0 },
8261 { 0x1d, 0x40489d2d },
8262 { 0x1e, 0x411111f0 },
8263 { 0x20, 0x0003ffff },
8264 { 0x21, 0x03214020 },
8265 { }
8266 },
8267 .chain_id = ALC269_FIXUP_DMIC,
8268 },
8269 [ALC269_FIXUP_LEMOTE_A190X] = {
8270 .type = HDA_FIXUP_PINS,
8271 .v.pins = (const struct hda_pintbl[]) {
8272 { 0x14, 0x99130110 }, /* speaker */
8273 { 0x15, 0x0121401f }, /* HP out */
8274 { 0x18, 0x01a19c20 }, /* rear mic */
8275 { 0x19, 0x99a3092f }, /* front mic */
8276 { 0x1b, 0x0201401f }, /* front lineout */
8277 { }
8278 },
8279 .chain_id = ALC269_FIXUP_DMIC,
8280 },
e2d2fded
KHF
8281 [ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
8282 .type = HDA_FIXUP_PINS,
8283 .v.pins = (const struct hda_pintbl[]) {
8284 { 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8285 { }
8286 },
8287 .chained = true,
8288 .chain_id = ALC269_FIXUP_HEADSET_MODE
8289 },
73e7161e
WS
8290 [ALC256_FIXUP_INTEL_NUC10] = {
8291 .type = HDA_FIXUP_PINS,
8292 .v.pins = (const struct hda_pintbl[]) {
8293 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8294 { }
8295 },
8296 .chained = true,
8297 .chain_id = ALC269_FIXUP_HEADSET_MODE
8298 },
fc19d559
HW
8299 [ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
8300 .type = HDA_FIXUP_VERBS,
8301 .v.verbs = (const struct hda_verb[]) {
8302 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8303 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8304 { }
8305 },
8306 .chained = true,
c84bfedc 8307 .chain_id = ALC289_FIXUP_ASUS_GA502
fc19d559 8308 },
13468bfa
HW
8309 [ALC274_FIXUP_HP_MIC] = {
8310 .type = HDA_FIXUP_VERBS,
8311 .v.verbs = (const struct hda_verb[]) {
8312 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8313 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8314 { }
8315 },
8316 },
8a8de09c
KY
8317 [ALC274_FIXUP_HP_HEADSET_MIC] = {
8318 .type = HDA_FIXUP_FUNC,
8319 .v.func = alc274_fixup_hp_headset_mic,
8320 .chained = true,
8321 .chain_id = ALC274_FIXUP_HP_MIC
8322 },
622464c8
TI
8323 [ALC274_FIXUP_HP_ENVY_GPIO] = {
8324 .type = HDA_FIXUP_FUNC,
8325 .v.func = alc274_fixup_hp_envy_gpio,
8326 },
ef9ce66f
KY
8327 [ALC256_FIXUP_ASUS_HPE] = {
8328 .type = HDA_FIXUP_VERBS,
8329 .v.verbs = (const struct hda_verb[]) {
8330 /* Set EAPD high */
8331 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8332 { 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
8333 { }
8334 },
8335 .chained = true,
8336 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8337 },
446b8185
KY
8338 [ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
8339 .type = HDA_FIXUP_FUNC,
8340 .v.func = alc_fixup_headset_jack,
8341 .chained = true,
8342 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8343 },
a0ccbc53
KY
8344 [ALC287_FIXUP_HP_GPIO_LED] = {
8345 .type = HDA_FIXUP_FUNC,
8346 .v.func = alc287_fixup_hp_gpio_led,
8347 },
9e885770
KY
8348 [ALC256_FIXUP_HP_HEADSET_MIC] = {
8349 .type = HDA_FIXUP_FUNC,
8350 .v.func = alc274_fixup_hp_headset_mic,
8351 },
92666d45
KY
8352 [ALC236_FIXUP_DELL_AIO_HEADSET_MIC] = {
8353 .type = HDA_FIXUP_FUNC,
8354 .v.func = alc_fixup_no_int_mic,
8355 .chained = true,
8356 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8357 },
34cdf405
CC
8358 [ALC282_FIXUP_ACER_DISABLE_LINEOUT] = {
8359 .type = HDA_FIXUP_PINS,
8360 .v.pins = (const struct hda_pintbl[]) {
8361 { 0x1b, 0x411111f0 },
8362 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8363 { },
8364 },
8365 .chained = true,
8366 .chain_id = ALC269_FIXUP_HEADSET_MODE
8367 },
495dc763
CC
8368 [ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST] = {
8369 .type = HDA_FIXUP_FUNC,
8370 .v.func = alc269_fixup_limit_int_mic_boost,
8371 .chained = true,
8372 .chain_id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
8373 },
d0e18561
CC
8374 [ALC256_FIXUP_ACER_HEADSET_MIC] = {
8375 .type = HDA_FIXUP_PINS,
8376 .v.pins = (const struct hda_pintbl[]) {
8377 { 0x19, 0x02a1113c }, /* use as headset mic, without its own jack detect */
8378 { 0x1a, 0x90a1092f }, /* use as internal mic */
8379 { }
8380 },
8381 .chained = true,
8382 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8383 },
26928ca1
TI
8384 [ALC285_FIXUP_IDEAPAD_S740_COEF] = {
8385 .type = HDA_FIXUP_FUNC,
8386 .v.func = alc285_fixup_ideapad_s740_coef,
8387 .chained = true,
8388 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8389 },
bd15b155
KHF
8390 [ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
8391 .type = HDA_FIXUP_FUNC,
8392 .v.func = alc269_fixup_limit_int_mic_boost,
8393 .chained = true,
8394 .chain_id = ALC285_FIXUP_HP_MUTE_LED,
8395 },
8eedd3a7
TI
8396 [ALC295_FIXUP_ASUS_DACS] = {
8397 .type = HDA_FIXUP_FUNC,
8398 .v.func = alc295_fixup_asus_dacs,
8399 },
5d84b531
TI
8400 [ALC295_FIXUP_HP_OMEN] = {
8401 .type = HDA_FIXUP_PINS,
8402 .v.pins = (const struct hda_pintbl[]) {
8403 { 0x12, 0xb7a60130 },
8404 { 0x13, 0x40000000 },
8405 { 0x14, 0x411111f0 },
8406 { 0x16, 0x411111f0 },
8407 { 0x17, 0x90170110 },
8408 { 0x18, 0x411111f0 },
8409 { 0x19, 0x02a11030 },
8410 { 0x1a, 0x411111f0 },
8411 { 0x1b, 0x04a19030 },
8412 { 0x1d, 0x40600001 },
8413 { 0x1e, 0x411111f0 },
8414 { 0x21, 0x03211020 },
8415 {}
8416 },
8417 .chained = true,
8418 .chain_id = ALC269_FIXUP_HP_LINE1_MIC1_LED,
8419 },
f2be77fe 8420 [ALC285_FIXUP_HP_SPECTRE_X360] = {
434591b2
ED
8421 .type = HDA_FIXUP_FUNC,
8422 .v.func = alc285_fixup_hp_spectre_x360,
f2be77fe 8423 },
d94befbb
DB
8424 [ALC285_FIXUP_HP_SPECTRE_X360_EB1] = {
8425 .type = HDA_FIXUP_FUNC,
8426 .v.func = alc285_fixup_hp_spectre_x360_eb1
8427 },
9ebaef05
HW
8428 [ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = {
8429 .type = HDA_FIXUP_FUNC,
8430 .v.func = alc285_fixup_ideapad_s740_coef,
8431 .chained = true,
8432 .chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
8433 },
29c8f40b
PU
8434 [ALC623_FIXUP_LENOVO_THINKSTATION_P340] = {
8435 .type = HDA_FIXUP_FUNC,
8436 .v.func = alc_fixup_no_shutup,
8437 .chained = true,
8438 .chain_id = ALC283_FIXUP_HEADSET_MIC,
8439 },
57c9e21a
HW
8440 [ALC255_FIXUP_ACER_HEADPHONE_AND_MIC] = {
8441 .type = HDA_FIXUP_PINS,
8442 .v.pins = (const struct hda_pintbl[]) {
8443 { 0x21, 0x03211030 }, /* Change the Headphone location to Left */
8444 { }
8445 },
8446 .chained = true,
8447 .chain_id = ALC255_FIXUP_XIAOMI_HEADSET_MIC
8448 },
8903376d
KHF
8449 [ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
8450 .type = HDA_FIXUP_FUNC,
8451 .v.func = alc269_fixup_limit_int_mic_boost,
8452 .chained = true,
8453 .chain_id = ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
8454 },
e7e2503a
BF
8455 [ALC285_FIXUP_LEGION_Y9000X_SPEAKERS] = {
8456 .type = HDA_FIXUP_FUNC,
8457 .v.func = alc285_fixup_ideapad_s740_coef,
8458 .chained = true,
8459 .chain_id = ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
8460 },
8461 [ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE] = {
8462 .type = HDA_FIXUP_FUNC,
8463 .v.func = alc287_fixup_legion_15imhg05_speakers,
8464 .chained = true,
8465 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8466 },
ad7cc2d4
CB
8467 [ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS] = {
8468 .type = HDA_FIXUP_VERBS,
8469 //.v.verbs = legion_15imhg05_coefs,
8470 .v.verbs = (const struct hda_verb[]) {
8471 // set left speaker Legion 7i.
8472 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8473 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
8474
8475 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8476 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8477 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8478 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
8479 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8480
8481 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8482 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8483 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8484 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8485 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8486
8487 // set right speaker Legion 7i.
8488 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8489 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
8490
8491 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8492 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8493 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8494 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
8495 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8496
8497 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8498 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8499 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8500 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8501 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8502 {}
8503 },
8504 .chained = true,
8505 .chain_id = ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
8506 },
8507 [ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE] = {
8508 .type = HDA_FIXUP_FUNC,
8509 .v.func = alc287_fixup_legion_15imhg05_speakers,
8510 .chained = true,
8511 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8512 },
8513 [ALC287_FIXUP_YOGA7_14ITL_SPEAKERS] = {
8514 .type = HDA_FIXUP_VERBS,
8515 .v.verbs = (const struct hda_verb[]) {
8516 // set left speaker Yoga 7i.
8517 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8518 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
8519
8520 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8521 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8522 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8523 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
8524 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8525
8526 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8527 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8528 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8529 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8530 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8531
8532 // set right speaker Yoga 7i.
8533 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8534 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
8535
8536 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8537 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8538 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8539 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
8540 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8541
8542 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8543 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8544 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8545 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8546 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8547 {}
8548 },
8549 .chained = true,
8550 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8551 },
8552 [ALC287_FIXUP_13S_GEN2_SPEAKERS] = {
8553 .type = HDA_FIXUP_VERBS,
8554 .v.verbs = (const struct hda_verb[]) {
8555 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8556 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
023a062f 8557 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
ad7cc2d4
CB
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 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8563 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
8564 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8565 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8566 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8567 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8568 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8569 {}
8570 },
8571 .chained = true,
8572 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8573 },
b9145ede 8574 [ALC256_FIXUP_SET_COEF_DEFAULTS] = {
dd6dd6e3 8575 .type = HDA_FIXUP_FUNC,
b9145ede 8576 .v.func = alc256_fixup_set_coef_defaults,
dd6dd6e3 8577 },
c47b3112
JC
8578 [ALC245_FIXUP_HP_GPIO_LED] = {
8579 .type = HDA_FIXUP_FUNC,
8580 .v.func = alc245_fixup_hp_gpio_led,
8581 },
4803b99a
JS
8582 [ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
8583 .type = HDA_FIXUP_PINS,
8584 .v.pins = (const struct hda_pintbl[]) {
8585 { 0x19, 0x03a11120 }, /* use as headset mic, without its own jack detect */
8586 { }
8587 },
8588 .chained = true,
8589 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
8590 },
e1abacd3
WS
8591 [ALC233_FIXUP_NO_AUDIO_JACK] = {
8592 .type = HDA_FIXUP_FUNC,
8593 .v.func = alc233_fixup_no_audio_jack,
8594 },
f2ca7e35
WS
8595 [ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME] = {
8596 .type = HDA_FIXUP_FUNC,
8597 .v.func = alc256_fixup_mic_no_presence_and_resume,
8598 .chained = true,
8599 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8600 },
f1d4e28b
KY
8601};
8602
1d045db9 8603static const struct snd_pci_quirk alc269_fixup_tbl[] = {
a6b92b66 8604 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
693b613d
DH
8605 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
8606 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
aaedfb47 8607 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
7819717b 8608 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
aaedfb47
DH
8609 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
8610 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
02322ac9 8611 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
b1e8972e 8612 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
1a22e775 8613 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
433f894e 8614 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
c8426b27 8615 SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF),
13be30f1 8616 SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK),
705b65f1 8617 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
6e15d126 8618 SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
b9c2fa52 8619 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
495dc763 8620 SND_PCI_QUIRK(0x1025, 0x1094, "Acer Aspire E5-575T", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
c7531e31
CC
8621 SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
8622 SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
13be30f1
CC
8623 SND_PCI_QUIRK(0x1025, 0x1166, "Acer Veriton N4640G", ALC269_FIXUP_LIFEBOOK),
8624 SND_PCI_QUIRK(0x1025, 0x1167, "Acer Veriton N6640G", ALC269_FIXUP_LIFEBOOK),
e2a829b3 8625 SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
8eae7e9b 8626 SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
781c90c0 8627 SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
d0e18561 8628 SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
667a8f73
JHP
8629 SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8630 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8631 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
d0e18561 8632 SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
35171fbf 8633 SND_PCI_QUIRK(0x1025, 0x1300, "Acer SWIFT SF314-56", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
2733cceb 8634 SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
ea5c7eba 8635 SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
cbc05fd6 8636 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
204a71b0 8637 SND_PCI_QUIRK(0x1025, 0x141f, "Acer Spin SP513-54N", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
0d4867a1 8638 SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
f50a121d 8639 SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
57c9e21a 8640 SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC),
aaedfb47 8641 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
6ed1131f 8642 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
86f799b8 8643 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
cf52103a 8644 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
8b99aba7
TI
8645 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
8646 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
0f4881dc 8647 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
73bdd597
DH
8648 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
8649 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
8650 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
0f4881dc
DH
8651 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
8652 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
98070576 8653 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
4275554d 8654 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
0f4881dc 8655 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
a22aa26f
KY
8656 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8657 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
831bfdf9 8658 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
afecb146 8659 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
3a05d12f 8660 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
8b72415d 8661 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
b734304f
KY
8662 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8663 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
c04017ea
DH
8664 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8665 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8666 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8667 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8668 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
fd06c77e 8669 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
3b43b71f 8670 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
c0ca5ece 8671 SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
709ae62e 8672 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
dd9aa335 8673 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
493de342 8674 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
aa143ad3 8675 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
5f364135 8676 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
40e2c4e5
KY
8677 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
8678 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
f0ba9d69
KY
8679 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
8680 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
ae104a21 8681 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
136824ef 8682 SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
da484d00 8683 SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
c2a7c55a 8684 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
e79c2269 8685 SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
aa143ad3 8686 SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
78def224
KY
8687 SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
8688 SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
92666d45
KY
8689 SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
8690 SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
c1e89523 8691 SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC),
da946920 8692 SND_PCI_QUIRK(0x1028, 0x0a61, "Dell XPS 15 9510", ALC289_FIXUP_DUAL_SPK),
eb676622 8693 SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK),
2b987fe8
CC
8694 SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
8695 SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
a22aa26f
KY
8696 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8697 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
08fb0d0e 8698 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
9f5c6faf 8699 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
8e35cd4a 8700 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
7976eb49 8701 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8a02b164 8702 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8a02b164 8703 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
45461e3b
TI
8704 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8705 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
8706 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8707 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9c5dc3bf
KY
8708 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8709 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8710 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8711 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9c5dc3bf 8712 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9c5dc3bf
KY
8713 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8714 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8715 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8716 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8717 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9c5dc3bf 8718 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
04d5466a 8719 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
45461e3b 8720 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
c60666bd 8721 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd
KY
8722 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8723 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8724 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
45461e3b
TI
8725 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8726 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8727 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8728 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8729 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
9c5dc3bf 8730 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
45461e3b 8731 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
9c5dc3bf 8732 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
45461e3b 8733 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
9c5dc3bf 8734 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
c60666bd 8735 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 8736 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 8737 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 8738 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
45461e3b
TI
8739 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8740 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8741 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8742 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8743 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 8744 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd
KY
8745 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8746 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
45461e3b
TI
8747 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8748 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
8749 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8750 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8a02b164
KY
8751 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8752 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8753 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8754 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
167897f4
JK
8755 SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8756 SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
1c9d9dfd
KY
8757 SND_PCI_QUIRK(0x103c, 0x8077, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
8758 SND_PCI_QUIRK(0x103c, 0x8158, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
563785ed 8759 SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
e549d190 8760 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
bbf8ff6b 8761 SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
aeedad25 8762 SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
167897f4
JK
8763 SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8764 SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
56e40eb6 8765 SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
901be145 8766 SND_PCI_QUIRK(0x103c, 0x841c, "HP Pavilion 15-CK0xx", ALC269_FIXUP_HP_MUTE_LED_MIC3),
190d0381 8767 SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
5d84b531 8768 SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
d33cd42d 8769 SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
f2be77fe 8770 SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
a94c91b4 8771 SND_PCI_QUIRK(0x103c, 0x860f, "HP ZBook 15 G6", ALC285_FIXUP_HP_GPIO_AMP_INIT),
0ac05b25 8772 SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
b2c22910 8773 SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
622464c8 8774 SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
15d295b5 8775 SND_PCI_QUIRK(0x103c, 0x8716, "HP Elite Dragonfly G2 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
61d3e874 8776 SND_PCI_QUIRK(0x103c, 0x8720, "HP EliteBook x360 1040 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
a598098c 8777 SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
afbac2a3 8778 SND_PCI_QUIRK(0x103c, 0x8728, "HP EliteBook 840 G7", ALC285_FIXUP_HP_GPIO_LED),
b2c22910 8779 SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
75b62ab6 8780 SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
de1c4c2b 8781 SND_PCI_QUIRK(0x103c, 0x8735, "HP ProBook 435 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
56496253 8782 SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
08befca4 8783 SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
431e76c3 8784 SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
24164f43 8785 SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
91bc1568
JS
8786 SND_PCI_QUIRK(0x103c, 0x8780, "HP ZBook Fury 17 G7 Mobile Workstation",
8787 ALC285_FIXUP_HP_GPIO_AMP_INIT),
8788 SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation",
8789 ALC285_FIXUP_HP_GPIO_AMP_INIT),
ba28051e 8790 SND_PCI_QUIRK(0x103c, 0x8788, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
48422958 8791 SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
e7d66cf7 8792 SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
2b70b264 8793 SND_PCI_QUIRK(0x103c, 0x87e7, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
fb3acdb2 8794 SND_PCI_QUIRK(0x103c, 0x87f1, "HP ProBook 630 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
417eadfd 8795 SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
a0ccbc53
KY
8796 SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
8797 SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
93ab3eaf 8798 SND_PCI_QUIRK(0x103c, 0x87f6, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
c3bb2b52 8799 SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
d07149ab 8800 SND_PCI_QUIRK(0x103c, 0x8805, "HP ProBook 650 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
dfc2e8ae 8801 SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
d94befbb
DB
8802 SND_PCI_QUIRK(0x103c, 0x8811, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
8803 SND_PCI_QUIRK(0x103c, 0x8812, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
53b861be 8804 SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
c3d2c882 8805 SND_PCI_QUIRK(0x103c, 0x8847, "HP EliteBook x360 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
dfb06401 8806 SND_PCI_QUIRK(0x103c, 0x884b, "HP EliteBook 840 Aero G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
ca688339 8807 SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
8903376d
KHF
8808 SND_PCI_QUIRK(0x103c, 0x8862, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
8809 SND_PCI_QUIRK(0x103c, 0x8863, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
50dbfae9 8810 SND_PCI_QUIRK(0x103c, 0x886d, "HP ZBook Fury 17.3 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
e650c1a9 8811 SND_PCI_QUIRK(0x103c, 0x8870, "HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
bbe183e0 8812 SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
600dd2a7 8813 SND_PCI_QUIRK(0x103c, 0x888d, "HP ZBook Power 15.6 inch G8 Mobile Workstation PC", ALC236_FIXUP_HP_GPIO_LED),
0e68c4b1 8814 SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
bd15b155 8815 SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
42334fbc 8816 SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED),
0aa32e54 8817 SND_PCI_QUIRK(0x103c, 0x89c3, "HP", ALC285_FIXUP_HP_GPIO_LED),
1e30191c 8818 SND_PCI_QUIRK(0x103c, 0x89ca, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
c1732ede 8819 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
7bba2157 8820 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
3e0d611b 8821 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9cf6533e 8822 SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
c1732ede 8823 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
4eab0ea1 8824 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
3e0d611b 8825 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4eab0ea1 8826 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
3cd0ed63 8827 SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
5cfca596 8828 SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
4eab0ea1
TI
8829 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
8830 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
c1732ede 8831 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
3cd0ed63 8832 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
c1732ede 8833 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
2cede303 8834 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
23870831 8835 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
3e0d611b 8836 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
8eedd3a7 8837 SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
48e01504 8838 SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
739d0959 8839 SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
3cd0ed63 8840 SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
8c8967a7 8841 SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
4963d66b 8842 SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
158ae2f5 8843 SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
d3a9b1ce 8844 SND_PCI_QUIRK(0x1043, 0x1970, "ASUS UX550VE", ALC289_FIXUP_ASUS_GA401),
5de3b943 8845 SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE),
8b33a134 8846 SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
7900e817 8847 SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
017f2a10 8848 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
28e8af8a 8849 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
1b94e59d 8850 SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
693b613d 8851 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
615966ad 8852 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
4eab0ea1 8853 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
c1732ede 8854 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
ef9ce66f 8855 SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
4b43d05a 8856 SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
c1b55029 8857 SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
76fae618 8858 SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
293a92c1 8859 SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
ff2ca018 8860 SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
eeed4cd1 8861 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
adabb3ec
TI
8862 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
8863 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
8864 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
8865 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
d240d1dc 8866 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
1d045db9
TI
8867 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
8868 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
8869 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
e9bd7d5c 8870 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
cab561f8
TI
8871 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
8872 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
24519911 8873 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
4df3fd17 8874 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
cc7016ab 8875 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
fdcc968a 8876 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
c656f747 8877 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
2041d564 8878 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
b84e8436 8879 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
c656f747 8880 SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
6fa38ef1 8881 SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
ce2e79b2
PH
8882 SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
8883 SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
0fca97a2 8884 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
a33cc48d 8885 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
14425f1f
MP
8886 SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
8887 SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
f70fff83 8888 SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
8bcea6cb 8889 SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
823ff161 8890 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
568e4e82 8891 SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
c656f747 8892 SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
abaa2274
AA
8893 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
8894 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
8cd65271 8895 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
6ca653e3 8896 SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK),
b5acfe15 8897 SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
745f260b 8898 SND_PCI_QUIRK(0x1558, 0x1325, "Clevo N15[01][CW]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15
PH
8899 SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8900 SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8901 SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8902 SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8903 SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8904 SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8905 SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8906 SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8907 SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8908 SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4803b99a
JS
8909 SND_PCI_QUIRK(0x1558, 0x5015, "Clevo NH5[58]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8910 SND_PCI_QUIRK(0x1558, 0x5017, "Clevo NH7[79]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15
PH
8911 SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8912 SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8913 SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8914 SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8915 SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
4803b99a
JS
8916 SND_PCI_QUIRK(0x1558, 0x50e1, "Clevo NH5[58]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8917 SND_PCI_QUIRK(0x1558, 0x50e2, "Clevo NH7[79]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15 8918 SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1d5cfca2 8919 SND_PCI_QUIRK(0x1558, 0x50f2, "Clevo NH50E[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15 8920 SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1d5cfca2
PH
8921 SND_PCI_QUIRK(0x1558, 0x50f5, "Clevo NH55EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8922 SND_PCI_QUIRK(0x1558, 0x50f6, "Clevo NH55DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15
PH
8923 SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8924 SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8925 SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8926 SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8927 SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1d5cfca2
PH
8928 SND_PCI_QUIRK(0x1558, 0x70f2, "Clevo NH79EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8929 SND_PCI_QUIRK(0x1558, 0x70f3, "Clevo NH77DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8930 SND_PCI_QUIRK(0x1558, 0x70f4, "Clevo NH77EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8931 SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15
PH
8932 SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8933 SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8934 SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8935 SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8936 SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
745f260b
WS
8937 SND_PCI_QUIRK(0x1558, 0x8550, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8938 SND_PCI_QUIRK(0x1558, 0x8551, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8939 SND_PCI_QUIRK(0x1558, 0x8560, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
8940 SND_PCI_QUIRK(0x1558, 0x8561, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
8941 SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[57][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
b5acfe15
PH
8942 SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8943 SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
f2ca7e35 8944 SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME),
b5acfe15
PH
8945 SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8946 SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8947 SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8948 SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1d5cfca2 8949 SND_PCI_QUIRK(0x1558, 0x9600, "Clevo N960K[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15
PH
8950 SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8951 SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
745f260b
WS
8952 SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL5[03]RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8953 SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL50NU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1d5cfca2
PH
8954 SND_PCI_QUIRK(0x1558, 0xb018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8955 SND_PCI_QUIRK(0x1558, 0xb019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8956 SND_PCI_QUIRK(0x1558, 0xb022, "Clevo NH77D[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8957 SND_PCI_QUIRK(0x1558, 0xc018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8958 SND_PCI_QUIRK(0x1558, 0xc019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8959 SND_PCI_QUIRK(0x1558, 0xc022, "Clevo NH77[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
ca169cc2 8960 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
29c8f40b 8961 SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
1d045db9
TI
8962 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
8963 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
8964 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
8965 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
8966 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
f552ff54 8967 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
b590b38c 8968 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
c8415a48 8969 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
4407be6b 8970 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
108cc108 8971 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
aaedfb47 8972 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
9a811230 8973 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
1c37c223 8974 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
a12137e7 8975 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
59a51a6b 8976 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
6d16941a 8977 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
7c21539c 8978 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
a4a9e082 8979 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
b6903c0e 8980 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
d05ea7da 8981 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
c0278669 8982 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
61fcf8ec
KY
8983 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8984 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
dab38e43 8985 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
c636b95e 8986 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
61fcf8ec
KY
8987 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
8988 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8989 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
e4c07b3b 8990 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
61fcf8ec
KY
8991 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8992 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8993 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
85981dfd 8994 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9774dc21 8995 SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
ca707b3f 8996 SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
446b8185
KY
8997 SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
8998 SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
3694cb29 8999 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
6ef2f68f 9000 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
f33f79f3 9001 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
bef33e19 9002 SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
e41fc8c5 9003 SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
65811834 9004 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
8da5bbfc 9005 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
2a36c16e 9006 SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
8a6c55d0
AM
9007 SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
9008 SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
e4efa826 9009 SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
c6e388f4 9010 SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
f86de9b1 9011 SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940", ALC298_FIXUP_LENOVO_SPK_VOLUME),
c6e388f4 9012 SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
e7e2503a 9013 SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
c6e388f4 9014 SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
b67ef1ff 9015 SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
9ebaef05 9016 SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
c6e388f4 9017 SND_PCI_QUIRK(0x17aa, 0x384a, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
ad7cc2d4
CB
9018 SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
9019 SND_PCI_QUIRK(0x17aa, 0x3853, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
56f27013 9020 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
fedb2245 9021 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
56df90b6 9022 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
f552ff54 9023 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
a4a9e082 9024 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
1bb3e062 9025 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
c497d9f9 9026 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
cd5302c0 9027 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
f2aa1110 9028 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
80b311d3 9029 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
09ea9976 9030 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
037e1197 9031 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
23adc192 9032 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
0f087ee3 9033 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
9cd25743 9034 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
0f087ee3 9035 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
61fcf8ec
KY
9036 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9037 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9038 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
cd5302c0 9039 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
61fcf8ec
KY
9040 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9041 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
1d045db9 9042 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
e1abacd3 9043 SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_NO_AUDIO_JACK),
0fbf21c3 9044 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
f1ec5be1
HC
9045 SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
9046 SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
9047 SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
02b504d9 9048 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
c656f747
TI
9049 SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
9050 SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
b9145ede 9051 SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_SET_COEF_DEFAULTS),
fc19d559 9052 SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
b95bc12e 9053 SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
695d1ec3 9054 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
e1c86210 9055 SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
d1ee66c5 9056 SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
e2d2fded 9057 SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
73e7161e 9058 SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
a4297b5d 9059
a7f3eedc 9060#if 0
a4297b5d
TI
9061 /* Below is a quirk table taken from the old code.
9062 * Basically the device should work as is without the fixup table.
9063 * If BIOS doesn't give a proper info, enable the corresponding
9064 * fixup entry.
7d7eb9ea 9065 */
a4297b5d
TI
9066 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
9067 ALC269_FIXUP_AMIC),
9068 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
a4297b5d
TI
9069 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
9070 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
9071 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
9072 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
9073 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
9074 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
9075 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
9076 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
9077 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
9078 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
9079 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
9080 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
9081 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
9082 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
9083 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
9084 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
9085 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
9086 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
9087 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
9088 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
9089 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
9090 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
9091 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
9092 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
9093 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
9094 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
9095 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
9096 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
9097 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
9098 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
9099 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
9100 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
9101 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
9102 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
9103 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
9104 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
9105 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
9106 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
9107#endif
9108 {}
9109};
9110
214eef76
DH
9111static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
9112 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
9113 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
9114 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
9115 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
0fbf21c3 9116 SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
214eef76
DH
9117 {}
9118};
9119
1727a771 9120static const struct hda_model_fixup alc269_fixup_models[] = {
a4297b5d
TI
9121 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
9122 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
6e72aa5f
TI
9123 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
9124 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
9125 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
7c478f03 9126 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
b016951e
TI
9127 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
9128 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
108cc108 9129 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
b590b38c 9130 {.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
9f5c6faf 9131 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
04d5466a 9132 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
e32aa85a
DH
9133 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
9134 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
a26d96c7
TI
9135 {.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
9136 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
be8ef16a 9137 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
0202e99c 9138 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
1c37c223 9139 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
9a811230 9140 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
c636b95e 9141 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
399c01aa 9142 {.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
a26d96c7 9143 {.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
ba90d6a6 9144 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
28d1d6d2 9145 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
a26d96c7
TI
9146 {.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
9147 {.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
9148 {.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
9149 {.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
9150 {.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
9151 {.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
9152 {.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
9153 {.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
9154 {.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
9155 {.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
9156 {.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
9157 {.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
9158 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
9159 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
9160 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
9161 {.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
9162 {.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
9163 {.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
9164 {.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
9165 {.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
9166 {.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
9167 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
9168 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
9169 {.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
9170 {.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
9171 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
9172 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
9173 {.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
9174 {.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
9175 {.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
9176 {.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
9177 {.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
9178 {.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
9179 {.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
9180 {.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
9181 {.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
9182 {.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
9183 {.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
9184 {.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
9185 {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
b3802783 9186 {.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
a26d96c7 9187 {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
c8426b27 9188 {.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"},
a26d96c7
TI
9189 {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
9190 {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
9191 {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
9192 {.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
9193 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
9194 {.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
9195 {.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
9196 {.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
9197 {.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
9198 {.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
9199 {.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
9200 {.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
9201 {.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
9202 {.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
a26d96c7
TI
9203 {.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
9204 {.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
9205 {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
82aa0d7e 9206 {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
a26d96c7 9207 {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
d2cd795c 9208 {.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
a26d96c7
TI
9209 {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
9210 {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
9211 {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
9212 {.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
9213 {.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
9214 {.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
9215 {.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
9216 {.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
9217 {.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
9218 {.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
9219 {.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
9220 {.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
9221 {.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
9222 {.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
9223 {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
9224 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
9225 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
8983eb60
KY
9226 {.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
9227 {.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
e2a829b3 9228 {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
a2ef03fe 9229 {.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
bd9c10bc 9230 {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
23dc9586 9231 {.id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc298-samsung-headphone"},
fc19d559 9232 {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
13468bfa 9233 {.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
c3bb2b52 9234 {.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
5d84b531 9235 {.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
f2be77fe 9236 {.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
d94befbb 9237 {.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"},
9ebaef05 9238 {.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
29c8f40b 9239 {.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
57c9e21a 9240 {.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
657da58e 9241 {.id = ALC285_FIXUP_HP_GPIO_AMP_INIT, .name = "alc285-hp-amp-init"},
1d045db9 9242 {}
6dda9f4a 9243};
cfc5a845 9244#define ALC225_STANDARD_PINS \
cfc5a845 9245 {0x21, 0x04211020}
6dda9f4a 9246
e8191a8e
HW
9247#define ALC256_STANDARD_PINS \
9248 {0x12, 0x90a60140}, \
9249 {0x14, 0x90170110}, \
e8191a8e
HW
9250 {0x21, 0x02211020}
9251
fea185e2 9252#define ALC282_STANDARD_PINS \
11580297 9253 {0x14, 0x90170110}
e1e62b98 9254
fea185e2 9255#define ALC290_STANDARD_PINS \
11580297 9256 {0x12, 0x99a30130}
fea185e2
DH
9257
9258#define ALC292_STANDARD_PINS \
9259 {0x14, 0x90170110}, \
11580297 9260 {0x15, 0x0221401f}
977e6276 9261
3f640970
HW
9262#define ALC295_STANDARD_PINS \
9263 {0x12, 0xb7a60130}, \
9264 {0x14, 0x90170110}, \
3f640970
HW
9265 {0x21, 0x04211020}
9266
703867e2
WS
9267#define ALC298_STANDARD_PINS \
9268 {0x12, 0x90a60130}, \
9269 {0x21, 0x03211020}
9270
e1918938 9271static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
8a328ac1
KY
9272 SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
9273 {0x14, 0x01014020},
9274 {0x17, 0x90170110},
9275 {0x18, 0x02a11030},
9276 {0x19, 0x0181303F},
9277 {0x21, 0x0221102f}),
5824ce8d
CC
9278 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
9279 {0x12, 0x90a601c0},
9280 {0x14, 0x90171120},
9281 {0x21, 0x02211030}),
615966ad
CC
9282 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9283 {0x14, 0x90170110},
9284 {0x1b, 0x90a70130},
9285 {0x21, 0x03211020}),
9286 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9287 {0x1a, 0x90a70130},
9288 {0x1b, 0x90170110},
9289 {0x21, 0x03211020}),
2ae95577 9290 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
cfc5a845 9291 ALC225_STANDARD_PINS,
8a132099 9292 {0x12, 0xb7a60130},
cfc5a845 9293 {0x14, 0x901701a0}),
2ae95577 9294 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
cfc5a845 9295 ALC225_STANDARD_PINS,
8a132099 9296 {0x12, 0xb7a60130},
cfc5a845 9297 {0x14, 0x901701b0}),
8a132099
HW
9298 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9299 ALC225_STANDARD_PINS,
9300 {0x12, 0xb7a60150},
9301 {0x14, 0x901701a0}),
9302 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9303 ALC225_STANDARD_PINS,
9304 {0x12, 0xb7a60150},
9305 {0x14, 0x901701b0}),
9306 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9307 ALC225_STANDARD_PINS,
9308 {0x12, 0xb7a60130},
9309 {0x1b, 0x90170110}),
0ce48e17
KHF
9310 SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9311 {0x1b, 0x01111010},
9312 {0x1e, 0x01451130},
9313 {0x21, 0x02211020}),
986376b6
HW
9314 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
9315 {0x12, 0x90a60140},
9316 {0x14, 0x90170110},
9317 {0x19, 0x02a11030},
9318 {0x21, 0x02211020}),
e41fc8c5
HW
9319 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9320 {0x14, 0x90170110},
9321 {0x19, 0x02a11030},
9322 {0x1a, 0x02a11040},
9323 {0x1b, 0x01014020},
9324 {0x21, 0x0221101f}),
d06fb562
HW
9325 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9326 {0x14, 0x90170110},
9327 {0x19, 0x02a11030},
9328 {0x1a, 0x02a11040},
9329 {0x1b, 0x01011020},
9330 {0x21, 0x0221101f}),
c6b17f10
HW
9331 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9332 {0x14, 0x90170110},
9333 {0x19, 0x02a11020},
9334 {0x1a, 0x02a11030},
9335 {0x21, 0x0221101f}),
92666d45
KY
9336 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
9337 {0x21, 0x02211010}),
9e885770
KY
9338 SND_HDA_PIN_QUIRK(0x10ec0236, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
9339 {0x14, 0x90170110},
9340 {0x19, 0x02a11020},
9341 {0x21, 0x02211030}),
c77900e6 9342 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
c77900e6 9343 {0x14, 0x90170110},
c77900e6 9344 {0x21, 0x02211020}),
86c72d1c
HW
9345 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9346 {0x14, 0x90170130},
9347 {0x21, 0x02211040}),
76c2132e
DH
9348 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9349 {0x12, 0x90a60140},
9350 {0x14, 0x90170110},
76c2132e
DH
9351 {0x21, 0x02211020}),
9352 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9353 {0x12, 0x90a60160},
9354 {0x14, 0x90170120},
76c2132e 9355 {0x21, 0x02211030}),
392c9da2
HW
9356 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9357 {0x14, 0x90170110},
9358 {0x1b, 0x02011020},
9359 {0x21, 0x0221101f}),
6aecd871
HW
9360 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9361 {0x14, 0x90170110},
9362 {0x1b, 0x01011020},
9363 {0x21, 0x0221101f}),
cba59972 9364 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
cba59972 9365 {0x14, 0x90170130},
cba59972 9366 {0x1b, 0x01014020},
cba59972 9367 {0x21, 0x0221103f}),
6aecd871
HW
9368 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9369 {0x14, 0x90170130},
9370 {0x1b, 0x01011020},
9371 {0x21, 0x0221103f}),
59ec4b57
HW
9372 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9373 {0x14, 0x90170130},
9374 {0x1b, 0x02011020},
9375 {0x21, 0x0221103f}),
e9c28e16 9376 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
e9c28e16 9377 {0x14, 0x90170150},
e9c28e16 9378 {0x1b, 0x02011020},
e9c28e16
WS
9379 {0x21, 0x0221105f}),
9380 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
e9c28e16 9381 {0x14, 0x90170110},
e9c28e16 9382 {0x1b, 0x01014020},
e9c28e16 9383 {0x21, 0x0221101f}),
76c2132e
DH
9384 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9385 {0x12, 0x90a60160},
9386 {0x14, 0x90170120},
9387 {0x17, 0x90170140},
76c2132e
DH
9388 {0x21, 0x0321102f}),
9389 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9390 {0x12, 0x90a60160},
9391 {0x14, 0x90170130},
76c2132e
DH
9392 {0x21, 0x02211040}),
9393 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9394 {0x12, 0x90a60160},
9395 {0x14, 0x90170140},
76c2132e
DH
9396 {0x21, 0x02211050}),
9397 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9398 {0x12, 0x90a60170},
9399 {0x14, 0x90170120},
76c2132e
DH
9400 {0x21, 0x02211030}),
9401 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9402 {0x12, 0x90a60170},
9403 {0x14, 0x90170130},
76c2132e 9404 {0x21, 0x02211040}),
0a1f90a9
HW
9405 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9406 {0x12, 0x90a60170},
9407 {0x14, 0x90171130},
9408 {0x21, 0x02211040}),
70658b99 9409 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
70658b99
HW
9410 {0x12, 0x90a60170},
9411 {0x14, 0x90170140},
70658b99 9412 {0x21, 0x02211050}),
9b5a4e39 9413 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9b5a4e39
DH
9414 {0x12, 0x90a60180},
9415 {0x14, 0x90170130},
9b5a4e39 9416 {0x21, 0x02211040}),
f90d83b3
AK
9417 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9418 {0x12, 0x90a60180},
9419 {0x14, 0x90170120},
9420 {0x21, 0x02211030}),
989dbe4a
HW
9421 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9422 {0x1b, 0x01011020},
9423 {0x21, 0x02211010}),
c1732ede
CC
9424 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
9425 {0x14, 0x90170110},
9426 {0x1b, 0x90a70130},
9427 {0x21, 0x04211020}),
9428 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
9429 {0x14, 0x90170110},
9430 {0x1b, 0x90a70130},
9431 {0x21, 0x03211020}),
a806ef1c
CC
9432 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
9433 {0x12, 0x90a60130},
9434 {0x14, 0x90170110},
9435 {0x21, 0x03211020}),
6ac371aa
JHP
9436 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
9437 {0x12, 0x90a60130},
9438 {0x14, 0x90170110},
9439 {0x21, 0x04211020}),
e1037354
JHP
9440 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
9441 {0x1a, 0x90a70130},
9442 {0x1b, 0x90170110},
9443 {0x21, 0x03211020}),
9e885770
KY
9444 SND_HDA_PIN_QUIRK(0x10ec0256, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
9445 {0x14, 0x90170110},
9446 {0x19, 0x02a11020},
9447 {0x21, 0x0221101f}),
8a8de09c
KY
9448 SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
9449 {0x17, 0x90170110},
9450 {0x19, 0x03a11030},
9451 {0x21, 0x03211020}),
cf51eb9d
DH
9452 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
9453 {0x12, 0x90a60130},
cf51eb9d
DH
9454 {0x14, 0x90170110},
9455 {0x15, 0x0421101f},
11580297 9456 {0x1a, 0x04a11020}),
0279661b
HW
9457 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
9458 {0x12, 0x90a60140},
0279661b
HW
9459 {0x14, 0x90170110},
9460 {0x15, 0x0421101f},
0279661b 9461 {0x18, 0x02811030},
0279661b 9462 {0x1a, 0x04a1103f},
11580297 9463 {0x1b, 0x02011020}),
42304474 9464 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9465 ALC282_STANDARD_PINS,
42304474 9466 {0x12, 0x99a30130},
42304474 9467 {0x19, 0x03a11020},
42304474 9468 {0x21, 0x0321101f}),
2c609999 9469 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9470 ALC282_STANDARD_PINS,
2c609999 9471 {0x12, 0x99a30130},
2c609999 9472 {0x19, 0x03a11020},
2c609999
HW
9473 {0x21, 0x03211040}),
9474 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9475 ALC282_STANDARD_PINS,
2c609999 9476 {0x12, 0x99a30130},
2c609999 9477 {0x19, 0x03a11030},
2c609999
HW
9478 {0x21, 0x03211020}),
9479 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9480 ALC282_STANDARD_PINS,
2c609999 9481 {0x12, 0x99a30130},
2c609999 9482 {0x19, 0x04a11020},
2c609999 9483 {0x21, 0x0421101f}),
200afc09 9484 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
aec856d0 9485 ALC282_STANDARD_PINS,
200afc09 9486 {0x12, 0x90a60140},
200afc09 9487 {0x19, 0x04a11030},
200afc09 9488 {0x21, 0x04211020}),
34cdf405
CC
9489 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
9490 ALC282_STANDARD_PINS,
9491 {0x12, 0x90a609c0},
9492 {0x18, 0x03a11830},
9493 {0x19, 0x04a19831},
9494 {0x1a, 0x0481303f},
9495 {0x1b, 0x04211020},
9496 {0x21, 0x0321101f}),
9497 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
9498 ALC282_STANDARD_PINS,
9499 {0x12, 0x90a60940},
9500 {0x18, 0x03a11830},
9501 {0x19, 0x04a19831},
9502 {0x1a, 0x0481303f},
9503 {0x1b, 0x04211020},
9504 {0x21, 0x0321101f}),
76c2132e 9505 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 9506 ALC282_STANDARD_PINS,
76c2132e 9507 {0x12, 0x90a60130},
76c2132e
DH
9508 {0x21, 0x0321101f}),
9509 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9510 {0x12, 0x90a60160},
9511 {0x14, 0x90170120},
76c2132e 9512 {0x21, 0x02211030}),
bc262179 9513 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 9514 ALC282_STANDARD_PINS,
bc262179 9515 {0x12, 0x90a60130},
bc262179 9516 {0x19, 0x03a11020},
bc262179 9517 {0x21, 0x0321101f}),
c8c6ee61 9518 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
266fd994
SL
9519 {0x12, 0x90a60130},
9520 {0x14, 0x90170110},
9521 {0x19, 0x04a11040},
9522 {0x21, 0x04211020}),
9523 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
9524 {0x14, 0x90170110},
9525 {0x19, 0x04a11040},
9526 {0x1d, 0x40600001},
9527 {0x21, 0x04211020}),
9528 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
c4cfcf6f
HW
9529 {0x14, 0x90170110},
9530 {0x19, 0x04a11040},
9531 {0x21, 0x04211020}),
c72b9bfe
HW
9532 SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9533 {0x14, 0x90170110},
9534 {0x17, 0x90170111},
9535 {0x19, 0x03a11030},
9536 {0x21, 0x03211020}),
33aaebd4
CC
9537 SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
9538 {0x12, 0x90a60130},
9539 {0x17, 0x90170110},
9540 {0x21, 0x02211020}),
d44a6864 9541 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
e1e62b98 9542 {0x12, 0x90a60120},
e1e62b98 9543 {0x14, 0x90170110},
e1e62b98 9544 {0x21, 0x0321101f}),
e4442bcf 9545 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9546 ALC290_STANDARD_PINS,
e4442bcf 9547 {0x15, 0x04211040},
e4442bcf 9548 {0x18, 0x90170112},
11580297 9549 {0x1a, 0x04a11020}),
e4442bcf 9550 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9551 ALC290_STANDARD_PINS,
e4442bcf 9552 {0x15, 0x04211040},
e4442bcf 9553 {0x18, 0x90170110},
11580297 9554 {0x1a, 0x04a11020}),
e4442bcf 9555 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9556 ALC290_STANDARD_PINS,
e4442bcf 9557 {0x15, 0x0421101f},
11580297 9558 {0x1a, 0x04a11020}),
e4442bcf 9559 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9560 ALC290_STANDARD_PINS,
e4442bcf 9561 {0x15, 0x04211020},
11580297 9562 {0x1a, 0x04a11040}),
e4442bcf 9563 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9564 ALC290_STANDARD_PINS,
e4442bcf
HW
9565 {0x14, 0x90170110},
9566 {0x15, 0x04211020},
11580297 9567 {0x1a, 0x04a11040}),
e4442bcf 9568 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9569 ALC290_STANDARD_PINS,
e4442bcf
HW
9570 {0x14, 0x90170110},
9571 {0x15, 0x04211020},
11580297 9572 {0x1a, 0x04a11020}),
e4442bcf 9573 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9574 ALC290_STANDARD_PINS,
e4442bcf
HW
9575 {0x14, 0x90170110},
9576 {0x15, 0x0421101f},
11580297 9577 {0x1a, 0x04a11020}),
e8818fa8 9578 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
aec856d0 9579 ALC292_STANDARD_PINS,
e8818fa8 9580 {0x12, 0x90a60140},
e8818fa8 9581 {0x16, 0x01014020},
11580297 9582 {0x19, 0x01a19030}),
e8818fa8 9583 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
aec856d0 9584 ALC292_STANDARD_PINS,
e8818fa8 9585 {0x12, 0x90a60140},
e8818fa8
HW
9586 {0x16, 0x01014020},
9587 {0x18, 0x02a19031},
11580297 9588 {0x19, 0x01a1903e}),
76c2132e 9589 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
aec856d0 9590 ALC292_STANDARD_PINS,
11580297 9591 {0x12, 0x90a60140}),
76c2132e 9592 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 9593 ALC292_STANDARD_PINS,
76c2132e 9594 {0x13, 0x90a60140},
76c2132e 9595 {0x16, 0x21014020},
11580297 9596 {0x19, 0x21a19030}),
e03fdbde 9597 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 9598 ALC292_STANDARD_PINS,
11580297 9599 {0x13, 0x90a60140}),
eeacd80f
JHP
9600 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_HPE,
9601 {0x17, 0x90170110},
9602 {0x21, 0x04211020}),
d8ae458e
CC
9603 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
9604 {0x14, 0x90170110},
9605 {0x1b, 0x90a70130},
9606 {0x21, 0x04211020}),
8bb37a2a
JHP
9607 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9608 {0x12, 0x90a60130},
9609 {0x17, 0x90170110},
9610 {0x21, 0x03211020}),
0bea4cc8
JHP
9611 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9612 {0x12, 0x90a60130},
9613 {0x17, 0x90170110},
9614 {0x21, 0x04211020}),
3887c26c
TI
9615 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9616 {0x12, 0x90a60130},
9617 {0x17, 0x90170110},
9618 {0x21, 0x03211020}),
9e43342b 9619 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
ad97d667
JHP
9620 {0x12, 0x90a60120},
9621 {0x17, 0x90170110},
9622 {0x21, 0x04211030}),
9623 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
9e43342b
CC
9624 {0x12, 0x90a60130},
9625 {0x17, 0x90170110},
9626 {0x21, 0x03211020}),
9627 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
9628 {0x12, 0x90a60130},
9629 {0x17, 0x90170110},
9630 {0x21, 0x03211020}),
fbc57129 9631 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
0a29c57b
KY
9632 {0x14, 0x90170110},
9633 {0x21, 0x04211020}),
fbc57129
KY
9634 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9635 {0x14, 0x90170110},
9636 {0x21, 0x04211030}),
3f640970 9637 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
f771d5bb
HW
9638 ALC295_STANDARD_PINS,
9639 {0x17, 0x21014020},
9640 {0x18, 0x21a19030}),
9641 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9642 ALC295_STANDARD_PINS,
9643 {0x17, 0x21014040},
9644 {0x18, 0x21a19050}),
3f307834
HW
9645 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9646 ALC295_STANDARD_PINS),
9f502ff5
TI
9647 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
9648 ALC298_STANDARD_PINS,
9649 {0x17, 0x90170110}),
977e6276 9650 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
703867e2
WS
9651 ALC298_STANDARD_PINS,
9652 {0x17, 0x90170140}),
9653 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
9654 ALC298_STANDARD_PINS,
9f502ff5 9655 {0x17, 0x90170150}),
9f1bc2c4
KHF
9656 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
9657 {0x12, 0xb7a60140},
9658 {0x13, 0xb7a60150},
9659 {0x17, 0x90170110},
9660 {0x1a, 0x03011020},
9661 {0x21, 0x03211030}),
54324221
JM
9662 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
9663 {0x12, 0xb7a60140},
9664 {0x17, 0x90170110},
9665 {0x1a, 0x03a11030},
9666 {0x21, 0x03211020}),
fcc6c877
KY
9667 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9668 ALC225_STANDARD_PINS,
9669 {0x12, 0xb7a60130},
fcc6c877 9670 {0x17, 0x90170110}),
573fcbfd
HW
9671 SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
9672 {0x14, 0x01014010},
9673 {0x17, 0x90170120},
9674 {0x18, 0x02a11030},
9675 {0x19, 0x02a1103f},
9676 {0x21, 0x0221101f}),
e1918938
HW
9677 {}
9678};
6dda9f4a 9679
7c0a6939
HW
9680/* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
9681 * more machines, don't need to match all valid pins, just need to match
9682 * all the pins defined in the tbl. Just because of this reason, it is possible
9683 * that a single machine matches multiple tbls, so there is one limitation:
9684 * at most one tbl is allowed to define for the same vendor and same codec
9685 */
9686static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
9687 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9688 {0x19, 0x40000000},
9689 {0x1b, 0x40000000}),
aed8c7f4
HW
9690 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9691 {0x19, 0x40000000},
9692 {0x1a, 0x40000000}),
d64ebdbf
HW
9693 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9694 {0x19, 0x40000000},
9695 {0x1a, 0x40000000}),
5815bdfd
HW
9696 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
9697 {0x19, 0x40000000},
9698 {0x1a, 0x40000000}),
7c0a6939
HW
9699 {}
9700};
9701
546bb678 9702static void alc269_fill_coef(struct hda_codec *codec)
1d045db9 9703{
526af6eb 9704 struct alc_spec *spec = codec->spec;
1d045db9 9705 int val;
ebb83eeb 9706
526af6eb 9707 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
546bb678 9708 return;
526af6eb 9709
1bb7e43e 9710 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
1d045db9
TI
9711 alc_write_coef_idx(codec, 0xf, 0x960b);
9712 alc_write_coef_idx(codec, 0xe, 0x8817);
9713 }
ebb83eeb 9714
1bb7e43e 9715 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
1d045db9
TI
9716 alc_write_coef_idx(codec, 0xf, 0x960b);
9717 alc_write_coef_idx(codec, 0xe, 0x8814);
9718 }
ebb83eeb 9719
1bb7e43e 9720 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
1d045db9 9721 /* Power up output pin */
98b24883 9722 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
1d045db9 9723 }
ebb83eeb 9724
1bb7e43e 9725 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
1d045db9 9726 val = alc_read_coef_idx(codec, 0xd);
f3ee07d8 9727 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
1d045db9
TI
9728 /* Capless ramp up clock control */
9729 alc_write_coef_idx(codec, 0xd, val | (1<<10));
9730 }
9731 val = alc_read_coef_idx(codec, 0x17);
f3ee07d8 9732 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
1d045db9
TI
9733 /* Class D power on reset */
9734 alc_write_coef_idx(codec, 0x17, val | (1<<7));
9735 }
9736 }
ebb83eeb 9737
98b24883
TI
9738 /* HP */
9739 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
1d045db9 9740}
a7f2371f 9741
1d045db9
TI
9742/*
9743 */
1d045db9
TI
9744static int patch_alc269(struct hda_codec *codec)
9745{
9746 struct alc_spec *spec;
3de95173 9747 int err;
f1d4e28b 9748
3de95173 9749 err = alc_alloc_spec(codec, 0x0b);
e16fb6d1 9750 if (err < 0)
3de95173
TI
9751 return err;
9752
9753 spec = codec->spec;
08c189f2 9754 spec->gen.shared_mic_vref_pin = 0x18;
317d9313 9755 codec->power_save_node = 0;
e16fb6d1 9756
225068ab
TI
9757#ifdef CONFIG_PM
9758 codec->patch_ops.suspend = alc269_suspend;
9759 codec->patch_ops.resume = alc269_resume;
9760#endif
c2d6af53
KY
9761 spec->shutup = alc_default_shutup;
9762 spec->init_hook = alc_default_init;
225068ab 9763
7639a06c 9764 switch (codec->core.vendor_id) {
065380f0 9765 case 0x10ec0269:
1d045db9 9766 spec->codec_variant = ALC269_TYPE_ALC269VA;
1bb7e43e
TI
9767 switch (alc_get_coef0(codec) & 0x00f0) {
9768 case 0x0010:
5100cd07
TI
9769 if (codec->bus->pci &&
9770 codec->bus->pci->subsystem_vendor == 0x1025 &&
e16fb6d1 9771 spec->cdefine.platform_type == 1)
20ca0c35 9772 err = alc_codec_rename(codec, "ALC271X");
1d045db9 9773 spec->codec_variant = ALC269_TYPE_ALC269VB;
1bb7e43e
TI
9774 break;
9775 case 0x0020:
5100cd07
TI
9776 if (codec->bus->pci &&
9777 codec->bus->pci->subsystem_vendor == 0x17aa &&
e16fb6d1 9778 codec->bus->pci->subsystem_device == 0x21f3)
20ca0c35 9779 err = alc_codec_rename(codec, "ALC3202");
1d045db9 9780 spec->codec_variant = ALC269_TYPE_ALC269VC;
1bb7e43e 9781 break;
adcc70b2
KY
9782 case 0x0030:
9783 spec->codec_variant = ALC269_TYPE_ALC269VD;
9784 break;
1bb7e43e 9785 default:
1d045db9 9786 alc_fix_pll_init(codec, 0x20, 0x04, 15);
1bb7e43e 9787 }
e16fb6d1
TI
9788 if (err < 0)
9789 goto error;
c2d6af53 9790 spec->shutup = alc269_shutup;
546bb678 9791 spec->init_hook = alc269_fill_coef;
1d045db9 9792 alc269_fill_coef(codec);
065380f0
KY
9793 break;
9794
9795 case 0x10ec0280:
9796 case 0x10ec0290:
9797 spec->codec_variant = ALC269_TYPE_ALC280;
9798 break;
9799 case 0x10ec0282:
065380f0 9800 spec->codec_variant = ALC269_TYPE_ALC282;
7b5c7a02
KY
9801 spec->shutup = alc282_shutup;
9802 spec->init_hook = alc282_init;
065380f0 9803 break;
2af02be7
KY
9804 case 0x10ec0233:
9805 case 0x10ec0283:
9806 spec->codec_variant = ALC269_TYPE_ALC283;
9807 spec->shutup = alc283_shutup;
9808 spec->init_hook = alc283_init;
9809 break;
065380f0
KY
9810 case 0x10ec0284:
9811 case 0x10ec0292:
9812 spec->codec_variant = ALC269_TYPE_ALC284;
9813 break;
161ebf29 9814 case 0x10ec0293:
4731d5de 9815 spec->codec_variant = ALC269_TYPE_ALC293;
161ebf29 9816 break;
7fc7d047 9817 case 0x10ec0286:
7c665932 9818 case 0x10ec0288:
7fc7d047
KY
9819 spec->codec_variant = ALC269_TYPE_ALC286;
9820 break;
506b62c3
KY
9821 case 0x10ec0298:
9822 spec->codec_variant = ALC269_TYPE_ALC298;
9823 break;
ea04a1db 9824 case 0x10ec0235:
1d04c9de
KY
9825 case 0x10ec0255:
9826 spec->codec_variant = ALC269_TYPE_ALC255;
ab3b8e51
KY
9827 spec->shutup = alc256_shutup;
9828 spec->init_hook = alc256_init;
1d04c9de 9829 break;
1948fc06 9830 case 0x10ec0230:
736f20a7 9831 case 0x10ec0236:
4344aec8
KY
9832 case 0x10ec0256:
9833 spec->codec_variant = ALC269_TYPE_ALC256;
4a219ef8
KY
9834 spec->shutup = alc256_shutup;
9835 spec->init_hook = alc256_init;
7d1b6e29 9836 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
4344aec8 9837 break;
f429e7e4
KY
9838 case 0x10ec0257:
9839 spec->codec_variant = ALC269_TYPE_ALC257;
88d42b2b
KY
9840 spec->shutup = alc256_shutup;
9841 spec->init_hook = alc256_init;
f429e7e4
KY
9842 spec->gen.mixer_nid = 0;
9843 break;
0a6f0600 9844 case 0x10ec0215:
7fbdcd83 9845 case 0x10ec0245:
0a6f0600
KY
9846 case 0x10ec0285:
9847 case 0x10ec0289:
9848 spec->codec_variant = ALC269_TYPE_ALC215;
1b6832be
KY
9849 spec->shutup = alc225_shutup;
9850 spec->init_hook = alc225_init;
0a6f0600
KY
9851 spec->gen.mixer_nid = 0;
9852 break;
4231430d 9853 case 0x10ec0225:
7d727869 9854 case 0x10ec0295:
28f1f9b2 9855 case 0x10ec0299:
4231430d 9856 spec->codec_variant = ALC269_TYPE_ALC225;
da911b1f
KY
9857 spec->shutup = alc225_shutup;
9858 spec->init_hook = alc225_init;
c1350bff 9859 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
4231430d 9860 break;
99cee034
KY
9861 case 0x10ec0287:
9862 spec->codec_variant = ALC269_TYPE_ALC287;
9863 spec->shutup = alc225_shutup;
9864 spec->init_hook = alc225_init;
9865 spec->gen.mixer_nid = 0; /* no loopback on ALC287 */
9866 break;
dcd4f0db
KY
9867 case 0x10ec0234:
9868 case 0x10ec0274:
9869 case 0x10ec0294:
9870 spec->codec_variant = ALC269_TYPE_ALC294;
532a7784 9871 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
71683c32 9872 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
693abe11 9873 spec->init_hook = alc294_init;
dcd4f0db 9874 break;
1078bef0
KY
9875 case 0x10ec0300:
9876 spec->codec_variant = ALC269_TYPE_ALC300;
9877 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
dcd4f0db 9878 break;
f0778871
KY
9879 case 0x10ec0623:
9880 spec->codec_variant = ALC269_TYPE_ALC623;
9881 break;
6fbae35a
KY
9882 case 0x10ec0700:
9883 case 0x10ec0701:
9884 case 0x10ec0703:
83629532 9885 case 0x10ec0711:
6fbae35a
KY
9886 spec->codec_variant = ALC269_TYPE_ALC700;
9887 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
2d7fe618 9888 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
693abe11 9889 spec->init_hook = alc294_init;
6fbae35a
KY
9890 break;
9891
1d045db9 9892 }
6dda9f4a 9893
ad60d502 9894 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
97a26570 9895 spec->has_alc5505_dsp = 1;
ad60d502
KY
9896 spec->init_hook = alc5505_dsp_init;
9897 }
9898
c9af753f
TI
9899 alc_pre_init(codec);
9900
efe55732
TI
9901 snd_hda_pick_fixup(codec, alc269_fixup_models,
9902 alc269_fixup_tbl, alc269_fixups);
13d9c6b9
TI
9903 /* FIXME: both TX300 and ROG Strix G17 have the same SSID, and
9904 * the quirk breaks the latter (bko#214101).
9905 * Clear the wrong entry.
9906 */
9907 if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 &&
9908 codec->core.vendor_id == 0x10ec0294) {
9909 codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n");
9910 codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
9911 }
9912
0fc1e447 9913 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
7c0a6939 9914 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
efe55732
TI
9915 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
9916 alc269_fixups);
9917 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
9918
9919 alc_auto_parse_customize_define(codec);
9920
9921 if (has_cdefine_beep(codec))
9922 spec->gen.beep_nid = 0x01;
9923
a4297b5d
TI
9924 /* automatic parse from the BIOS config */
9925 err = alc269_parse_auto_config(codec);
e16fb6d1
TI
9926 if (err < 0)
9927 goto error;
6dda9f4a 9928
fea80fae
TI
9929 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
9930 err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
9931 if (err < 0)
9932 goto error;
9933 }
f1d4e28b 9934
1727a771 9935 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 9936
1d045db9 9937 return 0;
e16fb6d1
TI
9938
9939 error:
9940 alc_free(codec);
9941 return err;
1d045db9 9942}
f1d4e28b 9943
1d045db9
TI
9944/*
9945 * ALC861
9946 */
622e84cd 9947
1d045db9 9948static int alc861_parse_auto_config(struct hda_codec *codec)
6dda9f4a 9949{
1d045db9 9950 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
3e6179b8
TI
9951 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
9952 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
604401a9
TI
9953}
9954
1d045db9
TI
9955/* Pin config fixes */
9956enum {
e652f4c8
TI
9957 ALC861_FIXUP_FSC_AMILO_PI1505,
9958 ALC861_FIXUP_AMP_VREF_0F,
9959 ALC861_FIXUP_NO_JACK_DETECT,
9960 ALC861_FIXUP_ASUS_A6RP,
6ddf0fd1 9961 ALC660_FIXUP_ASUS_W7J,
1d045db9 9962};
7085ec12 9963
31150f23
TI
9964/* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
9965static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
1727a771 9966 const struct hda_fixup *fix, int action)
31150f23
TI
9967{
9968 struct alc_spec *spec = codec->spec;
9969 unsigned int val;
9970
1727a771 9971 if (action != HDA_FIXUP_ACT_INIT)
31150f23 9972 return;
d3f02d60 9973 val = snd_hda_codec_get_pin_target(codec, 0x0f);
31150f23
TI
9974 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
9975 val |= AC_PINCTL_IN_EN;
9976 val |= AC_PINCTL_VREF_50;
cdd03ced 9977 snd_hda_set_pin_ctl(codec, 0x0f, val);
08c189f2 9978 spec->gen.keep_vref_in_automute = 1;
31150f23
TI
9979}
9980
e652f4c8
TI
9981/* suppress the jack-detection */
9982static void alc_fixup_no_jack_detect(struct hda_codec *codec,
1727a771 9983 const struct hda_fixup *fix, int action)
e652f4c8 9984{
1727a771 9985 if (action == HDA_FIXUP_ACT_PRE_PROBE)
e652f4c8 9986 codec->no_jack_detect = 1;
7d7eb9ea 9987}
e652f4c8 9988
1727a771 9989static const struct hda_fixup alc861_fixups[] = {
e652f4c8 9990 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
1727a771
TI
9991 .type = HDA_FIXUP_PINS,
9992 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
9993 { 0x0b, 0x0221101f }, /* HP */
9994 { 0x0f, 0x90170310 }, /* speaker */
9995 { }
9996 }
9997 },
e652f4c8 9998 [ALC861_FIXUP_AMP_VREF_0F] = {
1727a771 9999 .type = HDA_FIXUP_FUNC,
31150f23 10000 .v.func = alc861_fixup_asus_amp_vref_0f,
3b25eb69 10001 },
e652f4c8 10002 [ALC861_FIXUP_NO_JACK_DETECT] = {
1727a771 10003 .type = HDA_FIXUP_FUNC,
e652f4c8
TI
10004 .v.func = alc_fixup_no_jack_detect,
10005 },
10006 [ALC861_FIXUP_ASUS_A6RP] = {
1727a771 10007 .type = HDA_FIXUP_FUNC,
e652f4c8
TI
10008 .v.func = alc861_fixup_asus_amp_vref_0f,
10009 .chained = true,
10010 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
6ddf0fd1
TI
10011 },
10012 [ALC660_FIXUP_ASUS_W7J] = {
10013 .type = HDA_FIXUP_VERBS,
10014 .v.verbs = (const struct hda_verb[]) {
10015 /* ASUS W7J needs a magic pin setup on unused NID 0x10
10016 * for enabling outputs
10017 */
10018 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10019 { }
10020 },
e652f4c8 10021 }
1d045db9 10022};
7085ec12 10023
1d045db9 10024static const struct snd_pci_quirk alc861_fixup_tbl[] = {
6ddf0fd1 10025 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
e7ca237b 10026 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
e652f4c8
TI
10027 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
10028 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
10029 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
defce244 10030 SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F),
e652f4c8 10031 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
1d045db9
TI
10032 {}
10033};
3af9ee6b 10034
1d045db9
TI
10035/*
10036 */
1d045db9 10037static int patch_alc861(struct hda_codec *codec)
7085ec12 10038{
1d045db9 10039 struct alc_spec *spec;
1d045db9 10040 int err;
7085ec12 10041
3de95173
TI
10042 err = alc_alloc_spec(codec, 0x15);
10043 if (err < 0)
10044 return err;
1d045db9 10045
3de95173 10046 spec = codec->spec;
2722b535
TI
10047 if (has_cdefine_beep(codec))
10048 spec->gen.beep_nid = 0x23;
1d045db9 10049
225068ab
TI
10050#ifdef CONFIG_PM
10051 spec->power_hook = alc_power_eapd;
10052#endif
10053
c9af753f
TI
10054 alc_pre_init(codec);
10055
1727a771
TI
10056 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
10057 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
3af9ee6b 10058
cb4e4824
TI
10059 /* automatic parse from the BIOS config */
10060 err = alc861_parse_auto_config(codec);
e16fb6d1
TI
10061 if (err < 0)
10062 goto error;
3af9ee6b 10063
fea80fae
TI
10064 if (!spec->gen.no_analog) {
10065 err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
10066 if (err < 0)
10067 goto error;
10068 }
7085ec12 10069
1727a771 10070 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 10071
1d045db9 10072 return 0;
e16fb6d1
TI
10073
10074 error:
10075 alc_free(codec);
10076 return err;
7085ec12
TI
10077}
10078
1d045db9
TI
10079/*
10080 * ALC861-VD support
10081 *
10082 * Based on ALC882
10083 *
10084 * In addition, an independent DAC
10085 */
1d045db9 10086static int alc861vd_parse_auto_config(struct hda_codec *codec)
bc9f98a9 10087{
1d045db9 10088 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
3e6179b8
TI
10089 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
10090 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
ce764ab2
TI
10091}
10092
1d045db9 10093enum {
8fdcb6fe
TI
10094 ALC660VD_FIX_ASUS_GPIO1,
10095 ALC861VD_FIX_DALLAS,
1d045db9 10096};
ce764ab2 10097
8fdcb6fe
TI
10098/* exclude VREF80 */
10099static void alc861vd_fixup_dallas(struct hda_codec *codec,
1727a771 10100 const struct hda_fixup *fix, int action)
8fdcb6fe 10101{
1727a771 10102 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
b78562b1
TI
10103 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
10104 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
8fdcb6fe
TI
10105 }
10106}
10107
df73d83f
TI
10108/* reset GPIO1 */
10109static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
10110 const struct hda_fixup *fix, int action)
10111{
10112 struct alc_spec *spec = codec->spec;
10113
10114 if (action == HDA_FIXUP_ACT_PRE_PROBE)
10115 spec->gpio_mask |= 0x02;
10116 alc_fixup_gpio(codec, action, 0x01);
10117}
10118
1727a771 10119static const struct hda_fixup alc861vd_fixups[] = {
1d045db9 10120 [ALC660VD_FIX_ASUS_GPIO1] = {
df73d83f
TI
10121 .type = HDA_FIXUP_FUNC,
10122 .v.func = alc660vd_fixup_asus_gpio1,
1d045db9 10123 },
8fdcb6fe 10124 [ALC861VD_FIX_DALLAS] = {
1727a771 10125 .type = HDA_FIXUP_FUNC,
8fdcb6fe
TI
10126 .v.func = alc861vd_fixup_dallas,
10127 },
1d045db9 10128};
ce764ab2 10129
1d045db9 10130static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
8fdcb6fe 10131 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
1d045db9 10132 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
8fdcb6fe 10133 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
1d045db9
TI
10134 {}
10135};
ce764ab2 10136
1d045db9
TI
10137/*
10138 */
1d045db9 10139static int patch_alc861vd(struct hda_codec *codec)
ce764ab2 10140{
1d045db9 10141 struct alc_spec *spec;
cb4e4824 10142 int err;
ce764ab2 10143
3de95173
TI
10144 err = alc_alloc_spec(codec, 0x0b);
10145 if (err < 0)
10146 return err;
1d045db9 10147
3de95173 10148 spec = codec->spec;
2722b535
TI
10149 if (has_cdefine_beep(codec))
10150 spec->gen.beep_nid = 0x23;
1d045db9 10151
225068ab
TI
10152 spec->shutup = alc_eapd_shutup;
10153
c9af753f
TI
10154 alc_pre_init(codec);
10155
1727a771
TI
10156 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
10157 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1d045db9 10158
cb4e4824
TI
10159 /* automatic parse from the BIOS config */
10160 err = alc861vd_parse_auto_config(codec);
e16fb6d1
TI
10161 if (err < 0)
10162 goto error;
ce764ab2 10163
fea80fae
TI
10164 if (!spec->gen.no_analog) {
10165 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10166 if (err < 0)
10167 goto error;
10168 }
1d045db9 10169
1727a771 10170 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 10171
ce764ab2 10172 return 0;
e16fb6d1
TI
10173
10174 error:
10175 alc_free(codec);
10176 return err;
ce764ab2
TI
10177}
10178
1d045db9
TI
10179/*
10180 * ALC662 support
10181 *
10182 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
10183 * configuration. Each pin widget can choose any input DACs and a mixer.
10184 * Each ADC is connected from a mixer of all inputs. This makes possible
10185 * 6-channel independent captures.
10186 *
10187 * In addition, an independent DAC for the multi-playback (not used in this
10188 * driver yet).
10189 */
1d045db9
TI
10190
10191/*
10192 * BIOS auto configuration
10193 */
10194
bc9f98a9
KY
10195static int alc662_parse_auto_config(struct hda_codec *codec)
10196{
4c6d72d1 10197 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
3e6179b8
TI
10198 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
10199 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
10200 const hda_nid_t *ssids;
ee979a14 10201
7639a06c
TI
10202 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
10203 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
10204 codec->core.vendor_id == 0x10ec0671)
3e6179b8 10205 ssids = alc663_ssids;
6227cdce 10206 else
3e6179b8
TI
10207 ssids = alc662_ssids;
10208 return alc_parse_auto_config(codec, alc662_ignore, ssids);
bc9f98a9
KY
10209}
10210
6be7948f 10211static void alc272_fixup_mario(struct hda_codec *codec,
1727a771 10212 const struct hda_fixup *fix, int action)
6fc398cb 10213{
9bb1f06f 10214 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6fc398cb 10215 return;
6be7948f
TB
10216 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
10217 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
10218 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
10219 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
10220 (0 << AC_AMPCAP_MUTE_SHIFT)))
4e76a883 10221 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
6be7948f
TB
10222}
10223
8e383953
TI
10224static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
10225 { .channels = 2,
10226 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
10227 { .channels = 4,
10228 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
10229 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
10230 { }
10231};
10232
10233/* override the 2.1 chmap */
eb9ca3ab 10234static void alc_fixup_bass_chmap(struct hda_codec *codec,
8e383953
TI
10235 const struct hda_fixup *fix, int action)
10236{
10237 if (action == HDA_FIXUP_ACT_BUILD) {
10238 struct alc_spec *spec = codec->spec;
bbbc7e85 10239 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
8e383953
TI
10240 }
10241}
10242
bf68665d
TI
10243/* avoid D3 for keeping GPIO up */
10244static unsigned int gpio_led_power_filter(struct hda_codec *codec,
10245 hda_nid_t nid,
10246 unsigned int power_state)
10247{
10248 struct alc_spec *spec = codec->spec;
d261eec8 10249 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
bf68665d
TI
10250 return AC_PWRST_D0;
10251 return power_state;
10252}
10253
3e887f37
TI
10254static void alc662_fixup_led_gpio1(struct hda_codec *codec,
10255 const struct hda_fixup *fix, int action)
10256{
10257 struct alc_spec *spec = codec->spec;
3e887f37 10258
01e4a275 10259 alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
3e887f37 10260 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
0f32fd19 10261 spec->mute_led_polarity = 1;
bf68665d 10262 codec->power_filter = gpio_led_power_filter;
3e887f37
TI
10263 }
10264}
10265
c6790c8e
KY
10266static void alc662_usi_automute_hook(struct hda_codec *codec,
10267 struct hda_jack_callback *jack)
10268{
10269 struct alc_spec *spec = codec->spec;
10270 int vref;
10271 msleep(200);
10272 snd_hda_gen_hp_automute(codec, jack);
10273
10274 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
10275 msleep(100);
10276 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10277 vref);
10278}
10279
10280static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
10281 const struct hda_fixup *fix, int action)
10282{
10283 struct alc_spec *spec = codec->spec;
10284 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10285 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
10286 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
10287 }
10288}
10289
00066e97
SB
10290static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
10291 struct hda_jack_callback *cb)
10292{
10293 /* surround speakers at 0x1b already get muted automatically when
10294 * headphones are plugged in, but we have to mute/unmute the remaining
10295 * channels manually:
10296 * 0x15 - front left/front right
10297 * 0x18 - front center/ LFE
10298 */
10299 if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
10300 snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
10301 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
10302 } else {
10303 snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
10304 snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
10305 }
10306}
10307
10308static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
10309 const struct hda_fixup *fix, int action)
10310{
10311 /* Pin 0x1b: shared headphones jack and surround speakers */
10312 if (!is_jack_detectable(codec, 0x1b))
10313 return;
10314
10315 switch (action) {
10316 case HDA_FIXUP_ACT_PRE_PROBE:
10317 snd_hda_jack_detect_enable_callback(codec, 0x1b,
10318 alc662_aspire_ethos_mute_speakers);
336820c4
TI
10319 /* subwoofer needs an extra GPIO setting to become audible */
10320 alc_setup_gpio(codec, 0x02);
00066e97
SB
10321 break;
10322 case HDA_FIXUP_ACT_INIT:
10323 /* Make sure to start in a correct state, i.e. if
10324 * headphones have been plugged in before powering up the system
10325 */
10326 alc662_aspire_ethos_mute_speakers(codec, NULL);
10327 break;
10328 }
10329}
10330
5af29028
KY
10331static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
10332 const struct hda_fixup *fix, int action)
10333{
10334 struct alc_spec *spec = codec->spec;
10335
10336 static const struct hda_pintbl pincfgs[] = {
10337 { 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
10338 { 0x1b, 0x0181304f },
10339 { }
10340 };
10341
10342 switch (action) {
10343 case HDA_FIXUP_ACT_PRE_PROBE:
10344 spec->gen.mixer_nid = 0;
10345 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
10346 snd_hda_apply_pincfgs(codec, pincfgs);
10347 break;
10348 case HDA_FIXUP_ACT_INIT:
10349 alc_write_coef_idx(codec, 0x19, 0xa054);
10350 break;
10351 }
10352}
10353
09ad269c
KY
10354static void alc897_hp_automute_hook(struct hda_codec *codec,
10355 struct hda_jack_callback *jack)
10356{
10357 struct alc_spec *spec = codec->spec;
10358 int vref;
10359
10360 snd_hda_gen_hp_automute(codec, jack);
10361 vref = spec->gen.hp_jack_present ? (PIN_HP | AC_PINCTL_VREF_100) : PIN_HP;
10362 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10363 vref);
10364}
10365
10366static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec,
10367 const struct hda_fixup *fix, int action)
10368{
10369 struct alc_spec *spec = codec->spec;
10370 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10371 spec->gen.hp_automute_hook = alc897_hp_automute_hook;
10372 }
10373}
10374
6b0f95c4 10375static const struct coef_fw alc668_coefs[] = {
f3f9185f
KY
10376 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
10377 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
10378 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
10379 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
10380 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
10381 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
10382 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
10383 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
10384 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
10385 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
10386 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
10387 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
10388 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
10389 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
10390 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
10391 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
10392 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
10393 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
10394 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
10395 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
10396 {}
10397};
10398
10399static void alc668_restore_default_value(struct hda_codec *codec)
10400{
10401 alc_process_coef_fw(codec, alc668_coefs);
10402}
10403
6cb3b707 10404enum {
2df03514 10405 ALC662_FIXUP_ASPIRE,
3e887f37 10406 ALC662_FIXUP_LED_GPIO1,
6cb3b707 10407 ALC662_FIXUP_IDEAPAD,
6be7948f 10408 ALC272_FIXUP_MARIO,
f1ec5be1 10409 ALC662_FIXUP_CZC_ET26,
d2ebd479 10410 ALC662_FIXUP_CZC_P10T,
94024cd1 10411 ALC662_FIXUP_SKU_IGNORE,
e59ea3ed 10412 ALC662_FIXUP_HP_RP5800,
53c334ad
TI
10413 ALC662_FIXUP_ASUS_MODE1,
10414 ALC662_FIXUP_ASUS_MODE2,
10415 ALC662_FIXUP_ASUS_MODE3,
10416 ALC662_FIXUP_ASUS_MODE4,
10417 ALC662_FIXUP_ASUS_MODE5,
10418 ALC662_FIXUP_ASUS_MODE6,
10419 ALC662_FIXUP_ASUS_MODE7,
10420 ALC662_FIXUP_ASUS_MODE8,
1565cc35 10421 ALC662_FIXUP_NO_JACK_DETECT,
edfe3bfc 10422 ALC662_FIXUP_ZOTAC_Z68,
125821ae 10423 ALC662_FIXUP_INV_DMIC,
1f8b46cd 10424 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
73bdd597 10425 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
1f8b46cd 10426 ALC662_FIXUP_HEADSET_MODE,
73bdd597 10427 ALC668_FIXUP_HEADSET_MODE,
8e54b4ac 10428 ALC662_FIXUP_BASS_MODE4_CHMAP,
61a75f13 10429 ALC662_FIXUP_BASS_16,
a30c9aaa 10430 ALC662_FIXUP_BASS_1A,
8e54b4ac 10431 ALC662_FIXUP_BASS_CHMAP,
493a52a9 10432 ALC668_FIXUP_AUTO_MUTE,
5e6db669 10433 ALC668_FIXUP_DELL_DISABLE_AAMIX,
033b0a7c 10434 ALC668_FIXUP_DELL_XPS13,
9d4dc584 10435 ALC662_FIXUP_ASUS_Nx50,
fc7438b1 10436 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
3231e205 10437 ALC668_FIXUP_ASUS_Nx51,
5b7c5e1f 10438 ALC668_FIXUP_MIC_COEF,
11ba6111 10439 ALC668_FIXUP_ASUS_G751,
78f4f7c2
KY
10440 ALC891_FIXUP_HEADSET_MODE,
10441 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
9b51fe3e 10442 ALC662_FIXUP_ACER_VERITON,
1a3f0991 10443 ALC892_FIXUP_ASROCK_MOBO,
c6790c8e
KY
10444 ALC662_FIXUP_USI_FUNC,
10445 ALC662_FIXUP_USI_HEADSET_MODE,
ca169cc2 10446 ALC662_FIXUP_LENOVO_MULTI_CODECS,
00066e97 10447 ALC669_FIXUP_ACER_ASPIRE_ETHOS,
00066e97 10448 ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
5af29028 10449 ALC671_FIXUP_HP_HEADSET_MIC2,
d858c706 10450 ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
a124458a 10451 ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
a3fd1a98
HW
10452 ALC668_FIXUP_ASUS_NO_HEADSET_MIC,
10453 ALC668_FIXUP_HEADSET_MIC,
10454 ALC668_FIXUP_MIC_DET_COEF,
09ad269c
KY
10455 ALC897_FIXUP_LENOVO_HEADSET_MIC,
10456 ALC897_FIXUP_HEADSET_MIC_PIN,
6cb3b707
DH
10457};
10458
1727a771 10459static const struct hda_fixup alc662_fixups[] = {
2df03514 10460 [ALC662_FIXUP_ASPIRE] = {
1727a771
TI
10461 .type = HDA_FIXUP_PINS,
10462 .v.pins = (const struct hda_pintbl[]) {
2df03514
DC
10463 { 0x15, 0x99130112 }, /* subwoofer */
10464 { }
10465 }
10466 },
3e887f37
TI
10467 [ALC662_FIXUP_LED_GPIO1] = {
10468 .type = HDA_FIXUP_FUNC,
10469 .v.func = alc662_fixup_led_gpio1,
10470 },
6cb3b707 10471 [ALC662_FIXUP_IDEAPAD] = {
1727a771
TI
10472 .type = HDA_FIXUP_PINS,
10473 .v.pins = (const struct hda_pintbl[]) {
6cb3b707
DH
10474 { 0x17, 0x99130112 }, /* subwoofer */
10475 { }
3e887f37
TI
10476 },
10477 .chained = true,
10478 .chain_id = ALC662_FIXUP_LED_GPIO1,
6cb3b707 10479 },
6be7948f 10480 [ALC272_FIXUP_MARIO] = {
1727a771 10481 .type = HDA_FIXUP_FUNC,
b5bfbc67 10482 .v.func = alc272_fixup_mario,
d2ebd479 10483 },
f1ec5be1
HC
10484 [ALC662_FIXUP_CZC_ET26] = {
10485 .type = HDA_FIXUP_PINS,
10486 .v.pins = (const struct hda_pintbl[]) {
10487 {0x12, 0x403cc000},
10488 {0x14, 0x90170110}, /* speaker */
10489 {0x15, 0x411111f0},
10490 {0x16, 0x411111f0},
10491 {0x18, 0x01a19030}, /* mic */
10492 {0x19, 0x90a7013f}, /* int-mic */
10493 {0x1a, 0x01014020},
10494 {0x1b, 0x0121401f},
10495 {0x1c, 0x411111f0},
10496 {0x1d, 0x411111f0},
10497 {0x1e, 0x40478e35},
10498 {}
10499 },
10500 .chained = true,
10501 .chain_id = ALC662_FIXUP_SKU_IGNORE
10502 },
d2ebd479 10503 [ALC662_FIXUP_CZC_P10T] = {
1727a771 10504 .type = HDA_FIXUP_VERBS,
d2ebd479
AA
10505 .v.verbs = (const struct hda_verb[]) {
10506 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
10507 {}
10508 }
10509 },
94024cd1 10510 [ALC662_FIXUP_SKU_IGNORE] = {
1727a771 10511 .type = HDA_FIXUP_FUNC,
23d30f28 10512 .v.func = alc_fixup_sku_ignore,
c6b35874 10513 },
e59ea3ed 10514 [ALC662_FIXUP_HP_RP5800] = {
1727a771
TI
10515 .type = HDA_FIXUP_PINS,
10516 .v.pins = (const struct hda_pintbl[]) {
e59ea3ed
TI
10517 { 0x14, 0x0221201f }, /* HP out */
10518 { }
10519 },
10520 .chained = true,
10521 .chain_id = ALC662_FIXUP_SKU_IGNORE
10522 },
53c334ad 10523 [ALC662_FIXUP_ASUS_MODE1] = {
1727a771
TI
10524 .type = HDA_FIXUP_PINS,
10525 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
10526 { 0x14, 0x99130110 }, /* speaker */
10527 { 0x18, 0x01a19c20 }, /* mic */
10528 { 0x19, 0x99a3092f }, /* int-mic */
10529 { 0x21, 0x0121401f }, /* HP out */
10530 { }
10531 },
10532 .chained = true,
10533 .chain_id = ALC662_FIXUP_SKU_IGNORE
10534 },
10535 [ALC662_FIXUP_ASUS_MODE2] = {
1727a771
TI
10536 .type = HDA_FIXUP_PINS,
10537 .v.pins = (const struct hda_pintbl[]) {
2996bdba
TI
10538 { 0x14, 0x99130110 }, /* speaker */
10539 { 0x18, 0x01a19820 }, /* mic */
10540 { 0x19, 0x99a3092f }, /* int-mic */
10541 { 0x1b, 0x0121401f }, /* HP out */
10542 { }
10543 },
53c334ad
TI
10544 .chained = true,
10545 .chain_id = ALC662_FIXUP_SKU_IGNORE
10546 },
10547 [ALC662_FIXUP_ASUS_MODE3] = {
1727a771
TI
10548 .type = HDA_FIXUP_PINS,
10549 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
10550 { 0x14, 0x99130110 }, /* speaker */
10551 { 0x15, 0x0121441f }, /* HP */
10552 { 0x18, 0x01a19840 }, /* mic */
10553 { 0x19, 0x99a3094f }, /* int-mic */
10554 { 0x21, 0x01211420 }, /* HP2 */
10555 { }
10556 },
10557 .chained = true,
10558 .chain_id = ALC662_FIXUP_SKU_IGNORE
10559 },
10560 [ALC662_FIXUP_ASUS_MODE4] = {
1727a771
TI
10561 .type = HDA_FIXUP_PINS,
10562 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
10563 { 0x14, 0x99130110 }, /* speaker */
10564 { 0x16, 0x99130111 }, /* speaker */
10565 { 0x18, 0x01a19840 }, /* mic */
10566 { 0x19, 0x99a3094f }, /* int-mic */
10567 { 0x21, 0x0121441f }, /* HP */
10568 { }
10569 },
10570 .chained = true,
10571 .chain_id = ALC662_FIXUP_SKU_IGNORE
10572 },
10573 [ALC662_FIXUP_ASUS_MODE5] = {
1727a771
TI
10574 .type = HDA_FIXUP_PINS,
10575 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
10576 { 0x14, 0x99130110 }, /* speaker */
10577 { 0x15, 0x0121441f }, /* HP */
10578 { 0x16, 0x99130111 }, /* speaker */
10579 { 0x18, 0x01a19840 }, /* mic */
10580 { 0x19, 0x99a3094f }, /* int-mic */
10581 { }
10582 },
10583 .chained = true,
10584 .chain_id = ALC662_FIXUP_SKU_IGNORE
10585 },
10586 [ALC662_FIXUP_ASUS_MODE6] = {
1727a771
TI
10587 .type = HDA_FIXUP_PINS,
10588 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
10589 { 0x14, 0x99130110 }, /* speaker */
10590 { 0x15, 0x01211420 }, /* HP2 */
10591 { 0x18, 0x01a19840 }, /* mic */
10592 { 0x19, 0x99a3094f }, /* int-mic */
10593 { 0x1b, 0x0121441f }, /* HP */
10594 { }
10595 },
10596 .chained = true,
10597 .chain_id = ALC662_FIXUP_SKU_IGNORE
10598 },
10599 [ALC662_FIXUP_ASUS_MODE7] = {
1727a771
TI
10600 .type = HDA_FIXUP_PINS,
10601 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
10602 { 0x14, 0x99130110 }, /* speaker */
10603 { 0x17, 0x99130111 }, /* speaker */
10604 { 0x18, 0x01a19840 }, /* mic */
10605 { 0x19, 0x99a3094f }, /* int-mic */
10606 { 0x1b, 0x01214020 }, /* HP */
10607 { 0x21, 0x0121401f }, /* HP */
10608 { }
10609 },
10610 .chained = true,
10611 .chain_id = ALC662_FIXUP_SKU_IGNORE
10612 },
10613 [ALC662_FIXUP_ASUS_MODE8] = {
1727a771
TI
10614 .type = HDA_FIXUP_PINS,
10615 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
10616 { 0x14, 0x99130110 }, /* speaker */
10617 { 0x12, 0x99a30970 }, /* int-mic */
10618 { 0x15, 0x01214020 }, /* HP */
10619 { 0x17, 0x99130111 }, /* speaker */
10620 { 0x18, 0x01a19840 }, /* mic */
10621 { 0x21, 0x0121401f }, /* HP */
10622 { }
10623 },
10624 .chained = true,
10625 .chain_id = ALC662_FIXUP_SKU_IGNORE
2996bdba 10626 },
1565cc35 10627 [ALC662_FIXUP_NO_JACK_DETECT] = {
1727a771 10628 .type = HDA_FIXUP_FUNC,
1565cc35
TI
10629 .v.func = alc_fixup_no_jack_detect,
10630 },
edfe3bfc 10631 [ALC662_FIXUP_ZOTAC_Z68] = {
1727a771
TI
10632 .type = HDA_FIXUP_PINS,
10633 .v.pins = (const struct hda_pintbl[]) {
edfe3bfc
DH
10634 { 0x1b, 0x02214020 }, /* Front HP */
10635 { }
10636 }
10637 },
125821ae 10638 [ALC662_FIXUP_INV_DMIC] = {
1727a771 10639 .type = HDA_FIXUP_FUNC,
9d36a7dc 10640 .v.func = alc_fixup_inv_dmic,
125821ae 10641 },
033b0a7c
GM
10642 [ALC668_FIXUP_DELL_XPS13] = {
10643 .type = HDA_FIXUP_FUNC,
10644 .v.func = alc_fixup_dell_xps13,
10645 .chained = true,
10646 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
10647 },
5e6db669
GM
10648 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
10649 .type = HDA_FIXUP_FUNC,
10650 .v.func = alc_fixup_disable_aamix,
10651 .chained = true,
10652 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
10653 },
493a52a9
HW
10654 [ALC668_FIXUP_AUTO_MUTE] = {
10655 .type = HDA_FIXUP_FUNC,
10656 .v.func = alc_fixup_auto_mute_via_amp,
10657 .chained = true,
10658 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
10659 },
1f8b46cd
DH
10660 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
10661 .type = HDA_FIXUP_PINS,
10662 .v.pins = (const struct hda_pintbl[]) {
10663 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10664 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
10665 { }
10666 },
10667 .chained = true,
10668 .chain_id = ALC662_FIXUP_HEADSET_MODE
10669 },
10670 [ALC662_FIXUP_HEADSET_MODE] = {
10671 .type = HDA_FIXUP_FUNC,
10672 .v.func = alc_fixup_headset_mode_alc662,
10673 },
73bdd597
DH
10674 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
10675 .type = HDA_FIXUP_PINS,
10676 .v.pins = (const struct hda_pintbl[]) {
10677 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10678 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10679 { }
10680 },
10681 .chained = true,
10682 .chain_id = ALC668_FIXUP_HEADSET_MODE
10683 },
10684 [ALC668_FIXUP_HEADSET_MODE] = {
10685 .type = HDA_FIXUP_FUNC,
10686 .v.func = alc_fixup_headset_mode_alc668,
10687 },
8e54b4ac 10688 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
8e383953 10689 .type = HDA_FIXUP_FUNC,
eb9ca3ab 10690 .v.func = alc_fixup_bass_chmap,
8e383953
TI
10691 .chained = true,
10692 .chain_id = ALC662_FIXUP_ASUS_MODE4
10693 },
61a75f13
DH
10694 [ALC662_FIXUP_BASS_16] = {
10695 .type = HDA_FIXUP_PINS,
10696 .v.pins = (const struct hda_pintbl[]) {
10697 {0x16, 0x80106111}, /* bass speaker */
10698 {}
10699 },
10700 .chained = true,
10701 .chain_id = ALC662_FIXUP_BASS_CHMAP,
10702 },
a30c9aaa
TI
10703 [ALC662_FIXUP_BASS_1A] = {
10704 .type = HDA_FIXUP_PINS,
10705 .v.pins = (const struct hda_pintbl[]) {
10706 {0x1a, 0x80106111}, /* bass speaker */
10707 {}
10708 },
8e54b4ac
DH
10709 .chained = true,
10710 .chain_id = ALC662_FIXUP_BASS_CHMAP,
a30c9aaa 10711 },
8e54b4ac 10712 [ALC662_FIXUP_BASS_CHMAP] = {
a30c9aaa 10713 .type = HDA_FIXUP_FUNC,
eb9ca3ab 10714 .v.func = alc_fixup_bass_chmap,
a30c9aaa 10715 },
9d4dc584
BM
10716 [ALC662_FIXUP_ASUS_Nx50] = {
10717 .type = HDA_FIXUP_FUNC,
10718 .v.func = alc_fixup_auto_mute_via_amp,
10719 .chained = true,
10720 .chain_id = ALC662_FIXUP_BASS_1A
10721 },
fc7438b1
MP
10722 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
10723 .type = HDA_FIXUP_FUNC,
10724 .v.func = alc_fixup_headset_mode_alc668,
10725 .chain_id = ALC662_FIXUP_BASS_CHMAP
10726 },
3231e205
YP
10727 [ALC668_FIXUP_ASUS_Nx51] = {
10728 .type = HDA_FIXUP_PINS,
10729 .v.pins = (const struct hda_pintbl[]) {
fc7438b1
MP
10730 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10731 { 0x1a, 0x90170151 }, /* bass speaker */
10732 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
3231e205
YP
10733 {}
10734 },
10735 .chained = true,
fc7438b1 10736 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
3231e205 10737 },
5b7c5e1f 10738 [ALC668_FIXUP_MIC_COEF] = {
11ba6111
TI
10739 .type = HDA_FIXUP_VERBS,
10740 .v.verbs = (const struct hda_verb[]) {
10741 { 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
10742 { 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
10743 {}
10744 },
10745 },
5b7c5e1f
TI
10746 [ALC668_FIXUP_ASUS_G751] = {
10747 .type = HDA_FIXUP_PINS,
10748 .v.pins = (const struct hda_pintbl[]) {
10749 { 0x16, 0x0421101f }, /* HP */
10750 {}
10751 },
10752 .chained = true,
10753 .chain_id = ALC668_FIXUP_MIC_COEF
10754 },
78f4f7c2
KY
10755 [ALC891_FIXUP_HEADSET_MODE] = {
10756 .type = HDA_FIXUP_FUNC,
10757 .v.func = alc_fixup_headset_mode,
10758 },
10759 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
10760 .type = HDA_FIXUP_PINS,
10761 .v.pins = (const struct hda_pintbl[]) {
10762 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10763 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10764 { }
10765 },
10766 .chained = true,
10767 .chain_id = ALC891_FIXUP_HEADSET_MODE
10768 },
9b51fe3e
SB
10769 [ALC662_FIXUP_ACER_VERITON] = {
10770 .type = HDA_FIXUP_PINS,
10771 .v.pins = (const struct hda_pintbl[]) {
10772 { 0x15, 0x50170120 }, /* no internal speaker */
10773 { }
10774 }
10775 },
1a3f0991
TI
10776 [ALC892_FIXUP_ASROCK_MOBO] = {
10777 .type = HDA_FIXUP_PINS,
10778 .v.pins = (const struct hda_pintbl[]) {
10779 { 0x15, 0x40f000f0 }, /* disabled */
10780 { 0x16, 0x40f000f0 }, /* disabled */
1a3f0991
TI
10781 { }
10782 }
10783 },
c6790c8e
KY
10784 [ALC662_FIXUP_USI_FUNC] = {
10785 .type = HDA_FIXUP_FUNC,
10786 .v.func = alc662_fixup_usi_headset_mic,
10787 },
10788 [ALC662_FIXUP_USI_HEADSET_MODE] = {
10789 .type = HDA_FIXUP_PINS,
10790 .v.pins = (const struct hda_pintbl[]) {
10791 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
10792 { 0x18, 0x01a1903d },
10793 { }
10794 },
10795 .chained = true,
10796 .chain_id = ALC662_FIXUP_USI_FUNC
10797 },
ca169cc2
KY
10798 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
10799 .type = HDA_FIXUP_FUNC,
10800 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
10801 },
00066e97
SB
10802 [ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
10803 .type = HDA_FIXUP_FUNC,
10804 .v.func = alc662_fixup_aspire_ethos_hp,
10805 },
00066e97
SB
10806 [ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
10807 .type = HDA_FIXUP_PINS,
10808 .v.pins = (const struct hda_pintbl[]) {
10809 { 0x15, 0x92130110 }, /* front speakers */
10810 { 0x18, 0x99130111 }, /* center/subwoofer */
10811 { 0x1b, 0x11130012 }, /* surround plus jack for HP */
10812 { }
10813 },
10814 .chained = true,
336820c4 10815 .chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
00066e97 10816 },
5af29028
KY
10817 [ALC671_FIXUP_HP_HEADSET_MIC2] = {
10818 .type = HDA_FIXUP_FUNC,
10819 .v.func = alc671_fixup_hp_headset_mic2,
10820 },
d858c706
JHP
10821 [ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
10822 .type = HDA_FIXUP_PINS,
10823 .v.pins = (const struct hda_pintbl[]) {
10824 { 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
10825 { }
10826 },
10827 .chained = true,
10828 .chain_id = ALC662_FIXUP_USI_FUNC
10829 },
a124458a
JHP
10830 [ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
10831 .type = HDA_FIXUP_PINS,
10832 .v.pins = (const struct hda_pintbl[]) {
10833 { 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
10834 { 0x1b, 0x0221144f },
10835 { }
10836 },
10837 .chained = true,
10838 .chain_id = ALC662_FIXUP_USI_FUNC
10839 },
a3fd1a98
HW
10840 [ALC668_FIXUP_ASUS_NO_HEADSET_MIC] = {
10841 .type = HDA_FIXUP_PINS,
10842 .v.pins = (const struct hda_pintbl[]) {
10843 { 0x1b, 0x04a1112c },
10844 { }
10845 },
10846 .chained = true,
10847 .chain_id = ALC668_FIXUP_HEADSET_MIC
10848 },
10849 [ALC668_FIXUP_HEADSET_MIC] = {
10850 .type = HDA_FIXUP_FUNC,
10851 .v.func = alc269_fixup_headset_mic,
10852 .chained = true,
10853 .chain_id = ALC668_FIXUP_MIC_DET_COEF
10854 },
10855 [ALC668_FIXUP_MIC_DET_COEF] = {
10856 .type = HDA_FIXUP_VERBS,
10857 .v.verbs = (const struct hda_verb[]) {
10858 { 0x20, AC_VERB_SET_COEF_INDEX, 0x15 },
10859 { 0x20, AC_VERB_SET_PROC_COEF, 0x0d60 },
10860 {}
10861 },
10862 },
09ad269c
KY
10863 [ALC897_FIXUP_LENOVO_HEADSET_MIC] = {
10864 .type = HDA_FIXUP_FUNC,
10865 .v.func = alc897_fixup_lenovo_headset_mic,
10866 },
10867 [ALC897_FIXUP_HEADSET_MIC_PIN] = {
10868 .type = HDA_FIXUP_PINS,
10869 .v.pins = (const struct hda_pintbl[]) {
10870 { 0x1a, 0x03a11050 },
10871 { }
10872 },
10873 .chained = true,
10874 .chain_id = ALC897_FIXUP_LENOVO_HEADSET_MIC
10875 },
6cb3b707
DH
10876};
10877
a9111321 10878static const struct snd_pci_quirk alc662_fixup_tbl[] = {
53c334ad 10879 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
d3d3835c 10880 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
02f6ff90 10881 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
a6c47a85 10882 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
94024cd1 10883 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
125821ae 10884 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
1801928e 10885 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
2df03514 10886 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
9edeb110 10887 SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
a124458a 10888 SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
d858c706 10889 SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
73bdd597
DH
10890 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10891 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
c5d019c3 10892 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
033b0a7c 10893 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
467e1436 10894 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
09d2014f 10895 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
ad8ff99e 10896 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8dc9abb9
KY
10897 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10898 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
6a98e34b 10899 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
e59ea3ed 10900 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
148ebf54 10901 SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
2da2dc9e 10902 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
83a9efb5 10903 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
9d4dc584 10904 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
11ba6111 10905 SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
9edeb110 10906 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
8e54b4ac 10907 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
61a75f13 10908 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
3231e205
YP
10909 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
10910 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
a3fd1a98 10911 SND_PCI_QUIRK(0x1043, 0x185d, "ASUS G551JW", ALC668_FIXUP_ASUS_NO_HEADSET_MIC),
c7efff92 10912 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
61a75f13 10913 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
8e54b4ac 10914 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
1565cc35 10915 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
53c334ad 10916 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
a0e90acc 10917 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
c6790c8e 10918 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
ca169cc2 10919 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
09ad269c
KY
10920 SND_PCI_QUIRK(0x17aa, 0x32ca, "Lenovo ThinkCentre M80", ALC897_FIXUP_HEADSET_MIC_PIN),
10921 SND_PCI_QUIRK(0x17aa, 0x32cb, "Lenovo ThinkCentre M70", ALC897_FIXUP_HEADSET_MIC_PIN),
10922 SND_PCI_QUIRK(0x17aa, 0x32cf, "Lenovo ThinkCentre M950", ALC897_FIXUP_HEADSET_MIC_PIN),
10923 SND_PCI_QUIRK(0x17aa, 0x32f7, "Lenovo ThinkCentre M90", ALC897_FIXUP_HEADSET_MIC_PIN),
d4118588 10924 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
6cb3b707 10925 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
1a3f0991 10926 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
edfe3bfc 10927 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
9b51fe3e 10928 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
f1ec5be1 10929 SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
d2ebd479 10930 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
53c334ad
TI
10931
10932#if 0
10933 /* Below is a quirk table taken from the old code.
10934 * Basically the device should work as is without the fixup table.
10935 * If BIOS doesn't give a proper info, enable the corresponding
10936 * fixup entry.
7d7eb9ea 10937 */
53c334ad
TI
10938 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
10939 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
10940 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
10941 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
10942 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10943 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10944 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10945 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
10946 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
10947 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10948 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
10949 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
10950 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
10951 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
10952 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
10953 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10954 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
10955 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
10956 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10957 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
10958 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
10959 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10960 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
10961 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
10962 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
10963 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10964 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
10965 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
10966 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10967 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
10968 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10969 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10970 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
10971 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
10972 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
10973 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
10974 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
10975 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
10976 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
10977 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10978 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
10979 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
10980 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10981 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
10982 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
10983 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
10984 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
10985 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
10986 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10987 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
10988#endif
6cb3b707
DH
10989 {}
10990};
10991
1727a771 10992static const struct hda_model_fixup alc662_fixup_models[] = {
aa3841b5
TI
10993 {.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
10994 {.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
6be7948f 10995 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
aa3841b5 10996 {.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
53c334ad
TI
10997 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
10998 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
10999 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
11000 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
11001 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
11002 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
11003 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
11004 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
aa3841b5 11005 {.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
6e72aa5f 11006 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
aa3841b5 11007 {.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
e32aa85a 11008 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
aa3841b5
TI
11009 {.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
11010 {.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
11011 {.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
11012 {.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
11013 {.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
11014 {.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
11015 {.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
11016 {.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
40c51675 11017 {.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
aa3841b5
TI
11018 {.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
11019 {.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
11020 {.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
11021 {.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
11022 {.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
ba90d6a6 11023 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
00066e97 11024 {.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
6be7948f
TB
11025 {}
11026};
6cb3b707 11027
532895c5 11028static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
78f4f7c2
KY
11029 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
11030 {0x17, 0x02211010},
11031 {0x18, 0x01a19030},
11032 {0x1a, 0x01813040},
11033 {0x21, 0x01014020}),
4b4e0e32
HW
11034 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
11035 {0x16, 0x01813030},
11036 {0x17, 0x02211010},
11037 {0x18, 0x01a19040},
11038 {0x21, 0x01014020}),
1f8b46cd 11039 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
1f8b46cd 11040 {0x14, 0x01014010},
1f8b46cd 11041 {0x18, 0x01a19020},
1f8b46cd 11042 {0x1a, 0x0181302f},
11580297 11043 {0x1b, 0x0221401f}),
76c2132e
DH
11044 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
11045 {0x12, 0x99a30130},
11046 {0x14, 0x90170110},
11047 {0x15, 0x0321101f},
11580297 11048 {0x16, 0x03011020}),
76c2132e
DH
11049 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
11050 {0x12, 0x99a30140},
11051 {0x14, 0x90170110},
11052 {0x15, 0x0321101f},
11580297 11053 {0x16, 0x03011020}),
76c2132e
DH
11054 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
11055 {0x12, 0x99a30150},
11056 {0x14, 0x90170110},
11057 {0x15, 0x0321101f},
11580297 11058 {0x16, 0x03011020}),
76c2132e 11059 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
76c2132e
DH
11060 {0x14, 0x90170110},
11061 {0x15, 0x0321101f},
11580297 11062 {0x16, 0x03011020}),
76c2132e
DH
11063 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
11064 {0x12, 0x90a60130},
11065 {0x14, 0x90170110},
11580297 11066 {0x15, 0x0321101f}),
5af29028
KY
11067 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
11068 {0x14, 0x01014010},
11069 {0x17, 0x90170150},
f2adbae0 11070 {0x19, 0x02a11060},
5af29028
KY
11071 {0x1b, 0x01813030},
11072 {0x21, 0x02211020}),
11073 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
11074 {0x14, 0x01014010},
11075 {0x18, 0x01a19040},
11076 {0x1b, 0x01813030},
11077 {0x21, 0x02211020}),
11078 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
11079 {0x14, 0x01014020},
11080 {0x17, 0x90170110},
11081 {0x18, 0x01a19050},
11082 {0x1b, 0x01813040},
11083 {0x21, 0x02211030}),
532895c5
HW
11084 {}
11085};
11086
1d045db9
TI
11087/*
11088 */
bc9f98a9
KY
11089static int patch_alc662(struct hda_codec *codec)
11090{
11091 struct alc_spec *spec;
3de95173 11092 int err;
bc9f98a9 11093
3de95173
TI
11094 err = alc_alloc_spec(codec, 0x0b);
11095 if (err < 0)
11096 return err;
bc9f98a9 11097
3de95173 11098 spec = codec->spec;
1f0f4b80 11099
225068ab
TI
11100 spec->shutup = alc_eapd_shutup;
11101
53c334ad
TI
11102 /* handle multiple HPs as is */
11103 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
11104
2c3bf9ab
TI
11105 alc_fix_pll_init(codec, 0x20, 0x04, 15);
11106
7639a06c 11107 switch (codec->core.vendor_id) {
f3f9185f
KY
11108 case 0x10ec0668:
11109 spec->init_hook = alc668_restore_default_value;
11110 break;
f3f9185f 11111 }
8663ff75 11112
c9af753f
TI
11113 alc_pre_init(codec);
11114
1727a771 11115 snd_hda_pick_fixup(codec, alc662_fixup_models,
8e5a0509 11116 alc662_fixup_tbl, alc662_fixups);
0fc1e447 11117 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
1727a771 11118 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
8e5a0509
TI
11119
11120 alc_auto_parse_customize_define(codec);
11121
7504b6cd
TI
11122 if (has_cdefine_beep(codec))
11123 spec->gen.beep_nid = 0x01;
11124
1bb7e43e 11125 if ((alc_get_coef0(codec) & (1 << 14)) &&
5100cd07 11126 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
e16fb6d1 11127 spec->cdefine.platform_type == 1) {
6134b1a2
WY
11128 err = alc_codec_rename(codec, "ALC272X");
11129 if (err < 0)
e16fb6d1 11130 goto error;
20ca0c35 11131 }
274693f3 11132
b9c5106c
TI
11133 /* automatic parse from the BIOS config */
11134 err = alc662_parse_auto_config(codec);
e16fb6d1
TI
11135 if (err < 0)
11136 goto error;
bc9f98a9 11137
7504b6cd 11138 if (!spec->gen.no_analog && spec->gen.beep_nid) {
7639a06c 11139 switch (codec->core.vendor_id) {
da00c244 11140 case 0x10ec0662:
fea80fae 11141 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
da00c244
KY
11142 break;
11143 case 0x10ec0272:
11144 case 0x10ec0663:
11145 case 0x10ec0665:
9ad54547 11146 case 0x10ec0668:
fea80fae 11147 err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
da00c244
KY
11148 break;
11149 case 0x10ec0273:
fea80fae 11150 err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
da00c244
KY
11151 break;
11152 }
fea80fae
TI
11153 if (err < 0)
11154 goto error;
cec27c89 11155 }
2134ea4f 11156
1727a771 11157 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 11158
bc9f98a9 11159 return 0;
801f49d3 11160
e16fb6d1
TI
11161 error:
11162 alc_free(codec);
11163 return err;
b478b998
KY
11164}
11165
d1eb57f4
KY
11166/*
11167 * ALC680 support
11168 */
d1eb57f4 11169
d1eb57f4
KY
11170static int alc680_parse_auto_config(struct hda_codec *codec)
11171{
3e6179b8 11172 return alc_parse_auto_config(codec, NULL, NULL);
d1eb57f4
KY
11173}
11174
d1eb57f4 11175/*
d1eb57f4 11176 */
d1eb57f4
KY
11177static int patch_alc680(struct hda_codec *codec)
11178{
d1eb57f4
KY
11179 int err;
11180
1f0f4b80 11181 /* ALC680 has no aa-loopback mixer */
3de95173
TI
11182 err = alc_alloc_spec(codec, 0);
11183 if (err < 0)
11184 return err;
1f0f4b80 11185
1ebec5f2
TI
11186 /* automatic parse from the BIOS config */
11187 err = alc680_parse_auto_config(codec);
11188 if (err < 0) {
11189 alc_free(codec);
11190 return err;
d1eb57f4
KY
11191 }
11192
d1eb57f4
KY
11193 return 0;
11194}
11195
1da177e4
LT
11196/*
11197 * patch entries
11198 */
b9a94a9c 11199static const struct hda_device_id snd_hda_id_realtek[] = {
0a6f0600 11200 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
b9a94a9c 11201 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
2a36c16e 11202 HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
4231430d 11203 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
1948fc06 11204 HDA_CODEC_ENTRY(0x10ec0230, "ALC236", patch_alc269),
b9a94a9c
TI
11205 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
11206 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
dcd4f0db 11207 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
b9a94a9c 11208 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
736f20a7 11209 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
7fbdcd83 11210 HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
b9a94a9c
TI
11211 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
11212 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
f429e7e4 11213 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
b9a94a9c
TI
11214 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
11215 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
11216 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
11217 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
11218 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
11219 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
11220 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
dcd4f0db 11221 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
b9a94a9c
TI
11222 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
11223 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
11224 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
11225 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
11226 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
11227 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
0a6f0600 11228 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
b9a94a9c 11229 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
630e3612 11230 HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
b9a94a9c 11231 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
0a6f0600 11232 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
b9a94a9c
TI
11233 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
11234 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
11235 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
dcd4f0db 11236 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
7d727869 11237 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
b9a94a9c 11238 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
28f1f9b2 11239 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
1078bef0 11240 HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
f0778871 11241 HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
b9a94a9c
TI
11242 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
11243 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
11244 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
11245 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
11246 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
11247 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
11248 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
11249 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
11250 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
11251 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
11252 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
11253 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
11254 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
11255 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
6fbae35a
KY
11256 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
11257 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
11258 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
83629532 11259 HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
78f4f7c2 11260 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
b9a94a9c
TI
11261 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
11262 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
11263 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
11264 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
11265 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
11266 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
11267 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
11268 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
11269 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
11270 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
11271 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
e5782a5d 11272 HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
b9a94a9c
TI
11273 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
11274 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
6d9ffcff 11275 HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
65553b12 11276 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
a535ad57 11277 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
1da177e4
LT
11278 {} /* terminator */
11279};
b9a94a9c 11280MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
1289e9e8
TI
11281
11282MODULE_LICENSE("GPL");
11283MODULE_DESCRIPTION("Realtek HD-audio codec");
11284
d8a766a1 11285static struct hda_codec_driver realtek_driver = {
b9a94a9c 11286 .id = snd_hda_id_realtek,
1289e9e8
TI
11287};
11288
d8a766a1 11289module_hda_codec_driver(realtek_driver);