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