]> git.ipfire.org Git - thirdparty/linux.git/blame - sound/pci/hda/patch_realtek.c
ALSA: hda/realtek: Re-arrange quirk table entries
[thirdparty/linux.git] / sound / pci / hda / patch_realtek.c
CommitLineData
d0fa1179 1// SPDX-License-Identifier: GPL-2.0-or-later
1da177e4
LT
2/*
3 * Universal Interface for Intel High Definition Audio Codec
4 *
1d045db9 5 * HD audio interface patch for Realtek ALC codecs
1da177e4 6 *
df694daa
KY
7 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
8 * PeiSen Hou <pshou@realtek.com.tw>
1da177e4 9 * Takashi Iwai <tiwai@suse.de>
409a3e98 10 * Jonathan Woithe <jwoithe@just42.net>
1da177e4
LT
11 */
12
1da177e4
LT
13#include <linux/init.h>
14#include <linux/delay.h>
15#include <linux/slab.h>
16#include <linux/pci.h>
08fb0d0e 17#include <linux/dmi.h>
da155d5b 18#include <linux/module.h>
33f4acd3 19#include <linux/input.h>
87dc3648 20#include <linux/leds.h>
1da177e4 21#include <sound/core.h>
9ad0e496 22#include <sound/jack.h>
be57bfff 23#include <sound/hda_codec.h>
1da177e4 24#include "hda_local.h"
23d30f28 25#include "hda_auto_parser.h"
1835a0f9 26#include "hda_jack.h"
08c189f2 27#include "hda_generic.h"
d3dca026 28#include "hda_component.h"
1da177e4 29
cd63a5ff
TI
30/* keep halting ALC5505 DSP, for power saving */
31#define HALT_REALTEK_ALC5505
32
4a79ba34
TI
33/* extra amp-initialization sequence types */
34enum {
1c76aa5f 35 ALC_INIT_UNDEFINED,
4a79ba34
TI
36 ALC_INIT_NONE,
37 ALC_INIT_DEFAULT,
4a79ba34
TI
38};
39
73bdd597
DH
40enum {
41 ALC_HEADSET_MODE_UNKNOWN,
42 ALC_HEADSET_MODE_UNPLUGGED,
43 ALC_HEADSET_MODE_HEADSET,
44 ALC_HEADSET_MODE_MIC,
45 ALC_HEADSET_MODE_HEADPHONE,
46};
47
48enum {
49 ALC_HEADSET_TYPE_UNKNOWN,
50 ALC_HEADSET_TYPE_CTIA,
51 ALC_HEADSET_TYPE_OMTP,
52};
53
c7b60a89
HW
54enum {
55 ALC_KEY_MICMUTE_INDEX,
56};
57
da00c244
KY
58struct alc_customize_define {
59 unsigned int sku_cfg;
60 unsigned char port_connectivity;
61 unsigned char check_sum;
62 unsigned char customization;
63 unsigned char external_amp;
64 unsigned int enable_pcbeep:1;
65 unsigned int platform_type:1;
66 unsigned int swap:1;
67 unsigned int override:1;
90622917 68 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
da00c244
KY
69};
70
766538ac
TI
71struct alc_coef_led {
72 unsigned int idx;
73 unsigned int mask;
74 unsigned int on;
75 unsigned int off;
76};
77
1da177e4 78struct alc_spec {
08c189f2 79 struct hda_gen_spec gen; /* must be at head */
23d30f28 80
1da177e4 81 /* codec parameterization */
da00c244 82 struct alc_customize_define cdefine;
08c189f2 83 unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
834be88d 84
5579cd6f
TI
85 /* GPIO bits */
86 unsigned int gpio_mask;
87 unsigned int gpio_dir;
88 unsigned int gpio_data;
215c850c 89 bool gpio_write_delay; /* add a delay before writing gpio_data */
5579cd6f 90
8d3d1ece 91 /* mute LED for HP laptops, see vref_mute_led_set() */
08fb0d0e 92 int mute_led_polarity;
dbd13179 93 int micmute_led_polarity;
08fb0d0e 94 hda_nid_t mute_led_nid;
9c5dc3bf 95 hda_nid_t cap_mute_led_nid;
08fb0d0e 96
0f32fd19
TI
97 unsigned int gpio_mute_led_mask;
98 unsigned int gpio_mic_led_mask;
766538ac
TI
99 struct alc_coef_led mute_led_coef;
100 struct alc_coef_led mic_led_coef;
b837a9f5 101 struct mutex coef_mutex;
9f5c6faf 102
73bdd597
DH
103 hda_nid_t headset_mic_pin;
104 hda_nid_t headphone_mic_pin;
105 int current_headset_mode;
106 int current_headset_type;
107
ae6b813a
TI
108 /* hooks */
109 void (*init_hook)(struct hda_codec *codec);
83012a7c 110#ifdef CONFIG_PM
c97259df 111 void (*power_hook)(struct hda_codec *codec);
f5de24b0 112#endif
1c716153 113 void (*shutup)(struct hda_codec *codec);
d922b51d 114
4a79ba34 115 int init_amp;
d433a678 116 int codec_variant; /* flag for other variants */
97a26570
KY
117 unsigned int has_alc5505_dsp:1;
118 unsigned int no_depop_delay:1;
693abe11 119 unsigned int done_hp_init:1;
c0ca5ece 120 unsigned int no_shutup_pins:1;
d3ba58bb 121 unsigned int ultra_low_power:1;
476c02e0 122 unsigned int has_hs_key:1;
92666d45 123 unsigned int no_internal_mic_pin:1;
e64f14f4 124
2c3bf9ab
TI
125 /* for PLL fix */
126 hda_nid_t pll_nid;
127 unsigned int pll_coef_idx, pll_coef_bit;
1bb7e43e 128 unsigned int coef0;
33f4acd3 129 struct input_dev *kb_dev;
c7b60a89 130 u8 alc_mute_keycode_map[1];
d3dca026
LT
131
132 /* component binding */
133 struct component_match *match;
134 struct hda_component comps[HDA_MAX_COMPONENTS];
df694daa
KY
135};
136
f2a227cd
TI
137/*
138 * COEF access helper functions
139 */
140
2a845837
TI
141static void coef_mutex_lock(struct hda_codec *codec)
142{
143 struct alc_spec *spec = codec->spec;
144
145 snd_hda_power_up_pm(codec);
146 mutex_lock(&spec->coef_mutex);
147}
148
149static void coef_mutex_unlock(struct hda_codec *codec)
150{
151 struct alc_spec *spec = codec->spec;
152
153 mutex_unlock(&spec->coef_mutex);
154 snd_hda_power_down_pm(codec);
155}
156
b837a9f5
TI
157static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
158 unsigned int coef_idx)
f2a227cd
TI
159{
160 unsigned int val;
161
162 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
163 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
164 return val;
165}
166
b837a9f5
TI
167static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
168 unsigned int coef_idx)
169{
b837a9f5
TI
170 unsigned int val;
171
2a845837 172 coef_mutex_lock(codec);
b837a9f5 173 val = __alc_read_coefex_idx(codec, nid, coef_idx);
2a845837 174 coef_mutex_unlock(codec);
b837a9f5
TI
175 return val;
176}
177
f2a227cd
TI
178#define alc_read_coef_idx(codec, coef_idx) \
179 alc_read_coefex_idx(codec, 0x20, coef_idx)
180
b837a9f5
TI
181static void __alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
182 unsigned int coef_idx, unsigned int coef_val)
f2a227cd
TI
183{
184 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
185 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
186}
187
b837a9f5
TI
188static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
189 unsigned int coef_idx, unsigned int coef_val)
190{
2a845837 191 coef_mutex_lock(codec);
b837a9f5 192 __alc_write_coefex_idx(codec, nid, coef_idx, coef_val);
2a845837 193 coef_mutex_unlock(codec);
b837a9f5
TI
194}
195
f2a227cd
TI
196#define alc_write_coef_idx(codec, coef_idx, coef_val) \
197 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
198
b837a9f5
TI
199static void __alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
200 unsigned int coef_idx, unsigned int mask,
201 unsigned int bits_set)
202{
203 unsigned int val = __alc_read_coefex_idx(codec, nid, coef_idx);
204
205 if (val != -1)
206 __alc_write_coefex_idx(codec, nid, coef_idx,
207 (val & ~mask) | bits_set);
208}
209
98b24883
TI
210static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
211 unsigned int coef_idx, unsigned int mask,
212 unsigned int bits_set)
213{
2a845837 214 coef_mutex_lock(codec);
b837a9f5 215 __alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set);
2a845837 216 coef_mutex_unlock(codec);
98b24883
TI
217}
218
219#define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
220 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
221
f2a227cd
TI
222/* a special bypass for COEF 0; read the cached value at the second time */
223static unsigned int alc_get_coef0(struct hda_codec *codec)
224{
225 struct alc_spec *spec = codec->spec;
226
227 if (!spec->coef0)
228 spec->coef0 = alc_read_coef_idx(codec, 0);
229 return spec->coef0;
230}
231
54db6c39
TI
232/* coef writes/updates batch */
233struct coef_fw {
234 unsigned char nid;
235 unsigned char idx;
236 unsigned short mask;
237 unsigned short val;
238};
239
240#define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
241 { .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
242#define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
243#define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
244#define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
245
246static void alc_process_coef_fw(struct hda_codec *codec,
247 const struct coef_fw *fw)
248{
2a845837 249 coef_mutex_lock(codec);
54db6c39
TI
250 for (; fw->nid; fw++) {
251 if (fw->mask == (unsigned short)-1)
b837a9f5 252 __alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
54db6c39 253 else
b837a9f5
TI
254 __alc_update_coefex_idx(codec, fw->nid, fw->idx,
255 fw->mask, fw->val);
54db6c39 256 }
2a845837 257 coef_mutex_unlock(codec);
54db6c39
TI
258}
259
df694daa 260/*
1d045db9 261 * GPIO setup tables, used in initialization
df694daa 262 */
5579cd6f 263
bc9f98a9 264/* Enable GPIO mask and set output */
5579cd6f
TI
265static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
266{
267 struct alc_spec *spec = codec->spec;
bc9f98a9 268
5579cd6f
TI
269 spec->gpio_mask |= mask;
270 spec->gpio_dir |= mask;
271 spec->gpio_data |= mask;
272}
bc9f98a9 273
5579cd6f
TI
274static void alc_write_gpio_data(struct hda_codec *codec)
275{
276 struct alc_spec *spec = codec->spec;
277
278 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
279 spec->gpio_data);
280}
281
aaf312de
TI
282static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
283 bool on)
284{
285 struct alc_spec *spec = codec->spec;
286 unsigned int oldval = spec->gpio_data;
287
288 if (on)
289 spec->gpio_data |= mask;
290 else
291 spec->gpio_data &= ~mask;
292 if (oldval != spec->gpio_data)
293 alc_write_gpio_data(codec);
294}
295
5579cd6f
TI
296static void alc_write_gpio(struct hda_codec *codec)
297{
298 struct alc_spec *spec = codec->spec;
299
300 if (!spec->gpio_mask)
301 return;
302
303 snd_hda_codec_write(codec, codec->core.afg, 0,
304 AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
305 snd_hda_codec_write(codec, codec->core.afg, 0,
306 AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir);
215c850c
TI
307 if (spec->gpio_write_delay)
308 msleep(1);
5579cd6f
TI
309 alc_write_gpio_data(codec);
310}
311
312static void alc_fixup_gpio(struct hda_codec *codec, int action,
313 unsigned int mask)
314{
315 if (action == HDA_FIXUP_ACT_PRE_PROBE)
316 alc_setup_gpio(codec, mask);
317}
318
319static void alc_fixup_gpio1(struct hda_codec *codec,
320 const struct hda_fixup *fix, int action)
321{
322 alc_fixup_gpio(codec, action, 0x01);
323}
324
325static void alc_fixup_gpio2(struct hda_codec *codec,
326 const struct hda_fixup *fix, int action)
327{
328 alc_fixup_gpio(codec, action, 0x02);
329}
330
331static void alc_fixup_gpio3(struct hda_codec *codec,
332 const struct hda_fixup *fix, int action)
333{
334 alc_fixup_gpio(codec, action, 0x03);
335}
bdd148a3 336
ae065f1c
TI
337static void alc_fixup_gpio4(struct hda_codec *codec,
338 const struct hda_fixup *fix, int action)
339{
340 alc_fixup_gpio(codec, action, 0x04);
341}
342
8a503555
TI
343static void alc_fixup_micmute_led(struct hda_codec *codec,
344 const struct hda_fixup *fix, int action)
345{
e65bf997 346 if (action == HDA_FIXUP_ACT_PRE_PROBE)
8a503555
TI
347 snd_hda_gen_add_micmute_led_cdev(codec, NULL);
348}
349
2c3bf9ab
TI
350/*
351 * Fix hardware PLL issue
352 * On some codecs, the analog PLL gating control must be off while
353 * the default value is 1.
354 */
355static void alc_fix_pll(struct hda_codec *codec)
356{
357 struct alc_spec *spec = codec->spec;
2c3bf9ab 358
98b24883
TI
359 if (spec->pll_nid)
360 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
361 1 << spec->pll_coef_bit, 0);
2c3bf9ab
TI
362}
363
364static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
365 unsigned int coef_idx, unsigned int coef_bit)
366{
367 struct alc_spec *spec = codec->spec;
368 spec->pll_nid = nid;
369 spec->pll_coef_idx = coef_idx;
370 spec->pll_coef_bit = coef_bit;
371 alc_fix_pll(codec);
372}
373
cf5a2279 374/* update the master volume per volume-knob's unsol event */
1a4f69d5
TI
375static void alc_update_knob_master(struct hda_codec *codec,
376 struct hda_jack_callback *jack)
cf5a2279
TI
377{
378 unsigned int val;
379 struct snd_kcontrol *kctl;
380 struct snd_ctl_elem_value *uctl;
381
382 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
383 if (!kctl)
384 return;
385 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
386 if (!uctl)
387 return;
2ebab40e 388 val = snd_hda_codec_read(codec, jack->nid, 0,
cf5a2279
TI
389 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
390 val &= HDA_AMP_VOLMASK;
391 uctl->value.integer.value[0] = val;
392 uctl->value.integer.value[1] = val;
393 kctl->put(kctl, uctl);
394 kfree(uctl);
395}
396
29adc4b9 397static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
f21d78e2 398{
29adc4b9
DH
399 /* For some reason, the res given from ALC880 is broken.
400 Here we adjust it properly. */
401 snd_hda_jack_unsol_event(codec, res >> 2);
f21d78e2
TI
402}
403
394c97f8
KY
404/* Change EAPD to verb control */
405static void alc_fill_eapd_coef(struct hda_codec *codec)
406{
407 int coef;
408
409 coef = alc_get_coef0(codec);
410
7639a06c 411 switch (codec->core.vendor_id) {
394c97f8
KY
412 case 0x10ec0262:
413 alc_update_coef_idx(codec, 0x7, 0, 1<<5);
414 break;
415 case 0x10ec0267:
416 case 0x10ec0268:
417 alc_update_coef_idx(codec, 0x7, 0, 1<<13);
418 break;
419 case 0x10ec0269:
420 if ((coef & 0x00f0) == 0x0010)
421 alc_update_coef_idx(codec, 0xd, 0, 1<<14);
422 if ((coef & 0x00f0) == 0x0020)
423 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
424 if ((coef & 0x00f0) == 0x0030)
425 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
426 break;
427 case 0x10ec0280:
428 case 0x10ec0284:
429 case 0x10ec0290:
430 case 0x10ec0292:
431 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
432 break;
4231430d 433 case 0x10ec0225:
44be77c5
TI
434 case 0x10ec0295:
435 case 0x10ec0299:
436 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
c0dbbdad 437 fallthrough;
44be77c5 438 case 0x10ec0215:
1948fc06 439 case 0x10ec0230:
394c97f8 440 case 0x10ec0233:
ea04a1db 441 case 0x10ec0235:
c4473744 442 case 0x10ec0236:
7fbdcd83 443 case 0x10ec0245:
394c97f8 444 case 0x10ec0255:
c4473744 445 case 0x10ec0256:
527f4643 446 case 0x19e58326:
f429e7e4 447 case 0x10ec0257:
394c97f8
KY
448 case 0x10ec0282:
449 case 0x10ec0283:
450 case 0x10ec0286:
451 case 0x10ec0288:
0a6f0600 452 case 0x10ec0285:
506b62c3 453 case 0x10ec0298:
0a6f0600 454 case 0x10ec0289:
1078bef0 455 case 0x10ec0300:
394c97f8
KY
456 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
457 break;
3aabf94c
KY
458 case 0x10ec0275:
459 alc_update_coef_idx(codec, 0xe, 0, 1<<0);
460 break;
8822702f
HW
461 case 0x10ec0287:
462 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
463 alc_write_coef_idx(codec, 0x8, 0x4ab7);
464 break;
394c97f8
KY
465 case 0x10ec0293:
466 alc_update_coef_idx(codec, 0xa, 1<<13, 0);
467 break;
dcd4f0db
KY
468 case 0x10ec0234:
469 case 0x10ec0274:
470 case 0x10ec0294:
6fbae35a
KY
471 case 0x10ec0700:
472 case 0x10ec0701:
473 case 0x10ec0703:
83629532 474 case 0x10ec0711:
dcd4f0db
KY
475 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
476 break;
394c97f8
KY
477 case 0x10ec0662:
478 if ((coef & 0x00f0) == 0x0030)
479 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
480 break;
481 case 0x10ec0272:
482 case 0x10ec0273:
483 case 0x10ec0663:
484 case 0x10ec0665:
485 case 0x10ec0670:
486 case 0x10ec0671:
487 case 0x10ec0672:
488 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
489 break;
9194a1eb 490 case 0x10ec0222:
f0778871
KY
491 case 0x10ec0623:
492 alc_update_coef_idx(codec, 0x19, 1<<13, 0);
493 break;
394c97f8
KY
494 case 0x10ec0668:
495 alc_update_coef_idx(codec, 0x7, 3<<13, 0);
496 break;
497 case 0x10ec0867:
498 alc_update_coef_idx(codec, 0x4, 1<<10, 0);
499 break;
500 case 0x10ec0888:
501 if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
502 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
503 break;
504 case 0x10ec0892:
e5782a5d 505 case 0x10ec0897:
394c97f8
KY
506 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
507 break;
508 case 0x10ec0899:
509 case 0x10ec0900:
6d9ffcff 510 case 0x10ec0b00:
65553b12 511 case 0x10ec1168:
a535ad57 512 case 0x10ec1220:
394c97f8
KY
513 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
514 break;
515 }
516}
517
f9423e7a
KY
518/* additional initialization for ALC888 variants */
519static void alc888_coef_init(struct hda_codec *codec)
520{
1df8874b
KY
521 switch (alc_get_coef0(codec) & 0x00f0) {
522 /* alc888-VA */
523 case 0x00:
524 /* alc888-VB */
525 case 0x10:
526 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
527 break;
528 }
87a8c370
JK
529}
530
3fb4a508
TI
531/* turn on/off EAPD control (only if available) */
532static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
533{
534 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
535 return;
536 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
537 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
538 on ? 2 : 0);
539}
540
691f1fcc
TI
541/* turn on/off EAPD controls of the codec */
542static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
543{
544 /* We currently only handle front, HP */
caf3c043 545 static const hda_nid_t pins[] = {
af95b414 546 0x0f, 0x10, 0x14, 0x15, 0x17, 0
39fa84e9 547 };
caf3c043 548 const hda_nid_t *p;
39fa84e9
TI
549 for (p = pins; *p; p++)
550 set_eapd(codec, *p, on);
691f1fcc
TI
551}
552
dad3197d
KY
553static int find_ext_mic_pin(struct hda_codec *codec);
554
555static void alc_headset_mic_no_shutup(struct hda_codec *codec)
556{
557 const struct hda_pincfg *pin;
558 int mic_pin = find_ext_mic_pin(codec);
559 int i;
560
561 /* don't shut up pins when unloading the driver; otherwise it breaks
562 * the default pin setup at the next load of the driver
563 */
564 if (codec->bus->shutdown)
565 return;
566
567 snd_array_for_each(&codec->init_pins, i, pin) {
568 /* use read here for syncing after issuing each verb */
569 if (pin->nid != mic_pin)
570 snd_hda_codec_read(codec, pin->nid, 0,
571 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
572 }
573
574 codec->pins_shutup = 1;
575}
576
c0ca5ece
TI
577static void alc_shutup_pins(struct hda_codec *codec)
578{
579 struct alc_spec *spec = codec->spec;
580
dad3197d 581 switch (codec->core.vendor_id) {
5aec9891
KY
582 case 0x10ec0236:
583 case 0x10ec0256:
527f4643 584 case 0x19e58326:
66c5d718 585 case 0x10ec0283:
dad3197d
KY
586 case 0x10ec0286:
587 case 0x10ec0288:
588 case 0x10ec0298:
589 alc_headset_mic_no_shutup(codec);
590 break;
591 default:
592 if (!spec->no_shutup_pins)
593 snd_hda_shutup_pins(codec);
594 break;
595 }
c0ca5ece
TI
596}
597
1c716153 598/* generic shutup callback;
4ce8e6a5 599 * just turning off EAPD and a little pause for avoiding pop-noise
1c716153
TI
600 */
601static void alc_eapd_shutup(struct hda_codec *codec)
602{
97a26570
KY
603 struct alc_spec *spec = codec->spec;
604
1c716153 605 alc_auto_setup_eapd(codec, false);
97a26570
KY
606 if (!spec->no_depop_delay)
607 msleep(200);
c0ca5ece 608 alc_shutup_pins(codec);
1c716153
TI
609}
610
1d045db9 611/* generic EAPD initialization */
4a79ba34 612static void alc_auto_init_amp(struct hda_codec *codec, int type)
bc9f98a9 613{
39fa84e9 614 alc_auto_setup_eapd(codec, true);
5579cd6f 615 alc_write_gpio(codec);
4a79ba34 616 switch (type) {
4a79ba34 617 case ALC_INIT_DEFAULT:
7639a06c 618 switch (codec->core.vendor_id) {
c9b58006 619 case 0x10ec0260:
98b24883 620 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
c9b58006 621 break;
c9b58006
KY
622 case 0x10ec0880:
623 case 0x10ec0882:
624 case 0x10ec0883:
625 case 0x10ec0885:
1df8874b 626 alc_update_coef_idx(codec, 7, 0, 0x2030);
c9b58006 627 break;
f9423e7a 628 case 0x10ec0888:
4a79ba34 629 alc888_coef_init(codec);
f9423e7a 630 break;
bc9f98a9 631 }
4a79ba34
TI
632 break;
633 }
634}
635
35a39f98
TI
636/* get a primary headphone pin if available */
637static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
638{
639 if (spec->gen.autocfg.hp_pins[0])
640 return spec->gen.autocfg.hp_pins[0];
641 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
642 return spec->gen.autocfg.line_out_pins[0];
643 return 0;
644}
08c189f2 645
1d045db9 646/*
08c189f2 647 * Realtek SSID verification
1d045db9 648 */
42cf0d01 649
08c189f2
TI
650/* Could be any non-zero and even value. When used as fixup, tells
651 * the driver to ignore any present sku defines.
652 */
653#define ALC_FIXUP_SKU_IGNORE (2)
1a1455de 654
08c189f2
TI
655static void alc_fixup_sku_ignore(struct hda_codec *codec,
656 const struct hda_fixup *fix, int action)
1a1455de 657{
1a1455de 658 struct alc_spec *spec = codec->spec;
08c189f2
TI
659 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
660 spec->cdefine.fixup = 1;
661 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
1a1455de 662 }
1a1455de
TI
663}
664
b5c6611f
ML
665static void alc_fixup_no_depop_delay(struct hda_codec *codec,
666 const struct hda_fixup *fix, int action)
667{
668 struct alc_spec *spec = codec->spec;
669
84d2dc3e 670 if (action == HDA_FIXUP_ACT_PROBE) {
b5c6611f 671 spec->no_depop_delay = 1;
84d2dc3e
ML
672 codec->depop_delay = 0;
673 }
b5c6611f
ML
674}
675
08c189f2 676static int alc_auto_parse_customize_define(struct hda_codec *codec)
4a79ba34 677{
08c189f2
TI
678 unsigned int ass, tmp, i;
679 unsigned nid = 0;
4a79ba34
TI
680 struct alc_spec *spec = codec->spec;
681
08c189f2 682 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
4a79ba34 683
08c189f2
TI
684 if (spec->cdefine.fixup) {
685 ass = spec->cdefine.sku_cfg;
686 if (ass == ALC_FIXUP_SKU_IGNORE)
687 return -1;
688 goto do_sku;
bb35febd
TI
689 }
690
5100cd07
TI
691 if (!codec->bus->pci)
692 return -1;
7639a06c 693 ass = codec->core.subsystem_id & 0xffff;
08c189f2
TI
694 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
695 goto do_sku;
4a79ba34 696
08c189f2 697 nid = 0x1d;
7639a06c 698 if (codec->core.vendor_id == 0x10ec0260)
08c189f2
TI
699 nid = 0x17;
700 ass = snd_hda_codec_get_pincfg(codec, nid);
42cf0d01 701
08c189f2 702 if (!(ass & 1)) {
4e76a883 703 codec_info(codec, "%s: SKU not ready 0x%08x\n",
7639a06c 704 codec->core.chip_name, ass);
08c189f2 705 return -1;
42cf0d01
DH
706 }
707
08c189f2
TI
708 /* check sum */
709 tmp = 0;
710 for (i = 1; i < 16; i++) {
711 if ((ass >> i) & 1)
712 tmp++;
ae8a60a5 713 }
08c189f2
TI
714 if (((ass >> 16) & 0xf) != tmp)
715 return -1;
ae8a60a5 716
da00c244
KY
717 spec->cdefine.port_connectivity = ass >> 30;
718 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
719 spec->cdefine.check_sum = (ass >> 16) & 0xf;
720 spec->cdefine.customization = ass >> 8;
721do_sku:
722 spec->cdefine.sku_cfg = ass;
723 spec->cdefine.external_amp = (ass & 0x38) >> 3;
724 spec->cdefine.platform_type = (ass & 0x4) >> 2;
725 spec->cdefine.swap = (ass & 0x2) >> 1;
726 spec->cdefine.override = ass & 0x1;
727
4e76a883 728 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
da00c244 729 nid, spec->cdefine.sku_cfg);
4e76a883 730 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
da00c244 731 spec->cdefine.port_connectivity);
4e76a883
TI
732 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
733 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
734 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
735 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
736 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
737 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
738 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
da00c244
KY
739
740 return 0;
741}
742
08c189f2
TI
743/* return the position of NID in the list, or -1 if not found */
744static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
745{
746 int i;
747 for (i = 0; i < nums; i++)
748 if (list[i] == nid)
749 return i;
750 return -1;
751}
1d045db9 752/* return true if the given NID is found in the list */
3af9ee6b
TI
753static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
754{
21268961 755 return find_idx_in_nid_list(nid, list, nums) >= 0;
3af9ee6b
TI
756}
757
4a79ba34
TI
758/* check subsystem ID and set up device-specific initialization;
759 * return 1 if initialized, 0 if invalid SSID
760 */
761/* 32-bit subsystem ID for BIOS loading in HD Audio codec.
762 * 31 ~ 16 : Manufacture ID
763 * 15 ~ 8 : SKU ID
764 * 7 ~ 0 : Assembly ID
765 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
766 */
58c57cfa 767static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
4a79ba34
TI
768{
769 unsigned int ass, tmp, i;
770 unsigned nid;
771 struct alc_spec *spec = codec->spec;
772
90622917
DH
773 if (spec->cdefine.fixup) {
774 ass = spec->cdefine.sku_cfg;
775 if (ass == ALC_FIXUP_SKU_IGNORE)
776 return 0;
777 goto do_sku;
778 }
779
7639a06c 780 ass = codec->core.subsystem_id & 0xffff;
5100cd07
TI
781 if (codec->bus->pci &&
782 ass != codec->bus->pci->subsystem_device && (ass & 1))
4a79ba34
TI
783 goto do_sku;
784
785 /* invalid SSID, check the special NID pin defcfg instead */
786 /*
def319f9 787 * 31~30 : port connectivity
4a79ba34
TI
788 * 29~21 : reserve
789 * 20 : PCBEEP input
790 * 19~16 : Check sum (15:1)
791 * 15~1 : Custom
792 * 0 : override
793 */
794 nid = 0x1d;
7639a06c 795 if (codec->core.vendor_id == 0x10ec0260)
4a79ba34
TI
796 nid = 0x17;
797 ass = snd_hda_codec_get_pincfg(codec, nid);
4e76a883
TI
798 codec_dbg(codec,
799 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
cb6605c1 800 ass, nid);
6227cdce 801 if (!(ass & 1))
4a79ba34
TI
802 return 0;
803 if ((ass >> 30) != 1) /* no physical connection */
804 return 0;
805
806 /* check sum */
807 tmp = 0;
808 for (i = 1; i < 16; i++) {
809 if ((ass >> i) & 1)
810 tmp++;
811 }
812 if (((ass >> 16) & 0xf) != tmp)
813 return 0;
814do_sku:
4e76a883 815 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
7639a06c 816 ass & 0xffff, codec->core.vendor_id);
4a79ba34
TI
817 /*
818 * 0 : override
819 * 1 : Swap Jack
820 * 2 : 0 --> Desktop, 1 --> Laptop
821 * 3~5 : External Amplifier control
822 * 7~6 : Reserved
823 */
824 tmp = (ass & 0x38) >> 3; /* external Amp control */
1c76aa5f
TI
825 if (spec->init_amp == ALC_INIT_UNDEFINED) {
826 switch (tmp) {
827 case 1:
5579cd6f 828 alc_setup_gpio(codec, 0x01);
1c76aa5f
TI
829 break;
830 case 3:
5579cd6f 831 alc_setup_gpio(codec, 0x02);
1c76aa5f
TI
832 break;
833 case 7:
5579cd6f 834 alc_setup_gpio(codec, 0x03);
1c76aa5f
TI
835 break;
836 case 5:
837 default:
838 spec->init_amp = ALC_INIT_DEFAULT;
839 break;
840 }
bc9f98a9 841 }
ea1fb29a 842
8c427226 843 /* is laptop or Desktop and enable the function "Mute internal speaker
c9b58006
KY
844 * when the external headphone out jack is plugged"
845 */
8c427226 846 if (!(ass & 0x8000))
4a79ba34 847 return 1;
c9b58006
KY
848 /*
849 * 10~8 : Jack location
850 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
851 * 14~13: Resvered
852 * 15 : 1 --> enable the function "Mute internal speaker
853 * when the external headphone out jack is plugged"
854 */
35a39f98 855 if (!alc_get_hp_pin(spec)) {
01d4825d 856 hda_nid_t nid;
c9b58006 857 tmp = (ass >> 11) & 0x3; /* HP to chassis */
58c57cfa 858 nid = ports[tmp];
08c189f2
TI
859 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
860 spec->gen.autocfg.line_outs))
3af9ee6b 861 return 1;
08c189f2 862 spec->gen.autocfg.hp_pins[0] = nid;
c9b58006 863 }
4a79ba34
TI
864 return 1;
865}
ea1fb29a 866
3e6179b8
TI
867/* Check the validity of ALC subsystem-id
868 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
869static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
4a79ba34 870{
58c57cfa 871 if (!alc_subsystem_id(codec, ports)) {
4a79ba34 872 struct alc_spec *spec = codec->spec;
67791202
TI
873 if (spec->init_amp == ALC_INIT_UNDEFINED) {
874 codec_dbg(codec,
875 "realtek: Enable default setup for auto mode as fallback\n");
876 spec->init_amp = ALC_INIT_DEFAULT;
877 }
4a79ba34 878 }
21268961 879}
1a1455de 880
1d045db9 881/*
ef8ef5fb 882 */
f9e336f6 883
9d36a7dc
DH
884static void alc_fixup_inv_dmic(struct hda_codec *codec,
885 const struct hda_fixup *fix, int action)
125821ae
TI
886{
887 struct alc_spec *spec = codec->spec;
668d1e96 888
9d36a7dc 889 spec->gen.inv_dmic_split = 1;
6e72aa5f
TI
890}
891
e9edcee0 892
08c189f2 893static int alc_build_controls(struct hda_codec *codec)
1d045db9 894{
a5cb463a 895 int err;
e9427969 896
08c189f2
TI
897 err = snd_hda_gen_build_controls(codec);
898 if (err < 0)
899 return err;
1da177e4 900
1727a771 901 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
1c4a54b4 902 return 0;
a361d84b
KY
903}
904
a361d84b 905
df694daa 906/*
08c189f2 907 * Common callbacks
df694daa 908 */
a361d84b 909
c9af753f
TI
910static void alc_pre_init(struct hda_codec *codec)
911{
912 alc_fill_eapd_coef(codec);
913}
914
aeac1a0d
KY
915#define is_s3_resume(codec) \
916 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
c9af753f
TI
917#define is_s4_resume(codec) \
918 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
919
08c189f2 920static int alc_init(struct hda_codec *codec)
1d045db9
TI
921{
922 struct alc_spec *spec = codec->spec;
a361d84b 923
c9af753f
TI
924 /* hibernation resume needs the full chip initialization */
925 if (is_s4_resume(codec))
926 alc_pre_init(codec);
927
08c189f2
TI
928 if (spec->init_hook)
929 spec->init_hook(codec);
a361d84b 930
89781d08 931 spec->gen.skip_verbs = 1; /* applied in below */
607ca3bd 932 snd_hda_gen_init(codec);
08c189f2
TI
933 alc_fix_pll(codec);
934 alc_auto_init_amp(codec, spec->init_amp);
89781d08 935 snd_hda_apply_verbs(codec); /* apply verbs here after own init */
3abf2f36 936
1727a771 937 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
a361d84b 938
1d045db9
TI
939 return 0;
940}
a361d84b 941
c3d9ca93
RD
942#define alc_free snd_hda_gen_free
943
944#ifdef CONFIG_PM
08c189f2 945static inline void alc_shutup(struct hda_codec *codec)
1d045db9
TI
946{
947 struct alc_spec *spec = codec->spec;
a361d84b 948
c7273bd6
TI
949 if (!snd_hda_get_bool_hint(codec, "shutup"))
950 return; /* disabled explicitly by hints */
951
08c189f2
TI
952 if (spec && spec->shutup)
953 spec->shutup(codec);
9bfb2844 954 else
c0ca5ece 955 alc_shutup_pins(codec);
1d045db9
TI
956}
957
08c189f2 958static void alc_power_eapd(struct hda_codec *codec)
1d045db9 959{
08c189f2 960 alc_auto_setup_eapd(codec, false);
1d045db9 961}
2134ea4f 962
08c189f2 963static int alc_suspend(struct hda_codec *codec)
1d045db9
TI
964{
965 struct alc_spec *spec = codec->spec;
08c189f2
TI
966 alc_shutup(codec);
967 if (spec && spec->power_hook)
968 spec->power_hook(codec);
a361d84b
KY
969 return 0;
970}
971
08c189f2 972static int alc_resume(struct hda_codec *codec)
1d045db9 973{
97a26570
KY
974 struct alc_spec *spec = codec->spec;
975
976 if (!spec->no_depop_delay)
977 msleep(150); /* to avoid pop noise */
08c189f2 978 codec->patch_ops.init(codec);
1a462be5 979 snd_hda_regmap_sync(codec);
08c189f2
TI
980 hda_call_check_power_status(codec, 0x01);
981 return 0;
1d045db9 982}
08c189f2 983#endif
f6a92248 984
1d045db9 985/*
1d045db9 986 */
08c189f2
TI
987static const struct hda_codec_ops alc_patch_ops = {
988 .build_controls = alc_build_controls,
989 .build_pcms = snd_hda_gen_build_pcms,
990 .init = alc_init,
991 .free = alc_free,
992 .unsol_event = snd_hda_jack_unsol_event,
993#ifdef CONFIG_PM
994 .resume = alc_resume,
08c189f2 995 .suspend = alc_suspend,
fce52a3b 996 .check_power_status = snd_hda_gen_check_power_status,
08c189f2 997#endif
08c189f2 998};
f6a92248 999
f53281e6 1000
ded255be 1001#define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
e01bf509 1002
e4770629 1003/*
4b016931 1004 * Rename codecs appropriately from COEF value or subvendor id
e4770629 1005 */
08c189f2
TI
1006struct alc_codec_rename_table {
1007 unsigned int vendor_id;
1008 unsigned short coef_mask;
1009 unsigned short coef_bits;
1010 const char *name;
1011};
84898e87 1012
4b016931
KY
1013struct alc_codec_rename_pci_table {
1014 unsigned int codec_vendor_id;
1015 unsigned short pci_subvendor;
1016 unsigned short pci_subdevice;
1017 const char *name;
1018};
1019
6b0f95c4 1020static const struct alc_codec_rename_table rename_tbl[] = {
e6e5f7ad 1021 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
08c189f2
TI
1022 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
1023 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
1024 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
1025 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
1026 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
1027 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
1028 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
1029 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
e6e5f7ad 1030 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
08c189f2
TI
1031 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
1032 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
1033 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
1034 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
1035 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
1036 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
1037 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
1038 { } /* terminator */
1039};
84898e87 1040
6b0f95c4 1041static const struct alc_codec_rename_pci_table rename_pci_tbl[] = {
4b016931
KY
1042 { 0x10ec0280, 0x1028, 0, "ALC3220" },
1043 { 0x10ec0282, 0x1028, 0, "ALC3221" },
1044 { 0x10ec0283, 0x1028, 0, "ALC3223" },
193177de 1045 { 0x10ec0288, 0x1028, 0, "ALC3263" },
4b016931 1046 { 0x10ec0292, 0x1028, 0, "ALC3226" },
193177de 1047 { 0x10ec0293, 0x1028, 0, "ALC3235" },
4b016931
KY
1048 { 0x10ec0255, 0x1028, 0, "ALC3234" },
1049 { 0x10ec0668, 0x1028, 0, "ALC3661" },
e6e5f7ad
KY
1050 { 0x10ec0275, 0x1028, 0, "ALC3260" },
1051 { 0x10ec0899, 0x1028, 0, "ALC3861" },
2c674fac 1052 { 0x10ec0298, 0x1028, 0, "ALC3266" },
736f20a7 1053 { 0x10ec0236, 0x1028, 0, "ALC3204" },
82324502 1054 { 0x10ec0256, 0x1028, 0, "ALC3246" },
4231430d 1055 { 0x10ec0225, 0x1028, 0, "ALC3253" },
7d727869 1056 { 0x10ec0295, 0x1028, 0, "ALC3254" },
28f1f9b2 1057 { 0x10ec0299, 0x1028, 0, "ALC3271" },
e6e5f7ad
KY
1058 { 0x10ec0670, 0x1025, 0, "ALC669X" },
1059 { 0x10ec0676, 0x1025, 0, "ALC679X" },
1060 { 0x10ec0282, 0x1043, 0, "ALC3229" },
1061 { 0x10ec0233, 0x1043, 0, "ALC3236" },
1062 { 0x10ec0280, 0x103c, 0, "ALC3228" },
1063 { 0x10ec0282, 0x103c, 0, "ALC3227" },
1064 { 0x10ec0286, 0x103c, 0, "ALC3242" },
1065 { 0x10ec0290, 0x103c, 0, "ALC3241" },
1066 { 0x10ec0668, 0x103c, 0, "ALC3662" },
1067 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
1068 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
4b016931
KY
1069 { } /* terminator */
1070};
1071
08c189f2 1072static int alc_codec_rename_from_preset(struct hda_codec *codec)
1d045db9 1073{
08c189f2 1074 const struct alc_codec_rename_table *p;
4b016931 1075 const struct alc_codec_rename_pci_table *q;
60db6b53 1076
08c189f2 1077 for (p = rename_tbl; p->vendor_id; p++) {
7639a06c 1078 if (p->vendor_id != codec->core.vendor_id)
08c189f2
TI
1079 continue;
1080 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
1081 return alc_codec_rename(codec, p->name);
1d045db9 1082 }
4b016931 1083
5100cd07
TI
1084 if (!codec->bus->pci)
1085 return 0;
4b016931 1086 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
7639a06c 1087 if (q->codec_vendor_id != codec->core.vendor_id)
4b016931
KY
1088 continue;
1089 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1090 continue;
1091 if (!q->pci_subdevice ||
1092 q->pci_subdevice == codec->bus->pci->subsystem_device)
1093 return alc_codec_rename(codec, q->name);
1094 }
1095
08c189f2 1096 return 0;
1d045db9 1097}
f53281e6 1098
e4770629 1099
1d045db9
TI
1100/*
1101 * Digital-beep handlers
1102 */
1103#ifdef CONFIG_SND_HDA_INPUT_BEEP
fea80fae
TI
1104
1105/* additional beep mixers; private_value will be overwritten */
1106static const struct snd_kcontrol_new alc_beep_mixer[] = {
1107 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1108 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1109};
1110
1111/* set up and create beep controls */
1112static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1113 int idx, int dir)
1114{
1115 struct snd_kcontrol_new *knew;
1116 unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1117 int i;
1118
1119 for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1120 knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1121 &alc_beep_mixer[i]);
1122 if (!knew)
1123 return -ENOMEM;
1124 knew->private_value = beep_amp;
1125 }
1126 return 0;
1127}
84898e87 1128
6317e5eb 1129static const struct snd_pci_quirk beep_allow_list[] = {
7110005e 1130 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
a4b7f21d 1131 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
1d045db9 1132 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
8554ee40 1133 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
1d045db9
TI
1134 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1135 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1136 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
78f8baf1 1137 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
1d045db9 1138 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
6317e5eb 1139 /* denylist -- no beep available */
051c78af
TI
1140 SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
1141 SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
1d045db9 1142 {}
fe3eb0a7
KY
1143};
1144
1d045db9
TI
1145static inline int has_cdefine_beep(struct hda_codec *codec)
1146{
1147 struct alc_spec *spec = codec->spec;
1148 const struct snd_pci_quirk *q;
6317e5eb 1149 q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list);
1d045db9
TI
1150 if (q)
1151 return q->value;
1152 return spec->cdefine.enable_pcbeep;
1153}
1154#else
fea80fae 1155#define set_beep_amp(spec, nid, idx, dir) 0
1d045db9
TI
1156#define has_cdefine_beep(codec) 0
1157#endif
84898e87 1158
1d045db9
TI
1159/* parse the BIOS configuration and set up the alc_spec */
1160/* return 1 if successful, 0 if the proper config is not found,
1161 * or a negative error code
1162 */
3e6179b8
TI
1163static int alc_parse_auto_config(struct hda_codec *codec,
1164 const hda_nid_t *ignore_nids,
1165 const hda_nid_t *ssid_nids)
1d045db9
TI
1166{
1167 struct alc_spec *spec = codec->spec;
08c189f2 1168 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
1d045db9 1169 int err;
26f5df26 1170
53c334ad
TI
1171 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1172 spec->parse_flags);
1d045db9
TI
1173 if (err < 0)
1174 return err;
3e6179b8
TI
1175
1176 if (ssid_nids)
1177 alc_ssid_check(codec, ssid_nids);
64154835 1178
08c189f2
TI
1179 err = snd_hda_gen_parse_auto_config(codec, cfg);
1180 if (err < 0)
1181 return err;
070cff4c 1182
1d045db9 1183 return 1;
60db6b53 1184}
f6a92248 1185
3de95173
TI
1186/* common preparation job for alc_spec */
1187static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1188{
1189 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1190 int err;
1191
1192 if (!spec)
1193 return -ENOMEM;
1194 codec->spec = spec;
08c189f2
TI
1195 snd_hda_gen_spec_init(&spec->gen);
1196 spec->gen.mixer_nid = mixer_nid;
1197 spec->gen.own_eapd_ctl = 1;
1098b7c2 1198 codec->single_adc_amp = 1;
08c189f2
TI
1199 /* FIXME: do we need this for all Realtek codec models? */
1200 codec->spdif_status_reset = 1;
a6e7d0a4 1201 codec->forced_resume = 1;
225068ab 1202 codec->patch_ops = alc_patch_ops;
b837a9f5 1203 mutex_init(&spec->coef_mutex);
3de95173
TI
1204
1205 err = alc_codec_rename_from_preset(codec);
1206 if (err < 0) {
1207 kfree(spec);
1208 return err;
1209 }
1210 return 0;
1211}
1212
3e6179b8
TI
1213static int alc880_parse_auto_config(struct hda_codec *codec)
1214{
1215 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
7d7eb9ea 1216 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3e6179b8
TI
1217 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1218}
1219
ee3b2969
TI
1220/*
1221 * ALC880 fix-ups
1222 */
1223enum {
411225a0 1224 ALC880_FIXUP_GPIO1,
ee3b2969
TI
1225 ALC880_FIXUP_GPIO2,
1226 ALC880_FIXUP_MEDION_RIM,
dc6af52d 1227 ALC880_FIXUP_LG,
db8a38e5 1228 ALC880_FIXUP_LG_LW25,
f02aab5d 1229 ALC880_FIXUP_W810,
27e917f8 1230 ALC880_FIXUP_EAPD_COEF,
b9368f5c 1231 ALC880_FIXUP_TCL_S700,
cf5a2279
TI
1232 ALC880_FIXUP_VOL_KNOB,
1233 ALC880_FIXUP_FUJITSU,
ba533818 1234 ALC880_FIXUP_F1734,
817de92f 1235 ALC880_FIXUP_UNIWILL,
967b88c4 1236 ALC880_FIXUP_UNIWILL_DIG,
96e225f6 1237 ALC880_FIXUP_Z71V,
487a588d 1238 ALC880_FIXUP_ASUS_W5A,
67b6ec31
TI
1239 ALC880_FIXUP_3ST_BASE,
1240 ALC880_FIXUP_3ST,
1241 ALC880_FIXUP_3ST_DIG,
1242 ALC880_FIXUP_5ST_BASE,
1243 ALC880_FIXUP_5ST,
1244 ALC880_FIXUP_5ST_DIG,
1245 ALC880_FIXUP_6ST_BASE,
1246 ALC880_FIXUP_6ST,
1247 ALC880_FIXUP_6ST_DIG,
5397145f 1248 ALC880_FIXUP_6ST_AUTOMUTE,
ee3b2969
TI
1249};
1250
cf5a2279
TI
1251/* enable the volume-knob widget support on NID 0x21 */
1252static void alc880_fixup_vol_knob(struct hda_codec *codec,
1727a771 1253 const struct hda_fixup *fix, int action)
cf5a2279 1254{
1727a771 1255 if (action == HDA_FIXUP_ACT_PROBE)
62f949bf
TI
1256 snd_hda_jack_detect_enable_callback(codec, 0x21,
1257 alc_update_knob_master);
cf5a2279
TI
1258}
1259
1727a771 1260static const struct hda_fixup alc880_fixups[] = {
411225a0 1261 [ALC880_FIXUP_GPIO1] = {
5579cd6f
TI
1262 .type = HDA_FIXUP_FUNC,
1263 .v.func = alc_fixup_gpio1,
411225a0 1264 },
ee3b2969 1265 [ALC880_FIXUP_GPIO2] = {
5579cd6f
TI
1266 .type = HDA_FIXUP_FUNC,
1267 .v.func = alc_fixup_gpio2,
ee3b2969
TI
1268 },
1269 [ALC880_FIXUP_MEDION_RIM] = {
1727a771 1270 .type = HDA_FIXUP_VERBS,
ee3b2969
TI
1271 .v.verbs = (const struct hda_verb[]) {
1272 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1273 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1274 { }
1275 },
1276 .chained = true,
1277 .chain_id = ALC880_FIXUP_GPIO2,
1278 },
dc6af52d 1279 [ALC880_FIXUP_LG] = {
1727a771
TI
1280 .type = HDA_FIXUP_PINS,
1281 .v.pins = (const struct hda_pintbl[]) {
dc6af52d
TI
1282 /* disable bogus unused pins */
1283 { 0x16, 0x411111f0 },
1284 { 0x18, 0x411111f0 },
1285 { 0x1a, 0x411111f0 },
1286 { }
1287 }
1288 },
db8a38e5
TI
1289 [ALC880_FIXUP_LG_LW25] = {
1290 .type = HDA_FIXUP_PINS,
1291 .v.pins = (const struct hda_pintbl[]) {
1292 { 0x1a, 0x0181344f }, /* line-in */
1293 { 0x1b, 0x0321403f }, /* headphone */
1294 { }
1295 }
1296 },
f02aab5d 1297 [ALC880_FIXUP_W810] = {
1727a771
TI
1298 .type = HDA_FIXUP_PINS,
1299 .v.pins = (const struct hda_pintbl[]) {
f02aab5d
TI
1300 /* disable bogus unused pins */
1301 { 0x17, 0x411111f0 },
1302 { }
1303 },
1304 .chained = true,
1305 .chain_id = ALC880_FIXUP_GPIO2,
1306 },
27e917f8 1307 [ALC880_FIXUP_EAPD_COEF] = {
1727a771 1308 .type = HDA_FIXUP_VERBS,
27e917f8
TI
1309 .v.verbs = (const struct hda_verb[]) {
1310 /* change to EAPD mode */
1311 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1312 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1313 {}
1314 },
1315 },
b9368f5c 1316 [ALC880_FIXUP_TCL_S700] = {
1727a771 1317 .type = HDA_FIXUP_VERBS,
b9368f5c
TI
1318 .v.verbs = (const struct hda_verb[]) {
1319 /* change to EAPD mode */
1320 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1321 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1322 {}
1323 },
1324 .chained = true,
1325 .chain_id = ALC880_FIXUP_GPIO2,
1326 },
cf5a2279 1327 [ALC880_FIXUP_VOL_KNOB] = {
1727a771 1328 .type = HDA_FIXUP_FUNC,
cf5a2279
TI
1329 .v.func = alc880_fixup_vol_knob,
1330 },
1331 [ALC880_FIXUP_FUJITSU] = {
1332 /* override all pins as BIOS on old Amilo is broken */
1727a771
TI
1333 .type = HDA_FIXUP_PINS,
1334 .v.pins = (const struct hda_pintbl[]) {
bb148bde 1335 { 0x14, 0x0121401f }, /* HP */
cf5a2279
TI
1336 { 0x15, 0x99030120 }, /* speaker */
1337 { 0x16, 0x99030130 }, /* bass speaker */
1338 { 0x17, 0x411111f0 }, /* N/A */
1339 { 0x18, 0x411111f0 }, /* N/A */
1340 { 0x19, 0x01a19950 }, /* mic-in */
1341 { 0x1a, 0x411111f0 }, /* N/A */
1342 { 0x1b, 0x411111f0 }, /* N/A */
1343 { 0x1c, 0x411111f0 }, /* N/A */
1344 { 0x1d, 0x411111f0 }, /* N/A */
1345 { 0x1e, 0x01454140 }, /* SPDIF out */
1346 { }
1347 },
1348 .chained = true,
1349 .chain_id = ALC880_FIXUP_VOL_KNOB,
1350 },
ba533818
TI
1351 [ALC880_FIXUP_F1734] = {
1352 /* almost compatible with FUJITSU, but no bass and SPDIF */
1727a771
TI
1353 .type = HDA_FIXUP_PINS,
1354 .v.pins = (const struct hda_pintbl[]) {
bb148bde 1355 { 0x14, 0x0121401f }, /* HP */
ba533818
TI
1356 { 0x15, 0x99030120 }, /* speaker */
1357 { 0x16, 0x411111f0 }, /* N/A */
1358 { 0x17, 0x411111f0 }, /* N/A */
1359 { 0x18, 0x411111f0 }, /* N/A */
1360 { 0x19, 0x01a19950 }, /* mic-in */
1361 { 0x1a, 0x411111f0 }, /* N/A */
1362 { 0x1b, 0x411111f0 }, /* N/A */
1363 { 0x1c, 0x411111f0 }, /* N/A */
1364 { 0x1d, 0x411111f0 }, /* N/A */
1365 { 0x1e, 0x411111f0 }, /* N/A */
1366 { }
1367 },
1368 .chained = true,
1369 .chain_id = ALC880_FIXUP_VOL_KNOB,
1370 },
817de92f
TI
1371 [ALC880_FIXUP_UNIWILL] = {
1372 /* need to fix HP and speaker pins to be parsed correctly */
1727a771
TI
1373 .type = HDA_FIXUP_PINS,
1374 .v.pins = (const struct hda_pintbl[]) {
817de92f
TI
1375 { 0x14, 0x0121411f }, /* HP */
1376 { 0x15, 0x99030120 }, /* speaker */
1377 { 0x16, 0x99030130 }, /* bass speaker */
1378 { }
1379 },
1380 },
967b88c4 1381 [ALC880_FIXUP_UNIWILL_DIG] = {
1727a771
TI
1382 .type = HDA_FIXUP_PINS,
1383 .v.pins = (const struct hda_pintbl[]) {
967b88c4
TI
1384 /* disable bogus unused pins */
1385 { 0x17, 0x411111f0 },
1386 { 0x19, 0x411111f0 },
1387 { 0x1b, 0x411111f0 },
1388 { 0x1f, 0x411111f0 },
1389 { }
1390 }
1391 },
96e225f6 1392 [ALC880_FIXUP_Z71V] = {
1727a771
TI
1393 .type = HDA_FIXUP_PINS,
1394 .v.pins = (const struct hda_pintbl[]) {
96e225f6
TI
1395 /* set up the whole pins as BIOS is utterly broken */
1396 { 0x14, 0x99030120 }, /* speaker */
1397 { 0x15, 0x0121411f }, /* HP */
1398 { 0x16, 0x411111f0 }, /* N/A */
1399 { 0x17, 0x411111f0 }, /* N/A */
1400 { 0x18, 0x01a19950 }, /* mic-in */
1401 { 0x19, 0x411111f0 }, /* N/A */
1402 { 0x1a, 0x01813031 }, /* line-in */
1403 { 0x1b, 0x411111f0 }, /* N/A */
1404 { 0x1c, 0x411111f0 }, /* N/A */
1405 { 0x1d, 0x411111f0 }, /* N/A */
1406 { 0x1e, 0x0144111e }, /* SPDIF */
1407 { }
1408 }
1409 },
487a588d
TI
1410 [ALC880_FIXUP_ASUS_W5A] = {
1411 .type = HDA_FIXUP_PINS,
1412 .v.pins = (const struct hda_pintbl[]) {
1413 /* set up the whole pins as BIOS is utterly broken */
1414 { 0x14, 0x0121411f }, /* HP */
1415 { 0x15, 0x411111f0 }, /* N/A */
1416 { 0x16, 0x411111f0 }, /* N/A */
1417 { 0x17, 0x411111f0 }, /* N/A */
1418 { 0x18, 0x90a60160 }, /* mic */
1419 { 0x19, 0x411111f0 }, /* N/A */
1420 { 0x1a, 0x411111f0 }, /* N/A */
1421 { 0x1b, 0x411111f0 }, /* N/A */
1422 { 0x1c, 0x411111f0 }, /* N/A */
1423 { 0x1d, 0x411111f0 }, /* N/A */
1424 { 0x1e, 0xb743111e }, /* SPDIF out */
1425 { }
1426 },
1427 .chained = true,
1428 .chain_id = ALC880_FIXUP_GPIO1,
1429 },
67b6ec31 1430 [ALC880_FIXUP_3ST_BASE] = {
1727a771
TI
1431 .type = HDA_FIXUP_PINS,
1432 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1433 { 0x14, 0x01014010 }, /* line-out */
1434 { 0x15, 0x411111f0 }, /* N/A */
1435 { 0x16, 0x411111f0 }, /* N/A */
1436 { 0x17, 0x411111f0 }, /* N/A */
1437 { 0x18, 0x01a19c30 }, /* mic-in */
1438 { 0x19, 0x0121411f }, /* HP */
1439 { 0x1a, 0x01813031 }, /* line-in */
1440 { 0x1b, 0x02a19c40 }, /* front-mic */
1441 { 0x1c, 0x411111f0 }, /* N/A */
1442 { 0x1d, 0x411111f0 }, /* N/A */
1443 /* 0x1e is filled in below */
1444 { 0x1f, 0x411111f0 }, /* N/A */
1445 { }
1446 }
1447 },
1448 [ALC880_FIXUP_3ST] = {
1727a771
TI
1449 .type = HDA_FIXUP_PINS,
1450 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1451 { 0x1e, 0x411111f0 }, /* N/A */
1452 { }
1453 },
1454 .chained = true,
1455 .chain_id = ALC880_FIXUP_3ST_BASE,
1456 },
1457 [ALC880_FIXUP_3ST_DIG] = {
1727a771
TI
1458 .type = HDA_FIXUP_PINS,
1459 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1460 { 0x1e, 0x0144111e }, /* SPDIF */
1461 { }
1462 },
1463 .chained = true,
1464 .chain_id = ALC880_FIXUP_3ST_BASE,
1465 },
1466 [ALC880_FIXUP_5ST_BASE] = {
1727a771
TI
1467 .type = HDA_FIXUP_PINS,
1468 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1469 { 0x14, 0x01014010 }, /* front */
1470 { 0x15, 0x411111f0 }, /* N/A */
1471 { 0x16, 0x01011411 }, /* CLFE */
1472 { 0x17, 0x01016412 }, /* surr */
1473 { 0x18, 0x01a19c30 }, /* mic-in */
1474 { 0x19, 0x0121411f }, /* HP */
1475 { 0x1a, 0x01813031 }, /* line-in */
1476 { 0x1b, 0x02a19c40 }, /* front-mic */
1477 { 0x1c, 0x411111f0 }, /* N/A */
1478 { 0x1d, 0x411111f0 }, /* N/A */
1479 /* 0x1e is filled in below */
1480 { 0x1f, 0x411111f0 }, /* N/A */
1481 { }
1482 }
1483 },
1484 [ALC880_FIXUP_5ST] = {
1727a771
TI
1485 .type = HDA_FIXUP_PINS,
1486 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1487 { 0x1e, 0x411111f0 }, /* N/A */
1488 { }
1489 },
1490 .chained = true,
1491 .chain_id = ALC880_FIXUP_5ST_BASE,
1492 },
1493 [ALC880_FIXUP_5ST_DIG] = {
1727a771
TI
1494 .type = HDA_FIXUP_PINS,
1495 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1496 { 0x1e, 0x0144111e }, /* SPDIF */
1497 { }
1498 },
1499 .chained = true,
1500 .chain_id = ALC880_FIXUP_5ST_BASE,
1501 },
1502 [ALC880_FIXUP_6ST_BASE] = {
1727a771
TI
1503 .type = HDA_FIXUP_PINS,
1504 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1505 { 0x14, 0x01014010 }, /* front */
1506 { 0x15, 0x01016412 }, /* surr */
1507 { 0x16, 0x01011411 }, /* CLFE */
1508 { 0x17, 0x01012414 }, /* side */
1509 { 0x18, 0x01a19c30 }, /* mic-in */
1510 { 0x19, 0x02a19c40 }, /* front-mic */
1511 { 0x1a, 0x01813031 }, /* line-in */
1512 { 0x1b, 0x0121411f }, /* HP */
1513 { 0x1c, 0x411111f0 }, /* N/A */
1514 { 0x1d, 0x411111f0 }, /* N/A */
1515 /* 0x1e is filled in below */
1516 { 0x1f, 0x411111f0 }, /* N/A */
1517 { }
1518 }
1519 },
1520 [ALC880_FIXUP_6ST] = {
1727a771
TI
1521 .type = HDA_FIXUP_PINS,
1522 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1523 { 0x1e, 0x411111f0 }, /* N/A */
1524 { }
1525 },
1526 .chained = true,
1527 .chain_id = ALC880_FIXUP_6ST_BASE,
1528 },
1529 [ALC880_FIXUP_6ST_DIG] = {
1727a771
TI
1530 .type = HDA_FIXUP_PINS,
1531 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1532 { 0x1e, 0x0144111e }, /* SPDIF */
1533 { }
1534 },
1535 .chained = true,
1536 .chain_id = ALC880_FIXUP_6ST_BASE,
1537 },
5397145f
TI
1538 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1539 .type = HDA_FIXUP_PINS,
1540 .v.pins = (const struct hda_pintbl[]) {
1541 { 0x1b, 0x0121401f }, /* HP with jack detect */
1542 { }
1543 },
1544 .chained_before = true,
1545 .chain_id = ALC880_FIXUP_6ST_BASE,
1546 },
ee3b2969
TI
1547};
1548
1549static const struct snd_pci_quirk alc880_fixup_tbl[] = {
f02aab5d 1550 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
487a588d 1551 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
96e225f6 1552 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
29e3fdcc 1553 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
6538de03 1554 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
29e3fdcc 1555 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
27e917f8 1556 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
967b88c4 1557 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
ba533818 1558 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
817de92f 1559 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
7833c7e8 1560 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
f02aab5d 1561 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
ee3b2969 1562 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
5397145f 1563 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
a161574e 1564 SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
cf5a2279 1565 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
ba533818 1566 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
cf5a2279 1567 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
dc6af52d
TI
1568 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1569 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1570 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
db8a38e5 1571 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
b9368f5c 1572 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
67b6ec31
TI
1573
1574 /* Below is the copied entries from alc880_quirks.c.
1575 * It's not quite sure whether BIOS sets the correct pin-config table
1576 * on these machines, thus they are kept to be compatible with
1577 * the old static quirks. Once when it's confirmed to work without
1578 * these overrides, it'd be better to remove.
1579 */
1580 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1581 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1582 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1583 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1584 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1585 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1586 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1587 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1588 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1589 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1590 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1591 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1592 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1593 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1594 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1595 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1596 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1597 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1598 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1599 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1600 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1601 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1602 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1603 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1604 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1605 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1606 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1607 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1608 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1609 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1610 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1611 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1612 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1613 /* default Intel */
1614 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1615 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1616 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1617 {}
1618};
1619
1727a771 1620static const struct hda_model_fixup alc880_fixup_models[] = {
67b6ec31
TI
1621 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1622 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1623 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1624 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1625 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1626 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
5397145f 1627 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
ee3b2969
TI
1628 {}
1629};
1630
1631
1d045db9
TI
1632/*
1633 * OK, here we have finally the patch for ALC880
1634 */
1d045db9 1635static int patch_alc880(struct hda_codec *codec)
60db6b53 1636{
1d045db9 1637 struct alc_spec *spec;
1d045db9 1638 int err;
f6a92248 1639
3de95173
TI
1640 err = alc_alloc_spec(codec, 0x0b);
1641 if (err < 0)
1642 return err;
64154835 1643
3de95173 1644 spec = codec->spec;
08c189f2 1645 spec->gen.need_dac_fix = 1;
7504b6cd 1646 spec->gen.beep_nid = 0x01;
f53281e6 1647
225068ab
TI
1648 codec->patch_ops.unsol_event = alc880_unsol_event;
1649
c9af753f
TI
1650 alc_pre_init(codec);
1651
1727a771 1652 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
67b6ec31 1653 alc880_fixups);
1727a771 1654 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
ee3b2969 1655
67b6ec31
TI
1656 /* automatic parse from the BIOS config */
1657 err = alc880_parse_auto_config(codec);
1658 if (err < 0)
1659 goto error;
fe3eb0a7 1660
fea80fae
TI
1661 if (!spec->gen.no_analog) {
1662 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1663 if (err < 0)
1664 goto error;
1665 }
f53281e6 1666
1727a771 1667 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 1668
1d045db9 1669 return 0;
e16fb6d1
TI
1670
1671 error:
1672 alc_free(codec);
1673 return err;
226b1ec8
KY
1674}
1675
1d045db9 1676
60db6b53 1677/*
1d045db9 1678 * ALC260 support
60db6b53 1679 */
1d045db9 1680static int alc260_parse_auto_config(struct hda_codec *codec)
f6a92248 1681{
1d045db9 1682 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
3e6179b8
TI
1683 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1684 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
f6a92248
KY
1685}
1686
1d045db9
TI
1687/*
1688 * Pin config fixes
1689 */
1690enum {
ca8f0424
TI
1691 ALC260_FIXUP_HP_DC5750,
1692 ALC260_FIXUP_HP_PIN_0F,
1693 ALC260_FIXUP_COEF,
15317ab2 1694 ALC260_FIXUP_GPIO1,
20f7d928
TI
1695 ALC260_FIXUP_GPIO1_TOGGLE,
1696 ALC260_FIXUP_REPLACER,
0a1c4fa2 1697 ALC260_FIXUP_HP_B1900,
118cb4a4 1698 ALC260_FIXUP_KN1,
39aedee7 1699 ALC260_FIXUP_FSC_S7020,
5ebd3bbd 1700 ALC260_FIXUP_FSC_S7020_JWSE,
d08c5ef2 1701 ALC260_FIXUP_VAIO_PINS,
1d045db9
TI
1702};
1703
20f7d928
TI
1704static void alc260_gpio1_automute(struct hda_codec *codec)
1705{
1706 struct alc_spec *spec = codec->spec;
aaf312de
TI
1707
1708 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
20f7d928
TI
1709}
1710
1711static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1727a771 1712 const struct hda_fixup *fix, int action)
20f7d928
TI
1713{
1714 struct alc_spec *spec = codec->spec;
1727a771 1715 if (action == HDA_FIXUP_ACT_PROBE) {
20f7d928
TI
1716 /* although the machine has only one output pin, we need to
1717 * toggle GPIO1 according to the jack state
1718 */
08c189f2
TI
1719 spec->gen.automute_hook = alc260_gpio1_automute;
1720 spec->gen.detect_hp = 1;
1721 spec->gen.automute_speaker = 1;
1722 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
62f949bf 1723 snd_hda_jack_detect_enable_callback(codec, 0x0f,
08c189f2 1724 snd_hda_gen_hp_automute);
5579cd6f 1725 alc_setup_gpio(codec, 0x01);
20f7d928
TI
1726 }
1727}
1728
118cb4a4 1729static void alc260_fixup_kn1(struct hda_codec *codec,
1727a771 1730 const struct hda_fixup *fix, int action)
118cb4a4
TI
1731{
1732 struct alc_spec *spec = codec->spec;
1727a771 1733 static const struct hda_pintbl pincfgs[] = {
118cb4a4
TI
1734 { 0x0f, 0x02214000 }, /* HP/speaker */
1735 { 0x12, 0x90a60160 }, /* int mic */
1736 { 0x13, 0x02a19000 }, /* ext mic */
1737 { 0x18, 0x01446000 }, /* SPDIF out */
1738 /* disable bogus I/O pins */
1739 { 0x10, 0x411111f0 },
1740 { 0x11, 0x411111f0 },
1741 { 0x14, 0x411111f0 },
1742 { 0x15, 0x411111f0 },
1743 { 0x16, 0x411111f0 },
1744 { 0x17, 0x411111f0 },
1745 { 0x19, 0x411111f0 },
1746 { }
1747 };
1748
1749 switch (action) {
1727a771
TI
1750 case HDA_FIXUP_ACT_PRE_PROBE:
1751 snd_hda_apply_pincfgs(codec, pincfgs);
118cb4a4
TI
1752 spec->init_amp = ALC_INIT_NONE;
1753 break;
1754 }
1755}
1756
39aedee7
TI
1757static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1758 const struct hda_fixup *fix, int action)
1759{
1760 struct alc_spec *spec = codec->spec;
1c76aa5f 1761 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5ebd3bbd
TI
1762 spec->init_amp = ALC_INIT_NONE;
1763}
39aedee7 1764
5ebd3bbd
TI
1765static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1766 const struct hda_fixup *fix, int action)
1767{
1768 struct alc_spec *spec = codec->spec;
1769 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
f811c3cf 1770 spec->gen.add_jack_modes = 1;
5ebd3bbd 1771 spec->gen.hp_mic = 1;
e6e0ee50 1772 }
39aedee7
TI
1773}
1774
1727a771 1775static const struct hda_fixup alc260_fixups[] = {
ca8f0424 1776 [ALC260_FIXUP_HP_DC5750] = {
1727a771
TI
1777 .type = HDA_FIXUP_PINS,
1778 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
1779 { 0x11, 0x90130110 }, /* speaker */
1780 { }
1781 }
1782 },
ca8f0424 1783 [ALC260_FIXUP_HP_PIN_0F] = {
1727a771
TI
1784 .type = HDA_FIXUP_PINS,
1785 .v.pins = (const struct hda_pintbl[]) {
ca8f0424
TI
1786 { 0x0f, 0x01214000 }, /* HP */
1787 { }
1788 }
1789 },
1790 [ALC260_FIXUP_COEF] = {
1727a771 1791 .type = HDA_FIXUP_VERBS,
ca8f0424 1792 .v.verbs = (const struct hda_verb[]) {
e30cf2d2
RM
1793 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1794 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
ca8f0424
TI
1795 { }
1796 },
ca8f0424 1797 },
15317ab2 1798 [ALC260_FIXUP_GPIO1] = {
5579cd6f
TI
1799 .type = HDA_FIXUP_FUNC,
1800 .v.func = alc_fixup_gpio1,
15317ab2 1801 },
20f7d928 1802 [ALC260_FIXUP_GPIO1_TOGGLE] = {
1727a771 1803 .type = HDA_FIXUP_FUNC,
20f7d928
TI
1804 .v.func = alc260_fixup_gpio1_toggle,
1805 .chained = true,
1806 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1807 },
1808 [ALC260_FIXUP_REPLACER] = {
1727a771 1809 .type = HDA_FIXUP_VERBS,
20f7d928 1810 .v.verbs = (const struct hda_verb[]) {
192a98e2
TI
1811 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1812 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
20f7d928
TI
1813 { }
1814 },
1815 .chained = true,
1816 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1817 },
0a1c4fa2 1818 [ALC260_FIXUP_HP_B1900] = {
1727a771 1819 .type = HDA_FIXUP_FUNC,
0a1c4fa2
TI
1820 .v.func = alc260_fixup_gpio1_toggle,
1821 .chained = true,
1822 .chain_id = ALC260_FIXUP_COEF,
118cb4a4
TI
1823 },
1824 [ALC260_FIXUP_KN1] = {
1727a771 1825 .type = HDA_FIXUP_FUNC,
118cb4a4
TI
1826 .v.func = alc260_fixup_kn1,
1827 },
39aedee7
TI
1828 [ALC260_FIXUP_FSC_S7020] = {
1829 .type = HDA_FIXUP_FUNC,
1830 .v.func = alc260_fixup_fsc_s7020,
1831 },
5ebd3bbd
TI
1832 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1833 .type = HDA_FIXUP_FUNC,
1834 .v.func = alc260_fixup_fsc_s7020_jwse,
1835 .chained = true,
1836 .chain_id = ALC260_FIXUP_FSC_S7020,
1837 },
d08c5ef2
TI
1838 [ALC260_FIXUP_VAIO_PINS] = {
1839 .type = HDA_FIXUP_PINS,
1840 .v.pins = (const struct hda_pintbl[]) {
1841 /* Pin configs are missing completely on some VAIOs */
1842 { 0x0f, 0x01211020 },
1843 { 0x10, 0x0001003f },
1844 { 0x11, 0x411111f0 },
1845 { 0x12, 0x01a15930 },
1846 { 0x13, 0x411111f0 },
1847 { 0x14, 0x411111f0 },
1848 { 0x15, 0x411111f0 },
1849 { 0x16, 0x411111f0 },
1850 { 0x17, 0x411111f0 },
1851 { 0x18, 0x411111f0 },
1852 { 0x19, 0x411111f0 },
1853 { }
1854 }
1855 },
1d045db9
TI
1856};
1857
1858static const struct snd_pci_quirk alc260_fixup_tbl[] = {
15317ab2 1859 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
ca8f0424 1860 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
15317ab2 1861 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
ca8f0424 1862 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
0a1c4fa2 1863 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
d08c5ef2 1864 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
0f5a5b85 1865 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
39aedee7 1866 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
b1f58085 1867 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
118cb4a4 1868 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
20f7d928 1869 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
ca8f0424 1870 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
1d045db9
TI
1871 {}
1872};
1873
5ebd3bbd
TI
1874static const struct hda_model_fixup alc260_fixup_models[] = {
1875 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1876 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1877 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1878 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1879 {}
1880};
1881
1d045db9
TI
1882/*
1883 */
1d045db9 1884static int patch_alc260(struct hda_codec *codec)
977ddd6b 1885{
1d045db9 1886 struct alc_spec *spec;
c3c2c9e7 1887 int err;
1d045db9 1888
3de95173
TI
1889 err = alc_alloc_spec(codec, 0x07);
1890 if (err < 0)
1891 return err;
1d045db9 1892
3de95173 1893 spec = codec->spec;
ea46c3c8
TI
1894 /* as quite a few machines require HP amp for speaker outputs,
1895 * it's easier to enable it unconditionally; even if it's unneeded,
1896 * it's almost harmless.
1897 */
1898 spec->gen.prefer_hp_amp = 1;
7504b6cd 1899 spec->gen.beep_nid = 0x01;
1d045db9 1900
225068ab
TI
1901 spec->shutup = alc_eapd_shutup;
1902
c9af753f
TI
1903 alc_pre_init(codec);
1904
5ebd3bbd
TI
1905 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1906 alc260_fixups);
1727a771 1907 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
977ddd6b 1908
c3c2c9e7
TI
1909 /* automatic parse from the BIOS config */
1910 err = alc260_parse_auto_config(codec);
1911 if (err < 0)
1912 goto error;
977ddd6b 1913
fea80fae
TI
1914 if (!spec->gen.no_analog) {
1915 err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1916 if (err < 0)
1917 goto error;
1918 }
977ddd6b 1919
1727a771 1920 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 1921
1d045db9 1922 return 0;
e16fb6d1
TI
1923
1924 error:
1925 alc_free(codec);
1926 return err;
6981d184
TI
1927}
1928
1d045db9
TI
1929
1930/*
1931 * ALC882/883/885/888/889 support
1932 *
1933 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1934 * configuration. Each pin widget can choose any input DACs and a mixer.
1935 * Each ADC is connected from a mixer of all inputs. This makes possible
1936 * 6-channel independent captures.
1937 *
1938 * In addition, an independent DAC for the multi-playback (not used in this
1939 * driver yet).
1940 */
1d045db9
TI
1941
1942/*
1943 * Pin config fixes
1944 */
ff818c24 1945enum {
5c0ebfbe
TI
1946 ALC882_FIXUP_ABIT_AW9D_MAX,
1947 ALC882_FIXUP_LENOVO_Y530,
1948 ALC882_FIXUP_PB_M5210,
1949 ALC882_FIXUP_ACER_ASPIRE_7736,
1950 ALC882_FIXUP_ASUS_W90V,
8f239214 1951 ALC889_FIXUP_CD,
b2c53e20 1952 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
5c0ebfbe 1953 ALC889_FIXUP_VAIO_TT,
0e7cc2e7 1954 ALC888_FIXUP_EEE1601,
4841b8e6 1955 ALC886_FIXUP_EAPD,
177943a3 1956 ALC882_FIXUP_EAPD,
7a6069bf 1957 ALC883_FIXUP_EAPD,
8812c4f9 1958 ALC883_FIXUP_ACER_EAPD,
1a97b7f2
TI
1959 ALC882_FIXUP_GPIO1,
1960 ALC882_FIXUP_GPIO2,
eb844d51 1961 ALC882_FIXUP_GPIO3,
68ef0561
TI
1962 ALC889_FIXUP_COEF,
1963 ALC882_FIXUP_ASUS_W2JC,
c3e837bb
TI
1964 ALC882_FIXUP_ACER_ASPIRE_4930G,
1965 ALC882_FIXUP_ACER_ASPIRE_8930G,
1966 ALC882_FIXUP_ASPIRE_8930G_VERBS,
5671087f 1967 ALC885_FIXUP_MACPRO_GPIO,
02a237b2 1968 ALC889_FIXUP_DAC_ROUTE,
1a97b7f2
TI
1969 ALC889_FIXUP_MBP_VREF,
1970 ALC889_FIXUP_IMAC91_VREF,
e7729a41 1971 ALC889_FIXUP_MBA11_VREF,
0756f09c 1972 ALC889_FIXUP_MBA21_VREF,
c20f31ec 1973 ALC889_FIXUP_MP11_VREF,
9f660a1c 1974 ALC889_FIXUP_MP41_VREF,
6e72aa5f 1975 ALC882_FIXUP_INV_DMIC,
e427c237 1976 ALC882_FIXUP_NO_PRIMARY_HP,
1f0bbf03 1977 ALC887_FIXUP_ASUS_BASS,
eb9ca3ab 1978 ALC887_FIXUP_BASS_CHMAP,
7beb3a6e 1979 ALC1220_FIXUP_GB_DUAL_CODECS,
c1933008 1980 ALC1220_FIXUP_GB_X570,
0202f5cd 1981 ALC1220_FIXUP_CLEVO_P950,
80690a27
RS
1982 ALC1220_FIXUP_CLEVO_PB51ED,
1983 ALC1220_FIXUP_CLEVO_PB51ED_PINS,
ca184355
JHP
1984 ALC887_FIXUP_ASUS_AUDIO,
1985 ALC887_FIXUP_ASUS_HMIC,
9bfa7b36 1986 ALCS1200A_FIXUP_MIC_VREF,
ff818c24
TI
1987};
1988
68ef0561 1989static void alc889_fixup_coef(struct hda_codec *codec,
1727a771 1990 const struct hda_fixup *fix, int action)
68ef0561 1991{
1727a771 1992 if (action != HDA_FIXUP_ACT_INIT)
68ef0561 1993 return;
1df8874b 1994 alc_update_coef_idx(codec, 7, 0, 0x2030);
68ef0561
TI
1995}
1996
5671087f
TI
1997/* set up GPIO at initialization */
1998static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
1727a771 1999 const struct hda_fixup *fix, int action)
5671087f 2000{
215c850c
TI
2001 struct alc_spec *spec = codec->spec;
2002
2003 spec->gpio_write_delay = true;
2004 alc_fixup_gpio3(codec, fix, action);
5671087f
TI
2005}
2006
02a237b2
TI
2007/* Fix the connection of some pins for ALC889:
2008 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
2009 * work correctly (bko#42740)
2010 */
2011static void alc889_fixup_dac_route(struct hda_codec *codec,
1727a771 2012 const struct hda_fixup *fix, int action)
02a237b2 2013{
1727a771 2014 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
ef8d60fb 2015 /* fake the connections during parsing the tree */
caf3c043
MM
2016 static const hda_nid_t conn1[] = { 0x0c, 0x0d };
2017 static const hda_nid_t conn2[] = { 0x0e, 0x0f };
2018 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2019 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
2020 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
2021 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
1727a771 2022 } else if (action == HDA_FIXUP_ACT_PROBE) {
ef8d60fb 2023 /* restore the connections */
caf3c043
MM
2024 static const hda_nid_t conn[] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
2025 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
2026 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
2027 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
2028 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
02a237b2
TI
2029 }
2030}
2031
1a97b7f2
TI
2032/* Set VREF on HP pin */
2033static void alc889_fixup_mbp_vref(struct hda_codec *codec,
1727a771 2034 const struct hda_fixup *fix, int action)
1a97b7f2 2035{
caf3c043 2036 static const hda_nid_t nids[] = { 0x14, 0x15, 0x19 };
1a97b7f2 2037 struct alc_spec *spec = codec->spec;
1a97b7f2
TI
2038 int i;
2039
1727a771 2040 if (action != HDA_FIXUP_ACT_INIT)
1a97b7f2
TI
2041 return;
2042 for (i = 0; i < ARRAY_SIZE(nids); i++) {
2043 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
2044 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
2045 continue;
d3f02d60 2046 val = snd_hda_codec_get_pin_target(codec, nids[i]);
1a97b7f2 2047 val |= AC_PINCTL_VREF_80;
cdd03ced 2048 snd_hda_set_pin_ctl(codec, nids[i], val);
08c189f2 2049 spec->gen.keep_vref_in_automute = 1;
1a97b7f2
TI
2050 break;
2051 }
2052}
2053
0756f09c
TI
2054static void alc889_fixup_mac_pins(struct hda_codec *codec,
2055 const hda_nid_t *nids, int num_nids)
1a97b7f2
TI
2056{
2057 struct alc_spec *spec = codec->spec;
1a97b7f2
TI
2058 int i;
2059
0756f09c 2060 for (i = 0; i < num_nids; i++) {
1a97b7f2 2061 unsigned int val;
d3f02d60 2062 val = snd_hda_codec_get_pin_target(codec, nids[i]);
1a97b7f2 2063 val |= AC_PINCTL_VREF_50;
cdd03ced 2064 snd_hda_set_pin_ctl(codec, nids[i], val);
1a97b7f2 2065 }
08c189f2 2066 spec->gen.keep_vref_in_automute = 1;
1a97b7f2
TI
2067}
2068
0756f09c
TI
2069/* Set VREF on speaker pins on imac91 */
2070static void alc889_fixup_imac91_vref(struct hda_codec *codec,
2071 const struct hda_fixup *fix, int action)
2072{
caf3c043 2073 static const hda_nid_t nids[] = { 0x18, 0x1a };
0756f09c
TI
2074
2075 if (action == HDA_FIXUP_ACT_INIT)
2076 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2077}
2078
e7729a41
AV
2079/* Set VREF on speaker pins on mba11 */
2080static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2081 const struct hda_fixup *fix, int action)
2082{
caf3c043 2083 static const hda_nid_t nids[] = { 0x18 };
e7729a41
AV
2084
2085 if (action == HDA_FIXUP_ACT_INIT)
2086 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2087}
2088
0756f09c
TI
2089/* Set VREF on speaker pins on mba21 */
2090static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2091 const struct hda_fixup *fix, int action)
2092{
caf3c043 2093 static const hda_nid_t nids[] = { 0x18, 0x19 };
0756f09c
TI
2094
2095 if (action == HDA_FIXUP_ACT_INIT)
2096 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2097}
2098
e427c237 2099/* Don't take HP output as primary
d9111496
FLVC
2100 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2101 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
e427c237
TI
2102 */
2103static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
1727a771 2104 const struct hda_fixup *fix, int action)
e427c237
TI
2105{
2106 struct alc_spec *spec = codec->spec;
da96fb5b 2107 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
08c189f2 2108 spec->gen.no_primary_hp = 1;
da96fb5b
TI
2109 spec->gen.no_multi_io = 1;
2110 }
e427c237
TI
2111}
2112
eb9ca3ab
TI
2113static void alc_fixup_bass_chmap(struct hda_codec *codec,
2114 const struct hda_fixup *fix, int action);
2115
7beb3a6e
TI
2116/* For dual-codec configuration, we need to disable some features to avoid
2117 * conflicts of kctls and PCM streams
2118 */
2119static void alc_fixup_dual_codecs(struct hda_codec *codec,
2120 const struct hda_fixup *fix, int action)
2121{
2122 struct alc_spec *spec = codec->spec;
2123
2124 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2125 return;
2126 /* disable vmaster */
2127 spec->gen.suppress_vmaster = 1;
2128 /* auto-mute and auto-mic switch don't work with multiple codecs */
2129 spec->gen.suppress_auto_mute = 1;
2130 spec->gen.suppress_auto_mic = 1;
2131 /* disable aamix as well */
2132 spec->gen.mixer_nid = 0;
2133 /* add location prefix to avoid conflicts */
2134 codec->force_pin_prefix = 1;
2135}
2136
2137static void rename_ctl(struct hda_codec *codec, const char *oldname,
2138 const char *newname)
2139{
2140 struct snd_kcontrol *kctl;
2141
2142 kctl = snd_hda_find_mixer_ctl(codec, oldname);
2143 if (kctl)
2144 strcpy(kctl->id.name, newname);
2145}
2146
2147static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2148 const struct hda_fixup *fix,
2149 int action)
2150{
2151 alc_fixup_dual_codecs(codec, fix, action);
2152 switch (action) {
2153 case HDA_FIXUP_ACT_PRE_PROBE:
2154 /* override card longname to provide a unique UCM profile */
2155 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2156 break;
2157 case HDA_FIXUP_ACT_BUILD:
2158 /* rename Capture controls depending on the codec */
2159 rename_ctl(codec, "Capture Volume",
2160 codec->addr == 0 ?
2161 "Rear-Panel Capture Volume" :
2162 "Front-Panel Capture Volume");
2163 rename_ctl(codec, "Capture Switch",
2164 codec->addr == 0 ?
2165 "Rear-Panel Capture Switch" :
2166 "Front-Panel Capture Switch");
2167 break;
2168 }
2169}
2170
c1933008
CL
2171static void alc1220_fixup_gb_x570(struct hda_codec *codec,
2172 const struct hda_fixup *fix,
2173 int action)
2174{
2175 static const hda_nid_t conn1[] = { 0x0c };
2176 static const struct coef_fw gb_x570_coefs[] = {
41a86013 2177 WRITE_COEF(0x07, 0x03c0),
c1933008
CL
2178 WRITE_COEF(0x1a, 0x01c1),
2179 WRITE_COEF(0x1b, 0x0202),
2180 WRITE_COEF(0x43, 0x3005),
2181 {}
2182 };
2183
2184 switch (action) {
2185 case HDA_FIXUP_ACT_PRE_PROBE:
2186 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2187 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2188 break;
2189 case HDA_FIXUP_ACT_INIT:
2190 alc_process_coef_fw(codec, gb_x570_coefs);
2191 break;
2192 }
2193}
2194
0202f5cd
P
2195static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2196 const struct hda_fixup *fix,
2197 int action)
2198{
caf3c043 2199 static const hda_nid_t conn1[] = { 0x0c };
0202f5cd
P
2200
2201 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2202 return;
2203
2204 alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2205 /* We therefore want to make sure 0x14 (front headphone) and
2206 * 0x1b (speakers) use the stereo DAC 0x02
2207 */
caf3c043
MM
2208 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2209 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
0202f5cd
P
2210}
2211
7f665b1c
JS
2212static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2213 const struct hda_fixup *fix, int action);
2214
80690a27 2215static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
7f665b1c
JS
2216 const struct hda_fixup *fix,
2217 int action)
2218{
2219 alc1220_fixup_clevo_p950(codec, fix, action);
2220 alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2221}
2222
ca184355
JHP
2223static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
2224 struct hda_jack_callback *jack)
2225{
2226 struct alc_spec *spec = codec->spec;
2227 unsigned int vref;
2228
2229 snd_hda_gen_hp_automute(codec, jack);
2230
2231 if (spec->gen.hp_jack_present)
2232 vref = AC_PINCTL_VREF_80;
2233 else
2234 vref = AC_PINCTL_VREF_HIZ;
2235 snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
2236}
2237
2238static void alc887_fixup_asus_jack(struct hda_codec *codec,
2239 const struct hda_fixup *fix, int action)
2240{
2241 struct alc_spec *spec = codec->spec;
2242 if (action != HDA_FIXUP_ACT_PROBE)
2243 return;
2244 snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
2245 spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook;
2246}
2247
1727a771 2248static const struct hda_fixup alc882_fixups[] = {
5c0ebfbe 2249 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
1727a771
TI
2250 .type = HDA_FIXUP_PINS,
2251 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
2252 { 0x15, 0x01080104 }, /* side */
2253 { 0x16, 0x01011012 }, /* rear */
2254 { 0x17, 0x01016011 }, /* clfe */
2785591a 2255 { }
145a902b
DH
2256 }
2257 },
5c0ebfbe 2258 [ALC882_FIXUP_LENOVO_Y530] = {
1727a771
TI
2259 .type = HDA_FIXUP_PINS,
2260 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
2261 { 0x15, 0x99130112 }, /* rear int speakers */
2262 { 0x16, 0x99130111 }, /* subwoofer */
ac612407
DH
2263 { }
2264 }
2265 },
5c0ebfbe 2266 [ALC882_FIXUP_PB_M5210] = {
fd108215
TI
2267 .type = HDA_FIXUP_PINCTLS,
2268 .v.pins = (const struct hda_pintbl[]) {
2269 { 0x19, PIN_VREF50 },
357f915e
KY
2270 {}
2271 }
2272 },
5c0ebfbe 2273 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
1727a771 2274 .type = HDA_FIXUP_FUNC,
23d30f28 2275 .v.func = alc_fixup_sku_ignore,
6981d184 2276 },
5c0ebfbe 2277 [ALC882_FIXUP_ASUS_W90V] = {
1727a771
TI
2278 .type = HDA_FIXUP_PINS,
2279 .v.pins = (const struct hda_pintbl[]) {
5cdf745e
TI
2280 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
2281 { }
2282 }
2283 },
8f239214 2284 [ALC889_FIXUP_CD] = {
1727a771
TI
2285 .type = HDA_FIXUP_PINS,
2286 .v.pins = (const struct hda_pintbl[]) {
8f239214
MB
2287 { 0x1c, 0x993301f0 }, /* CD */
2288 { }
2289 }
2290 },
b2c53e20
DH
2291 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2292 .type = HDA_FIXUP_PINS,
2293 .v.pins = (const struct hda_pintbl[]) {
2294 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2295 { }
2296 },
2297 .chained = true,
2298 .chain_id = ALC889_FIXUP_CD,
2299 },
5c0ebfbe 2300 [ALC889_FIXUP_VAIO_TT] = {
1727a771
TI
2301 .type = HDA_FIXUP_PINS,
2302 .v.pins = (const struct hda_pintbl[]) {
5c0ebfbe
TI
2303 { 0x17, 0x90170111 }, /* hidden surround speaker */
2304 { }
2305 }
2306 },
0e7cc2e7 2307 [ALC888_FIXUP_EEE1601] = {
1727a771 2308 .type = HDA_FIXUP_VERBS,
0e7cc2e7
TI
2309 .v.verbs = (const struct hda_verb[]) {
2310 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2311 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
2312 { }
2313 }
177943a3 2314 },
4841b8e6
PH
2315 [ALC886_FIXUP_EAPD] = {
2316 .type = HDA_FIXUP_VERBS,
2317 .v.verbs = (const struct hda_verb[]) {
2318 /* change to EAPD mode */
2319 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2320 { 0x20, AC_VERB_SET_PROC_COEF, 0x0068 },
2321 { }
2322 }
2323 },
177943a3 2324 [ALC882_FIXUP_EAPD] = {
1727a771 2325 .type = HDA_FIXUP_VERBS,
177943a3
TI
2326 .v.verbs = (const struct hda_verb[]) {
2327 /* change to EAPD mode */
2328 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2329 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2330 { }
2331 }
2332 },
7a6069bf 2333 [ALC883_FIXUP_EAPD] = {
1727a771 2334 .type = HDA_FIXUP_VERBS,
7a6069bf
TI
2335 .v.verbs = (const struct hda_verb[]) {
2336 /* change to EAPD mode */
2337 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2338 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2339 { }
2340 }
2341 },
8812c4f9 2342 [ALC883_FIXUP_ACER_EAPD] = {
1727a771 2343 .type = HDA_FIXUP_VERBS,
8812c4f9
TI
2344 .v.verbs = (const struct hda_verb[]) {
2345 /* eanable EAPD on Acer laptops */
2346 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2347 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2348 { }
2349 }
2350 },
1a97b7f2 2351 [ALC882_FIXUP_GPIO1] = {
5579cd6f
TI
2352 .type = HDA_FIXUP_FUNC,
2353 .v.func = alc_fixup_gpio1,
1a97b7f2
TI
2354 },
2355 [ALC882_FIXUP_GPIO2] = {
5579cd6f
TI
2356 .type = HDA_FIXUP_FUNC,
2357 .v.func = alc_fixup_gpio2,
1a97b7f2 2358 },
eb844d51 2359 [ALC882_FIXUP_GPIO3] = {
5579cd6f
TI
2360 .type = HDA_FIXUP_FUNC,
2361 .v.func = alc_fixup_gpio3,
eb844d51 2362 },
68ef0561 2363 [ALC882_FIXUP_ASUS_W2JC] = {
5579cd6f
TI
2364 .type = HDA_FIXUP_FUNC,
2365 .v.func = alc_fixup_gpio1,
68ef0561
TI
2366 .chained = true,
2367 .chain_id = ALC882_FIXUP_EAPD,
2368 },
2369 [ALC889_FIXUP_COEF] = {
1727a771 2370 .type = HDA_FIXUP_FUNC,
68ef0561
TI
2371 .v.func = alc889_fixup_coef,
2372 },
c3e837bb 2373 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
1727a771
TI
2374 .type = HDA_FIXUP_PINS,
2375 .v.pins = (const struct hda_pintbl[]) {
c3e837bb
TI
2376 { 0x16, 0x99130111 }, /* CLFE speaker */
2377 { 0x17, 0x99130112 }, /* surround speaker */
2378 { }
038d4fef
TI
2379 },
2380 .chained = true,
2381 .chain_id = ALC882_FIXUP_GPIO1,
c3e837bb
TI
2382 },
2383 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
1727a771
TI
2384 .type = HDA_FIXUP_PINS,
2385 .v.pins = (const struct hda_pintbl[]) {
c3e837bb
TI
2386 { 0x16, 0x99130111 }, /* CLFE speaker */
2387 { 0x1b, 0x99130112 }, /* surround speaker */
2388 { }
2389 },
2390 .chained = true,
2391 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2392 },
2393 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2394 /* additional init verbs for Acer Aspire 8930G */
1727a771 2395 .type = HDA_FIXUP_VERBS,
c3e837bb
TI
2396 .v.verbs = (const struct hda_verb[]) {
2397 /* Enable all DACs */
2398 /* DAC DISABLE/MUTE 1? */
2399 /* setting bits 1-5 disables DAC nids 0x02-0x06
2400 * apparently. Init=0x38 */
2401 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2402 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2403 /* DAC DISABLE/MUTE 2? */
2404 /* some bit here disables the other DACs.
2405 * Init=0x4900 */
2406 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2407 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2408 /* DMIC fix
2409 * This laptop has a stereo digital microphone.
2410 * The mics are only 1cm apart which makes the stereo
2411 * useless. However, either the mic or the ALC889
2412 * makes the signal become a difference/sum signal
2413 * instead of standard stereo, which is annoying.
2414 * So instead we flip this bit which makes the
2415 * codec replicate the sum signal to both channels,
2416 * turning it into a normal mono mic.
2417 */
2418 /* DMIC_CONTROL? Init value = 0x0001 */
2419 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2420 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2421 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2422 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2423 { }
038d4fef
TI
2424 },
2425 .chained = true,
2426 .chain_id = ALC882_FIXUP_GPIO1,
c3e837bb 2427 },
5671087f 2428 [ALC885_FIXUP_MACPRO_GPIO] = {
1727a771 2429 .type = HDA_FIXUP_FUNC,
5671087f
TI
2430 .v.func = alc885_fixup_macpro_gpio,
2431 },
02a237b2 2432 [ALC889_FIXUP_DAC_ROUTE] = {
1727a771 2433 .type = HDA_FIXUP_FUNC,
02a237b2
TI
2434 .v.func = alc889_fixup_dac_route,
2435 },
1a97b7f2 2436 [ALC889_FIXUP_MBP_VREF] = {
1727a771 2437 .type = HDA_FIXUP_FUNC,
1a97b7f2
TI
2438 .v.func = alc889_fixup_mbp_vref,
2439 .chained = true,
2440 .chain_id = ALC882_FIXUP_GPIO1,
2441 },
2442 [ALC889_FIXUP_IMAC91_VREF] = {
1727a771 2443 .type = HDA_FIXUP_FUNC,
1a97b7f2
TI
2444 .v.func = alc889_fixup_imac91_vref,
2445 .chained = true,
2446 .chain_id = ALC882_FIXUP_GPIO1,
2447 },
e7729a41
AV
2448 [ALC889_FIXUP_MBA11_VREF] = {
2449 .type = HDA_FIXUP_FUNC,
2450 .v.func = alc889_fixup_mba11_vref,
2451 .chained = true,
2452 .chain_id = ALC889_FIXUP_MBP_VREF,
2453 },
0756f09c
TI
2454 [ALC889_FIXUP_MBA21_VREF] = {
2455 .type = HDA_FIXUP_FUNC,
2456 .v.func = alc889_fixup_mba21_vref,
2457 .chained = true,
2458 .chain_id = ALC889_FIXUP_MBP_VREF,
2459 },
c20f31ec
TI
2460 [ALC889_FIXUP_MP11_VREF] = {
2461 .type = HDA_FIXUP_FUNC,
2462 .v.func = alc889_fixup_mba11_vref,
2463 .chained = true,
2464 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2465 },
9f660a1c
MK
2466 [ALC889_FIXUP_MP41_VREF] = {
2467 .type = HDA_FIXUP_FUNC,
2468 .v.func = alc889_fixup_mbp_vref,
2469 .chained = true,
2470 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2471 },
6e72aa5f 2472 [ALC882_FIXUP_INV_DMIC] = {
1727a771 2473 .type = HDA_FIXUP_FUNC,
9d36a7dc 2474 .v.func = alc_fixup_inv_dmic,
6e72aa5f 2475 },
e427c237 2476 [ALC882_FIXUP_NO_PRIMARY_HP] = {
1727a771 2477 .type = HDA_FIXUP_FUNC,
e427c237
TI
2478 .v.func = alc882_fixup_no_primary_hp,
2479 },
1f0bbf03
TI
2480 [ALC887_FIXUP_ASUS_BASS] = {
2481 .type = HDA_FIXUP_PINS,
2482 .v.pins = (const struct hda_pintbl[]) {
2483 {0x16, 0x99130130}, /* bass speaker */
2484 {}
2485 },
eb9ca3ab
TI
2486 .chained = true,
2487 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2488 },
2489 [ALC887_FIXUP_BASS_CHMAP] = {
2490 .type = HDA_FIXUP_FUNC,
2491 .v.func = alc_fixup_bass_chmap,
1f0bbf03 2492 },
7beb3a6e
TI
2493 [ALC1220_FIXUP_GB_DUAL_CODECS] = {
2494 .type = HDA_FIXUP_FUNC,
2495 .v.func = alc1220_fixup_gb_dual_codecs,
2496 },
c1933008
CL
2497 [ALC1220_FIXUP_GB_X570] = {
2498 .type = HDA_FIXUP_FUNC,
2499 .v.func = alc1220_fixup_gb_x570,
2500 },
0202f5cd
P
2501 [ALC1220_FIXUP_CLEVO_P950] = {
2502 .type = HDA_FIXUP_FUNC,
2503 .v.func = alc1220_fixup_clevo_p950,
2504 },
80690a27 2505 [ALC1220_FIXUP_CLEVO_PB51ED] = {
7f665b1c 2506 .type = HDA_FIXUP_FUNC,
80690a27 2507 .v.func = alc1220_fixup_clevo_pb51ed,
7f665b1c 2508 },
80690a27 2509 [ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
7f665b1c
JS
2510 .type = HDA_FIXUP_PINS,
2511 .v.pins = (const struct hda_pintbl[]) {
2512 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2513 {}
2514 },
2515 .chained = true,
80690a27 2516 .chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
7f665b1c 2517 },
ca184355
JHP
2518 [ALC887_FIXUP_ASUS_AUDIO] = {
2519 .type = HDA_FIXUP_PINS,
2520 .v.pins = (const struct hda_pintbl[]) {
2521 { 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */
2522 { 0x19, 0x22219420 },
2523 {}
2524 },
2525 },
2526 [ALC887_FIXUP_ASUS_HMIC] = {
2527 .type = HDA_FIXUP_FUNC,
2528 .v.func = alc887_fixup_asus_jack,
2529 .chained = true,
2530 .chain_id = ALC887_FIXUP_ASUS_AUDIO,
2531 },
9bfa7b36
ML
2532 [ALCS1200A_FIXUP_MIC_VREF] = {
2533 .type = HDA_FIXUP_PINCTLS,
2534 .v.pins = (const struct hda_pintbl[]) {
2535 { 0x18, PIN_VREF50 }, /* rear mic */
2536 { 0x19, PIN_VREF50 }, /* front mic */
2537 {}
2538 }
2539 },
ff818c24
TI
2540};
2541
1d045db9 2542static const struct snd_pci_quirk alc882_fixup_tbl[] = {
8812c4f9
TI
2543 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2544 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
b5d724b1 2545 SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
8812c4f9
TI
2546 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2547 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2548 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2549 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
c3e837bb
TI
2550 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2551 ALC882_FIXUP_ACER_ASPIRE_4930G),
2552 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2553 ALC882_FIXUP_ACER_ASPIRE_4930G),
2554 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2555 ALC882_FIXUP_ACER_ASPIRE_8930G),
2556 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2557 ALC882_FIXUP_ACER_ASPIRE_8930G),
b265047a
TI
2558 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2559 ALC882_FIXUP_ACER_ASPIRE_4930G),
2560 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
c3e837bb
TI
2561 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2562 ALC882_FIXUP_ACER_ASPIRE_4930G),
2563 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2564 ALC882_FIXUP_ACER_ASPIRE_4930G),
f5c53d89
TI
2565 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2566 ALC882_FIXUP_ACER_ASPIRE_4930G),
02a237b2 2567 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
fe97da1f 2568 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
ac9b1cdd 2569 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
177943a3 2570 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
5c0ebfbe 2571 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
68ef0561 2572 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
ca184355 2573 SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC),
0e7cc2e7 2574 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
1f0bbf03 2575 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
85bcf96c 2576 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
9bfa7b36 2577 SND_PCI_QUIRK(0x1043, 0x8797, "ASUS TUF B550M-PLUS", ALCS1200A_FIXUP_MIC_VREF),
b7529c18
TI
2578 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2579 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
ac9b1cdd 2580 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
e427c237 2581 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
3f3c3714 2582 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
5671087f
TI
2583
2584 /* All Apple entries are in codec SSIDs */
1a97b7f2
TI
2585 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2586 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2587 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
c20f31ec 2588 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
5671087f
TI
2589 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2590 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
1a97b7f2
TI
2591 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2592 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
5671087f 2593 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
e7729a41 2594 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
0756f09c 2595 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
1a97b7f2
TI
2596 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2597 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
5671087f 2598 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
1a97b7f2
TI
2599 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2600 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2601 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
9f660a1c 2602 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
05193639 2603 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
1a97b7f2
TI
2604 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2605 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
649ccd08 2606 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
5671087f 2607
7a6069bf 2608 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
4841b8e6 2609 SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
b2c53e20 2610 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
7beb3a6e 2611 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
c1933008 2612 SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570),
ea354196 2613 SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_GB_X570),
41a86013 2614 SND_PCI_QUIRK(0x1458, 0xa0d5, "Gigabyte X570S Aorus Master", ALC1220_FIXUP_GB_X570),
a0b03952 2615 SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
a655e2b1 2616 SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
09926202 2617 SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
1d3aa4a5 2618 SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
7dafba37 2619 SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
cc5049ae 2620 SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
d2c3b14e 2621 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
26af1772 2622 SND_PCI_QUIRK(0x1462, 0xcc34, "MSI Godlike X570", ALC1220_FIXUP_GB_DUAL_CODECS),
63691587 2623 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
d2c3b14e 2624 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
5c0ebfbe 2625 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
13e1a4cd
TI
2626 SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2627 SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2628 SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2629 SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2630 SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
aef454b4 2631 SND_PCI_QUIRK(0x1558, 0x65f1, "Clevo PC50HS", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
9eb6f5c3 2632 SND_PCI_QUIRK(0x1558, 0x65f5, "Clevo PD50PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
13e1a4cd
TI
2633 SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2634 SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2635 SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
dbfe8350 2636 SND_PCI_QUIRK(0x1558, 0x67f1, "Clevo PC70H[PRS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
d4995121 2637 SND_PCI_QUIRK(0x1558, 0x67f5, "Clevo PD70PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
13e1a4cd 2638 SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
1f8d398e 2639 SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170SM", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
cc03069a 2640 SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED),
0202f5cd 2641 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
b5acfe15 2642 SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
13e1a4cd 2643 SND_PCI_QUIRK(0x1558, 0x950a, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
f3d737b6 2644 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2f0d520a 2645 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
b5acfe15
PH
2646 SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
2647 SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950),
2648 SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950),
2649 SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950),
503d90b3
RS
2650 SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2651 SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
b5acfe15 2652 SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
7a6069bf
TI
2653 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2654 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
ac9b1cdd 2655 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
68ef0561 2656 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
ff818c24
TI
2657 {}
2658};
2659
1727a771 2660static const struct hda_model_fixup alc882_fixup_models[] = {
772c2917
TI
2661 {.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2662 {.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2663 {.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2664 {.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2665 {.id = ALC889_FIXUP_CD, .name = "cd"},
2666 {.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2667 {.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2668 {.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2669 {.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2670 {.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2671 {.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2672 {.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2673 {.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2674 {.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2675 {.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
912093bc
TI
2676 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2677 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2678 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
772c2917
TI
2679 {.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2680 {.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2681 {.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2682 {.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2683 {.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2684 {.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2685 {.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2686 {.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
6e72aa5f 2687 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
e427c237 2688 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
772c2917 2689 {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
ba90d6a6 2690 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
63394a16 2691 {.id = ALC1220_FIXUP_GB_X570, .name = "gb-x570"},
772c2917 2692 {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
912093bc
TI
2693 {}
2694};
2695
119b75c1
HW
2696static const struct snd_hda_pin_quirk alc882_pin_fixup_tbl[] = {
2697 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1043, "ASUS", ALC1220_FIXUP_CLEVO_P950,
2698 {0x14, 0x01014010},
2699 {0x15, 0x01011012},
2700 {0x16, 0x01016011},
2701 {0x18, 0x01a19040},
2702 {0x19, 0x02a19050},
2703 {0x1a, 0x0181304f},
2704 {0x1b, 0x0221401f},
2705 {0x1e, 0x01456130}),
2706 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1462, "MS-7C35", ALC1220_FIXUP_CLEVO_P950,
2707 {0x14, 0x01015010},
2708 {0x15, 0x01011012},
2709 {0x16, 0x01011011},
2710 {0x18, 0x01a11040},
2711 {0x19, 0x02a19050},
2712 {0x1a, 0x0181104f},
2713 {0x1b, 0x0221401f},
2714 {0x1e, 0x01451130}),
2715 {}
2716};
2717
f6a92248 2718/*
1d045db9 2719 * BIOS auto configuration
f6a92248 2720 */
1d045db9
TI
2721/* almost identical with ALC880 parser... */
2722static int alc882_parse_auto_config(struct hda_codec *codec)
2723{
1d045db9 2724 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
3e6179b8
TI
2725 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2726 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
1d045db9 2727}
b896b4eb 2728
1d045db9
TI
2729/*
2730 */
1d045db9 2731static int patch_alc882(struct hda_codec *codec)
f6a92248
KY
2732{
2733 struct alc_spec *spec;
1a97b7f2 2734 int err;
f6a92248 2735
3de95173
TI
2736 err = alc_alloc_spec(codec, 0x0b);
2737 if (err < 0)
2738 return err;
f6a92248 2739
3de95173 2740 spec = codec->spec;
1f0f4b80 2741
7639a06c 2742 switch (codec->core.vendor_id) {
1d045db9
TI
2743 case 0x10ec0882:
2744 case 0x10ec0885:
acf08081 2745 case 0x10ec0900:
6d9ffcff 2746 case 0x10ec0b00:
a535ad57 2747 case 0x10ec1220:
1d045db9
TI
2748 break;
2749 default:
2750 /* ALC883 and variants */
2751 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2752 break;
c793bec5 2753 }
977ddd6b 2754
c9af753f
TI
2755 alc_pre_init(codec);
2756
1727a771 2757 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
912093bc 2758 alc882_fixups);
119b75c1 2759 snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true);
1727a771 2760 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
ff818c24 2761
1d045db9
TI
2762 alc_auto_parse_customize_define(codec);
2763
7504b6cd
TI
2764 if (has_cdefine_beep(codec))
2765 spec->gen.beep_nid = 0x01;
2766
1a97b7f2
TI
2767 /* automatic parse from the BIOS config */
2768 err = alc882_parse_auto_config(codec);
2769 if (err < 0)
2770 goto error;
f6a92248 2771
fea80fae
TI
2772 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2773 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2774 if (err < 0)
2775 goto error;
2776 }
f6a92248 2777
1727a771 2778 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 2779
f6a92248 2780 return 0;
e16fb6d1
TI
2781
2782 error:
2783 alc_free(codec);
2784 return err;
f6a92248
KY
2785}
2786
df694daa 2787
df694daa 2788/*
1d045db9 2789 * ALC262 support
df694daa 2790 */
1d045db9 2791static int alc262_parse_auto_config(struct hda_codec *codec)
df694daa 2792{
1d045db9 2793 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
3e6179b8
TI
2794 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2795 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
df694daa
KY
2796}
2797
df694daa 2798/*
1d045db9 2799 * Pin config fixes
df694daa 2800 */
cfc9b06f 2801enum {
ea4e7af1 2802 ALC262_FIXUP_FSC_H270,
7513e6da 2803 ALC262_FIXUP_FSC_S7110,
ea4e7af1
TI
2804 ALC262_FIXUP_HP_Z200,
2805 ALC262_FIXUP_TYAN,
c470150c 2806 ALC262_FIXUP_LENOVO_3000,
b42590b8
TI
2807 ALC262_FIXUP_BENQ,
2808 ALC262_FIXUP_BENQ_T31,
6e72aa5f 2809 ALC262_FIXUP_INV_DMIC,
b5c6611f 2810 ALC262_FIXUP_INTEL_BAYLEYBAY,
cfc9b06f
TI
2811};
2812
1727a771 2813static const struct hda_fixup alc262_fixups[] = {
ea4e7af1 2814 [ALC262_FIXUP_FSC_H270] = {
1727a771
TI
2815 .type = HDA_FIXUP_PINS,
2816 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
2817 { 0x14, 0x99130110 }, /* speaker */
2818 { 0x15, 0x0221142f }, /* front HP */
2819 { 0x1b, 0x0121141f }, /* rear HP */
2820 { }
2821 }
2822 },
7513e6da
TI
2823 [ALC262_FIXUP_FSC_S7110] = {
2824 .type = HDA_FIXUP_PINS,
2825 .v.pins = (const struct hda_pintbl[]) {
2826 { 0x15, 0x90170110 }, /* speaker */
2827 { }
2828 },
2829 .chained = true,
2830 .chain_id = ALC262_FIXUP_BENQ,
2831 },
ea4e7af1 2832 [ALC262_FIXUP_HP_Z200] = {
1727a771
TI
2833 .type = HDA_FIXUP_PINS,
2834 .v.pins = (const struct hda_pintbl[]) {
1d045db9 2835 { 0x16, 0x99130120 }, /* internal speaker */
73413b12
TI
2836 { }
2837 }
cfc9b06f 2838 },
ea4e7af1 2839 [ALC262_FIXUP_TYAN] = {
1727a771
TI
2840 .type = HDA_FIXUP_PINS,
2841 .v.pins = (const struct hda_pintbl[]) {
ea4e7af1
TI
2842 { 0x14, 0x1993e1f0 }, /* int AUX */
2843 { }
2844 }
2845 },
c470150c 2846 [ALC262_FIXUP_LENOVO_3000] = {
fd108215
TI
2847 .type = HDA_FIXUP_PINCTLS,
2848 .v.pins = (const struct hda_pintbl[]) {
2849 { 0x19, PIN_VREF50 },
b42590b8
TI
2850 {}
2851 },
2852 .chained = true,
2853 .chain_id = ALC262_FIXUP_BENQ,
2854 },
2855 [ALC262_FIXUP_BENQ] = {
1727a771 2856 .type = HDA_FIXUP_VERBS,
b42590b8 2857 .v.verbs = (const struct hda_verb[]) {
c470150c
TI
2858 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2859 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2860 {}
2861 }
2862 },
b42590b8 2863 [ALC262_FIXUP_BENQ_T31] = {
1727a771 2864 .type = HDA_FIXUP_VERBS,
b42590b8
TI
2865 .v.verbs = (const struct hda_verb[]) {
2866 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2867 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2868 {}
2869 }
2870 },
6e72aa5f 2871 [ALC262_FIXUP_INV_DMIC] = {
1727a771 2872 .type = HDA_FIXUP_FUNC,
9d36a7dc 2873 .v.func = alc_fixup_inv_dmic,
6e72aa5f 2874 },
b5c6611f
ML
2875 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2876 .type = HDA_FIXUP_FUNC,
2877 .v.func = alc_fixup_no_depop_delay,
2878 },
cfc9b06f
TI
2879};
2880
1d045db9 2881static const struct snd_pci_quirk alc262_fixup_tbl[] = {
ea4e7af1 2882 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
7513e6da 2883 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
3dcd3be3 2884 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
ea4e7af1 2885 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
275ec0cb 2886 SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
ea4e7af1 2887 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
c470150c 2888 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
b42590b8
TI
2889 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2890 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
b5c6611f 2891 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
cfc9b06f
TI
2892 {}
2893};
df694daa 2894
1727a771 2895static const struct hda_model_fixup alc262_fixup_models[] = {
6e72aa5f 2896 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
e43c44d6
TI
2897 {.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2898 {.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2899 {.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2900 {.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2901 {.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2902 {.id = ALC262_FIXUP_BENQ, .name = "benq"},
2903 {.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2904 {.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
6e72aa5f
TI
2905 {}
2906};
1d045db9 2907
1d045db9
TI
2908/*
2909 */
1d045db9 2910static int patch_alc262(struct hda_codec *codec)
df694daa
KY
2911{
2912 struct alc_spec *spec;
df694daa
KY
2913 int err;
2914
3de95173
TI
2915 err = alc_alloc_spec(codec, 0x0b);
2916 if (err < 0)
2917 return err;
df694daa 2918
3de95173 2919 spec = codec->spec;
08c189f2 2920 spec->gen.shared_mic_vref_pin = 0x18;
1d045db9 2921
225068ab
TI
2922 spec->shutup = alc_eapd_shutup;
2923
1d045db9
TI
2924#if 0
2925 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2926 * under-run
2927 */
98b24883 2928 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
1d045db9 2929#endif
1d045db9
TI
2930 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2931
c9af753f
TI
2932 alc_pre_init(codec);
2933
1727a771 2934 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
6e72aa5f 2935 alc262_fixups);
1727a771 2936 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
9c7f852e 2937
af741c15
TI
2938 alc_auto_parse_customize_define(codec);
2939
7504b6cd
TI
2940 if (has_cdefine_beep(codec))
2941 spec->gen.beep_nid = 0x01;
2942
42399f7a
TI
2943 /* automatic parse from the BIOS config */
2944 err = alc262_parse_auto_config(codec);
2945 if (err < 0)
2946 goto error;
df694daa 2947
fea80fae
TI
2948 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2949 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2950 if (err < 0)
2951 goto error;
2952 }
2134ea4f 2953
1727a771 2954 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 2955
1da177e4 2956 return 0;
e16fb6d1
TI
2957
2958 error:
2959 alc_free(codec);
2960 return err;
1da177e4
LT
2961}
2962
f32610ed 2963/*
1d045db9 2964 * ALC268
f32610ed 2965 */
1d045db9 2966/* bind Beep switches of both NID 0x0f and 0x10 */
a717777d
TI
2967static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2968 struct snd_ctl_elem_value *ucontrol)
2969{
2970 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2971 unsigned long pval;
2972 int err;
2973
2974 mutex_lock(&codec->control_mutex);
2975 pval = kcontrol->private_value;
2976 kcontrol->private_value = (pval & ~0xff) | 0x0f;
2977 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2978 if (err >= 0) {
2979 kcontrol->private_value = (pval & ~0xff) | 0x10;
2980 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2981 }
2982 kcontrol->private_value = pval;
2983 mutex_unlock(&codec->control_mutex);
2984 return err;
2985}
f32610ed 2986
1d045db9
TI
2987static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2988 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
a717777d
TI
2989 {
2990 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2991 .name = "Beep Playback Switch",
2992 .subdevice = HDA_SUBDEV_AMP_FLAG,
2993 .info = snd_hda_mixer_amp_switch_info,
2994 .get = snd_hda_mixer_amp_switch_get,
2995 .put = alc268_beep_switch_put,
2996 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
2997 },
f32610ed
JS
2998};
2999
1d045db9
TI
3000/* set PCBEEP vol = 0, mute connections */
3001static const struct hda_verb alc268_beep_init_verbs[] = {
3002 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3003 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3004 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3005 { }
f32610ed
JS
3006};
3007
6e72aa5f
TI
3008enum {
3009 ALC268_FIXUP_INV_DMIC,
cb766404 3010 ALC268_FIXUP_HP_EAPD,
24eff328 3011 ALC268_FIXUP_SPDIF,
6e72aa5f
TI
3012};
3013
1727a771 3014static const struct hda_fixup alc268_fixups[] = {
6e72aa5f 3015 [ALC268_FIXUP_INV_DMIC] = {
1727a771 3016 .type = HDA_FIXUP_FUNC,
9d36a7dc 3017 .v.func = alc_fixup_inv_dmic,
6e72aa5f 3018 },
cb766404 3019 [ALC268_FIXUP_HP_EAPD] = {
1727a771 3020 .type = HDA_FIXUP_VERBS,
cb766404
TI
3021 .v.verbs = (const struct hda_verb[]) {
3022 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
3023 {}
3024 }
3025 },
24eff328
TI
3026 [ALC268_FIXUP_SPDIF] = {
3027 .type = HDA_FIXUP_PINS,
3028 .v.pins = (const struct hda_pintbl[]) {
3029 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
3030 {}
3031 }
3032 },
6e72aa5f
TI
3033};
3034
1727a771 3035static const struct hda_model_fixup alc268_fixup_models[] = {
6e72aa5f 3036 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
cb766404 3037 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
03bf11c9 3038 {.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
cb766404
TI
3039 {}
3040};
3041
3042static const struct snd_pci_quirk alc268_fixup_tbl[] = {
24eff328 3043 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
fcd8f3b1 3044 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
cb766404
TI
3045 /* below is codec SSID since multiple Toshiba laptops have the
3046 * same PCI SSID 1179:ff00
3047 */
3048 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
6e72aa5f
TI
3049 {}
3050};
3051
f32610ed
JS
3052/*
3053 * BIOS auto configuration
3054 */
1d045db9 3055static int alc268_parse_auto_config(struct hda_codec *codec)
f32610ed 3056{
3e6179b8 3057 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
7504b6cd 3058 return alc_parse_auto_config(codec, NULL, alc268_ssids);
f32610ed
JS
3059}
3060
1d045db9
TI
3061/*
3062 */
1d045db9 3063static int patch_alc268(struct hda_codec *codec)
f32610ed
JS
3064{
3065 struct alc_spec *spec;
a5cb463a 3066 int i, err;
f32610ed 3067
1d045db9 3068 /* ALC268 has no aa-loopback mixer */
3de95173
TI
3069 err = alc_alloc_spec(codec, 0);
3070 if (err < 0)
3071 return err;
3072
3073 spec = codec->spec;
2722b535
TI
3074 if (has_cdefine_beep(codec))
3075 spec->gen.beep_nid = 0x01;
1f0f4b80 3076
225068ab
TI
3077 spec->shutup = alc_eapd_shutup;
3078
c9af753f
TI
3079 alc_pre_init(codec);
3080
1727a771
TI
3081 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
3082 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
6e72aa5f 3083
6ebb8053
TI
3084 /* automatic parse from the BIOS config */
3085 err = alc268_parse_auto_config(codec);
e16fb6d1
TI
3086 if (err < 0)
3087 goto error;
f32610ed 3088
7504b6cd
TI
3089 if (err > 0 && !spec->gen.no_analog &&
3090 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
a5cb463a
TI
3091 for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
3092 if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
3093 &alc268_beep_mixer[i])) {
3094 err = -ENOMEM;
3095 goto error;
3096 }
3097 }
7504b6cd 3098 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
1d045db9
TI
3099 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
3100 /* override the amp caps for beep generator */
3101 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
3102 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
3103 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
3104 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
3105 (0 << AC_AMPCAP_MUTE_SHIFT));
2f893286
KY
3106 }
3107
1727a771 3108 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
6e72aa5f 3109
f32610ed 3110 return 0;
e16fb6d1
TI
3111
3112 error:
3113 alc_free(codec);
3114 return err;
f32610ed
JS
3115}
3116
bc9f98a9 3117/*
1d045db9 3118 * ALC269
bc9f98a9 3119 */
08c189f2 3120
1d045db9 3121static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
1d045db9 3122 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
bc9f98a9
KY
3123};
3124
1d045db9 3125static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
1d045db9 3126 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
bc9f98a9 3127};
291702f0 3128
1d045db9
TI
3129/* different alc269-variants */
3130enum {
3131 ALC269_TYPE_ALC269VA,
3132 ALC269_TYPE_ALC269VB,
3133 ALC269_TYPE_ALC269VC,
adcc70b2 3134 ALC269_TYPE_ALC269VD,
065380f0
KY
3135 ALC269_TYPE_ALC280,
3136 ALC269_TYPE_ALC282,
2af02be7 3137 ALC269_TYPE_ALC283,
065380f0 3138 ALC269_TYPE_ALC284,
4731d5de 3139 ALC269_TYPE_ALC293,
7fc7d047 3140 ALC269_TYPE_ALC286,
506b62c3 3141 ALC269_TYPE_ALC298,
1d04c9de 3142 ALC269_TYPE_ALC255,
4344aec8 3143 ALC269_TYPE_ALC256,
f429e7e4 3144 ALC269_TYPE_ALC257,
0a6f0600 3145 ALC269_TYPE_ALC215,
4231430d 3146 ALC269_TYPE_ALC225,
60571929 3147 ALC269_TYPE_ALC245,
99cee034 3148 ALC269_TYPE_ALC287,
dcd4f0db 3149 ALC269_TYPE_ALC294,
1078bef0 3150 ALC269_TYPE_ALC300,
f0778871 3151 ALC269_TYPE_ALC623,
6fbae35a 3152 ALC269_TYPE_ALC700,
bc9f98a9
KY
3153};
3154
3155/*
1d045db9 3156 * BIOS auto configuration
bc9f98a9 3157 */
1d045db9
TI
3158static int alc269_parse_auto_config(struct hda_codec *codec)
3159{
1d045db9 3160 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
3e6179b8
TI
3161 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
3162 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3163 struct alc_spec *spec = codec->spec;
adcc70b2
KY
3164 const hda_nid_t *ssids;
3165
3166 switch (spec->codec_variant) {
3167 case ALC269_TYPE_ALC269VA:
3168 case ALC269_TYPE_ALC269VC:
065380f0
KY
3169 case ALC269_TYPE_ALC280:
3170 case ALC269_TYPE_ALC284:
4731d5de 3171 case ALC269_TYPE_ALC293:
adcc70b2
KY
3172 ssids = alc269va_ssids;
3173 break;
3174 case ALC269_TYPE_ALC269VB:
3175 case ALC269_TYPE_ALC269VD:
065380f0 3176 case ALC269_TYPE_ALC282:
2af02be7 3177 case ALC269_TYPE_ALC283:
7fc7d047 3178 case ALC269_TYPE_ALC286:
506b62c3 3179 case ALC269_TYPE_ALC298:
1d04c9de 3180 case ALC269_TYPE_ALC255:
4344aec8 3181 case ALC269_TYPE_ALC256:
f429e7e4 3182 case ALC269_TYPE_ALC257:
0a6f0600 3183 case ALC269_TYPE_ALC215:
4231430d 3184 case ALC269_TYPE_ALC225:
60571929 3185 case ALC269_TYPE_ALC245:
99cee034 3186 case ALC269_TYPE_ALC287:
dcd4f0db 3187 case ALC269_TYPE_ALC294:
1078bef0 3188 case ALC269_TYPE_ALC300:
f0778871 3189 case ALC269_TYPE_ALC623:
6fbae35a 3190 case ALC269_TYPE_ALC700:
adcc70b2
KY
3191 ssids = alc269_ssids;
3192 break;
3193 default:
3194 ssids = alc269_ssids;
3195 break;
3196 }
bc9f98a9 3197
3e6179b8 3198 return alc_parse_auto_config(codec, alc269_ignore, ssids);
1d045db9 3199}
bc9f98a9 3200
476c02e0
HW
3201static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
3202 { SND_JACK_BTN_0, KEY_PLAYPAUSE },
3203 { SND_JACK_BTN_1, KEY_VOICECOMMAND },
3204 { SND_JACK_BTN_2, KEY_VOLUMEUP },
3205 { SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3206 {}
3207};
3208
3209static void alc_headset_btn_callback(struct hda_codec *codec,
3210 struct hda_jack_callback *jack)
3211{
3212 int report = 0;
3213
3214 if (jack->unsol_res & (7 << 13))
3215 report |= SND_JACK_BTN_0;
3216
3217 if (jack->unsol_res & (1 << 16 | 3 << 8))
3218 report |= SND_JACK_BTN_1;
3219
3220 /* Volume up key */
3221 if (jack->unsol_res & (7 << 23))
3222 report |= SND_JACK_BTN_2;
3223
3224 /* Volume down key */
3225 if (jack->unsol_res & (7 << 10))
3226 report |= SND_JACK_BTN_3;
3227
04f7791b 3228 snd_hda_jack_set_button_state(codec, jack->nid, report);
476c02e0
HW
3229}
3230
3231static void alc_disable_headset_jack_key(struct hda_codec *codec)
3232{
3233 struct alc_spec *spec = codec->spec;
3234
3235 if (!spec->has_hs_key)
3236 return;
3237
3238 switch (codec->core.vendor_id) {
3239 case 0x10ec0215:
3240 case 0x10ec0225:
3241 case 0x10ec0285:
c72b9bfe 3242 case 0x10ec0287:
476c02e0
HW
3243 case 0x10ec0295:
3244 case 0x10ec0289:
3245 case 0x10ec0299:
3246 alc_write_coef_idx(codec, 0x48, 0x0);
3247 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3248 alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3249 break;
1948fc06 3250 case 0x10ec0230:
476c02e0
HW
3251 case 0x10ec0236:
3252 case 0x10ec0256:
527f4643 3253 case 0x19e58326:
476c02e0
HW
3254 alc_write_coef_idx(codec, 0x48, 0x0);
3255 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3256 break;
3257 }
3258}
3259
3260static void alc_enable_headset_jack_key(struct hda_codec *codec)
3261{
3262 struct alc_spec *spec = codec->spec;
3263
3264 if (!spec->has_hs_key)
3265 return;
3266
3267 switch (codec->core.vendor_id) {
3268 case 0x10ec0215:
3269 case 0x10ec0225:
3270 case 0x10ec0285:
c72b9bfe 3271 case 0x10ec0287:
476c02e0
HW
3272 case 0x10ec0295:
3273 case 0x10ec0289:
3274 case 0x10ec0299:
3275 alc_write_coef_idx(codec, 0x48, 0xd011);
3276 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3277 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3278 break;
1948fc06 3279 case 0x10ec0230:
476c02e0
HW
3280 case 0x10ec0236:
3281 case 0x10ec0256:
527f4643 3282 case 0x19e58326:
476c02e0
HW
3283 alc_write_coef_idx(codec, 0x48, 0xd011);
3284 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3285 break;
3286 }
3287}
3288
3289static void alc_fixup_headset_jack(struct hda_codec *codec,
3290 const struct hda_fixup *fix, int action)
3291{
3292 struct alc_spec *spec = codec->spec;
04f7791b 3293 hda_nid_t hp_pin;
476c02e0
HW
3294
3295 switch (action) {
3296 case HDA_FIXUP_ACT_PRE_PROBE:
3297 spec->has_hs_key = 1;
3298 snd_hda_jack_detect_enable_callback(codec, 0x55,
3299 alc_headset_btn_callback);
476c02e0 3300 break;
04f7791b
HW
3301 case HDA_FIXUP_ACT_BUILD:
3302 hp_pin = alc_get_hp_pin(spec);
3303 if (!hp_pin || snd_hda_jack_bind_keymap(codec, 0x55,
3304 alc_headset_btn_keymap,
3305 hp_pin))
3306 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack",
3307 false, SND_JACK_HEADSET,
3308 alc_headset_btn_keymap);
3309
476c02e0
HW
3310 alc_enable_headset_jack_key(codec);
3311 break;
3312 }
3313}
3314
1387e2d1 3315static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
1d045db9 3316{
98b24883 3317 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
1d045db9 3318}
291702f0 3319
1d045db9
TI
3320static void alc269_shutup(struct hda_codec *codec)
3321{
adcc70b2
KY
3322 struct alc_spec *spec = codec->spec;
3323
1387e2d1
KY
3324 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3325 alc269vb_toggle_power_output(codec, 0);
3326 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3327 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
1d045db9
TI
3328 msleep(150);
3329 }
c0ca5ece 3330 alc_shutup_pins(codec);
1d045db9 3331}
291702f0 3332
6b0f95c4 3333static const struct coef_fw alc282_coefs[] = {
54db6c39 3334 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
32fa7e49 3335 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
54db6c39
TI
3336 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3337 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3338 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3339 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3340 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3341 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3342 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3343 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3344 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3345 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3346 WRITE_COEF(0x34, 0xa0c0), /* ANC */
3347 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3348 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3349 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3350 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3351 WRITE_COEF(0x63, 0x2902), /* PLL */
3352 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3353 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3354 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3355 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3356 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3357 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3358 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3359 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3360 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3361 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3362 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3363 {}
3364};
3365
cb149cb3
KY
3366static void alc282_restore_default_value(struct hda_codec *codec)
3367{
54db6c39 3368 alc_process_coef_fw(codec, alc282_coefs);
cb149cb3
KY
3369}
3370
7b5c7a02
KY
3371static void alc282_init(struct hda_codec *codec)
3372{
3373 struct alc_spec *spec = codec->spec;
35a39f98 3374 hda_nid_t hp_pin = alc_get_hp_pin(spec);
7b5c7a02
KY
3375 bool hp_pin_sense;
3376 int coef78;
3377
cb149cb3
KY
3378 alc282_restore_default_value(codec);
3379
7b5c7a02
KY
3380 if (!hp_pin)
3381 return;
3382 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3383 coef78 = alc_read_coef_idx(codec, 0x78);
3384
3385 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3386 /* Headphone capless set to high power mode */
3387 alc_write_coef_idx(codec, 0x78, 0x9004);
3388
3389 if (hp_pin_sense)
3390 msleep(2);
3391
3392 snd_hda_codec_write(codec, hp_pin, 0,
3393 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3394
3395 if (hp_pin_sense)
3396 msleep(85);
3397
3398 snd_hda_codec_write(codec, hp_pin, 0,
3399 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3400
3401 if (hp_pin_sense)
3402 msleep(100);
3403
3404 /* Headphone capless set to normal mode */
3405 alc_write_coef_idx(codec, 0x78, coef78);
3406}
3407
3408static void alc282_shutup(struct hda_codec *codec)
3409{
3410 struct alc_spec *spec = codec->spec;
35a39f98 3411 hda_nid_t hp_pin = alc_get_hp_pin(spec);
7b5c7a02
KY
3412 bool hp_pin_sense;
3413 int coef78;
3414
3415 if (!hp_pin) {
3416 alc269_shutup(codec);
3417 return;
3418 }
3419
3420 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3421 coef78 = alc_read_coef_idx(codec, 0x78);
3422 alc_write_coef_idx(codec, 0x78, 0x9004);
3423
3424 if (hp_pin_sense)
3425 msleep(2);
3426
3427 snd_hda_codec_write(codec, hp_pin, 0,
3428 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3429
3430 if (hp_pin_sense)
3431 msleep(85);
3432
c0ca5ece
TI
3433 if (!spec->no_shutup_pins)
3434 snd_hda_codec_write(codec, hp_pin, 0,
3435 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
7b5c7a02
KY
3436
3437 if (hp_pin_sense)
3438 msleep(100);
3439
3440 alc_auto_setup_eapd(codec, false);
c0ca5ece 3441 alc_shutup_pins(codec);
7b5c7a02
KY
3442 alc_write_coef_idx(codec, 0x78, coef78);
3443}
3444
6b0f95c4 3445static const struct coef_fw alc283_coefs[] = {
54db6c39 3446 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
56779864 3447 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
54db6c39
TI
3448 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3449 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3450 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3451 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3452 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3453 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3454 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3455 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3456 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3457 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3458 WRITE_COEF(0x22, 0xa0c0), /* ANC */
3459 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3460 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3461 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3462 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3463 WRITE_COEF(0x2e, 0x2902), /* PLL */
3464 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3465 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3466 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3467 WRITE_COEF(0x36, 0x0), /* capless control 5 */
3468 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3469 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3470 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3471 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3472 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3473 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3474 WRITE_COEF(0x49, 0x0), /* test mode */
3475 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3476 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3477 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
56779864 3478 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
54db6c39
TI
3479 {}
3480};
3481
6bd55b04
KY
3482static void alc283_restore_default_value(struct hda_codec *codec)
3483{
54db6c39 3484 alc_process_coef_fw(codec, alc283_coefs);
6bd55b04
KY
3485}
3486
2af02be7
KY
3487static void alc283_init(struct hda_codec *codec)
3488{
3489 struct alc_spec *spec = codec->spec;
35a39f98 3490 hda_nid_t hp_pin = alc_get_hp_pin(spec);
2af02be7 3491 bool hp_pin_sense;
2af02be7 3492
6bd55b04
KY
3493 alc283_restore_default_value(codec);
3494
2af02be7
KY
3495 if (!hp_pin)
3496 return;
a59d7199
KY
3497
3498 msleep(30);
2af02be7
KY
3499 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3500
3501 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3502 /* Headphone capless set to high power mode */
3503 alc_write_coef_idx(codec, 0x43, 0x9004);
3504
3505 snd_hda_codec_write(codec, hp_pin, 0,
3506 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3507
3508 if (hp_pin_sense)
3509 msleep(85);
3510
3511 snd_hda_codec_write(codec, hp_pin, 0,
3512 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3513
3514 if (hp_pin_sense)
3515 msleep(85);
3516 /* Index 0x46 Combo jack auto switch control 2 */
3517 /* 3k pull low control for Headset jack. */
98b24883 3518 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
2af02be7
KY
3519 /* Headphone capless set to normal mode */
3520 alc_write_coef_idx(codec, 0x43, 0x9614);
3521}
3522
3523static void alc283_shutup(struct hda_codec *codec)
3524{
3525 struct alc_spec *spec = codec->spec;
35a39f98 3526 hda_nid_t hp_pin = alc_get_hp_pin(spec);
2af02be7 3527 bool hp_pin_sense;
2af02be7
KY
3528
3529 if (!hp_pin) {
3530 alc269_shutup(codec);
3531 return;
3532 }
3533
3534 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3535
3536 alc_write_coef_idx(codec, 0x43, 0x9004);
3537
b450b17c
HP
3538 /*depop hp during suspend*/
3539 alc_write_coef_idx(codec, 0x06, 0x2100);
3540
2af02be7
KY
3541 snd_hda_codec_write(codec, hp_pin, 0,
3542 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3543
3544 if (hp_pin_sense)
88011c09 3545 msleep(100);
2af02be7 3546
c0ca5ece
TI
3547 if (!spec->no_shutup_pins)
3548 snd_hda_codec_write(codec, hp_pin, 0,
3549 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
2af02be7 3550
98b24883 3551 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
2af02be7
KY
3552
3553 if (hp_pin_sense)
88011c09 3554 msleep(100);
0435b3ff 3555 alc_auto_setup_eapd(codec, false);
c0ca5ece 3556 alc_shutup_pins(codec);
2af02be7
KY
3557 alc_write_coef_idx(codec, 0x43, 0x9614);
3558}
3559
4a219ef8
KY
3560static void alc256_init(struct hda_codec *codec)
3561{
3562 struct alc_spec *spec = codec->spec;
35a39f98 3563 hda_nid_t hp_pin = alc_get_hp_pin(spec);
4a219ef8
KY
3564 bool hp_pin_sense;
3565
3566 if (!hp_pin)
6447c962 3567 hp_pin = 0x21;
4a219ef8
KY
3568
3569 msleep(30);
3570
3571 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3572
3573 if (hp_pin_sense)
3574 msleep(2);
3575
3576 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
6447c962
KY
3577 if (spec->ultra_low_power) {
3578 alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3579 alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3580 alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3581 alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3582 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3583 msleep(30);
3584 }
4a219ef8
KY
3585
3586 snd_hda_codec_write(codec, hp_pin, 0,
3587 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3588
6447c962 3589 if (hp_pin_sense || spec->ultra_low_power)
4a219ef8
KY
3590 msleep(85);
3591
3592 snd_hda_codec_write(codec, hp_pin, 0,
3593 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3594
6447c962 3595 if (hp_pin_sense || spec->ultra_low_power)
4a219ef8
KY
3596 msleep(100);
3597
3598 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3599 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
88d42b2b
KY
3600 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3601 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
c4473744
TH
3602 /*
3603 * Expose headphone mic (or possibly Line In on some machines) instead
3604 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3605 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3606 * this register.
3607 */
3608 alc_write_coef_idx(codec, 0x36, 0x5757);
4a219ef8
KY
3609}
3610
3611static void alc256_shutup(struct hda_codec *codec)
3612{
3613 struct alc_spec *spec = codec->spec;
35a39f98 3614 hda_nid_t hp_pin = alc_get_hp_pin(spec);
4a219ef8
KY
3615 bool hp_pin_sense;
3616
6447c962
KY
3617 if (!hp_pin)
3618 hp_pin = 0x21;
4a219ef8
KY
3619
3620 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3621
3622 if (hp_pin_sense)
3623 msleep(2);
3624
3625 snd_hda_codec_write(codec, hp_pin, 0,
3626 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3627
6447c962 3628 if (hp_pin_sense || spec->ultra_low_power)
4a219ef8
KY
3629 msleep(85);
3630
1c9609e3
TI
3631 /* 3k pull low control for Headset jack. */
3632 /* NOTE: call this before clearing the pin, otherwise codec stalls */
3f742490
HW
3633 /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
3634 * when booting with headset plugged. So skip setting it for the codec alc257
3635 */
f30741cd
KHF
3636 if (codec->core.vendor_id != 0x10ec0236 &&
3637 codec->core.vendor_id != 0x10ec0257)
3f742490 3638 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
1c9609e3 3639
c0ca5ece
TI
3640 if (!spec->no_shutup_pins)
3641 snd_hda_codec_write(codec, hp_pin, 0,
3642 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4a219ef8 3643
6447c962 3644 if (hp_pin_sense || spec->ultra_low_power)
4a219ef8
KY
3645 msleep(100);
3646
3647 alc_auto_setup_eapd(codec, false);
c0ca5ece 3648 alc_shutup_pins(codec);
6447c962
KY
3649 if (spec->ultra_low_power) {
3650 msleep(50);
3651 alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3652 alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3653 alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3654 alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3655 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3656 msleep(30);
3657 }
4a219ef8
KY
3658}
3659
3c24e483
KY
3660static void alc285_hp_init(struct hda_codec *codec)
3661{
3662 struct alc_spec *spec = codec->spec;
3663 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3664 int i, val;
3665 int coef38, coef0d, coef36;
3666
3667 alc_update_coef_idx(codec, 0x4a, 1<<15, 1<<15); /* Reset HP JD */
3668 coef38 = alc_read_coef_idx(codec, 0x38); /* Amp control */
3669 coef0d = alc_read_coef_idx(codec, 0x0d); /* Digital Misc control */
3670 coef36 = alc_read_coef_idx(codec, 0x36); /* Passthrough Control */
3671 alc_update_coef_idx(codec, 0x38, 1<<4, 0x0);
3672 alc_update_coef_idx(codec, 0x0d, 0x110, 0x0);
3673
3674 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
3675
3676 if (hp_pin)
3677 snd_hda_codec_write(codec, hp_pin, 0,
3678 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3679
3680 msleep(130);
3681 alc_update_coef_idx(codec, 0x36, 1<<14, 1<<14);
3682 alc_update_coef_idx(codec, 0x36, 1<<13, 0x0);
3683
3684 if (hp_pin)
3685 snd_hda_codec_write(codec, hp_pin, 0,
3686 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3687 msleep(10);
3688 alc_write_coef_idx(codec, 0x67, 0x0); /* Set HP depop to manual mode */
3689 alc_write_coefex_idx(codec, 0x58, 0x00, 0x7880);
3690 alc_write_coefex_idx(codec, 0x58, 0x0f, 0xf049);
3691 alc_update_coefex_idx(codec, 0x58, 0x03, 0x00f0, 0x00c0);
3692
3693 alc_write_coefex_idx(codec, 0x58, 0x00, 0xf888); /* HP depop procedure start */
3694 val = alc_read_coefex_idx(codec, 0x58, 0x00);
3695 for (i = 0; i < 20 && val & 0x8000; i++) {
3696 msleep(50);
3697 val = alc_read_coefex_idx(codec, 0x58, 0x00);
3698 } /* Wait for depop procedure finish */
3699
3700 alc_write_coefex_idx(codec, 0x58, 0x00, val); /* write back the result */
3701 alc_update_coef_idx(codec, 0x38, 1<<4, coef38);
3702 alc_update_coef_idx(codec, 0x0d, 0x110, coef0d);
3703 alc_update_coef_idx(codec, 0x36, 3<<13, coef36);
3704
3705 msleep(50);
3706 alc_update_coef_idx(codec, 0x4a, 1<<15, 0);
3707}
3708
da911b1f
KY
3709static void alc225_init(struct hda_codec *codec)
3710{
3711 struct alc_spec *spec = codec->spec;
35a39f98 3712 hda_nid_t hp_pin = alc_get_hp_pin(spec);
da911b1f
KY
3713 bool hp1_pin_sense, hp2_pin_sense;
3714
60571929
KY
3715 if (spec->codec_variant != ALC269_TYPE_ALC287 &&
3716 spec->codec_variant != ALC269_TYPE_ALC245)
3c24e483
KY
3717 /* required only at boot or S3 and S4 resume time */
3718 if (!spec->done_hp_init ||
3719 is_s3_resume(codec) ||
3720 is_s4_resume(codec)) {
3721 alc285_hp_init(codec);
3722 spec->done_hp_init = true;
3723 }
3724
da911b1f 3725 if (!hp_pin)
d3ba58bb 3726 hp_pin = 0x21;
da911b1f
KY
3727 msleep(30);
3728
3729 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3730 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3731
3732 if (hp1_pin_sense || hp2_pin_sense)
3733 msleep(2);
3734
3735 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
d3ba58bb
KY
3736 if (spec->ultra_low_power) {
3737 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3738 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3739 alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3740 msleep(30);
3741 }
da911b1f 3742
d3ba58bb 3743 if (hp1_pin_sense || spec->ultra_low_power)
da911b1f
KY
3744 snd_hda_codec_write(codec, hp_pin, 0,
3745 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3746 if (hp2_pin_sense)
3747 snd_hda_codec_write(codec, 0x16, 0,
3748 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3749
d3ba58bb 3750 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
da911b1f
KY
3751 msleep(85);
3752
d3ba58bb 3753 if (hp1_pin_sense || spec->ultra_low_power)
da911b1f
KY
3754 snd_hda_codec_write(codec, hp_pin, 0,
3755 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3756 if (hp2_pin_sense)
3757 snd_hda_codec_write(codec, 0x16, 0,
3758 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3759
d3ba58bb 3760 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
da911b1f
KY
3761 msleep(100);
3762
3763 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3764 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3765}
3766
3767static void alc225_shutup(struct hda_codec *codec)
3768{
3769 struct alc_spec *spec = codec->spec;
35a39f98 3770 hda_nid_t hp_pin = alc_get_hp_pin(spec);
da911b1f
KY
3771 bool hp1_pin_sense, hp2_pin_sense;
3772
d3ba58bb
KY
3773 if (!hp_pin)
3774 hp_pin = 0x21;
476c02e0
HW
3775
3776 alc_disable_headset_jack_key(codec);
da911b1f
KY
3777 /* 3k pull low control for Headset jack. */
3778 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3779
3780 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3781 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3782
3783 if (hp1_pin_sense || hp2_pin_sense)
3784 msleep(2);
3785
d3ba58bb 3786 if (hp1_pin_sense || spec->ultra_low_power)
da911b1f
KY
3787 snd_hda_codec_write(codec, hp_pin, 0,
3788 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3789 if (hp2_pin_sense)
3790 snd_hda_codec_write(codec, 0x16, 0,
3791 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3792
d3ba58bb 3793 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
da911b1f
KY
3794 msleep(85);
3795
d3ba58bb 3796 if (hp1_pin_sense || spec->ultra_low_power)
da911b1f
KY
3797 snd_hda_codec_write(codec, hp_pin, 0,
3798 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3799 if (hp2_pin_sense)
3800 snd_hda_codec_write(codec, 0x16, 0,
3801 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3802
d3ba58bb 3803 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
da911b1f
KY
3804 msleep(100);
3805
3806 alc_auto_setup_eapd(codec, false);
c0ca5ece 3807 alc_shutup_pins(codec);
d3ba58bb
KY
3808 if (spec->ultra_low_power) {
3809 msleep(50);
3810 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3811 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3812 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3813 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3814 msleep(30);
3815 }
476c02e0
HW
3816
3817 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3818 alc_enable_headset_jack_key(codec);
da911b1f
KY
3819}
3820
c2d6af53
KY
3821static void alc_default_init(struct hda_codec *codec)
3822{
3823 struct alc_spec *spec = codec->spec;
35a39f98 3824 hda_nid_t hp_pin = alc_get_hp_pin(spec);
c2d6af53
KY
3825 bool hp_pin_sense;
3826
3827 if (!hp_pin)
3828 return;
3829
3830 msleep(30);
3831
3832 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3833
3834 if (hp_pin_sense)
3835 msleep(2);
3836
3837 snd_hda_codec_write(codec, hp_pin, 0,
3838 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3839
3840 if (hp_pin_sense)
3841 msleep(85);
3842
3843 snd_hda_codec_write(codec, hp_pin, 0,
3844 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3845
3846 if (hp_pin_sense)
3847 msleep(100);
3848}
3849
3850static void alc_default_shutup(struct hda_codec *codec)
3851{
3852 struct alc_spec *spec = codec->spec;
35a39f98 3853 hda_nid_t hp_pin = alc_get_hp_pin(spec);
c2d6af53
KY
3854 bool hp_pin_sense;
3855
3856 if (!hp_pin) {
3857 alc269_shutup(codec);
3858 return;
3859 }
3860
3861 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3862
3863 if (hp_pin_sense)
3864 msleep(2);
3865
3866 snd_hda_codec_write(codec, hp_pin, 0,
3867 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3868
3869 if (hp_pin_sense)
3870 msleep(85);
3871
c0ca5ece
TI
3872 if (!spec->no_shutup_pins)
3873 snd_hda_codec_write(codec, hp_pin, 0,
3874 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
c2d6af53
KY
3875
3876 if (hp_pin_sense)
3877 msleep(100);
3878
3879 alc_auto_setup_eapd(codec, false);
c0ca5ece 3880 alc_shutup_pins(codec);
c2d6af53
KY
3881}
3882
693abe11
KY
3883static void alc294_hp_init(struct hda_codec *codec)
3884{
3885 struct alc_spec *spec = codec->spec;
35a39f98 3886 hda_nid_t hp_pin = alc_get_hp_pin(spec);
693abe11
KY
3887 int i, val;
3888
3889 if (!hp_pin)
3890 return;
3891
3892 snd_hda_codec_write(codec, hp_pin, 0,
3893 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3894
3895 msleep(100);
3896
c0ca5ece
TI
3897 if (!spec->no_shutup_pins)
3898 snd_hda_codec_write(codec, hp_pin, 0,
3899 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
693abe11
KY
3900
3901 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3902 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3903
3904 /* Wait for depop procedure finish */
3905 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3906 for (i = 0; i < 20 && val & 0x0080; i++) {
3907 msleep(50);
3908 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3909 }
3910 /* Set HP depop to auto mode */
3911 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3912 msleep(50);
3913}
3914
3915static void alc294_init(struct hda_codec *codec)
3916{
3917 struct alc_spec *spec = codec->spec;
3918
f6ef4e0e
TI
3919 /* required only at boot or S4 resume time */
3920 if (!spec->done_hp_init ||
3921 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
693abe11
KY
3922 alc294_hp_init(codec);
3923 spec->done_hp_init = true;
3924 }
3925 alc_default_init(codec);
3926}
3927
ad60d502
KY
3928static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3929 unsigned int val)
3930{
3931 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3932 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3933 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3934}
3935
3936static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3937{
3938 unsigned int val;
3939
3940 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3941 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3942 & 0xffff;
3943 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3944 << 16;
3945 return val;
3946}
3947
3948static void alc5505_dsp_halt(struct hda_codec *codec)
3949{
3950 unsigned int val;
3951
3952 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3953 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3954 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3955 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3956 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3957 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3958 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3959 val = alc5505_coef_get(codec, 0x6220);
3960 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3961}
3962
3963static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3964{
3965 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3966 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3967 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3968 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3969 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3970 alc5505_coef_set(codec, 0x880c, 0x00000004);
3971}
3972
3973static void alc5505_dsp_init(struct hda_codec *codec)
3974{
3975 unsigned int val;
3976
3977 alc5505_dsp_halt(codec);
3978 alc5505_dsp_back_from_halt(codec);
3979 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3980 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3981 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3982 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3983 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3984 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3985 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3986 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3987 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3988 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3989 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3990 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3991 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3992
3993 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3994 if (val <= 3)
3995 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3996 else
3997 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3998
3999 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
4000 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
4001 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
4002 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
4003 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
4004 alc5505_coef_set(codec, 0x880c, 0x00000003);
4005 alc5505_coef_set(codec, 0x880c, 0x00000010);
cd63a5ff
TI
4006
4007#ifdef HALT_REALTEK_ALC5505
4008 alc5505_dsp_halt(codec);
4009#endif
ad60d502
KY
4010}
4011
cd63a5ff 4012#ifdef HALT_REALTEK_ALC5505
8a71821f
PLB
4013#define alc5505_dsp_suspend(codec) do { } while (0) /* NOP */
4014#define alc5505_dsp_resume(codec) do { } while (0) /* NOP */
cd63a5ff
TI
4015#else
4016#define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
4017#define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
4018#endif
4019
2a43952a 4020#ifdef CONFIG_PM
ad60d502
KY
4021static int alc269_suspend(struct hda_codec *codec)
4022{
4023 struct alc_spec *spec = codec->spec;
1873ebd3 4024 int i;
ad60d502
KY
4025
4026 if (spec->has_alc5505_dsp)
cd63a5ff 4027 alc5505_dsp_suspend(codec);
1873ebd3
SB
4028
4029 for (i = 0; i < HDA_MAX_COMPONENTS; i++)
4030 if (spec->comps[i].suspend_hook)
4031 spec->comps[i].suspend_hook(spec->comps[i].dev);
4032
ad60d502
KY
4033 return alc_suspend(codec);
4034}
4035
1d045db9
TI
4036static int alc269_resume(struct hda_codec *codec)
4037{
adcc70b2 4038 struct alc_spec *spec = codec->spec;
1873ebd3 4039 int i;
adcc70b2 4040
1387e2d1
KY
4041 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4042 alc269vb_toggle_power_output(codec, 0);
4043 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
adcc70b2 4044 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
1d045db9
TI
4045 msleep(150);
4046 }
8c427226 4047
1d045db9 4048 codec->patch_ops.init(codec);
f1d4e28b 4049
1387e2d1
KY
4050 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4051 alc269vb_toggle_power_output(codec, 1);
4052 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
adcc70b2 4053 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
1d045db9
TI
4054 msleep(200);
4055 }
f1d4e28b 4056
1a462be5 4057 snd_hda_regmap_sync(codec);
1d045db9 4058 hda_call_check_power_status(codec, 0x01);
f475371a
HW
4059
4060 /* on some machine, the BIOS will clear the codec gpio data when enter
4061 * suspend, and won't restore the data after resume, so we restore it
4062 * in the driver.
4063 */
d261eec8
TI
4064 if (spec->gpio_data)
4065 alc_write_gpio_data(codec);
f475371a 4066
ad60d502 4067 if (spec->has_alc5505_dsp)
cd63a5ff 4068 alc5505_dsp_resume(codec);
c5177c86 4069
1873ebd3
SB
4070 for (i = 0; i < HDA_MAX_COMPONENTS; i++)
4071 if (spec->comps[i].resume_hook)
4072 spec->comps[i].resume_hook(spec->comps[i].dev);
4073
1d045db9
TI
4074 return 0;
4075}
2a43952a 4076#endif /* CONFIG_PM */
f1d4e28b 4077
108cc108 4078static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
1727a771 4079 const struct hda_fixup *fix, int action)
108cc108
DH
4080{
4081 struct alc_spec *spec = codec->spec;
4082
1727a771 4083 if (action == HDA_FIXUP_ACT_PRE_PROBE)
108cc108
DH
4084 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
4085}
4086
fdcc968a
JMG
4087static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
4088 const struct hda_fixup *fix,
4089 int action)
4090{
4091 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
4092 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
4093
4094 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
4095 snd_hda_codec_set_pincfg(codec, 0x19,
4096 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
4097 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
4098}
4099
1d045db9 4100static void alc269_fixup_hweq(struct hda_codec *codec,
1727a771 4101 const struct hda_fixup *fix, int action)
1d045db9 4102{
98b24883
TI
4103 if (action == HDA_FIXUP_ACT_INIT)
4104 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
1d045db9 4105}
f1d4e28b 4106
7c478f03
DH
4107static void alc269_fixup_headset_mic(struct hda_codec *codec,
4108 const struct hda_fixup *fix, int action)
4109{
4110 struct alc_spec *spec = codec->spec;
4111
4112 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4113 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4114}
4115
1d045db9 4116static void alc271_fixup_dmic(struct hda_codec *codec,
1727a771 4117 const struct hda_fixup *fix, int action)
1d045db9
TI
4118{
4119 static const struct hda_verb verbs[] = {
4120 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
4121 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
4122 {}
4123 };
4124 unsigned int cfg;
f1d4e28b 4125
7639a06c
TI
4126 if (strcmp(codec->core.chip_name, "ALC271X") &&
4127 strcmp(codec->core.chip_name, "ALC269VB"))
1d045db9
TI
4128 return;
4129 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
4130 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
4131 snd_hda_sequence_write(codec, verbs);
4132}
f1d4e28b 4133
c8426b27
TI
4134/* Fix the speaker amp after resume, etc */
4135static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec,
4136 const struct hda_fixup *fix,
4137 int action)
4138{
4139 if (action == HDA_FIXUP_ACT_INIT)
4140 alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000);
4141}
4142
017f2a10 4143static void alc269_fixup_pcm_44k(struct hda_codec *codec,
1727a771 4144 const struct hda_fixup *fix, int action)
017f2a10
TI
4145{
4146 struct alc_spec *spec = codec->spec;
4147
1727a771 4148 if (action != HDA_FIXUP_ACT_PROBE)
017f2a10
TI
4149 return;
4150
4151 /* Due to a hardware problem on Lenovo Ideadpad, we need to
4152 * fix the sample rate of analog I/O to 44.1kHz
4153 */
08c189f2
TI
4154 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
4155 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
017f2a10
TI
4156}
4157
adabb3ec 4158static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
1727a771 4159 const struct hda_fixup *fix, int action)
adabb3ec 4160{
adabb3ec
TI
4161 /* The digital-mic unit sends PDM (differential signal) instead of
4162 * the standard PCM, thus you can't record a valid mono stream as is.
4163 * Below is a workaround specific to ALC269 to control the dmic
4164 * signal source as mono.
4165 */
98b24883
TI
4166 if (action == HDA_FIXUP_ACT_INIT)
4167 alc_update_coef_idx(codec, 0x07, 0, 0x80);
adabb3ec
TI
4168}
4169
24519911
TI
4170static void alc269_quanta_automute(struct hda_codec *codec)
4171{
08c189f2 4172 snd_hda_gen_update_outputs(codec);
24519911 4173
1687ccc8
TI
4174 alc_write_coef_idx(codec, 0x0c, 0x680);
4175 alc_write_coef_idx(codec, 0x0c, 0x480);
24519911
TI
4176}
4177
4178static void alc269_fixup_quanta_mute(struct hda_codec *codec,
1727a771 4179 const struct hda_fixup *fix, int action)
24519911
TI
4180{
4181 struct alc_spec *spec = codec->spec;
1727a771 4182 if (action != HDA_FIXUP_ACT_PROBE)
24519911 4183 return;
08c189f2 4184 spec->gen.automute_hook = alc269_quanta_automute;
24519911
TI
4185}
4186
d240d1dc 4187static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
1a4f69d5 4188 struct hda_jack_callback *jack)
d240d1dc
DH
4189{
4190 struct alc_spec *spec = codec->spec;
4191 int vref;
4192 msleep(200);
4193 snd_hda_gen_hp_automute(codec, jack);
4194
4195 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4196 msleep(100);
4197 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4198 vref);
4199 msleep(500);
4200 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4201 vref);
4202}
4203
a2ef03fe
TE
4204/*
4205 * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
4206 */
4207struct hda_alc298_mbxinit {
4208 unsigned char value_0x23;
4209 unsigned char value_0x25;
4210};
4211
4212static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
4213 const struct hda_alc298_mbxinit *initval,
4214 bool first)
4215{
4216 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
4217 alc_write_coef_idx(codec, 0x26, 0xb000);
4218
4219 if (first)
4220 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
4221
4222 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4223 alc_write_coef_idx(codec, 0x26, 0xf000);
4224 alc_write_coef_idx(codec, 0x23, initval->value_0x23);
4225
4226 if (initval->value_0x23 != 0x1e)
4227 alc_write_coef_idx(codec, 0x25, initval->value_0x25);
4228
4229 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4230 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4231}
4232
4233static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
4234 const struct hda_fixup *fix,
4235 int action)
4236{
4237 /* Initialization magic */
4238 static const struct hda_alc298_mbxinit dac_init[] = {
4239 {0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
4240 {0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
4241 {0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
4242 {0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
4243 {0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
4244 {0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
4245 {0x2f, 0x00},
4246 {0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
4247 {0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
4248 {0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
4249 {}
4250 };
4251 const struct hda_alc298_mbxinit *seq;
4252
4253 if (action != HDA_FIXUP_ACT_INIT)
4254 return;
4255
4256 /* Start */
4257 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4258 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4259 alc_write_coef_idx(codec, 0x26, 0xf000);
4260 alc_write_coef_idx(codec, 0x22, 0x31);
4261 alc_write_coef_idx(codec, 0x23, 0x0b);
4262 alc_write_coef_idx(codec, 0x25, 0x00);
4263 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4264 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4265
4266 for (seq = dac_init; seq->value_0x23; seq++)
4267 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4268}
4269
d240d1dc
DH
4270static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4271 const struct hda_fixup *fix, int action)
4272{
4273 struct alc_spec *spec = codec->spec;
4274 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4275 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4276 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
4277 }
4278}
4279
766538ac
TI
4280static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4281 bool polarity, bool on)
4282{
4283 unsigned int pinval;
4284
4285 if (!pin)
4286 return;
4287 if (polarity)
4288 on = !on;
4289 pinval = snd_hda_codec_get_pin_target(codec, pin);
4290 pinval &= ~AC_PINCTL_VREFEN;
4291 pinval |= on ? AC_PINCTL_VREF_80 : AC_PINCTL_VREF_HIZ;
4292 /* temporarily power up/down for setting VREF */
4293 snd_hda_power_up_pm(codec);
4294 snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4295 snd_hda_power_down_pm(codec);
4296}
d240d1dc 4297
08fb0d0e 4298/* update mute-LED according to the speaker mute state via mic VREF pin */
8d3d1ece
TI
4299static int vref_mute_led_set(struct led_classdev *led_cdev,
4300 enum led_brightness brightness)
6d3cd5d4 4301{
8d3d1ece 4302 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
08fb0d0e 4303 struct alc_spec *spec = codec->spec;
08fb0d0e 4304
766538ac
TI
4305 alc_update_vref_led(codec, spec->mute_led_nid,
4306 spec->mute_led_polarity, brightness);
8d3d1ece 4307 return 0;
6d3cd5d4
DH
4308}
4309
d5b6b65e
DH
4310/* Make sure the led works even in runtime suspend */
4311static unsigned int led_power_filter(struct hda_codec *codec,
4312 hda_nid_t nid,
4313 unsigned int power_state)
4314{
4315 struct alc_spec *spec = codec->spec;
4316
50dd9050
HW
4317 if (power_state != AC_PWRST_D3 || nid == 0 ||
4318 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
d5b6b65e
DH
4319 return power_state;
4320
4321 /* Set pin ctl again, it might have just been set to 0 */
4322 snd_hda_set_pin_ctl(codec, nid,
4323 snd_hda_codec_get_pin_target(codec, nid));
4324
cffd3966 4325 return snd_hda_gen_path_power_filter(codec, nid, power_state);
d5b6b65e
DH
4326}
4327
08fb0d0e
TI
4328static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4329 const struct hda_fixup *fix, int action)
6d3cd5d4
DH
4330{
4331 struct alc_spec *spec = codec->spec;
08fb0d0e
TI
4332 const struct dmi_device *dev = NULL;
4333
4334 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4335 return;
4336
4337 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4338 int pol, pin;
4339 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4340 continue;
4341 if (pin < 0x0a || pin >= 0x10)
4342 break;
4343 spec->mute_led_polarity = pol;
4344 spec->mute_led_nid = pin - 0x0a + 0x18;
8d3d1ece 4345 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
d5b6b65e 4346 codec->power_filter = led_power_filter;
4e76a883
TI
4347 codec_dbg(codec,
4348 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
08fb0d0e 4349 spec->mute_led_polarity);
6d3cd5d4
DH
4350 break;
4351 }
4352}
4353
85c467dc
TI
4354static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4355 const struct hda_fixup *fix,
4356 int action, hda_nid_t pin)
d06ac143
DH
4357{
4358 struct alc_spec *spec = codec->spec;
85c467dc 4359
d06ac143
DH
4360 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4361 spec->mute_led_polarity = 0;
85c467dc 4362 spec->mute_led_nid = pin;
8d3d1ece 4363 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
d5b6b65e 4364 codec->power_filter = led_power_filter;
d06ac143
DH
4365 }
4366}
4367
85c467dc
TI
4368static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4369 const struct hda_fixup *fix, int action)
4370{
4371 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4372}
4373
08fb0d0e
TI
4374static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4375 const struct hda_fixup *fix, int action)
420b0feb 4376{
85c467dc 4377 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
420b0feb
TI
4378}
4379
7f783bd5
TB
4380static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4381 const struct hda_fixup *fix, int action)
4382{
85c467dc 4383 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
7f783bd5
TB
4384}
4385
0f32fd19
TI
4386/* update LED status via GPIO */
4387static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
dbd13179 4388 int polarity, bool enabled)
9f5c6faf 4389{
dbd13179 4390 if (polarity)
0f32fd19 4391 enabled = !enabled;
d261eec8 4392 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
9f5c6faf
TI
4393}
4394
0f32fd19 4395/* turn on/off mute LED via GPIO per vmaster hook */
8d3d1ece
TI
4396static int gpio_mute_led_set(struct led_classdev *led_cdev,
4397 enum led_brightness brightness)
9f5c6faf 4398{
8d3d1ece 4399 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
9f5c6faf 4400 struct alc_spec *spec = codec->spec;
9f5c6faf 4401
dbd13179 4402 alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
8d3d1ece
TI
4403 spec->mute_led_polarity, !brightness);
4404 return 0;
0f32fd19 4405}
9f5c6faf 4406
0f32fd19 4407/* turn on/off mic-mute LED via GPIO per capture hook */
87dc3648
KHF
4408static int micmute_led_set(struct led_classdev *led_cdev,
4409 enum led_brightness brightness)
4410{
4411 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4412 struct alc_spec *spec = codec->spec;
4413
4414 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
40469064 4415 spec->micmute_led_polarity, !brightness);
87dc3648
KHF
4416 return 0;
4417}
4418
01e4a275
TI
4419/* setup mute and mic-mute GPIO bits, add hooks appropriately */
4420static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4421 int action,
4422 unsigned int mute_mask,
4423 unsigned int micmute_mask)
9f5c6faf
TI
4424{
4425 struct alc_spec *spec = codec->spec;
9f5c6faf 4426
01e4a275
TI
4427 alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4428
4429 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4430 return;
4431 if (mute_mask) {
4432 spec->gpio_mute_led_mask = mute_mask;
8d3d1ece 4433 snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
01e4a275
TI
4434 }
4435 if (micmute_mask) {
4436 spec->gpio_mic_led_mask = micmute_mask;
7cdf8c49 4437 snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
9f5c6faf
TI
4438 }
4439}
4440
e7d66cf7
JS
4441static void alc236_fixup_hp_gpio_led(struct hda_codec *codec,
4442 const struct hda_fixup *fix, int action)
4443{
4444 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01);
4445}
4446
01e4a275 4447static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
eaa8e5ef
KY
4448 const struct hda_fixup *fix, int action)
4449{
01e4a275
TI
4450 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4451}
eaa8e5ef 4452
f5a88b0a
KHF
4453static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4454 const struct hda_fixup *fix, int action)
4455{
3e0650ab 4456 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
f5a88b0a
KHF
4457}
4458
01e4a275
TI
4459static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4460 const struct hda_fixup *fix, int action)
4461{
4462 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
9f5c6faf
TI
4463}
4464
a0ccbc53
KY
4465static void alc287_fixup_hp_gpio_led(struct hda_codec *codec,
4466 const struct hda_fixup *fix, int action)
4467{
4468 alc_fixup_hp_gpio_led(codec, action, 0x10, 0);
4469}
4470
5fc462c3
JC
4471static void alc245_fixup_hp_gpio_led(struct hda_codec *codec,
4472 const struct hda_fixup *fix, int action)
4473{
4474 struct alc_spec *spec = codec->spec;
4475
4476 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4477 spec->micmute_led_polarity = 1;
4478 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4479}
4480
8a503555
TI
4481/* turn on/off mic-mute LED per capture hook via VREF change */
4482static int vref_micmute_led_set(struct led_classdev *led_cdev,
4483 enum led_brightness brightness)
9c5dc3bf 4484{
8a503555 4485 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
9c5dc3bf 4486 struct alc_spec *spec = codec->spec;
9c5dc3bf 4487
766538ac
TI
4488 alc_update_vref_led(codec, spec->cap_mute_led_nid,
4489 spec->micmute_led_polarity, brightness);
8a503555 4490 return 0;
9c5dc3bf
KY
4491}
4492
4493static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4494 const struct hda_fixup *fix, int action)
4495{
4496 struct alc_spec *spec = codec->spec;
9c5dc3bf 4497
01e4a275 4498 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
9c5dc3bf 4499 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
01e4a275
TI
4500 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4501 * enable headphone amp
4502 */
4503 spec->gpio_mask |= 0x10;
4504 spec->gpio_dir |= 0x10;
9c5dc3bf 4505 spec->cap_mute_led_nid = 0x18;
8a503555 4506 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
50dd9050 4507 codec->power_filter = led_power_filter;
9c5dc3bf
KY
4508 }
4509}
4510
7a5255f1
DH
4511static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4512 const struct hda_fixup *fix, int action)
4513{
7a5255f1 4514 struct alc_spec *spec = codec->spec;
7a5255f1 4515
01e4a275 4516 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
7a5255f1 4517 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
7a5255f1 4518 spec->cap_mute_led_nid = 0x18;
8a503555 4519 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
7a5255f1
DH
4520 codec->power_filter = led_power_filter;
4521 }
4522}
4523
c3bb2b52
TI
4524/* HP Spectre x360 14 model needs a unique workaround for enabling the amp;
4525 * it needs to toggle the GPIO0 once on and off at each time (bko#210633)
4526 */
4527static void alc245_fixup_hp_x360_amp(struct hda_codec *codec,
4528 const struct hda_fixup *fix, int action)
4529{
4530 struct alc_spec *spec = codec->spec;
4531
4532 switch (action) {
4533 case HDA_FIXUP_ACT_PRE_PROBE:
4534 spec->gpio_mask |= 0x01;
4535 spec->gpio_dir |= 0x01;
4536 break;
4537 case HDA_FIXUP_ACT_INIT:
4538 /* need to toggle GPIO to enable the amp */
4539 alc_update_gpio_data(codec, 0x01, true);
4540 msleep(100);
4541 alc_update_gpio_data(codec, 0x01, false);
4542 break;
4543 }
4544}
4545
622464c8
TI
4546/* toggle GPIO2 at each time stream is started; we use PREPARE state instead */
4547static void alc274_hp_envy_pcm_hook(struct hda_pcm_stream *hinfo,
4548 struct hda_codec *codec,
4549 struct snd_pcm_substream *substream,
4550 int action)
4551{
4552 switch (action) {
4553 case HDA_GEN_PCM_ACT_PREPARE:
4554 alc_update_gpio_data(codec, 0x04, true);
4555 break;
4556 case HDA_GEN_PCM_ACT_CLEANUP:
4557 alc_update_gpio_data(codec, 0x04, false);
4558 break;
4559 }
4560}
4561
4562static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
4563 const struct hda_fixup *fix,
4564 int action)
4565{
4566 struct alc_spec *spec = codec->spec;
4567
4568 if (action == HDA_FIXUP_ACT_PROBE) {
4569 spec->gpio_mask |= 0x04;
4570 spec->gpio_dir |= 0x04;
4571 spec->gen.pcm_playback_hook = alc274_hp_envy_pcm_hook;
4572 }
4573}
4574
766538ac
TI
4575static void alc_update_coef_led(struct hda_codec *codec,
4576 struct alc_coef_led *led,
4577 bool polarity, bool on)
4578{
4579 if (polarity)
4580 on = !on;
4581 /* temporarily power up/down for setting COEF bit */
4582 alc_update_coef_idx(codec, led->idx, led->mask,
4583 on ? led->on : led->off);
4584}
4585
431e76c3 4586/* update mute-LED according to the speaker mute state via COEF bit */
8d3d1ece
TI
4587static int coef_mute_led_set(struct led_classdev *led_cdev,
4588 enum led_brightness brightness)
431e76c3 4589{
8d3d1ece 4590 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
431e76c3
KY
4591 struct alc_spec *spec = codec->spec;
4592
766538ac
TI
4593 alc_update_coef_led(codec, &spec->mute_led_coef,
4594 spec->mute_led_polarity, brightness);
8d3d1ece 4595 return 0;
431e76c3
KY
4596}
4597
4598static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4599 const struct hda_fixup *fix,
4600 int action)
4601{
4602 struct alc_spec *spec = codec->spec;
4603
4604 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4605 spec->mute_led_polarity = 0;
766538ac
TI
4606 spec->mute_led_coef.idx = 0x0b;
4607 spec->mute_led_coef.mask = 1 << 3;
4608 spec->mute_led_coef.on = 1 << 3;
4609 spec->mute_led_coef.off = 0;
8d3d1ece 4610 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
431e76c3
KY
4611 }
4612}
4613
24164f43
KY
4614static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4615 const struct hda_fixup *fix,
4616 int action)
4617{
4618 struct alc_spec *spec = codec->spec;
4619
4620 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4621 spec->mute_led_polarity = 0;
766538ac
TI
4622 spec->mute_led_coef.idx = 0x34;
4623 spec->mute_led_coef.mask = 1 << 5;
4624 spec->mute_led_coef.on = 0;
4625 spec->mute_led_coef.off = 1 << 5;
8d3d1ece 4626 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
24164f43
KY
4627 }
4628}
4629
431e76c3 4630/* turn on/off mic-mute LED per capture hook by coef bit */
8a503555
TI
4631static int coef_micmute_led_set(struct led_classdev *led_cdev,
4632 enum led_brightness brightness)
431e76c3 4633{
8a503555 4634 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
431e76c3
KY
4635 struct alc_spec *spec = codec->spec;
4636
766538ac
TI
4637 alc_update_coef_led(codec, &spec->mic_led_coef,
4638 spec->micmute_led_polarity, brightness);
8a503555 4639 return 0;
431e76c3
KY
4640}
4641
4642static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4643 const struct hda_fixup *fix, int action)
4644{
4645 struct alc_spec *spec = codec->spec;
4646
4647 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
766538ac
TI
4648 spec->mic_led_coef.idx = 0x19;
4649 spec->mic_led_coef.mask = 1 << 13;
4650 spec->mic_led_coef.on = 1 << 13;
4651 spec->mic_led_coef.off = 0;
8a503555 4652 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
431e76c3
KY
4653 }
4654}
4655
24164f43
KY
4656static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4657 const struct hda_fixup *fix, int action)
4658{
4659 struct alc_spec *spec = codec->spec;
4660
4661 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
766538ac
TI
4662 spec->mic_led_coef.idx = 0x35;
4663 spec->mic_led_coef.mask = 3 << 2;
4664 spec->mic_led_coef.on = 2 << 2;
4665 spec->mic_led_coef.off = 1 << 2;
8a503555 4666 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
24164f43
KY
4667 }
4668}
4669
431e76c3
KY
4670static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4671 const struct hda_fixup *fix, int action)
4672{
4673 alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4674 alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4675}
4676
24164f43
KY
4677static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4678 const struct hda_fixup *fix, int action)
4679{
4680 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4681 alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4682}
4683
75b62ab6
JW
4684static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec,
4685 const struct hda_fixup *fix, int action)
4686{
4687 struct alc_spec *spec = codec->spec;
4688
4689 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4690 spec->cap_mute_led_nid = 0x1a;
4691 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4692 codec->power_filter = led_power_filter;
4693 }
4694}
4695
4696static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec,
4697 const struct hda_fixup *fix, int action)
4698{
4699 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4700 alc236_fixup_hp_micmute_led_vref(codec, fix, action);
4701}
4702
a2d57ebe
KM
4703static inline void alc298_samsung_write_coef_pack(struct hda_codec *codec,
4704 const unsigned short coefs[2])
4705{
4706 alc_write_coef_idx(codec, 0x23, coefs[0]);
4707 alc_write_coef_idx(codec, 0x25, coefs[1]);
4708 alc_write_coef_idx(codec, 0x26, 0xb011);
4709}
4710
4711struct alc298_samsung_amp_desc {
4712 unsigned char nid;
4713 unsigned short init_seq[2][2];
4714};
4715
4716static void alc298_fixup_samsung_amp(struct hda_codec *codec,
4717 const struct hda_fixup *fix, int action)
4718{
4719 int i, j;
4720 static const unsigned short init_seq[][2] = {
4721 { 0x19, 0x00 }, { 0x20, 0xc0 }, { 0x22, 0x44 }, { 0x23, 0x08 },
4722 { 0x24, 0x85 }, { 0x25, 0x41 }, { 0x35, 0x40 }, { 0x36, 0x01 },
4723 { 0x38, 0x81 }, { 0x3a, 0x03 }, { 0x3b, 0x81 }, { 0x40, 0x3e },
4724 { 0x41, 0x07 }, { 0x400, 0x1 }
4725 };
4726 static const struct alc298_samsung_amp_desc amps[] = {
4727 { 0x3a, { { 0x18, 0x1 }, { 0x26, 0x0 } } },
4728 { 0x39, { { 0x18, 0x2 }, { 0x26, 0x1 } } }
4729 };
4730
4731 if (action != HDA_FIXUP_ACT_INIT)
4732 return;
4733
4734 for (i = 0; i < ARRAY_SIZE(amps); i++) {
4735 alc_write_coef_idx(codec, 0x22, amps[i].nid);
4736
4737 for (j = 0; j < ARRAY_SIZE(amps[i].init_seq); j++)
4738 alc298_samsung_write_coef_pack(codec, amps[i].init_seq[j]);
4739
4740 for (j = 0; j < ARRAY_SIZE(init_seq); j++)
4741 alc298_samsung_write_coef_pack(codec, init_seq[j]);
4742 }
4743}
4744
6a30abaa 4745#if IS_REACHABLE(CONFIG_INPUT)
33f4acd3
DH
4746static void gpio2_mic_hotkey_event(struct hda_codec *codec,
4747 struct hda_jack_callback *event)
4748{
4749 struct alc_spec *spec = codec->spec;
4750
4751 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
4752 send both key on and key off event for every interrupt. */
c7b60a89 4753 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
33f4acd3 4754 input_sync(spec->kb_dev);
c7b60a89 4755 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
33f4acd3
DH
4756 input_sync(spec->kb_dev);
4757}
33f4acd3 4758
3694cb29
K
4759static int alc_register_micmute_input_device(struct hda_codec *codec)
4760{
4761 struct alc_spec *spec = codec->spec;
c7b60a89 4762 int i;
3694cb29
K
4763
4764 spec->kb_dev = input_allocate_device();
4765 if (!spec->kb_dev) {
4766 codec_err(codec, "Out of memory (input_allocate_device)\n");
4767 return -ENOMEM;
4768 }
c7b60a89
HW
4769
4770 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
4771
3694cb29
K
4772 spec->kb_dev->name = "Microphone Mute Button";
4773 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
c7b60a89
HW
4774 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
4775 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
4776 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
4777 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
4778 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
3694cb29
K
4779
4780 if (input_register_device(spec->kb_dev)) {
4781 codec_err(codec, "input_register_device failed\n");
4782 input_free_device(spec->kb_dev);
4783 spec->kb_dev = NULL;
4784 return -ENOMEM;
4785 }
4786
4787 return 0;
4788}
4789
01e4a275
TI
4790/* GPIO1 = set according to SKU external amp
4791 * GPIO2 = mic mute hotkey
4792 * GPIO3 = mute LED
4793 * GPIO4 = mic mute LED
4794 */
33f4acd3
DH
4795static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4796 const struct hda_fixup *fix, int action)
4797{
33f4acd3
DH
4798 struct alc_spec *spec = codec->spec;
4799
01e4a275 4800 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
33f4acd3 4801 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1c76aa5f 4802 spec->init_amp = ALC_INIT_DEFAULT;
3694cb29 4803 if (alc_register_micmute_input_device(codec) != 0)
33f4acd3 4804 return;
33f4acd3 4805
01e4a275
TI
4806 spec->gpio_mask |= 0x06;
4807 spec->gpio_dir |= 0x02;
4808 spec->gpio_data |= 0x02;
7639a06c 4809 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
33f4acd3 4810 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
7639a06c 4811 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
33f4acd3 4812 gpio2_mic_hotkey_event);
33f4acd3
DH
4813 return;
4814 }
4815
4816 if (!spec->kb_dev)
4817 return;
4818
4819 switch (action) {
33f4acd3
DH
4820 case HDA_FIXUP_ACT_FREE:
4821 input_unregister_device(spec->kb_dev);
33f4acd3
DH
4822 spec->kb_dev = NULL;
4823 }
33f4acd3
DH
4824}
4825
01e4a275
TI
4826/* Line2 = mic mute hotkey
4827 * GPIO2 = mic mute LED
4828 */
3694cb29
K
4829static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4830 const struct hda_fixup *fix, int action)
4831{
3694cb29
K
4832 struct alc_spec *spec = codec->spec;
4833
01e4a275 4834 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
3694cb29 4835 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1c76aa5f 4836 spec->init_amp = ALC_INIT_DEFAULT;
3694cb29
K
4837 if (alc_register_micmute_input_device(codec) != 0)
4838 return;
4839
3694cb29
K
4840 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4841 gpio2_mic_hotkey_event);
3694cb29
K
4842 return;
4843 }
4844
4845 if (!spec->kb_dev)
4846 return;
4847
4848 switch (action) {
3694cb29
K
4849 case HDA_FIXUP_ACT_FREE:
4850 input_unregister_device(spec->kb_dev);
4851 spec->kb_dev = NULL;
4852 }
4853}
c469652b
TI
4854#else /* INPUT */
4855#define alc280_fixup_hp_gpio2_mic_hotkey NULL
4856#define alc233_fixup_lenovo_line2_mic_hotkey NULL
4857#endif /* INPUT */
3694cb29 4858
9c5dc3bf
KY
4859static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4860 const struct hda_fixup *fix, int action)
4861{
4862 struct alc_spec *spec = codec->spec;
4863
1bce62a6 4864 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
9c5dc3bf 4865 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
9c5dc3bf 4866 spec->cap_mute_led_nid = 0x18;
8a503555 4867 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
9c5dc3bf
KY
4868 }
4869}
4870
6b0f95c4 4871static const struct coef_fw alc225_pre_hsmode[] = {
5a36767a
KY
4872 UPDATE_COEF(0x4a, 1<<8, 0),
4873 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4874 UPDATE_COEF(0x63, 3<<14, 3<<14),
4875 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4876 UPDATE_COEF(0x4a, 3<<10, 3<<10),
4877 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4878 UPDATE_COEF(0x4a, 3<<10, 0),
4879 {}
4880};
4881
73bdd597
DH
4882static void alc_headset_mode_unplugged(struct hda_codec *codec)
4883{
92666d45 4884 struct alc_spec *spec = codec->spec;
6b0f95c4 4885 static const struct coef_fw coef0255[] = {
717f43d8 4886 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
54db6c39
TI
4887 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4888 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4889 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4890 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4891 {}
4892 };
6b0f95c4 4893 static const struct coef_fw coef0256[] = {
e69e7e03 4894 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
717f43d8
KY
4895 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4896 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4897 WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
4898 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
e69e7e03
KY
4899 {}
4900 };
6b0f95c4 4901 static const struct coef_fw coef0233[] = {
54db6c39
TI
4902 WRITE_COEF(0x1b, 0x0c0b),
4903 WRITE_COEF(0x45, 0xc429),
4904 UPDATE_COEF(0x35, 0x4000, 0),
4905 WRITE_COEF(0x06, 0x2104),
4906 WRITE_COEF(0x1a, 0x0001),
4907 WRITE_COEF(0x26, 0x0004),
4908 WRITE_COEF(0x32, 0x42a3),
4909 {}
4910 };
6b0f95c4 4911 static const struct coef_fw coef0288[] = {
f3b70332
KY
4912 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4913 UPDATE_COEF(0x50, 0x2000, 0x2000),
4914 UPDATE_COEF(0x56, 0x0006, 0x0006),
4915 UPDATE_COEF(0x66, 0x0008, 0),
4916 UPDATE_COEF(0x67, 0x2000, 0),
4917 {}
4918 };
6b0f95c4 4919 static const struct coef_fw coef0298[] = {
89542936
KY
4920 UPDATE_COEF(0x19, 0x1300, 0x0300),
4921 {}
4922 };
6b0f95c4 4923 static const struct coef_fw coef0292[] = {
54db6c39
TI
4924 WRITE_COEF(0x76, 0x000e),
4925 WRITE_COEF(0x6c, 0x2400),
4926 WRITE_COEF(0x18, 0x7308),
4927 WRITE_COEF(0x6b, 0xc429),
4928 {}
4929 };
6b0f95c4 4930 static const struct coef_fw coef0293[] = {
54db6c39
TI
4931 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
4932 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
4933 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
4934 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
4935 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
4936 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4937 {}
4938 };
6b0f95c4 4939 static const struct coef_fw coef0668[] = {
54db6c39
TI
4940 WRITE_COEF(0x15, 0x0d40),
4941 WRITE_COEF(0xb7, 0x802b),
4942 {}
4943 };
6b0f95c4 4944 static const struct coef_fw coef0225[] = {
5a36767a 4945 UPDATE_COEF(0x63, 3<<14, 0),
4cc9b9d6
KY
4946 {}
4947 };
6b0f95c4 4948 static const struct coef_fw coef0274[] = {
71683c32
KY
4949 UPDATE_COEF(0x4a, 0x0100, 0),
4950 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
4951 UPDATE_COEF(0x6b, 0xf000, 0x5000),
4952 UPDATE_COEF(0x4a, 0x0010, 0),
4953 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
4954 WRITE_COEF(0x45, 0x5289),
4955 UPDATE_COEF(0x4a, 0x0c00, 0),
4956 {}
4957 };
54db6c39 4958
92666d45
KY
4959 if (spec->no_internal_mic_pin) {
4960 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
4961 return;
4962 }
4963
7639a06c 4964 switch (codec->core.vendor_id) {
9a22a8f5 4965 case 0x10ec0255:
e69e7e03
KY
4966 alc_process_coef_fw(codec, coef0255);
4967 break;
1948fc06 4968 case 0x10ec0230:
736f20a7 4969 case 0x10ec0236:
7081adf3 4970 case 0x10ec0256:
527f4643 4971 case 0x19e58326:
e69e7e03 4972 alc_process_coef_fw(codec, coef0256);
9a22a8f5 4973 break;
71683c32
KY
4974 case 0x10ec0234:
4975 case 0x10ec0274:
4976 case 0x10ec0294:
4977 alc_process_coef_fw(codec, coef0274);
4978 break;
13fd08a3 4979 case 0x10ec0233:
73bdd597 4980 case 0x10ec0283:
54db6c39 4981 alc_process_coef_fw(codec, coef0233);
73bdd597 4982 break;
f3b70332
KY
4983 case 0x10ec0286:
4984 case 0x10ec0288:
89542936
KY
4985 alc_process_coef_fw(codec, coef0288);
4986 break;
1a5bc8d9 4987 case 0x10ec0298:
89542936 4988 alc_process_coef_fw(codec, coef0298);
f3b70332
KY
4989 alc_process_coef_fw(codec, coef0288);
4990 break;
73bdd597 4991 case 0x10ec0292:
54db6c39 4992 alc_process_coef_fw(codec, coef0292);
73bdd597 4993 break;
a22aa26f 4994 case 0x10ec0293:
54db6c39 4995 alc_process_coef_fw(codec, coef0293);
a22aa26f 4996 break;
73bdd597 4997 case 0x10ec0668:
54db6c39 4998 alc_process_coef_fw(codec, coef0668);
73bdd597 4999 break;
c2b691ee 5000 case 0x10ec0215:
4cc9b9d6 5001 case 0x10ec0225:
c2b691ee 5002 case 0x10ec0285:
7d727869 5003 case 0x10ec0295:
c2b691ee 5004 case 0x10ec0289:
28f1f9b2 5005 case 0x10ec0299:
4d4b0c52 5006 alc_process_coef_fw(codec, alc225_pre_hsmode);
4cc9b9d6
KY
5007 alc_process_coef_fw(codec, coef0225);
5008 break;
78f4f7c2
KY
5009 case 0x10ec0867:
5010 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5011 break;
73bdd597 5012 }
4e76a883 5013 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
73bdd597
DH
5014}
5015
5016
5017static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
5018 hda_nid_t mic_pin)
5019{
6b0f95c4 5020 static const struct coef_fw coef0255[] = {
54db6c39
TI
5021 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
5022 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
5023 {}
5024 };
6b0f95c4 5025 static const struct coef_fw coef0256[] = {
717f43d8
KY
5026 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
5027 WRITE_COEFEX(0x57, 0x03, 0x09a3),
5028 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
5029 {}
5030 };
6b0f95c4 5031 static const struct coef_fw coef0233[] = {
54db6c39
TI
5032 UPDATE_COEF(0x35, 0, 1<<14),
5033 WRITE_COEF(0x06, 0x2100),
5034 WRITE_COEF(0x1a, 0x0021),
5035 WRITE_COEF(0x26, 0x008c),
5036 {}
5037 };
6b0f95c4 5038 static const struct coef_fw coef0288[] = {
89542936 5039 UPDATE_COEF(0x4f, 0x00c0, 0),
f3b70332
KY
5040 UPDATE_COEF(0x50, 0x2000, 0),
5041 UPDATE_COEF(0x56, 0x0006, 0),
5042 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
5043 UPDATE_COEF(0x66, 0x0008, 0x0008),
5044 UPDATE_COEF(0x67, 0x2000, 0x2000),
5045 {}
5046 };
6b0f95c4 5047 static const struct coef_fw coef0292[] = {
54db6c39
TI
5048 WRITE_COEF(0x19, 0xa208),
5049 WRITE_COEF(0x2e, 0xacf0),
5050 {}
5051 };
6b0f95c4 5052 static const struct coef_fw coef0293[] = {
54db6c39
TI
5053 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
5054 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
5055 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5056 {}
5057 };
6b0f95c4 5058 static const struct coef_fw coef0688[] = {
54db6c39
TI
5059 WRITE_COEF(0xb7, 0x802b),
5060 WRITE_COEF(0xb5, 0x1040),
5061 UPDATE_COEF(0xc3, 0, 1<<12),
5062 {}
5063 };
6b0f95c4 5064 static const struct coef_fw coef0225[] = {
4cc9b9d6
KY
5065 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
5066 UPDATE_COEF(0x4a, 3<<4, 2<<4),
5067 UPDATE_COEF(0x63, 3<<14, 0),
5068 {}
5069 };
6b0f95c4 5070 static const struct coef_fw coef0274[] = {
71683c32
KY
5071 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
5072 UPDATE_COEF(0x4a, 0x0010, 0),
5073 UPDATE_COEF(0x6b, 0xf000, 0),
5074 {}
5075 };
54db6c39 5076
7639a06c 5077 switch (codec->core.vendor_id) {
9a22a8f5
KY
5078 case 0x10ec0255:
5079 alc_write_coef_idx(codec, 0x45, 0xc489);
5080 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 5081 alc_process_coef_fw(codec, coef0255);
9a22a8f5
KY
5082 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5083 break;
1948fc06 5084 case 0x10ec0230:
717f43d8
KY
5085 case 0x10ec0236:
5086 case 0x10ec0256:
527f4643 5087 case 0x19e58326:
717f43d8
KY
5088 alc_write_coef_idx(codec, 0x45, 0xc489);
5089 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5090 alc_process_coef_fw(codec, coef0256);
5091 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5092 break;
71683c32
KY
5093 case 0x10ec0234:
5094 case 0x10ec0274:
5095 case 0x10ec0294:
5096 alc_write_coef_idx(codec, 0x45, 0x4689);
5097 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5098 alc_process_coef_fw(codec, coef0274);
5099 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5100 break;
13fd08a3 5101 case 0x10ec0233:
73bdd597
DH
5102 case 0x10ec0283:
5103 alc_write_coef_idx(codec, 0x45, 0xc429);
5104 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 5105 alc_process_coef_fw(codec, coef0233);
73bdd597
DH
5106 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5107 break;
f3b70332
KY
5108 case 0x10ec0286:
5109 case 0x10ec0288:
1a5bc8d9 5110 case 0x10ec0298:
f3b70332
KY
5111 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5112 alc_process_coef_fw(codec, coef0288);
5113 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5114 break;
73bdd597
DH
5115 case 0x10ec0292:
5116 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 5117 alc_process_coef_fw(codec, coef0292);
73bdd597 5118 break;
a22aa26f
KY
5119 case 0x10ec0293:
5120 /* Set to TRS mode */
5121 alc_write_coef_idx(codec, 0x45, 0xc429);
5122 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 5123 alc_process_coef_fw(codec, coef0293);
a22aa26f
KY
5124 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5125 break;
78f4f7c2
KY
5126 case 0x10ec0867:
5127 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
c0dbbdad 5128 fallthrough;
9eb5d0e6 5129 case 0x10ec0221:
1f8b46cd
DH
5130 case 0x10ec0662:
5131 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5132 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5133 break;
73bdd597
DH
5134 case 0x10ec0668:
5135 alc_write_coef_idx(codec, 0x11, 0x0001);
5136 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 5137 alc_process_coef_fw(codec, coef0688);
73bdd597
DH
5138 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5139 break;
c2b691ee 5140 case 0x10ec0215:
4cc9b9d6 5141 case 0x10ec0225:
c2b691ee 5142 case 0x10ec0285:
7d727869 5143 case 0x10ec0295:
c2b691ee 5144 case 0x10ec0289:
28f1f9b2 5145 case 0x10ec0299:
5a36767a 5146 alc_process_coef_fw(codec, alc225_pre_hsmode);
4cc9b9d6
KY
5147 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
5148 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5149 alc_process_coef_fw(codec, coef0225);
5150 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5151 break;
73bdd597 5152 }
4e76a883 5153 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
73bdd597
DH
5154}
5155
5156static void alc_headset_mode_default(struct hda_codec *codec)
5157{
6b0f95c4 5158 static const struct coef_fw coef0225[] = {
5a36767a
KY
5159 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
5160 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
5161 UPDATE_COEF(0x49, 3<<8, 0<<8),
5162 UPDATE_COEF(0x4a, 3<<4, 3<<4),
5163 UPDATE_COEF(0x63, 3<<14, 0),
5164 UPDATE_COEF(0x67, 0xf000, 0x3000),
2ae95577
DH
5165 {}
5166 };
6b0f95c4 5167 static const struct coef_fw coef0255[] = {
54db6c39
TI
5168 WRITE_COEF(0x45, 0xc089),
5169 WRITE_COEF(0x45, 0xc489),
5170 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5171 WRITE_COEF(0x49, 0x0049),
5172 {}
5173 };
6b0f95c4 5174 static const struct coef_fw coef0256[] = {
717f43d8
KY
5175 WRITE_COEF(0x45, 0xc489),
5176 WRITE_COEFEX(0x57, 0x03, 0x0da3),
5177 WRITE_COEF(0x49, 0x0049),
5178 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5179 WRITE_COEF(0x06, 0x6100),
5180 {}
5181 };
6b0f95c4 5182 static const struct coef_fw coef0233[] = {
54db6c39
TI
5183 WRITE_COEF(0x06, 0x2100),
5184 WRITE_COEF(0x32, 0x4ea3),
5185 {}
5186 };
6b0f95c4 5187 static const struct coef_fw coef0288[] = {
f3b70332
KY
5188 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
5189 UPDATE_COEF(0x50, 0x2000, 0x2000),
5190 UPDATE_COEF(0x56, 0x0006, 0x0006),
5191 UPDATE_COEF(0x66, 0x0008, 0),
5192 UPDATE_COEF(0x67, 0x2000, 0),
5193 {}
5194 };
6b0f95c4 5195 static const struct coef_fw coef0292[] = {
54db6c39
TI
5196 WRITE_COEF(0x76, 0x000e),
5197 WRITE_COEF(0x6c, 0x2400),
5198 WRITE_COEF(0x6b, 0xc429),
5199 WRITE_COEF(0x18, 0x7308),
5200 {}
5201 };
6b0f95c4 5202 static const struct coef_fw coef0293[] = {
54db6c39
TI
5203 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5204 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
5205 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5206 {}
5207 };
6b0f95c4 5208 static const struct coef_fw coef0688[] = {
54db6c39
TI
5209 WRITE_COEF(0x11, 0x0041),
5210 WRITE_COEF(0x15, 0x0d40),
5211 WRITE_COEF(0xb7, 0x802b),
5212 {}
5213 };
6b0f95c4 5214 static const struct coef_fw coef0274[] = {
71683c32
KY
5215 WRITE_COEF(0x45, 0x4289),
5216 UPDATE_COEF(0x4a, 0x0010, 0x0010),
5217 UPDATE_COEF(0x6b, 0x0f00, 0),
5218 UPDATE_COEF(0x49, 0x0300, 0x0300),
5219 {}
5220 };
54db6c39 5221
7639a06c 5222 switch (codec->core.vendor_id) {
c2b691ee 5223 case 0x10ec0215:
2ae95577 5224 case 0x10ec0225:
c2b691ee 5225 case 0x10ec0285:
7d727869 5226 case 0x10ec0295:
c2b691ee 5227 case 0x10ec0289:
28f1f9b2 5228 case 0x10ec0299:
5a36767a 5229 alc_process_coef_fw(codec, alc225_pre_hsmode);
2ae95577
DH
5230 alc_process_coef_fw(codec, coef0225);
5231 break;
9a22a8f5 5232 case 0x10ec0255:
54db6c39 5233 alc_process_coef_fw(codec, coef0255);
9a22a8f5 5234 break;
1948fc06 5235 case 0x10ec0230:
717f43d8
KY
5236 case 0x10ec0236:
5237 case 0x10ec0256:
527f4643 5238 case 0x19e58326:
717f43d8
KY
5239 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5240 alc_write_coef_idx(codec, 0x45, 0xc089);
5241 msleep(50);
5242 alc_process_coef_fw(codec, coef0256);
5243 break;
71683c32
KY
5244 case 0x10ec0234:
5245 case 0x10ec0274:
5246 case 0x10ec0294:
5247 alc_process_coef_fw(codec, coef0274);
5248 break;
13fd08a3 5249 case 0x10ec0233:
73bdd597 5250 case 0x10ec0283:
54db6c39 5251 alc_process_coef_fw(codec, coef0233);
73bdd597 5252 break;
f3b70332
KY
5253 case 0x10ec0286:
5254 case 0x10ec0288:
1a5bc8d9 5255 case 0x10ec0298:
f3b70332
KY
5256 alc_process_coef_fw(codec, coef0288);
5257 break;
73bdd597 5258 case 0x10ec0292:
54db6c39 5259 alc_process_coef_fw(codec, coef0292);
73bdd597 5260 break;
a22aa26f 5261 case 0x10ec0293:
54db6c39 5262 alc_process_coef_fw(codec, coef0293);
a22aa26f 5263 break;
73bdd597 5264 case 0x10ec0668:
54db6c39 5265 alc_process_coef_fw(codec, coef0688);
73bdd597 5266 break;
78f4f7c2
KY
5267 case 0x10ec0867:
5268 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5269 break;
73bdd597 5270 }
4e76a883 5271 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
73bdd597
DH
5272}
5273
5274/* Iphone type */
5275static void alc_headset_mode_ctia(struct hda_codec *codec)
5276{
89542936
KY
5277 int val;
5278
6b0f95c4 5279 static const struct coef_fw coef0255[] = {
54db6c39
TI
5280 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5281 WRITE_COEF(0x1b, 0x0c2b),
5282 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5283 {}
5284 };
6b0f95c4 5285 static const struct coef_fw coef0256[] = {
e69e7e03 5286 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
717f43d8 5287 WRITE_COEF(0x1b, 0x0e6b),
e69e7e03
KY
5288 {}
5289 };
6b0f95c4 5290 static const struct coef_fw coef0233[] = {
54db6c39
TI
5291 WRITE_COEF(0x45, 0xd429),
5292 WRITE_COEF(0x1b, 0x0c2b),
5293 WRITE_COEF(0x32, 0x4ea3),
5294 {}
5295 };
6b0f95c4 5296 static const struct coef_fw coef0288[] = {
f3b70332
KY
5297 UPDATE_COEF(0x50, 0x2000, 0x2000),
5298 UPDATE_COEF(0x56, 0x0006, 0x0006),
5299 UPDATE_COEF(0x66, 0x0008, 0),
5300 UPDATE_COEF(0x67, 0x2000, 0),
5301 {}
5302 };
6b0f95c4 5303 static const struct coef_fw coef0292[] = {
54db6c39
TI
5304 WRITE_COEF(0x6b, 0xd429),
5305 WRITE_COEF(0x76, 0x0008),
5306 WRITE_COEF(0x18, 0x7388),
5307 {}
5308 };
6b0f95c4 5309 static const struct coef_fw coef0293[] = {
54db6c39
TI
5310 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
5311 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5312 {}
5313 };
6b0f95c4 5314 static const struct coef_fw coef0688[] = {
54db6c39
TI
5315 WRITE_COEF(0x11, 0x0001),
5316 WRITE_COEF(0x15, 0x0d60),
5317 WRITE_COEF(0xc3, 0x0000),
5318 {}
5319 };
6b0f95c4 5320 static const struct coef_fw coef0225_1[] = {
4cc9b9d6 5321 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5a36767a
KY
5322 UPDATE_COEF(0x63, 3<<14, 2<<14),
5323 {}
5324 };
6b0f95c4 5325 static const struct coef_fw coef0225_2[] = {
5a36767a
KY
5326 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5327 UPDATE_COEF(0x63, 3<<14, 1<<14),
4cc9b9d6
KY
5328 {}
5329 };
54db6c39 5330
7639a06c 5331 switch (codec->core.vendor_id) {
9a22a8f5 5332 case 0x10ec0255:
54db6c39 5333 alc_process_coef_fw(codec, coef0255);
9a22a8f5 5334 break;
1948fc06 5335 case 0x10ec0230:
736f20a7 5336 case 0x10ec0236:
e69e7e03 5337 case 0x10ec0256:
527f4643 5338 case 0x19e58326:
e69e7e03
KY
5339 alc_process_coef_fw(codec, coef0256);
5340 break;
71683c32
KY
5341 case 0x10ec0234:
5342 case 0x10ec0274:
5343 case 0x10ec0294:
5344 alc_write_coef_idx(codec, 0x45, 0xd689);
5345 break;
13fd08a3 5346 case 0x10ec0233:
73bdd597 5347 case 0x10ec0283:
54db6c39 5348 alc_process_coef_fw(codec, coef0233);
73bdd597 5349 break;
1a5bc8d9 5350 case 0x10ec0298:
89542936
KY
5351 val = alc_read_coef_idx(codec, 0x50);
5352 if (val & (1 << 12)) {
5353 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5354 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5355 msleep(300);
5356 } else {
5357 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5358 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5359 msleep(300);
5360 }
5361 break;
f3b70332
KY
5362 case 0x10ec0286:
5363 case 0x10ec0288:
5364 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5365 msleep(300);
5366 alc_process_coef_fw(codec, coef0288);
5367 break;
73bdd597 5368 case 0x10ec0292:
54db6c39 5369 alc_process_coef_fw(codec, coef0292);
73bdd597 5370 break;
a22aa26f 5371 case 0x10ec0293:
54db6c39 5372 alc_process_coef_fw(codec, coef0293);
a22aa26f 5373 break;
73bdd597 5374 case 0x10ec0668:
54db6c39 5375 alc_process_coef_fw(codec, coef0688);
73bdd597 5376 break;
c2b691ee 5377 case 0x10ec0215:
4cc9b9d6 5378 case 0x10ec0225:
c2b691ee 5379 case 0x10ec0285:
7d727869 5380 case 0x10ec0295:
c2b691ee 5381 case 0x10ec0289:
28f1f9b2 5382 case 0x10ec0299:
5a36767a
KY
5383 val = alc_read_coef_idx(codec, 0x45);
5384 if (val & (1 << 9))
5385 alc_process_coef_fw(codec, coef0225_2);
5386 else
5387 alc_process_coef_fw(codec, coef0225_1);
4cc9b9d6 5388 break;
78f4f7c2
KY
5389 case 0x10ec0867:
5390 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5391 break;
73bdd597 5392 }
4e76a883 5393 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
73bdd597
DH
5394}
5395
5396/* Nokia type */
5397static void alc_headset_mode_omtp(struct hda_codec *codec)
5398{
6b0f95c4 5399 static const struct coef_fw coef0255[] = {
54db6c39
TI
5400 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5401 WRITE_COEF(0x1b, 0x0c2b),
5402 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5403 {}
5404 };
6b0f95c4 5405 static const struct coef_fw coef0256[] = {
e69e7e03 5406 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
717f43d8 5407 WRITE_COEF(0x1b, 0x0e6b),
e69e7e03
KY
5408 {}
5409 };
6b0f95c4 5410 static const struct coef_fw coef0233[] = {
54db6c39
TI
5411 WRITE_COEF(0x45, 0xe429),
5412 WRITE_COEF(0x1b, 0x0c2b),
5413 WRITE_COEF(0x32, 0x4ea3),
5414 {}
5415 };
6b0f95c4 5416 static const struct coef_fw coef0288[] = {
f3b70332
KY
5417 UPDATE_COEF(0x50, 0x2000, 0x2000),
5418 UPDATE_COEF(0x56, 0x0006, 0x0006),
5419 UPDATE_COEF(0x66, 0x0008, 0),
5420 UPDATE_COEF(0x67, 0x2000, 0),
5421 {}
5422 };
6b0f95c4 5423 static const struct coef_fw coef0292[] = {
54db6c39
TI
5424 WRITE_COEF(0x6b, 0xe429),
5425 WRITE_COEF(0x76, 0x0008),
5426 WRITE_COEF(0x18, 0x7388),
5427 {}
5428 };
6b0f95c4 5429 static const struct coef_fw coef0293[] = {
54db6c39
TI
5430 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5431 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5432 {}
5433 };
6b0f95c4 5434 static const struct coef_fw coef0688[] = {
54db6c39
TI
5435 WRITE_COEF(0x11, 0x0001),
5436 WRITE_COEF(0x15, 0x0d50),
5437 WRITE_COEF(0xc3, 0x0000),
5438 {}
5439 };
6b0f95c4 5440 static const struct coef_fw coef0225[] = {
4cc9b9d6 5441 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
5a36767a 5442 UPDATE_COEF(0x63, 3<<14, 2<<14),
4cc9b9d6
KY
5443 {}
5444 };
54db6c39 5445
7639a06c 5446 switch (codec->core.vendor_id) {
9a22a8f5 5447 case 0x10ec0255:
54db6c39 5448 alc_process_coef_fw(codec, coef0255);
9a22a8f5 5449 break;
1948fc06 5450 case 0x10ec0230:
736f20a7 5451 case 0x10ec0236:
e69e7e03 5452 case 0x10ec0256:
527f4643 5453 case 0x19e58326:
e69e7e03
KY
5454 alc_process_coef_fw(codec, coef0256);
5455 break;
71683c32
KY
5456 case 0x10ec0234:
5457 case 0x10ec0274:
5458 case 0x10ec0294:
5459 alc_write_coef_idx(codec, 0x45, 0xe689);
5460 break;
13fd08a3 5461 case 0x10ec0233:
73bdd597 5462 case 0x10ec0283:
54db6c39 5463 alc_process_coef_fw(codec, coef0233);
73bdd597 5464 break;
1a5bc8d9
KY
5465 case 0x10ec0298:
5466 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
89542936
KY
5467 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5468 msleep(300);
5469 break;
f3b70332
KY
5470 case 0x10ec0286:
5471 case 0x10ec0288:
5472 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5473 msleep(300);
5474 alc_process_coef_fw(codec, coef0288);
5475 break;
73bdd597 5476 case 0x10ec0292:
54db6c39 5477 alc_process_coef_fw(codec, coef0292);
73bdd597 5478 break;
a22aa26f 5479 case 0x10ec0293:
54db6c39 5480 alc_process_coef_fw(codec, coef0293);
a22aa26f 5481 break;
73bdd597 5482 case 0x10ec0668:
54db6c39 5483 alc_process_coef_fw(codec, coef0688);
73bdd597 5484 break;
c2b691ee 5485 case 0x10ec0215:
4cc9b9d6 5486 case 0x10ec0225:
c2b691ee 5487 case 0x10ec0285:
7d727869 5488 case 0x10ec0295:
c2b691ee 5489 case 0x10ec0289:
28f1f9b2 5490 case 0x10ec0299:
4cc9b9d6
KY
5491 alc_process_coef_fw(codec, coef0225);
5492 break;
73bdd597 5493 }
4e76a883 5494 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
73bdd597
DH
5495}
5496
5497static void alc_determine_headset_type(struct hda_codec *codec)
5498{
5499 int val;
5500 bool is_ctia = false;
5501 struct alc_spec *spec = codec->spec;
6b0f95c4 5502 static const struct coef_fw coef0255[] = {
54db6c39
TI
5503 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5504 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5505 conteol) */
5506 {}
5507 };
6b0f95c4 5508 static const struct coef_fw coef0288[] = {
f3b70332
KY
5509 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5510 {}
5511 };
6b0f95c4 5512 static const struct coef_fw coef0298[] = {
89542936
KY
5513 UPDATE_COEF(0x50, 0x2000, 0x2000),
5514 UPDATE_COEF(0x56, 0x0006, 0x0006),
5515 UPDATE_COEF(0x66, 0x0008, 0),
5516 UPDATE_COEF(0x67, 0x2000, 0),
5517 UPDATE_COEF(0x19, 0x1300, 0x1300),
5518 {}
5519 };
6b0f95c4 5520 static const struct coef_fw coef0293[] = {
54db6c39
TI
5521 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5522 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5523 {}
5524 };
6b0f95c4 5525 static const struct coef_fw coef0688[] = {
54db6c39
TI
5526 WRITE_COEF(0x11, 0x0001),
5527 WRITE_COEF(0xb7, 0x802b),
5528 WRITE_COEF(0x15, 0x0d60),
5529 WRITE_COEF(0xc3, 0x0c00),
5530 {}
5531 };
6b0f95c4 5532 static const struct coef_fw coef0274[] = {
71683c32
KY
5533 UPDATE_COEF(0x4a, 0x0010, 0),
5534 UPDATE_COEF(0x4a, 0x8000, 0),
5535 WRITE_COEF(0x45, 0xd289),
5536 UPDATE_COEF(0x49, 0x0300, 0x0300),
5537 {}
5538 };
73bdd597 5539
92666d45
KY
5540 if (spec->no_internal_mic_pin) {
5541 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5542 return;
5543 }
5544
7639a06c 5545 switch (codec->core.vendor_id) {
9a22a8f5 5546 case 0x10ec0255:
717f43d8
KY
5547 alc_process_coef_fw(codec, coef0255);
5548 msleep(300);
5549 val = alc_read_coef_idx(codec, 0x46);
5550 is_ctia = (val & 0x0070) == 0x0070;
5551 break;
1948fc06 5552 case 0x10ec0230:
717f43d8 5553 case 0x10ec0236:
7081adf3 5554 case 0x10ec0256:
527f4643 5555 case 0x19e58326:
717f43d8
KY
5556 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5557 alc_write_coef_idx(codec, 0x06, 0x6104);
5558 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5559
5560 snd_hda_codec_write(codec, 0x21, 0,
5561 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5562 msleep(80);
5563 snd_hda_codec_write(codec, 0x21, 0,
5564 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5565
54db6c39 5566 alc_process_coef_fw(codec, coef0255);
9a22a8f5
KY
5567 msleep(300);
5568 val = alc_read_coef_idx(codec, 0x46);
5569 is_ctia = (val & 0x0070) == 0x0070;
717f43d8
KY
5570
5571 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5572 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5573
5574 snd_hda_codec_write(codec, 0x21, 0,
5575 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5576 msleep(80);
5577 snd_hda_codec_write(codec, 0x21, 0,
5578 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
9a22a8f5 5579 break;
71683c32
KY
5580 case 0x10ec0234:
5581 case 0x10ec0274:
5582 case 0x10ec0294:
5583 alc_process_coef_fw(codec, coef0274);
febf2256 5584 msleep(850);
71683c32
KY
5585 val = alc_read_coef_idx(codec, 0x46);
5586 is_ctia = (val & 0x00f0) == 0x00f0;
5587 break;
13fd08a3 5588 case 0x10ec0233:
73bdd597
DH
5589 case 0x10ec0283:
5590 alc_write_coef_idx(codec, 0x45, 0xd029);
5591 msleep(300);
5592 val = alc_read_coef_idx(codec, 0x46);
5593 is_ctia = (val & 0x0070) == 0x0070;
5594 break;
1a5bc8d9 5595 case 0x10ec0298:
89542936
KY
5596 snd_hda_codec_write(codec, 0x21, 0,
5597 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5598 msleep(100);
5599 snd_hda_codec_write(codec, 0x21, 0,
5600 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5601 msleep(200);
5602
5603 val = alc_read_coef_idx(codec, 0x50);
5604 if (val & (1 << 12)) {
5605 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5606 alc_process_coef_fw(codec, coef0288);
5607 msleep(350);
5608 val = alc_read_coef_idx(codec, 0x50);
5609 is_ctia = (val & 0x0070) == 0x0070;
5610 } else {
5611 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5612 alc_process_coef_fw(codec, coef0288);
5613 msleep(350);
5614 val = alc_read_coef_idx(codec, 0x50);
5615 is_ctia = (val & 0x0070) == 0x0070;
5616 }
5617 alc_process_coef_fw(codec, coef0298);
5618 snd_hda_codec_write(codec, 0x21, 0,
5619 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5620 msleep(75);
5621 snd_hda_codec_write(codec, 0x21, 0,
5622 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5623 break;
f3b70332
KY
5624 case 0x10ec0286:
5625 case 0x10ec0288:
5626 alc_process_coef_fw(codec, coef0288);
5627 msleep(350);
5628 val = alc_read_coef_idx(codec, 0x50);
5629 is_ctia = (val & 0x0070) == 0x0070;
5630 break;
73bdd597
DH
5631 case 0x10ec0292:
5632 alc_write_coef_idx(codec, 0x6b, 0xd429);
5633 msleep(300);
5634 val = alc_read_coef_idx(codec, 0x6c);
5635 is_ctia = (val & 0x001c) == 0x001c;
5636 break;
a22aa26f 5637 case 0x10ec0293:
54db6c39 5638 alc_process_coef_fw(codec, coef0293);
a22aa26f
KY
5639 msleep(300);
5640 val = alc_read_coef_idx(codec, 0x46);
5641 is_ctia = (val & 0x0070) == 0x0070;
5642 break;
73bdd597 5643 case 0x10ec0668:
54db6c39 5644 alc_process_coef_fw(codec, coef0688);
73bdd597
DH
5645 msleep(300);
5646 val = alc_read_coef_idx(codec, 0xbe);
5647 is_ctia = (val & 0x1c02) == 0x1c02;
5648 break;
c2b691ee 5649 case 0x10ec0215:
4cc9b9d6 5650 case 0x10ec0225:
c2b691ee 5651 case 0x10ec0285:
7d727869 5652 case 0x10ec0295:
c2b691ee 5653 case 0x10ec0289:
28f1f9b2 5654 case 0x10ec0299:
da911b1f
KY
5655 snd_hda_codec_write(codec, 0x21, 0,
5656 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5657 msleep(80);
5658 snd_hda_codec_write(codec, 0x21, 0,
5659 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5660
5a36767a
KY
5661 alc_process_coef_fw(codec, alc225_pre_hsmode);
5662 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5663 val = alc_read_coef_idx(codec, 0x45);
5664 if (val & (1 << 9)) {
5665 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5666 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5667 msleep(800);
5668 val = alc_read_coef_idx(codec, 0x46);
5669 is_ctia = (val & 0x00f0) == 0x00f0;
5670 } else {
5671 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5672 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5673 msleep(800);
5674 val = alc_read_coef_idx(codec, 0x46);
5675 is_ctia = (val & 0x00f0) == 0x00f0;
5676 }
5677 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
5678 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
5679 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
da911b1f
KY
5680
5681 snd_hda_codec_write(codec, 0x21, 0,
5682 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5683 msleep(80);
5684 snd_hda_codec_write(codec, 0x21, 0,
5685 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
4cc9b9d6 5686 break;
78f4f7c2
KY
5687 case 0x10ec0867:
5688 is_ctia = true;
5689 break;
73bdd597
DH
5690 }
5691
4e76a883 5692 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
73bdd597
DH
5693 is_ctia ? "yes" : "no");
5694 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
5695}
5696
5697static void alc_update_headset_mode(struct hda_codec *codec)
5698{
5699 struct alc_spec *spec = codec->spec;
5700
5701 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
35a39f98 5702 hda_nid_t hp_pin = alc_get_hp_pin(spec);
73bdd597
DH
5703
5704 int new_headset_mode;
5705
5706 if (!snd_hda_jack_detect(codec, hp_pin))
5707 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
5708 else if (mux_pin == spec->headset_mic_pin)
5709 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
5710 else if (mux_pin == spec->headphone_mic_pin)
5711 new_headset_mode = ALC_HEADSET_MODE_MIC;
5712 else
5713 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
5714
5959a6bc
DH
5715 if (new_headset_mode == spec->current_headset_mode) {
5716 snd_hda_gen_update_outputs(codec);
73bdd597 5717 return;
5959a6bc 5718 }
73bdd597
DH
5719
5720 switch (new_headset_mode) {
5721 case ALC_HEADSET_MODE_UNPLUGGED:
5722 alc_headset_mode_unplugged(codec);
aeac1a0d
KY
5723 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5724 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
73bdd597
DH
5725 spec->gen.hp_jack_present = false;
5726 break;
5727 case ALC_HEADSET_MODE_HEADSET:
5728 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
5729 alc_determine_headset_type(codec);
5730 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
5731 alc_headset_mode_ctia(codec);
5732 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
5733 alc_headset_mode_omtp(codec);
5734 spec->gen.hp_jack_present = true;
5735 break;
5736 case ALC_HEADSET_MODE_MIC:
5737 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
5738 spec->gen.hp_jack_present = false;
5739 break;
5740 case ALC_HEADSET_MODE_HEADPHONE:
5741 alc_headset_mode_default(codec);
5742 spec->gen.hp_jack_present = true;
5743 break;
5744 }
5745 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
5746 snd_hda_set_pin_ctl_cache(codec, hp_pin,
5747 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
1f8b46cd 5748 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
73bdd597
DH
5749 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
5750 PIN_VREFHIZ);
5751 }
5752 spec->current_headset_mode = new_headset_mode;
5753
5754 snd_hda_gen_update_outputs(codec);
5755}
5756
5757static void alc_update_headset_mode_hook(struct hda_codec *codec,
7fe30711
TI
5758 struct snd_kcontrol *kcontrol,
5759 struct snd_ctl_elem_value *ucontrol)
73bdd597
DH
5760{
5761 alc_update_headset_mode(codec);
5762}
5763
1a4f69d5
TI
5764static void alc_update_headset_jack_cb(struct hda_codec *codec,
5765 struct hda_jack_callback *jack)
73bdd597 5766{
73bdd597 5767 snd_hda_gen_hp_automute(codec, jack);
e54f30be 5768 alc_update_headset_mode(codec);
73bdd597
DH
5769}
5770
5771static void alc_probe_headset_mode(struct hda_codec *codec)
5772{
5773 int i;
5774 struct alc_spec *spec = codec->spec;
5775 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5776
5777 /* Find mic pins */
5778 for (i = 0; i < cfg->num_inputs; i++) {
5779 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
5780 spec->headset_mic_pin = cfg->inputs[i].pin;
5781 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
5782 spec->headphone_mic_pin = cfg->inputs[i].pin;
5783 }
5784
0bed2aa3 5785 WARN_ON(spec->gen.cap_sync_hook);
73bdd597
DH
5786 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
5787 spec->gen.automute_hook = alc_update_headset_mode;
5788 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
5789}
5790
5791static void alc_fixup_headset_mode(struct hda_codec *codec,
5792 const struct hda_fixup *fix, int action)
5793{
5794 struct alc_spec *spec = codec->spec;
5795
5796 switch (action) {
5797 case HDA_FIXUP_ACT_PRE_PROBE:
5798 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
5799 break;
5800 case HDA_FIXUP_ACT_PROBE:
5801 alc_probe_headset_mode(codec);
5802 break;
5803 case HDA_FIXUP_ACT_INIT:
aeac1a0d
KY
5804 if (is_s3_resume(codec) || is_s4_resume(codec)) {
5805 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5806 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5807 }
73bdd597
DH
5808 alc_update_headset_mode(codec);
5809 break;
5810 }
5811}
5812
5813static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
5814 const struct hda_fixup *fix, int action)
5815{
5816 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5817 struct alc_spec *spec = codec->spec;
5818 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5819 }
5820 else
5821 alc_fixup_headset_mode(codec, fix, action);
5822}
5823
31278997
KY
5824static void alc255_set_default_jack_type(struct hda_codec *codec)
5825{
5826 /* Set to iphone type */
6b0f95c4 5827 static const struct coef_fw alc255fw[] = {
54db6c39
TI
5828 WRITE_COEF(0x1b, 0x880b),
5829 WRITE_COEF(0x45, 0xd089),
5830 WRITE_COEF(0x1b, 0x080b),
5831 WRITE_COEF(0x46, 0x0004),
5832 WRITE_COEF(0x1b, 0x0c0b),
5833 {}
5834 };
6b0f95c4 5835 static const struct coef_fw alc256fw[] = {
e69e7e03
KY
5836 WRITE_COEF(0x1b, 0x884b),
5837 WRITE_COEF(0x45, 0xd089),
5838 WRITE_COEF(0x1b, 0x084b),
5839 WRITE_COEF(0x46, 0x0004),
5840 WRITE_COEF(0x1b, 0x0c4b),
5841 {}
5842 };
5843 switch (codec->core.vendor_id) {
5844 case 0x10ec0255:
5845 alc_process_coef_fw(codec, alc255fw);
5846 break;
1948fc06 5847 case 0x10ec0230:
736f20a7 5848 case 0x10ec0236:
e69e7e03 5849 case 0x10ec0256:
527f4643 5850 case 0x19e58326:
e69e7e03
KY
5851 alc_process_coef_fw(codec, alc256fw);
5852 break;
5853 }
31278997
KY
5854 msleep(30);
5855}
5856
9a22a8f5
KY
5857static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
5858 const struct hda_fixup *fix, int action)
5859{
5860 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
31278997 5861 alc255_set_default_jack_type(codec);
9a22a8f5
KY
5862 }
5863 alc_fixup_headset_mode(codec, fix, action);
5864}
5865
31278997
KY
5866static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
5867 const struct hda_fixup *fix, int action)
5868{
5869 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5870 struct alc_spec *spec = codec->spec;
5871 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5872 alc255_set_default_jack_type(codec);
5873 }
5874 else
5875 alc_fixup_headset_mode(codec, fix, action);
5876}
5877
e1e62b98
KY
5878static void alc288_update_headset_jack_cb(struct hda_codec *codec,
5879 struct hda_jack_callback *jack)
5880{
5881 struct alc_spec *spec = codec->spec;
e1e62b98
KY
5882
5883 alc_update_headset_jack_cb(codec, jack);
5884 /* Headset Mic enable or disable, only for Dell Dino */
d44a6864 5885 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
e1e62b98
KY
5886}
5887
5888static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5889 const struct hda_fixup *fix, int action)
5890{
5891 alc_fixup_headset_mode(codec, fix, action);
5892 if (action == HDA_FIXUP_ACT_PROBE) {
5893 struct alc_spec *spec = codec->spec;
d44a6864
TI
5894 /* toggled via hp_automute_hook */
5895 spec->gpio_mask |= 0x40;
5896 spec->gpio_dir |= 0x40;
e1e62b98
KY
5897 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
5898 }
5899}
5900
493a52a9
HW
5901static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5902 const struct hda_fixup *fix, int action)
5903{
5904 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5905 struct alc_spec *spec = codec->spec;
5906 spec->gen.auto_mute_via_amp = 1;
5907 }
5908}
5909
9b745ab8
TI
5910static void alc_fixup_no_shutup(struct hda_codec *codec,
5911 const struct hda_fixup *fix, int action)
5912{
efe55732 5913 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
9b745ab8 5914 struct alc_spec *spec = codec->spec;
c0ca5ece 5915 spec->no_shutup_pins = 1;
9b745ab8
TI
5916 }
5917}
5918
5e6db669
GM
5919static void alc_fixup_disable_aamix(struct hda_codec *codec,
5920 const struct hda_fixup *fix, int action)
5921{
5922 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5923 struct alc_spec *spec = codec->spec;
5924 /* Disable AA-loopback as it causes white noise */
5925 spec->gen.mixer_nid = 0;
5926 }
5927}
5928
7f57d803
TI
5929/* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
5930static void alc_fixup_tpt440_dock(struct hda_codec *codec,
5931 const struct hda_fixup *fix, int action)
5932{
5933 static const struct hda_pintbl pincfgs[] = {
5934 { 0x16, 0x21211010 }, /* dock headphone */
5935 { 0x19, 0x21a11010 }, /* dock mic */
5936 { }
5937 };
5938 struct alc_spec *spec = codec->spec;
5939
5940 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5941 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5942 codec->power_save_node = 0; /* avoid click noises */
5943 snd_hda_apply_pincfgs(codec, pincfgs);
5944 }
5945}
5946
61fcf8ec
KY
5947static void alc_fixup_tpt470_dock(struct hda_codec *codec,
5948 const struct hda_fixup *fix, int action)
5949{
5950 static const struct hda_pintbl pincfgs[] = {
5951 { 0x17, 0x21211010 }, /* dock headphone */
5952 { 0x19, 0x21a11010 }, /* dock mic */
5953 { }
5954 };
5955 struct alc_spec *spec = codec->spec;
5956
5957 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5958 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
71db96dd
TI
5959 snd_hda_apply_pincfgs(codec, pincfgs);
5960 } else if (action == HDA_FIXUP_ACT_INIT) {
61fcf8ec
KY
5961 /* Enable DOCK device */
5962 snd_hda_codec_write(codec, 0x17, 0,
5963 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5964 /* Enable DOCK device */
5965 snd_hda_codec_write(codec, 0x19, 0,
5966 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
61fcf8ec
KY
5967 }
5968}
5969
399c01aa
TI
5970static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
5971 const struct hda_fixup *fix, int action)
5972{
5973 /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
5974 * the speaker output becomes too low by some reason on Thinkpads with
5975 * ALC298 codec
5976 */
5977 static const hda_nid_t preferred_pairs[] = {
5978 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
5979 0
5980 };
5981 struct alc_spec *spec = codec->spec;
5982
5983 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5984 spec->gen.preferred_dacs = preferred_pairs;
5985}
5986
8eedd3a7
TI
5987static void alc295_fixup_asus_dacs(struct hda_codec *codec,
5988 const struct hda_fixup *fix, int action)
5989{
5990 static const hda_nid_t preferred_pairs[] = {
5991 0x17, 0x02, 0x21, 0x03, 0
5992 };
5993 struct alc_spec *spec = codec->spec;
5994
5995 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5996 spec->gen.preferred_dacs = preferred_pairs;
5997}
5998
9476d369 5999static void alc_shutup_dell_xps13(struct hda_codec *codec)
033b0a7c
GM
6000{
6001 struct alc_spec *spec = codec->spec;
35a39f98 6002 int hp_pin = alc_get_hp_pin(spec);
033b0a7c 6003
9476d369
GM
6004 /* Prevent pop noises when headphones are plugged in */
6005 snd_hda_codec_write(codec, hp_pin, 0,
6006 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
6007 msleep(20);
033b0a7c
GM
6008}
6009
6010static void alc_fixup_dell_xps13(struct hda_codec *codec,
6011 const struct hda_fixup *fix, int action)
6012{
3e1b0c4a
TI
6013 struct alc_spec *spec = codec->spec;
6014 struct hda_input_mux *imux = &spec->gen.input_mux;
6015 int i;
f38663ab 6016
3e1b0c4a
TI
6017 switch (action) {
6018 case HDA_FIXUP_ACT_PRE_PROBE:
6019 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
6020 * it causes a click noise at start up
6021 */
6022 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
efe55732 6023 spec->shutup = alc_shutup_dell_xps13;
3e1b0c4a
TI
6024 break;
6025 case HDA_FIXUP_ACT_PROBE:
f38663ab
GM
6026 /* Make the internal mic the default input source. */
6027 for (i = 0; i < imux->num_items; i++) {
6028 if (spec->gen.imux_pins[i] == 0x12) {
6029 spec->gen.cur_mux[0] = i;
6030 break;
6031 }
6032 }
3e1b0c4a 6033 break;
033b0a7c
GM
6034 }
6035}
6036
1f8b46cd
DH
6037static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
6038 const struct hda_fixup *fix, int action)
6039{
6040 struct alc_spec *spec = codec->spec;
6041
6042 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6043 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
6044 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
b40eda64
DH
6045
6046 /* Disable boost for mic-in permanently. (This code is only called
6047 from quirks that guarantee that the headphone is at NID 0x1b.) */
6048 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
6049 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
1f8b46cd
DH
6050 } else
6051 alc_fixup_headset_mode(codec, fix, action);
6052}
6053
73bdd597
DH
6054static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
6055 const struct hda_fixup *fix, int action)
6056{
6057 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
73bdd597 6058 alc_write_coef_idx(codec, 0xc4, 0x8000);
98b24883 6059 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
73bdd597
DH
6060 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
6061 }
6062 alc_fixup_headset_mode(codec, fix, action);
6063}
6064
bde7bc60
CCC
6065/* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
6066static int find_ext_mic_pin(struct hda_codec *codec)
6067{
6068 struct alc_spec *spec = codec->spec;
6069 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6070 hda_nid_t nid;
6071 unsigned int defcfg;
6072 int i;
6073
6074 for (i = 0; i < cfg->num_inputs; i++) {
6075 if (cfg->inputs[i].type != AUTO_PIN_MIC)
6076 continue;
6077 nid = cfg->inputs[i].pin;
6078 defcfg = snd_hda_codec_get_pincfg(codec, nid);
6079 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
6080 continue;
6081 return nid;
6082 }
6083
6084 return 0;
6085}
6086
08a978db 6087static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
1727a771 6088 const struct hda_fixup *fix,
08a978db
DR
6089 int action)
6090{
6091 struct alc_spec *spec = codec->spec;
6092
0db75790 6093 if (action == HDA_FIXUP_ACT_PROBE) {
bde7bc60 6094 int mic_pin = find_ext_mic_pin(codec);
35a39f98 6095 int hp_pin = alc_get_hp_pin(spec);
bde7bc60
CCC
6096
6097 if (snd_BUG_ON(!mic_pin || !hp_pin))
0db75790 6098 return;
bde7bc60 6099 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
0db75790 6100 }
08a978db 6101}
693b613d 6102
3e0d611b
DH
6103static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
6104 const struct hda_fixup *fix,
6105 int action)
6106{
6107 struct alc_spec *spec = codec->spec;
6108 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6109 int i;
6110
6111 /* The mic boosts on level 2 and 3 are too noisy
6112 on the internal mic input.
6113 Therefore limit the boost to 0 or 1. */
6114
6115 if (action != HDA_FIXUP_ACT_PROBE)
6116 return;
6117
6118 for (i = 0; i < cfg->num_inputs; i++) {
6119 hda_nid_t nid = cfg->inputs[i].pin;
6120 unsigned int defcfg;
6121 if (cfg->inputs[i].type != AUTO_PIN_MIC)
6122 continue;
6123 defcfg = snd_hda_codec_get_pincfg(codec, nid);
6124 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
6125 continue;
6126
6127 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
6128 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
6129 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
6130 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
6131 (0 << AC_AMPCAP_MUTE_SHIFT));
6132 }
6133}
6134
cd217a63 6135static void alc283_hp_automute_hook(struct hda_codec *codec,
1a4f69d5 6136 struct hda_jack_callback *jack)
cd217a63
KY
6137{
6138 struct alc_spec *spec = codec->spec;
6139 int vref;
6140
6141 msleep(200);
6142 snd_hda_gen_hp_automute(codec, jack);
6143
6144 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
6145
6146 msleep(600);
6147 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6148 vref);
6149}
6150
cd217a63
KY
6151static void alc283_fixup_chromebook(struct hda_codec *codec,
6152 const struct hda_fixup *fix, int action)
6153{
6154 struct alc_spec *spec = codec->spec;
cd217a63
KY
6155
6156 switch (action) {
6157 case HDA_FIXUP_ACT_PRE_PROBE:
0202e99c 6158 snd_hda_override_wcaps(codec, 0x03, 0);
d2e92709
TI
6159 /* Disable AA-loopback as it causes white noise */
6160 spec->gen.mixer_nid = 0;
38070219 6161 break;
0202e99c 6162 case HDA_FIXUP_ACT_INIT:
de9481cb
KY
6163 /* MIC2-VREF control */
6164 /* Set to manual mode */
98b24883 6165 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
0202e99c 6166 /* Enable Line1 input control by verb */
98b24883 6167 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
0202e99c
KY
6168 break;
6169 }
6170}
6171
6172static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
6173 const struct hda_fixup *fix, int action)
6174{
6175 struct alc_spec *spec = codec->spec;
0202e99c
KY
6176
6177 switch (action) {
6178 case HDA_FIXUP_ACT_PRE_PROBE:
cd217a63 6179 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
38070219
KY
6180 break;
6181 case HDA_FIXUP_ACT_INIT:
cd217a63
KY
6182 /* MIC2-VREF control */
6183 /* Set to manual mode */
98b24883 6184 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
cd217a63
KY
6185 break;
6186 }
6187}
6188
7bba2157
TI
6189/* mute tablet speaker pin (0x14) via dock plugging in addition */
6190static void asus_tx300_automute(struct hda_codec *codec)
6191{
6192 struct alc_spec *spec = codec->spec;
6193 snd_hda_gen_update_outputs(codec);
6194 if (snd_hda_jack_detect(codec, 0x1b))
6195 spec->gen.mute_bits |= (1ULL << 0x14);
6196}
6197
6198static void alc282_fixup_asus_tx300(struct hda_codec *codec,
6199 const struct hda_fixup *fix, int action)
6200{
6201 struct alc_spec *spec = codec->spec;
7bba2157
TI
6202 static const struct hda_pintbl dock_pins[] = {
6203 { 0x1b, 0x21114000 }, /* dock speaker pin */
6204 {}
6205 };
7bba2157
TI
6206
6207 switch (action) {
6208 case HDA_FIXUP_ACT_PRE_PROBE:
1c76aa5f 6209 spec->init_amp = ALC_INIT_DEFAULT;
ae065f1c
TI
6210 /* TX300 needs to set up GPIO2 for the speaker amp */
6211 alc_setup_gpio(codec, 0x04);
7bba2157
TI
6212 snd_hda_apply_pincfgs(codec, dock_pins);
6213 spec->gen.auto_mute_via_amp = 1;
6214 spec->gen.automute_hook = asus_tx300_automute;
6215 snd_hda_jack_detect_enable_callback(codec, 0x1b,
7bba2157
TI
6216 snd_hda_gen_hp_automute);
6217 break;
5579cd6f
TI
6218 case HDA_FIXUP_ACT_PROBE:
6219 spec->init_amp = ALC_INIT_DEFAULT;
6220 break;
7bba2157
TI
6221 case HDA_FIXUP_ACT_BUILD:
6222 /* this is a bit tricky; give more sane names for the main
6223 * (tablet) speaker and the dock speaker, respectively
6224 */
56798e6b
TI
6225 rename_ctl(codec, "Speaker Playback Switch",
6226 "Dock Speaker Playback Switch");
6227 rename_ctl(codec, "Bass Speaker Playback Switch",
6228 "Speaker Playback Switch");
7bba2157
TI
6229 break;
6230 }
6231}
6232
338cae56
DH
6233static void alc290_fixup_mono_speakers(struct hda_codec *codec,
6234 const struct hda_fixup *fix, int action)
6235{
0f4881dc
DH
6236 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6237 /* DAC node 0x03 is giving mono output. We therefore want to
6238 make sure 0x14 (front speaker) and 0x15 (headphones) use the
6239 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
caf3c043
MM
6240 static const hda_nid_t conn1[] = { 0x0c };
6241 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
6242 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
0f4881dc 6243 }
338cae56
DH
6244}
6245
dd9aa335
HW
6246static void alc298_fixup_speaker_volume(struct hda_codec *codec,
6247 const struct hda_fixup *fix, int action)
6248{
6249 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6250 /* The speaker is routed to the Node 0x06 by a mistake, as a result
6251 we can't adjust the speaker's volume since this node does not has
6252 Amp-out capability. we change the speaker's route to:
6253 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
6254 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
6255 speaker's volume now. */
6256
caf3c043
MM
6257 static const hda_nid_t conn1[] = { 0x0c };
6258 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
dd9aa335
HW
6259 }
6260}
6261
e312a869
TI
6262/* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
6263static void alc295_fixup_disable_dac3(struct hda_codec *codec,
6264 const struct hda_fixup *fix, int action)
6265{
6266 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
caf3c043
MM
6267 static const hda_nid_t conn[] = { 0x02, 0x03 };
6268 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
e312a869
TI
6269 }
6270}
6271
d2cd795c
JK
6272/* force NID 0x17 (Bass Speaker) to DAC1 to share it with the main speaker */
6273static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
6274 const struct hda_fixup *fix, int action)
6275{
6276 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
caf3c043
MM
6277 static const hda_nid_t conn[] = { 0x02 };
6278 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
d2cd795c
JK
6279 }
6280}
6281
98973f2f
KP
6282/* Hook to update amp GPIO4 for automute */
6283static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
6284 struct hda_jack_callback *jack)
6285{
6286 struct alc_spec *spec = codec->spec;
6287
6288 snd_hda_gen_hp_automute(codec, jack);
6289 /* mute_led_polarity is set to 0, so we pass inverted value here */
dbd13179
KHF
6290 alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
6291 !spec->gen.hp_jack_present);
98973f2f
KP
6292}
6293
6294/* Manage GPIOs for HP EliteBook Folio 9480m.
6295 *
6296 * GPIO4 is the headphone amplifier power control
6297 * GPIO3 is the audio output mute indicator LED
6298 */
6299
6300static void alc280_fixup_hp_9480m(struct hda_codec *codec,
6301 const struct hda_fixup *fix,
6302 int action)
6303{
6304 struct alc_spec *spec = codec->spec;
98973f2f 6305
01e4a275 6306 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
98973f2f 6307 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
01e4a275
TI
6308 /* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
6309 spec->gpio_mask |= 0x10;
6310 spec->gpio_dir |= 0x10;
98973f2f 6311 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
98973f2f
KP
6312 }
6313}
6314
ae065f1c
TI
6315static void alc275_fixup_gpio4_off(struct hda_codec *codec,
6316 const struct hda_fixup *fix,
6317 int action)
6318{
6319 struct alc_spec *spec = codec->spec;
6320
6321 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6322 spec->gpio_mask |= 0x04;
6323 spec->gpio_dir |= 0x04;
6324 /* set data bit low */
6325 }
6326}
6327
6a6660d0
TI
6328/* Quirk for Thinkpad X1 7th and 8th Gen
6329 * The following fixed routing needed
6330 * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
6331 * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
6332 * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
6333 */
6334static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
6335 const struct hda_fixup *fix, int action)
6336{
6337 static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
6338 static const hda_nid_t preferred_pairs[] = {
6339 0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
6340 };
6341 struct alc_spec *spec = codec->spec;
6342
6343 switch (action) {
6344 case HDA_FIXUP_ACT_PRE_PROBE:
6345 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6346 spec->gen.preferred_dacs = preferred_pairs;
6347 break;
6348 case HDA_FIXUP_ACT_BUILD:
6349 /* The generic parser creates somewhat unintuitive volume ctls
6350 * with the fixed routing above, and the shared DAC2 may be
6351 * confusing for PA.
6352 * Rename those to unique names so that PA doesn't touch them
6353 * and use only Master volume.
6354 */
6355 rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
6356 rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
6357 break;
6358 }
6359}
6360
ca169cc2
KY
6361static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
6362 const struct hda_fixup *fix,
6363 int action)
6364{
6365 alc_fixup_dual_codecs(codec, fix, action);
6366 switch (action) {
6367 case HDA_FIXUP_ACT_PRE_PROBE:
6368 /* override card longname to provide a unique UCM profile */
6369 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
6370 break;
6371 case HDA_FIXUP_ACT_BUILD:
6372 /* rename Capture controls depending on the codec */
6373 rename_ctl(codec, "Capture Volume",
6374 codec->addr == 0 ?
6375 "Rear-Panel Capture Volume" :
6376 "Front-Panel Capture Volume");
6377 rename_ctl(codec, "Capture Switch",
6378 codec->addr == 0 ?
6379 "Rear-Panel Capture Switch" :
6380 "Front-Panel Capture Switch");
6381 break;
6382 }
6383}
6384
52e4e368
KHF
6385static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
6386 const struct hda_fixup *fix, int action)
6387{
6388 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6389 return;
6390
6391 codec->power_save_node = 1;
6392}
6393
92266651
KY
6394/* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
6395static void alc274_fixup_bind_dacs(struct hda_codec *codec,
6396 const struct hda_fixup *fix, int action)
6397{
6398 struct alc_spec *spec = codec->spec;
caf3c043 6399 static const hda_nid_t preferred_pairs[] = {
92266651
KY
6400 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
6401 0
6402 };
6403
6404 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6405 return;
6406
6407 spec->gen.preferred_dacs = preferred_pairs;
0700d3d1
KY
6408 spec->gen.auto_mute_via_amp = 1;
6409 codec->power_save_node = 0;
92266651
KY
6410}
6411
c84bfedc
TI
6412/* avoid DAC 0x06 for bass speaker 0x17; it has no volume control */
6413static void alc289_fixup_asus_ga401(struct hda_codec *codec,
6414 const struct hda_fixup *fix, int action)
6415{
6416 static const hda_nid_t preferred_pairs[] = {
6417 0x14, 0x02, 0x17, 0x02, 0x21, 0x03, 0
6418 };
6419 struct alc_spec *spec = codec->spec;
6420
6421 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6422 spec->gen.preferred_dacs = preferred_pairs;
6423 spec->gen.obey_preferred_dacs = 1;
6424 }
6425}
6426
c4cfcf6f
HW
6427/* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */
6428static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6429 const struct hda_fixup *fix, int action)
6430{
6431 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6432 return;
6433
6434 snd_hda_override_wcaps(codec, 0x03, 0);
6435}
6436
8a8de09c
KY
6437static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6438{
6439 switch (codec->core.vendor_id) {
6440 case 0x10ec0274:
6441 case 0x10ec0294:
6442 case 0x10ec0225:
6443 case 0x10ec0295:
6444 case 0x10ec0299:
6445 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6446 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6447 break;
1948fc06 6448 case 0x10ec0230:
8a8de09c
KY
6449 case 0x10ec0235:
6450 case 0x10ec0236:
6451 case 0x10ec0255:
6452 case 0x10ec0256:
527f4643 6453 case 0x19e58326:
8a8de09c
KY
6454 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6455 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6456 break;
6457 }
6458}
6459
8983eb60
KY
6460static void alc295_fixup_chromebook(struct hda_codec *codec,
6461 const struct hda_fixup *fix, int action)
6462{
d3ba58bb
KY
6463 struct alc_spec *spec = codec->spec;
6464
8983eb60 6465 switch (action) {
d3ba58bb
KY
6466 case HDA_FIXUP_ACT_PRE_PROBE:
6467 spec->ultra_low_power = true;
6468 break;
8983eb60 6469 case HDA_FIXUP_ACT_INIT:
8a8de09c 6470 alc_combo_jack_hp_jd_restart(codec);
8983eb60
KY
6471 break;
6472 }
6473}
6474
d1dd4211
KY
6475static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6476 const struct hda_fixup *fix, int action)
6477{
6478 if (action == HDA_FIXUP_ACT_PRE_PROBE)
6479 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6480}
6481
c3cdf189
LJ
6482
6483static void alc294_gx502_toggle_output(struct hda_codec *codec,
6484 struct hda_jack_callback *cb)
6485{
6486 /* The Windows driver sets the codec up in a very different way where
6487 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6488 */
6489 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6490 alc_write_coef_idx(codec, 0x10, 0x8a20);
6491 else
6492 alc_write_coef_idx(codec, 0x10, 0x0a20);
6493}
6494
6495static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6496 const struct hda_fixup *fix, int action)
6497{
6498 /* Pin 0x21: headphones/headset mic */
6499 if (!is_jack_detectable(codec, 0x21))
6500 return;
6501
6502 switch (action) {
6503 case HDA_FIXUP_ACT_PRE_PROBE:
6504 snd_hda_jack_detect_enable_callback(codec, 0x21,
6505 alc294_gx502_toggle_output);
6506 break;
6507 case HDA_FIXUP_ACT_INIT:
6508 /* Make sure to start in a correct state, i.e. if
6509 * headphones have been plugged in before powering up the system
6510 */
6511 alc294_gx502_toggle_output(codec, NULL);
6512 break;
6513 }
6514}
6515
c1b55029
DC
6516static void alc294_gu502_toggle_output(struct hda_codec *codec,
6517 struct hda_jack_callback *cb)
6518{
6519 /* Windows sets 0x10 to 0x8420 for Node 0x20 which is
6520 * responsible from changes between speakers and headphones
6521 */
6522 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6523 alc_write_coef_idx(codec, 0x10, 0x8420);
6524 else
6525 alc_write_coef_idx(codec, 0x10, 0x0a20);
6526}
6527
6528static void alc294_fixup_gu502_hp(struct hda_codec *codec,
6529 const struct hda_fixup *fix, int action)
6530{
6531 if (!is_jack_detectable(codec, 0x21))
6532 return;
6533
6534 switch (action) {
6535 case HDA_FIXUP_ACT_PRE_PROBE:
6536 snd_hda_jack_detect_enable_callback(codec, 0x21,
6537 alc294_gu502_toggle_output);
6538 break;
6539 case HDA_FIXUP_ACT_INIT:
6540 alc294_gu502_toggle_output(codec, NULL);
6541 break;
6542 }
6543}
6544
56496253
KY
6545static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6546 const struct hda_fixup *fix, int action)
6547{
6548 if (action != HDA_FIXUP_ACT_INIT)
6549 return;
6550
6551 msleep(100);
6552 alc_write_coef_idx(codec, 0x65, 0x0);
6553}
6554
8a8de09c
KY
6555static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6556 const struct hda_fixup *fix, int action)
6557{
6558 switch (action) {
6559 case HDA_FIXUP_ACT_INIT:
6560 alc_combo_jack_hp_jd_restart(codec);
6561 break;
6562 }
6563}
6564
92666d45
KY
6565static void alc_fixup_no_int_mic(struct hda_codec *codec,
6566 const struct hda_fixup *fix, int action)
6567{
6568 struct alc_spec *spec = codec->spec;
6569
6570 switch (action) {
6571 case HDA_FIXUP_ACT_PRE_PROBE:
6572 /* Mic RING SLEEVE swap for combo jack */
6573 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
6574 spec->no_internal_mic_pin = true;
6575 break;
6576 case HDA_FIXUP_ACT_INIT:
6577 alc_combo_jack_hp_jd_restart(codec);
6578 break;
6579 }
6580}
6581
d94befbb
DB
6582/* GPIO1 = amplifier on/off
6583 * GPIO3 = mic mute LED
6584 */
6585static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec,
6586 const struct hda_fixup *fix, int action)
6587{
6588 static const hda_nid_t conn[] = { 0x02 };
6589
6590 struct alc_spec *spec = codec->spec;
6591 static const struct hda_pintbl pincfgs[] = {
6592 { 0x14, 0x90170110 }, /* front/high speakers */
6593 { 0x17, 0x90170130 }, /* back/bass speakers */
6594 { }
6595 };
6596
6597 //enable micmute led
6598 alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04);
6599
6600 switch (action) {
6601 case HDA_FIXUP_ACT_PRE_PROBE:
6602 spec->micmute_led_polarity = 1;
6603 /* needed for amp of back speakers */
6604 spec->gpio_mask |= 0x01;
6605 spec->gpio_dir |= 0x01;
6606 snd_hda_apply_pincfgs(codec, pincfgs);
6607 /* share DAC to have unified volume control */
6608 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
6609 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6610 break;
6611 case HDA_FIXUP_ACT_INIT:
6612 /* need to toggle GPIO to enable the amp of back speakers */
6613 alc_update_gpio_data(codec, 0x01, true);
6614 msleep(100);
6615 alc_update_gpio_data(codec, 0x01, false);
6616 break;
6617 }
6618}
6619
434591b2
ED
6620static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec,
6621 const struct hda_fixup *fix, int action)
6622{
6623 static const hda_nid_t conn[] = { 0x02 };
6624 static const struct hda_pintbl pincfgs[] = {
6625 { 0x14, 0x90170110 }, /* rear speaker */
6626 { }
6627 };
6628
6629 switch (action) {
6630 case HDA_FIXUP_ACT_PRE_PROBE:
6631 snd_hda_apply_pincfgs(codec, pincfgs);
6632 /* force front speaker to DAC1 */
6633 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6634 break;
6635 }
6636}
6637
b317b032
TI
6638/* for hda_fixup_thinkpad_acpi() */
6639#include "thinkpad_helper.c"
b67ae3f1 6640
d5a6cabf
TI
6641static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
6642 const struct hda_fixup *fix, int action)
6643{
6644 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
6645 hda_fixup_thinkpad_acpi(codec, fix, action);
6646}
6647
ad7cc2d4
CB
6648/* Fixup for Lenovo Legion 15IMHg05 speaker output on headset removal. */
6649static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec,
6650 const struct hda_fixup *fix,
6651 int action)
6652{
6653 struct alc_spec *spec = codec->spec;
6654
6655 switch (action) {
6656 case HDA_FIXUP_ACT_PRE_PROBE:
6657 spec->gen.suppress_auto_mute = 1;
6658 break;
6659 }
6660}
6661
d3dca026
LT
6662static int comp_bind(struct device *dev)
6663{
6664 struct hda_codec *cdc = dev_to_hda_codec(dev);
6665 struct alc_spec *spec = cdc->spec;
1873ebd3
SB
6666 int ret, i;
6667
6668 ret = component_bind_all(dev, spec->comps);
6669 if (ret)
6670 return ret;
d3dca026 6671
1873ebd3
SB
6672 if (snd_hdac_is_power_on(&cdc->core)) {
6673 codec_dbg(cdc, "Resuming after bind.\n");
6674 for (i = 0; i < HDA_MAX_COMPONENTS; i++)
6675 if (spec->comps[i].resume_hook)
6676 spec->comps[i].resume_hook(spec->comps[i].dev);
6677 }
6678
6679 return 0;
d3dca026
LT
6680}
6681
6682static void comp_unbind(struct device *dev)
6683{
6684 struct hda_codec *cdc = dev_to_hda_codec(dev);
6685 struct alc_spec *spec = cdc->spec;
6686
6687 component_unbind_all(dev, spec->comps);
6688}
6689
6690static const struct component_master_ops comp_master_ops = {
6691 .bind = comp_bind,
6692 .unbind = comp_unbind,
6693};
6694
6695static void comp_generic_playback_hook(struct hda_pcm_stream *hinfo, struct hda_codec *cdc,
6696 struct snd_pcm_substream *sub, int action)
6697{
6698 struct alc_spec *spec = cdc->spec;
6699 int i;
6700
6701 for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6702 if (spec->comps[i].dev)
6703 spec->comps[i].playback_hook(spec->comps[i].dev, action);
6704 }
6705}
6706
ae7abe36
SB
6707static void cs35l41_generic_fixup(struct hda_codec *cdc, int action, const char *bus,
6708 const char *hid, int count)
6709{
6710 struct device *dev = hda_codec_dev(cdc);
6711 struct alc_spec *spec = cdc->spec;
6712 char *name;
6713 int ret, i;
6714
6715 switch (action) {
6716 case HDA_FIXUP_ACT_PRE_PROBE:
6717 for (i = 0; i < count; i++) {
6718 name = devm_kasprintf(dev, GFP_KERNEL,
6719 "%s-%s:00-cs35l41-hda.%d", bus, hid, i);
6720 if (!name)
6721 return;
22d5cbd2 6722 spec->comps[i].codec = cdc;
ae016b9d 6723 component_match_add(dev, &spec->match, component_compare_dev_name, name);
ae7abe36
SB
6724 }
6725 ret = component_master_add_with_match(dev, &comp_master_ops, spec->match);
6726 if (ret)
6727 codec_err(cdc, "Fail to register component aggregator %d\n", ret);
6728 else
6729 spec->gen.pcm_playback_hook = comp_generic_playback_hook;
6730 break;
6731 }
6732}
6733
6734static void cs35l41_fixup_i2c_two(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
6735{
6736 cs35l41_generic_fixup(cdc, action, "i2c", "CSC3551", 2);
6737}
6738
07bcab93
LT
6739static void cs35l41_fixup_spi_two(struct hda_codec *codec, const struct hda_fixup *fix, int action)
6740{
6741 cs35l41_generic_fixup(codec, action, "spi0", "CSC3551", 2);
6742}
6743
6744static void cs35l41_fixup_spi_four(struct hda_codec *codec, const struct hda_fixup *fix, int action)
6745{
6746 cs35l41_generic_fixup(codec, action, "spi0", "CSC3551", 4);
6747}
6748
d3dca026
LT
6749static void alc287_fixup_legion_16achg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
6750 int action)
6751{
14e42cee 6752 cs35l41_generic_fixup(cdc, action, "i2c", "CLSA0100", 2);
d3dca026
LT
6753}
6754
1e24881d
LT
6755static void alc287_fixup_legion_16ithg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
6756 int action)
6757{
6758 cs35l41_generic_fixup(cdc, action, "i2c", "CLSA0101", 2);
6759}
6760
bbf8ff6b
TB
6761/* for alc295_fixup_hp_top_speakers */
6762#include "hp_x360_helper.c"
6763
26928ca1
TI
6764/* for alc285_fixup_ideapad_s740_coef() */
6765#include "ideapad_s740_helper.c"
6766
619764cc
WS
6767static const struct coef_fw alc256_fixup_set_coef_defaults_coefs[] = {
6768 WRITE_COEF(0x10, 0x0020), WRITE_COEF(0x24, 0x0000),
6769 WRITE_COEF(0x26, 0x0000), WRITE_COEF(0x29, 0x3000),
6770 WRITE_COEF(0x37, 0xfe05), WRITE_COEF(0x45, 0x5089),
6771 {}
6772};
6773
6774static void alc256_fixup_set_coef_defaults(struct hda_codec *codec,
6775 const struct hda_fixup *fix,
6776 int action)
dd6dd6e3
WS
6777{
6778 /*
619764cc
WS
6779 * A certain other OS sets these coeffs to different values. On at least
6780 * one TongFang barebone these settings might survive even a cold
6781 * reboot. So to restore a clean slate the values are explicitly reset
6782 * to default here. Without this, the external microphone is always in a
6783 * plugged-in state, while the internal microphone is always in an
6784 * unplugged state, breaking the ability to use the internal microphone.
6785 */
6786 alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs);
dd6dd6e3
WS
6787}
6788
174a7fb3
WS
6789static const struct coef_fw alc233_fixup_no_audio_jack_coefs[] = {
6790 WRITE_COEF(0x1a, 0x9003), WRITE_COEF(0x1b, 0x0e2b), WRITE_COEF(0x37, 0xfe06),
6791 WRITE_COEF(0x38, 0x4981), WRITE_COEF(0x45, 0xd489), WRITE_COEF(0x46, 0x0074),
6792 WRITE_COEF(0x49, 0x0149),
6793 {}
6794};
6795
6796static void alc233_fixup_no_audio_jack(struct hda_codec *codec,
6797 const struct hda_fixup *fix,
6798 int action)
6799{
6800 /*
6801 * The audio jack input and output is not detected on the ASRock NUC Box
6802 * 1100 series when cold booting without this fix. Warm rebooting from a
6803 * certain other OS makes the audio functional, as COEF settings are
6804 * preserved in this case. This fix sets these altered COEF values as
6805 * the default.
6806 */
6807 alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs);
6808}
6809
edca7cc4
WS
6810static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec,
6811 const struct hda_fixup *fix,
6812 int action)
6813{
6814 /*
6815 * The Clevo NJ51CU comes either with the ALC293 or the ALC256 codec,
6816 * but uses the 0x8686 subproduct id in both cases. The ALC256 codec
6817 * needs an additional quirk for sound working after suspend and resume.
6818 */
6819 if (codec->core.vendor_id == 0x10ec0256) {
6820 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
6821 snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120);
6822 } else {
6823 snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c);
6824 }
6825}
6826
1efcdd9c
GM
6827static void alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec *codec,
6828 const struct hda_fixup *fix,
6829 int action)
6830{
6831 struct alc_spec *spec = codec->spec;
6832 struct hda_input_mux *imux = &spec->gen.input_mux;
6833 int i;
6834
6835 alc269_fixup_limit_int_mic_boost(codec, fix, action);
6836
6837 switch (action) {
6838 case HDA_FIXUP_ACT_PRE_PROBE:
6839 /**
6840 * Set the vref of pin 0x19 (Headset Mic) and pin 0x1b (Headphone Mic)
6841 * to Hi-Z to avoid pop noises at startup and when plugging and
6842 * unplugging headphones.
6843 */
6844 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6845 snd_hda_codec_set_pin_target(codec, 0x1b, PIN_VREFHIZ);
6846 break;
6847 case HDA_FIXUP_ACT_PROBE:
6848 /**
6849 * Make the internal mic (0x12) the default input source to
6850 * prevent pop noises on cold boot.
6851 */
6852 for (i = 0; i < imux->num_items; i++) {
6853 if (spec->gen.imux_pins[i] == 0x12) {
6854 spec->gen.cur_mux[0] = i;
6855 break;
6856 }
6857 }
6858 break;
6859 }
6860}
6861
3790a3d6
PJ
6862static void alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec *codec,
6863 const struct hda_fixup *fix, int action)
6864{
6865 /*
6866 * The Pin Complex 0x17 for the bass speakers is wrongly reported as
6867 * unconnected.
6868 */
6869 static const struct hda_pintbl pincfgs[] = {
6870 { 0x17, 0x90170121 },
6871 { }
6872 };
6873 /*
6874 * Avoid DAC 0x06 and 0x08, as they have no volume controls.
6875 * DAC 0x02 and 0x03 would be fine.
6876 */
6877 static const hda_nid_t conn[] = { 0x02, 0x03 };
6878 /*
6879 * Prefer both speakerbar (0x14) and bass speakers (0x17) connected to DAC 0x02.
6880 * Headphones (0x21) are connected to DAC 0x03.
6881 */
6882 static const hda_nid_t preferred_pairs[] = {
6883 0x14, 0x02,
6884 0x17, 0x02,
6885 0x21, 0x03,
6886 0
6887 };
6888 struct alc_spec *spec = codec->spec;
6889
6890 switch (action) {
6891 case HDA_FIXUP_ACT_PRE_PROBE:
6892 snd_hda_apply_pincfgs(codec, pincfgs);
6893 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6894 spec->gen.preferred_dacs = preferred_pairs;
6895 break;
6896 }
6897}
6898
1d045db9 6899enum {
f73bbf63 6900 ALC269_FIXUP_GPIO2,
1d045db9
TI
6901 ALC269_FIXUP_SONY_VAIO,
6902 ALC275_FIXUP_SONY_VAIO_GPIO2,
6903 ALC269_FIXUP_DELL_M101Z,
6904 ALC269_FIXUP_SKU_IGNORE,
6905 ALC269_FIXUP_ASUS_G73JW,
6906 ALC269_FIXUP_LENOVO_EAPD,
6907 ALC275_FIXUP_SONY_HWEQ,
e9bd7d5c 6908 ALC275_FIXUP_SONY_DISABLE_AAMIX,
1d045db9 6909 ALC271_FIXUP_DMIC,
017f2a10 6910 ALC269_FIXUP_PCM_44K,
adabb3ec 6911 ALC269_FIXUP_STEREO_DMIC,
7c478f03 6912 ALC269_FIXUP_HEADSET_MIC,
24519911
TI
6913 ALC269_FIXUP_QUANTA_MUTE,
6914 ALC269_FIXUP_LIFEBOOK,
2041d564 6915 ALC269_FIXUP_LIFEBOOK_EXTMIC,
cc7016ab 6916 ALC269_FIXUP_LIFEBOOK_HP_PIN,
4df3fd17 6917 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
fdcc968a 6918 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
a4297b5d
TI
6919 ALC269_FIXUP_AMIC,
6920 ALC269_FIXUP_DMIC,
6921 ALC269VB_FIXUP_AMIC,
6922 ALC269VB_FIXUP_DMIC,
08fb0d0e 6923 ALC269_FIXUP_HP_MUTE_LED,
d06ac143 6924 ALC269_FIXUP_HP_MUTE_LED_MIC1,
08fb0d0e 6925 ALC269_FIXUP_HP_MUTE_LED_MIC2,
7f783bd5 6926 ALC269_FIXUP_HP_MUTE_LED_MIC3,
9f5c6faf 6927 ALC269_FIXUP_HP_GPIO_LED,
9c5dc3bf
KY
6928 ALC269_FIXUP_HP_GPIO_MIC1_LED,
6929 ALC269_FIXUP_HP_LINE1_MIC1_LED,
693b613d 6930 ALC269_FIXUP_INV_DMIC,
108cc108 6931 ALC269_FIXUP_LENOVO_DOCK,
b590b38c 6932 ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
9b745ab8 6933 ALC269_FIXUP_NO_SHUTUP,
88cfcf86 6934 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
108cc108 6935 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
73bdd597
DH
6936 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6937 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
338cae56 6938 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
fcc6c877 6939 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
1efcdd9c 6940 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET,
73bdd597
DH
6941 ALC269_FIXUP_HEADSET_MODE,
6942 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
7819717b 6943 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
d240d1dc
DH
6944 ALC269_FIXUP_ASUS_X101_FUNC,
6945 ALC269_FIXUP_ASUS_X101_VERB,
6946 ALC269_FIXUP_ASUS_X101,
08a978db
DR
6947 ALC271_FIXUP_AMIC_MIC2,
6948 ALC271_FIXUP_HP_GATE_MIC_JACK,
b1e8972e 6949 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
42397004 6950 ALC269_FIXUP_ACER_AC700,
3e0d611b 6951 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
2cede303 6952 ALC269VB_FIXUP_ASUS_ZENBOOK,
23870831 6953 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
f882c4be 6954 ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE,
8e35cd4a 6955 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
02b504d9 6956 ALC269VB_FIXUP_ORDISSIMO_EVE2,
cd217a63 6957 ALC283_FIXUP_CHROME_BOOK,
0202e99c 6958 ALC283_FIXUP_SENSE_COMBO_JACK,
7bba2157 6959 ALC282_FIXUP_ASUS_TX300,
1bb3e062 6960 ALC283_FIXUP_INT_MIC,
338cae56 6961 ALC290_FIXUP_MONO_SPEAKERS,
0f4881dc
DH
6962 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6963 ALC290_FIXUP_SUBWOOFER,
6964 ALC290_FIXUP_SUBWOOFER_HSJACK,
b67ae3f1 6965 ALC269_FIXUP_THINKPAD_ACPI,
56f27013 6966 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
5824ce8d 6967 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
615966ad 6968 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9a22a8f5 6969 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
31278997 6970 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
9a22a8f5 6971 ALC255_FIXUP_HEADSET_MODE,
31278997 6972 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
a22aa26f 6973 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
1c37c223 6974 ALC292_FIXUP_TPT440_DOCK,
9a811230 6975 ALC292_FIXUP_TPT440,
abaa2274 6976 ALC283_FIXUP_HEADSET_MIC,
b3802783 6977 ALC255_FIXUP_MIC_MUTE_LED,
1a22e775 6978 ALC282_FIXUP_ASPIRE_V5_PINS,
c8426b27 6979 ALC269VB_FIXUP_ASPIRE_E1_COEF,
7a5255f1 6980 ALC280_FIXUP_HP_GPIO4,
eaa8e5ef 6981 ALC286_FIXUP_HP_GPIO_LED,
33f4acd3 6982 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
b4b33f9d 6983 ALC280_FIXUP_HP_DOCK_PINS,
04d5466a 6984 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
98973f2f 6985 ALC280_FIXUP_HP_9480M,
c3bb2b52 6986 ALC245_FIXUP_HP_X360_AMP,
d94befbb 6987 ALC285_FIXUP_HP_SPECTRE_X360_EB1,
e1e62b98
KY
6988 ALC288_FIXUP_DELL_HEADSET_MODE,
6989 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
831bfdf9
HW
6990 ALC288_FIXUP_DELL_XPS_13,
6991 ALC288_FIXUP_DISABLE_AAMIX,
5fab5829 6992 ALC292_FIXUP_DELL_E7X_AAMIX,
8b99aba7
TI
6993 ALC292_FIXUP_DELL_E7X,
6994 ALC292_FIXUP_DISABLE_AAMIX,
c04017ea 6995 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
54324221 6996 ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
977e6276 6997 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
2f726aec 6998 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
6ed1131f 6999 ALC275_FIXUP_DELL_XPS,
23adc192 7000 ALC293_FIXUP_LENOVO_SPK_NOISE,
3694cb29 7001 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
3b43b71f 7002 ALC255_FIXUP_DELL_SPK_NOISE,
d1dd4211 7003 ALC225_FIXUP_DISABLE_MIC_VREF,
2ae95577 7004 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
e312a869 7005 ALC295_FIXUP_DISABLE_DAC3,
d2cd795c 7006 ALC285_FIXUP_SPEAKER2_TO_DAC1,
f883982d 7007 ALC280_FIXUP_HP_HEADSET_MIC,
e549d190 7008 ALC221_FIXUP_HP_FRONT_MIC,
c636b95e 7009 ALC292_FIXUP_TPT460,
dd9aa335 7010 ALC298_FIXUP_SPK_VOLUME,
f86de9b1 7011 ALC298_FIXUP_LENOVO_SPK_VOLUME,
fd06c77e 7012 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
823ff161 7013 ALC269_FIXUP_ATIV_BOOK_8,
4ba5c853 7014 ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE,
9eb5d0e6 7015 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
c1732ede
CC
7016 ALC256_FIXUP_ASUS_HEADSET_MODE,
7017 ALC256_FIXUP_ASUS_MIC,
eeed4cd1 7018 ALC256_FIXUP_ASUS_AIO_GPIO2,
216d7aeb
CC
7019 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
7020 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
ca169cc2 7021 ALC233_FIXUP_LENOVO_MULTI_CODECS,
ea5c7eba 7022 ALC233_FIXUP_ACER_HEADSET_MIC,
f33f79f3 7023 ALC294_FIXUP_LENOVO_MIC_LOCATION,
5f364135 7024 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
52e4e368 7025 ALC225_FIXUP_S3_POP_NOISE,
b84e8436 7026 ALC700_FIXUP_INTEL_REFERENCE,
92266651
KY
7027 ALC274_FIXUP_DELL_BIND_DACS,
7028 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
399c01aa 7029 ALC298_FIXUP_TPT470_DOCK_FIX,
61fcf8ec 7030 ALC298_FIXUP_TPT470_DOCK,
ae104a21 7031 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
f0ba9d69 7032 ALC255_FIXUP_DELL_HEADSET_MIC,
0fbf21c3 7033 ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
a2ef03fe 7034 ALC298_FIXUP_HUAWEI_MBX_STEREO,
bbf8ff6b 7035 ALC295_FIXUP_HP_X360,
8a328ac1 7036 ALC221_FIXUP_HP_HEADSET_MIC,
c4cfcf6f 7037 ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
e8ed64b0 7038 ALC295_FIXUP_HP_AUTO_MUTE,
33aaebd4 7039 ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
d8ae458e 7040 ALC294_FIXUP_ASUS_MIC,
4e051106
JHP
7041 ALC294_FIXUP_ASUS_HEADSET_MIC,
7042 ALC294_FIXUP_ASUS_SPK,
89e3a568 7043 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
c8c6ee61 7044 ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
cbc05fd6 7045 ALC255_FIXUP_ACER_HEADSET_MIC,
10f5b1b8 7046 ALC295_FIXUP_CHROME_BOOK,
8983eb60 7047 ALC225_FIXUP_HEADSET_JACK,
136824ef
KY
7048 ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
7049 ALC225_FIXUP_WYSE_AUTO_MUTE,
7050 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
667a8f73 7051 ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
8c8967a7 7052 ALC256_FIXUP_ASUS_HEADSET_MIC,
e1037354 7053 ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
e2a829b3 7054 ALC299_FIXUP_PREDATOR_SPK,
bd9c10bc 7055 ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
e79c2269
KY
7056 ALC289_FIXUP_DELL_SPK2,
7057 ALC289_FIXUP_DUAL_SPK,
48e01504
CC
7058 ALC294_FIXUP_SPK2_TO_DAC1,
7059 ALC294_FIXUP_ASUS_DUAL_SPK,
6a6660d0 7060 ALC285_FIXUP_THINKPAD_X1_GEN7,
76f7dec0 7061 ALC285_FIXUP_THINKPAD_HEADSET_JACK,
8b33a134 7062 ALC294_FIXUP_ASUS_HPE,
1b94e59d 7063 ALC294_FIXUP_ASUS_COEF_1B,
c3cdf189
LJ
7064 ALC294_FIXUP_ASUS_GX502_HP,
7065 ALC294_FIXUP_ASUS_GX502_PINS,
7066 ALC294_FIXUP_ASUS_GX502_VERBS,
c1b55029
DC
7067 ALC294_FIXUP_ASUS_GU502_HP,
7068 ALC294_FIXUP_ASUS_GU502_PINS,
7069 ALC294_FIXUP_ASUS_GU502_VERBS,
f5a88b0a 7070 ALC285_FIXUP_HP_GPIO_LED,
431e76c3 7071 ALC285_FIXUP_HP_MUTE_LED,
e7d66cf7 7072 ALC236_FIXUP_HP_GPIO_LED,
24164f43 7073 ALC236_FIXUP_HP_MUTE_LED,
75b62ab6 7074 ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
a2d57ebe 7075 ALC298_FIXUP_SAMSUNG_AMP,
14425f1f 7076 ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
ef248d9b 7077 ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
9e43342b 7078 ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
8eae7e9b 7079 ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
6e15d126 7080 ALC269VC_FIXUP_ACER_HEADSET_MIC,
781c90c0 7081 ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
293a92c1 7082 ALC289_FIXUP_ASUS_GA401,
4b43d05a 7083 ALC289_FIXUP_ASUS_GA502,
f50a121d 7084 ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
56496253 7085 ALC285_FIXUP_HP_GPIO_AMP_INIT,
f1ec5be1
HC
7086 ALC269_FIXUP_CZC_B20,
7087 ALC269_FIXUP_CZC_TMI,
7088 ALC269_FIXUP_CZC_L101,
7089 ALC269_FIXUP_LEMOTE_A1802,
7090 ALC269_FIXUP_LEMOTE_A190X,
e2d2fded 7091 ALC256_FIXUP_INTEL_NUC8_RUGGED,
d1ee66c5
PC
7092 ALC233_FIXUP_INTEL_NUC8_DMIC,
7093 ALC233_FIXUP_INTEL_NUC8_BOOST,
73e7161e 7094 ALC256_FIXUP_INTEL_NUC10,
fc19d559 7095 ALC255_FIXUP_XIAOMI_HEADSET_MIC,
13468bfa 7096 ALC274_FIXUP_HP_MIC,
8a8de09c 7097 ALC274_FIXUP_HP_HEADSET_MIC,
622464c8 7098 ALC274_FIXUP_HP_ENVY_GPIO,
ef9ce66f 7099 ALC256_FIXUP_ASUS_HPE,
446b8185 7100 ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
a0ccbc53 7101 ALC287_FIXUP_HP_GPIO_LED,
9e885770 7102 ALC256_FIXUP_HP_HEADSET_MIC,
5fc462c3 7103 ALC245_FIXUP_HP_GPIO_LED,
92666d45 7104 ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
34cdf405 7105 ALC282_FIXUP_ACER_DISABLE_LINEOUT,
495dc763 7106 ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST,
d0e18561 7107 ALC256_FIXUP_ACER_HEADSET_MIC,
26928ca1 7108 ALC285_FIXUP_IDEAPAD_S740_COEF,
bd15b155 7109 ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST,
8eedd3a7 7110 ALC295_FIXUP_ASUS_DACS,
5d84b531 7111 ALC295_FIXUP_HP_OMEN,
f2be77fe 7112 ALC285_FIXUP_HP_SPECTRE_X360,
9ebaef05 7113 ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP,
29c8f40b 7114 ALC623_FIXUP_LENOVO_THINKSTATION_P340,
57c9e21a 7115 ALC255_FIXUP_ACER_HEADPHONE_AND_MIC,
8903376d 7116 ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST,
ad7cc2d4
CB
7117 ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS,
7118 ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
7119 ALC287_FIXUP_YOGA7_14ITL_SPEAKERS,
56ec3e75 7120 ALC298_FIXUP_LENOVO_C940_DUET7,
dd6dd6e3 7121 ALC287_FIXUP_13S_GEN2_SPEAKERS,
619764cc 7122 ALC256_FIXUP_SET_COEF_DEFAULTS,
1278cc5a 7123 ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
174a7fb3 7124 ALC233_FIXUP_NO_AUDIO_JACK,
edca7cc4 7125 ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME,
8f4c9042
BF
7126 ALC285_FIXUP_LEGION_Y9000X_SPEAKERS,
7127 ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
d3dca026 7128 ALC287_FIXUP_LEGION_16ACHG6,
ae7abe36 7129 ALC287_FIXUP_CS35L41_I2C_2,
b3fbe536 7130 ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED,
07bcab93 7131 ALC245_FIXUP_CS35L41_SPI_2,
ce18f905 7132 ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED,
07bcab93
LT
7133 ALC245_FIXUP_CS35L41_SPI_4,
7134 ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED,
91502a9a 7135 ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED,
309d7363 7136 ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE,
1e24881d 7137 ALC287_FIXUP_LEGION_16ITHG6,
3790a3d6
PJ
7138 ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
7139 ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN,
f1d4e28b
KY
7140};
7141
56ec3e75
TI
7142/* A special fixup for Lenovo C940 and Yoga Duet 7;
7143 * both have the very same PCI SSID, and we need to apply different fixups
7144 * depending on the codec ID
7145 */
7146static void alc298_fixup_lenovo_c940_duet7(struct hda_codec *codec,
7147 const struct hda_fixup *fix,
7148 int action)
7149{
7150 int id;
7151
7152 if (codec->core.vendor_id == 0x10ec0298)
7153 id = ALC298_FIXUP_LENOVO_SPK_VOLUME; /* C940 */
7154 else
7155 id = ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* Duet 7 */
7156 __snd_hda_apply_fixup(codec, id, action, 0);
7157}
7158
1727a771 7159static const struct hda_fixup alc269_fixups[] = {
f73bbf63
KHF
7160 [ALC269_FIXUP_GPIO2] = {
7161 .type = HDA_FIXUP_FUNC,
7162 .v.func = alc_fixup_gpio2,
7163 },
1d045db9 7164 [ALC269_FIXUP_SONY_VAIO] = {
fd108215
TI
7165 .type = HDA_FIXUP_PINCTLS,
7166 .v.pins = (const struct hda_pintbl[]) {
7167 {0x19, PIN_VREFGRD},
1d045db9
TI
7168 {}
7169 }
f1d4e28b 7170 },
1d045db9 7171 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
ae065f1c
TI
7172 .type = HDA_FIXUP_FUNC,
7173 .v.func = alc275_fixup_gpio4_off,
1d045db9
TI
7174 .chained = true,
7175 .chain_id = ALC269_FIXUP_SONY_VAIO
7176 },
7177 [ALC269_FIXUP_DELL_M101Z] = {
1727a771 7178 .type = HDA_FIXUP_VERBS,
1d045db9
TI
7179 .v.verbs = (const struct hda_verb[]) {
7180 /* Enables internal speaker */
7181 {0x20, AC_VERB_SET_COEF_INDEX, 13},
7182 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
7183 {}
7184 }
7185 },
7186 [ALC269_FIXUP_SKU_IGNORE] = {
1727a771 7187 .type = HDA_FIXUP_FUNC,
23d30f28 7188 .v.func = alc_fixup_sku_ignore,
1d045db9
TI
7189 },
7190 [ALC269_FIXUP_ASUS_G73JW] = {
1727a771
TI
7191 .type = HDA_FIXUP_PINS,
7192 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
7193 { 0x17, 0x99130111 }, /* subwoofer */
7194 { }
7195 }
7196 },
7197 [ALC269_FIXUP_LENOVO_EAPD] = {
1727a771 7198 .type = HDA_FIXUP_VERBS,
1d045db9
TI
7199 .v.verbs = (const struct hda_verb[]) {
7200 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
7201 {}
7202 }
7203 },
7204 [ALC275_FIXUP_SONY_HWEQ] = {
1727a771 7205 .type = HDA_FIXUP_FUNC,
1d045db9
TI
7206 .v.func = alc269_fixup_hweq,
7207 .chained = true,
7208 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
7209 },
e9bd7d5c
TI
7210 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
7211 .type = HDA_FIXUP_FUNC,
7212 .v.func = alc_fixup_disable_aamix,
7213 .chained = true,
7214 .chain_id = ALC269_FIXUP_SONY_VAIO
7215 },
1d045db9 7216 [ALC271_FIXUP_DMIC] = {
1727a771 7217 .type = HDA_FIXUP_FUNC,
1d045db9 7218 .v.func = alc271_fixup_dmic,
f1d4e28b 7219 },
017f2a10 7220 [ALC269_FIXUP_PCM_44K] = {
1727a771 7221 .type = HDA_FIXUP_FUNC,
017f2a10 7222 .v.func = alc269_fixup_pcm_44k,
012e7eb1
DH
7223 .chained = true,
7224 .chain_id = ALC269_FIXUP_QUANTA_MUTE
017f2a10 7225 },
adabb3ec 7226 [ALC269_FIXUP_STEREO_DMIC] = {
1727a771 7227 .type = HDA_FIXUP_FUNC,
adabb3ec
TI
7228 .v.func = alc269_fixup_stereo_dmic,
7229 },
7c478f03
DH
7230 [ALC269_FIXUP_HEADSET_MIC] = {
7231 .type = HDA_FIXUP_FUNC,
7232 .v.func = alc269_fixup_headset_mic,
7233 },
24519911 7234 [ALC269_FIXUP_QUANTA_MUTE] = {
1727a771 7235 .type = HDA_FIXUP_FUNC,
24519911
TI
7236 .v.func = alc269_fixup_quanta_mute,
7237 },
7238 [ALC269_FIXUP_LIFEBOOK] = {
1727a771
TI
7239 .type = HDA_FIXUP_PINS,
7240 .v.pins = (const struct hda_pintbl[]) {
24519911
TI
7241 { 0x1a, 0x2101103f }, /* dock line-out */
7242 { 0x1b, 0x23a11040 }, /* dock mic-in */
7243 { }
7244 },
7245 .chained = true,
7246 .chain_id = ALC269_FIXUP_QUANTA_MUTE
7247 },
2041d564
DH
7248 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
7249 .type = HDA_FIXUP_PINS,
7250 .v.pins = (const struct hda_pintbl[]) {
7251 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
7252 { }
7253 },
7254 },
cc7016ab
TI
7255 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
7256 .type = HDA_FIXUP_PINS,
7257 .v.pins = (const struct hda_pintbl[]) {
7258 { 0x21, 0x0221102f }, /* HP out */
7259 { }
7260 },
7261 },
4df3fd17
TI
7262 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
7263 .type = HDA_FIXUP_FUNC,
7264 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
7265 },
fdcc968a
JMG
7266 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
7267 .type = HDA_FIXUP_FUNC,
7268 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
7269 },
a4297b5d 7270 [ALC269_FIXUP_AMIC] = {
1727a771
TI
7271 .type = HDA_FIXUP_PINS,
7272 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
7273 { 0x14, 0x99130110 }, /* speaker */
7274 { 0x15, 0x0121401f }, /* HP out */
7275 { 0x18, 0x01a19c20 }, /* mic */
7276 { 0x19, 0x99a3092f }, /* int-mic */
7277 { }
7278 },
7279 },
7280 [ALC269_FIXUP_DMIC] = {
1727a771
TI
7281 .type = HDA_FIXUP_PINS,
7282 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
7283 { 0x12, 0x99a3092f }, /* int-mic */
7284 { 0x14, 0x99130110 }, /* speaker */
7285 { 0x15, 0x0121401f }, /* HP out */
7286 { 0x18, 0x01a19c20 }, /* mic */
7287 { }
7288 },
7289 },
7290 [ALC269VB_FIXUP_AMIC] = {
1727a771
TI
7291 .type = HDA_FIXUP_PINS,
7292 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
7293 { 0x14, 0x99130110 }, /* speaker */
7294 { 0x18, 0x01a19c20 }, /* mic */
7295 { 0x19, 0x99a3092f }, /* int-mic */
7296 { 0x21, 0x0121401f }, /* HP out */
7297 { }
7298 },
7299 },
2267ea97 7300 [ALC269VB_FIXUP_DMIC] = {
1727a771
TI
7301 .type = HDA_FIXUP_PINS,
7302 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
7303 { 0x12, 0x99a3092f }, /* int-mic */
7304 { 0x14, 0x99130110 }, /* speaker */
7305 { 0x18, 0x01a19c20 }, /* mic */
7306 { 0x21, 0x0121401f }, /* HP out */
7307 { }
7308 },
7309 },
08fb0d0e 7310 [ALC269_FIXUP_HP_MUTE_LED] = {
1727a771 7311 .type = HDA_FIXUP_FUNC,
08fb0d0e 7312 .v.func = alc269_fixup_hp_mute_led,
6d3cd5d4 7313 },
d06ac143
DH
7314 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
7315 .type = HDA_FIXUP_FUNC,
7316 .v.func = alc269_fixup_hp_mute_led_mic1,
7317 },
08fb0d0e 7318 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
1727a771 7319 .type = HDA_FIXUP_FUNC,
08fb0d0e 7320 .v.func = alc269_fixup_hp_mute_led_mic2,
420b0feb 7321 },
7f783bd5
TB
7322 [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
7323 .type = HDA_FIXUP_FUNC,
7324 .v.func = alc269_fixup_hp_mute_led_mic3,
e8ed64b0
GKK
7325 .chained = true,
7326 .chain_id = ALC295_FIXUP_HP_AUTO_MUTE
7f783bd5 7327 },
9f5c6faf
TI
7328 [ALC269_FIXUP_HP_GPIO_LED] = {
7329 .type = HDA_FIXUP_FUNC,
7330 .v.func = alc269_fixup_hp_gpio_led,
7331 },
9c5dc3bf
KY
7332 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
7333 .type = HDA_FIXUP_FUNC,
7334 .v.func = alc269_fixup_hp_gpio_mic1_led,
7335 },
7336 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
7337 .type = HDA_FIXUP_FUNC,
7338 .v.func = alc269_fixup_hp_line1_mic1_led,
7339 },
693b613d 7340 [ALC269_FIXUP_INV_DMIC] = {
1727a771 7341 .type = HDA_FIXUP_FUNC,
9d36a7dc 7342 .v.func = alc_fixup_inv_dmic,
693b613d 7343 },
9b745ab8
TI
7344 [ALC269_FIXUP_NO_SHUTUP] = {
7345 .type = HDA_FIXUP_FUNC,
7346 .v.func = alc_fixup_no_shutup,
7347 },
108cc108 7348 [ALC269_FIXUP_LENOVO_DOCK] = {
1727a771
TI
7349 .type = HDA_FIXUP_PINS,
7350 .v.pins = (const struct hda_pintbl[]) {
108cc108
DH
7351 { 0x19, 0x23a11040 }, /* dock mic */
7352 { 0x1b, 0x2121103f }, /* dock headphone */
7353 { }
7354 },
7355 .chained = true,
7356 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
7357 },
b590b38c
TI
7358 [ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
7359 .type = HDA_FIXUP_FUNC,
7360 .v.func = alc269_fixup_limit_int_mic_boost,
7361 .chained = true,
7362 .chain_id = ALC269_FIXUP_LENOVO_DOCK,
7363 },
108cc108 7364 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
1727a771 7365 .type = HDA_FIXUP_FUNC,
108cc108 7366 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
52129000
DH
7367 .chained = true,
7368 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
108cc108 7369 },
73bdd597
DH
7370 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7371 .type = HDA_FIXUP_PINS,
7372 .v.pins = (const struct hda_pintbl[]) {
7373 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7374 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7375 { }
7376 },
7377 .chained = true,
7378 .chain_id = ALC269_FIXUP_HEADSET_MODE
7379 },
7380 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7381 .type = HDA_FIXUP_PINS,
7382 .v.pins = (const struct hda_pintbl[]) {
7383 { 0x16, 0x21014020 }, /* dock line out */
7384 { 0x19, 0x21a19030 }, /* dock mic */
7385 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7386 { }
7387 },
7388 .chained = true,
7389 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7390 },
338cae56
DH
7391 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
7392 .type = HDA_FIXUP_PINS,
7393 .v.pins = (const struct hda_pintbl[]) {
7394 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7395 { }
7396 },
7397 .chained = true,
7398 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7399 },
fcc6c877
KY
7400 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
7401 .type = HDA_FIXUP_PINS,
7402 .v.pins = (const struct hda_pintbl[]) {
7403 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7404 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7405 { }
7406 },
7407 .chained = true,
7408 .chain_id = ALC269_FIXUP_HEADSET_MODE
7409 },
73bdd597
DH
7410 [ALC269_FIXUP_HEADSET_MODE] = {
7411 .type = HDA_FIXUP_FUNC,
7412 .v.func = alc_fixup_headset_mode,
6676f308 7413 .chained = true,
b3802783 7414 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
73bdd597
DH
7415 },
7416 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7417 .type = HDA_FIXUP_FUNC,
7418 .v.func = alc_fixup_headset_mode_no_hp_mic,
7419 },
7819717b
TI
7420 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
7421 .type = HDA_FIXUP_PINS,
7422 .v.pins = (const struct hda_pintbl[]) {
7423 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
7424 { }
7425 },
7426 .chained = true,
7427 .chain_id = ALC269_FIXUP_HEADSET_MODE,
7428 },
88cfcf86
DH
7429 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
7430 .type = HDA_FIXUP_PINS,
7431 .v.pins = (const struct hda_pintbl[]) {
7432 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7433 { }
7434 },
fbc78ad6
DH
7435 .chained = true,
7436 .chain_id = ALC269_FIXUP_HEADSET_MIC
88cfcf86 7437 },
0fbf21c3 7438 [ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
8ac51bbc
AB
7439 .type = HDA_FIXUP_PINS,
7440 .v.pins = (const struct hda_pintbl[]) {
7441 {0x12, 0x90a60130},
7442 {0x13, 0x40000000},
7443 {0x14, 0x90170110},
7444 {0x18, 0x411111f0},
7445 {0x19, 0x04a11040},
7446 {0x1a, 0x411111f0},
7447 {0x1b, 0x90170112},
7448 {0x1d, 0x40759a05},
7449 {0x1e, 0x411111f0},
7450 {0x21, 0x04211020},
7451 { }
7452 },
e2744fd7
AB
7453 .chained = true,
7454 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
8ac51bbc 7455 },
a2ef03fe
TE
7456 [ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
7457 .type = HDA_FIXUP_FUNC,
7458 .v.func = alc298_fixup_huawei_mbx_stereo,
7459 .chained = true,
7460 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
7461 },
d240d1dc
DH
7462 [ALC269_FIXUP_ASUS_X101_FUNC] = {
7463 .type = HDA_FIXUP_FUNC,
7464 .v.func = alc269_fixup_x101_headset_mic,
7465 },
7466 [ALC269_FIXUP_ASUS_X101_VERB] = {
7467 .type = HDA_FIXUP_VERBS,
7468 .v.verbs = (const struct hda_verb[]) {
7469 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
7470 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
7471 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
7472 { }
7473 },
7474 .chained = true,
7475 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
7476 },
7477 [ALC269_FIXUP_ASUS_X101] = {
7478 .type = HDA_FIXUP_PINS,
7479 .v.pins = (const struct hda_pintbl[]) {
7480 { 0x18, 0x04a1182c }, /* Headset mic */
7481 { }
7482 },
7483 .chained = true,
7484 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
7485 },
08a978db 7486 [ALC271_FIXUP_AMIC_MIC2] = {
1727a771
TI
7487 .type = HDA_FIXUP_PINS,
7488 .v.pins = (const struct hda_pintbl[]) {
08a978db
DR
7489 { 0x14, 0x99130110 }, /* speaker */
7490 { 0x19, 0x01a19c20 }, /* mic */
7491 { 0x1b, 0x99a7012f }, /* int-mic */
7492 { 0x21, 0x0121401f }, /* HP out */
7493 { }
7494 },
7495 },
7496 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
1727a771 7497 .type = HDA_FIXUP_FUNC,
08a978db
DR
7498 .v.func = alc271_hp_gate_mic_jack,
7499 .chained = true,
7500 .chain_id = ALC271_FIXUP_AMIC_MIC2,
7501 },
b1e8972e
OR
7502 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
7503 .type = HDA_FIXUP_FUNC,
7504 .v.func = alc269_fixup_limit_int_mic_boost,
7505 .chained = true,
7506 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
7507 },
42397004
DR
7508 [ALC269_FIXUP_ACER_AC700] = {
7509 .type = HDA_FIXUP_PINS,
7510 .v.pins = (const struct hda_pintbl[]) {
7511 { 0x12, 0x99a3092f }, /* int-mic */
7512 { 0x14, 0x99130110 }, /* speaker */
7513 { 0x18, 0x03a11c20 }, /* mic */
7514 { 0x1e, 0x0346101e }, /* SPDIF1 */
7515 { 0x21, 0x0321101f }, /* HP out */
7516 { }
7517 },
7518 .chained = true,
7519 .chain_id = ALC271_FIXUP_DMIC,
7520 },
3e0d611b
DH
7521 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
7522 .type = HDA_FIXUP_FUNC,
7523 .v.func = alc269_fixup_limit_int_mic_boost,
2793769f
DH
7524 .chained = true,
7525 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
3e0d611b 7526 },
2cede303
OR
7527 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
7528 .type = HDA_FIXUP_FUNC,
7529 .v.func = alc269_fixup_limit_int_mic_boost,
7530 .chained = true,
7531 .chain_id = ALC269VB_FIXUP_DMIC,
7532 },
23870831
TI
7533 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
7534 .type = HDA_FIXUP_VERBS,
7535 .v.verbs = (const struct hda_verb[]) {
7536 /* class-D output amp +5dB */
7537 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
7538 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
7539 {}
7540 },
7541 .chained = true,
7542 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
7543 },
f882c4be
MT
7544 [ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7545 .type = HDA_FIXUP_PINS,
7546 .v.pins = (const struct hda_pintbl[]) {
7547 { 0x18, 0x01a110f0 }, /* use as headset mic */
7548 { }
7549 },
7550 .chained = true,
7551 .chain_id = ALC269_FIXUP_HEADSET_MIC
7552 },
8e35cd4a
DH
7553 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
7554 .type = HDA_FIXUP_FUNC,
7555 .v.func = alc269_fixup_limit_int_mic_boost,
7556 .chained = true,
7557 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
7558 },
02b504d9
AA
7559 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
7560 .type = HDA_FIXUP_PINS,
7561 .v.pins = (const struct hda_pintbl[]) {
7562 { 0x12, 0x99a3092f }, /* int-mic */
7563 { 0x18, 0x03a11d20 }, /* mic */
7564 { 0x19, 0x411111f0 }, /* Unused bogus pin */
7565 { }
7566 },
7567 },
cd217a63
KY
7568 [ALC283_FIXUP_CHROME_BOOK] = {
7569 .type = HDA_FIXUP_FUNC,
7570 .v.func = alc283_fixup_chromebook,
7571 },
0202e99c
KY
7572 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
7573 .type = HDA_FIXUP_FUNC,
7574 .v.func = alc283_fixup_sense_combo_jack,
7575 .chained = true,
7576 .chain_id = ALC283_FIXUP_CHROME_BOOK,
7577 },
7bba2157
TI
7578 [ALC282_FIXUP_ASUS_TX300] = {
7579 .type = HDA_FIXUP_FUNC,
7580 .v.func = alc282_fixup_asus_tx300,
7581 },
1bb3e062
KY
7582 [ALC283_FIXUP_INT_MIC] = {
7583 .type = HDA_FIXUP_VERBS,
7584 .v.verbs = (const struct hda_verb[]) {
7585 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
7586 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
7587 { }
7588 },
7589 .chained = true,
7590 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7591 },
0f4881dc
DH
7592 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
7593 .type = HDA_FIXUP_PINS,
7594 .v.pins = (const struct hda_pintbl[]) {
7595 { 0x17, 0x90170112 }, /* subwoofer */
7596 { }
7597 },
7598 .chained = true,
7599 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7600 },
7601 [ALC290_FIXUP_SUBWOOFER] = {
7602 .type = HDA_FIXUP_PINS,
7603 .v.pins = (const struct hda_pintbl[]) {
7604 { 0x17, 0x90170112 }, /* subwoofer */
7605 { }
7606 },
7607 .chained = true,
7608 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
7609 },
338cae56
DH
7610 [ALC290_FIXUP_MONO_SPEAKERS] = {
7611 .type = HDA_FIXUP_FUNC,
7612 .v.func = alc290_fixup_mono_speakers,
0f4881dc
DH
7613 },
7614 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
7615 .type = HDA_FIXUP_FUNC,
7616 .v.func = alc290_fixup_mono_speakers,
338cae56
DH
7617 .chained = true,
7618 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
7619 },
b67ae3f1
DH
7620 [ALC269_FIXUP_THINKPAD_ACPI] = {
7621 .type = HDA_FIXUP_FUNC,
d5a6cabf 7622 .v.func = alc_fixup_thinkpad_acpi,
09da111a
TI
7623 .chained = true,
7624 .chain_id = ALC269_FIXUP_SKU_IGNORE,
b67ae3f1 7625 },
56f27013
DH
7626 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
7627 .type = HDA_FIXUP_FUNC,
7628 .v.func = alc_fixup_inv_dmic,
7629 .chained = true,
7630 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7631 },
5824ce8d 7632 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
17d30460
HW
7633 .type = HDA_FIXUP_PINS,
7634 .v.pins = (const struct hda_pintbl[]) {
7635 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7636 { }
5824ce8d
CC
7637 },
7638 .chained = true,
17d30460 7639 .chain_id = ALC255_FIXUP_HEADSET_MODE
5824ce8d 7640 },
615966ad
CC
7641 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7642 .type = HDA_FIXUP_PINS,
7643 .v.pins = (const struct hda_pintbl[]) {
7644 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7645 { }
7646 },
7647 .chained = true,
7648 .chain_id = ALC255_FIXUP_HEADSET_MODE
7649 },
9a22a8f5
KY
7650 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7651 .type = HDA_FIXUP_PINS,
7652 .v.pins = (const struct hda_pintbl[]) {
7653 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7654 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7655 { }
7656 },
7657 .chained = true,
7658 .chain_id = ALC255_FIXUP_HEADSET_MODE
7659 },
31278997
KY
7660 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7661 .type = HDA_FIXUP_PINS,
7662 .v.pins = (const struct hda_pintbl[]) {
7663 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7664 { }
7665 },
7666 .chained = true,
7667 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
7668 },
9a22a8f5
KY
7669 [ALC255_FIXUP_HEADSET_MODE] = {
7670 .type = HDA_FIXUP_FUNC,
7671 .v.func = alc_fixup_headset_mode_alc255,
4a83d42a 7672 .chained = true,
b3802783 7673 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
9a22a8f5 7674 },
31278997
KY
7675 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7676 .type = HDA_FIXUP_FUNC,
7677 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
7678 },
a22aa26f
KY
7679 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7680 .type = HDA_FIXUP_PINS,
7681 .v.pins = (const struct hda_pintbl[]) {
7682 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7683 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7684 { }
7685 },
7686 .chained = true,
7687 .chain_id = ALC269_FIXUP_HEADSET_MODE
7688 },
1c37c223 7689 [ALC292_FIXUP_TPT440_DOCK] = {
ec56af67 7690 .type = HDA_FIXUP_FUNC,
7f57d803 7691 .v.func = alc_fixup_tpt440_dock,
1c37c223
TI
7692 .chained = true,
7693 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7694 },
9a811230
TI
7695 [ALC292_FIXUP_TPT440] = {
7696 .type = HDA_FIXUP_FUNC,
157f0b7f 7697 .v.func = alc_fixup_disable_aamix,
9a811230
TI
7698 .chained = true,
7699 .chain_id = ALC292_FIXUP_TPT440_DOCK,
7700 },
abaa2274 7701 [ALC283_FIXUP_HEADSET_MIC] = {
9dc12862
DD
7702 .type = HDA_FIXUP_PINS,
7703 .v.pins = (const struct hda_pintbl[]) {
7704 { 0x19, 0x04a110f0 },
7705 { },
7706 },
7707 },
b3802783 7708 [ALC255_FIXUP_MIC_MUTE_LED] = {
00ef9940 7709 .type = HDA_FIXUP_FUNC,
8a503555 7710 .v.func = alc_fixup_micmute_led,
00ef9940 7711 },
1a22e775
TI
7712 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
7713 .type = HDA_FIXUP_PINS,
7714 .v.pins = (const struct hda_pintbl[]) {
7715 { 0x12, 0x90a60130 },
7716 { 0x14, 0x90170110 },
7717 { 0x17, 0x40000008 },
7718 { 0x18, 0x411111f0 },
0420694d 7719 { 0x19, 0x01a1913c },
1a22e775
TI
7720 { 0x1a, 0x411111f0 },
7721 { 0x1b, 0x411111f0 },
7722 { 0x1d, 0x40f89b2d },
7723 { 0x1e, 0x411111f0 },
7724 { 0x21, 0x0321101f },
7725 { },
7726 },
7727 },
c8426b27
TI
7728 [ALC269VB_FIXUP_ASPIRE_E1_COEF] = {
7729 .type = HDA_FIXUP_FUNC,
7730 .v.func = alc269vb_fixup_aspire_e1_coef,
7731 },
7a5255f1
DH
7732 [ALC280_FIXUP_HP_GPIO4] = {
7733 .type = HDA_FIXUP_FUNC,
7734 .v.func = alc280_fixup_hp_gpio4,
7735 },
eaa8e5ef
KY
7736 [ALC286_FIXUP_HP_GPIO_LED] = {
7737 .type = HDA_FIXUP_FUNC,
7738 .v.func = alc286_fixup_hp_gpio_led,
7739 },
33f4acd3
DH
7740 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
7741 .type = HDA_FIXUP_FUNC,
7742 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
7743 },
b4b33f9d
TC
7744 [ALC280_FIXUP_HP_DOCK_PINS] = {
7745 .type = HDA_FIXUP_PINS,
7746 .v.pins = (const struct hda_pintbl[]) {
7747 { 0x1b, 0x21011020 }, /* line-out */
7748 { 0x1a, 0x01a1903c }, /* headset mic */
7749 { 0x18, 0x2181103f }, /* line-in */
7750 { },
7751 },
7752 .chained = true,
7753 .chain_id = ALC280_FIXUP_HP_GPIO4
7754 },
04d5466a
JK
7755 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
7756 .type = HDA_FIXUP_PINS,
7757 .v.pins = (const struct hda_pintbl[]) {
7758 { 0x1b, 0x21011020 }, /* line-out */
7759 { 0x18, 0x2181103f }, /* line-in */
7760 { },
7761 },
7762 .chained = true,
7763 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
7764 },
98973f2f
KP
7765 [ALC280_FIXUP_HP_9480M] = {
7766 .type = HDA_FIXUP_FUNC,
7767 .v.func = alc280_fixup_hp_9480m,
7768 },
c3bb2b52
TI
7769 [ALC245_FIXUP_HP_X360_AMP] = {
7770 .type = HDA_FIXUP_FUNC,
7771 .v.func = alc245_fixup_hp_x360_amp,
5fc462c3
JC
7772 .chained = true,
7773 .chain_id = ALC245_FIXUP_HP_GPIO_LED
c3bb2b52 7774 },
e1e62b98
KY
7775 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
7776 .type = HDA_FIXUP_FUNC,
7777 .v.func = alc_fixup_headset_mode_dell_alc288,
7778 .chained = true,
b3802783 7779 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
e1e62b98
KY
7780 },
7781 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7782 .type = HDA_FIXUP_PINS,
7783 .v.pins = (const struct hda_pintbl[]) {
7784 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7785 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7786 { }
7787 },
7788 .chained = true,
7789 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
7790 },
831bfdf9
HW
7791 [ALC288_FIXUP_DISABLE_AAMIX] = {
7792 .type = HDA_FIXUP_FUNC,
7793 .v.func = alc_fixup_disable_aamix,
7794 .chained = true,
d44a6864 7795 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
831bfdf9
HW
7796 },
7797 [ALC288_FIXUP_DELL_XPS_13] = {
7798 .type = HDA_FIXUP_FUNC,
7799 .v.func = alc_fixup_dell_xps13,
7800 .chained = true,
7801 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
7802 },
8b99aba7
TI
7803 [ALC292_FIXUP_DISABLE_AAMIX] = {
7804 .type = HDA_FIXUP_FUNC,
7805 .v.func = alc_fixup_disable_aamix,
831bfdf9
HW
7806 .chained = true,
7807 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
8b99aba7 7808 },
c04017ea
DH
7809 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
7810 .type = HDA_FIXUP_FUNC,
7811 .v.func = alc_fixup_disable_aamix,
7812 .chained = true,
7813 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
7814 },
5fab5829 7815 [ALC292_FIXUP_DELL_E7X_AAMIX] = {
8b99aba7
TI
7816 .type = HDA_FIXUP_FUNC,
7817 .v.func = alc_fixup_dell_xps13,
7818 .chained = true,
7819 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
7820 },
5fab5829
TI
7821 [ALC292_FIXUP_DELL_E7X] = {
7822 .type = HDA_FIXUP_FUNC,
8a503555 7823 .v.func = alc_fixup_micmute_led,
5fab5829
TI
7824 /* micmute fixup must be applied at last */
7825 .chained_before = true,
7826 .chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
7827 },
54324221
JM
7828 [ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
7829 .type = HDA_FIXUP_PINS,
7830 .v.pins = (const struct hda_pintbl[]) {
7831 { 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
7832 { }
7833 },
7834 .chained_before = true,
7835 .chain_id = ALC269_FIXUP_HEADSET_MODE,
7836 },
977e6276
KY
7837 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7838 .type = HDA_FIXUP_PINS,
7839 .v.pins = (const struct hda_pintbl[]) {
7840 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7841 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7842 { }
7843 },
7844 .chained = true,
7845 .chain_id = ALC269_FIXUP_HEADSET_MODE
7846 },
2f726aec
HW
7847 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
7848 .type = HDA_FIXUP_PINS,
7849 .v.pins = (const struct hda_pintbl[]) {
7850 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7851 { }
7852 },
7853 .chained = true,
7854 .chain_id = ALC269_FIXUP_HEADSET_MODE
7855 },
6ed1131f
KY
7856 [ALC275_FIXUP_DELL_XPS] = {
7857 .type = HDA_FIXUP_VERBS,
7858 .v.verbs = (const struct hda_verb[]) {
7859 /* Enables internal speaker */
7860 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
7861 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
7862 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
7863 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
7864 {}
7865 }
7866 },
23adc192
HW
7867 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
7868 .type = HDA_FIXUP_FUNC,
7869 .v.func = alc_fixup_disable_aamix,
7870 .chained = true,
7871 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7872 },
3694cb29
K
7873 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
7874 .type = HDA_FIXUP_FUNC,
7875 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
7876 },
d1ee66c5
PC
7877 [ALC233_FIXUP_INTEL_NUC8_DMIC] = {
7878 .type = HDA_FIXUP_FUNC,
7879 .v.func = alc_fixup_inv_dmic,
7880 .chained = true,
7881 .chain_id = ALC233_FIXUP_INTEL_NUC8_BOOST,
7882 },
7883 [ALC233_FIXUP_INTEL_NUC8_BOOST] = {
7884 .type = HDA_FIXUP_FUNC,
7885 .v.func = alc269_fixup_limit_int_mic_boost
7886 },
3b43b71f
KHF
7887 [ALC255_FIXUP_DELL_SPK_NOISE] = {
7888 .type = HDA_FIXUP_FUNC,
7889 .v.func = alc_fixup_disable_aamix,
7890 .chained = true,
7891 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7892 },
d1dd4211
KY
7893 [ALC225_FIXUP_DISABLE_MIC_VREF] = {
7894 .type = HDA_FIXUP_FUNC,
7895 .v.func = alc_fixup_disable_mic_vref,
7896 .chained = true,
7897 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7898 },
2ae95577
DH
7899 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7900 .type = HDA_FIXUP_VERBS,
7901 .v.verbs = (const struct hda_verb[]) {
7902 /* Disable pass-through path for FRONT 14h */
7903 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7904 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7905 {}
7906 },
7907 .chained = true,
d1dd4211 7908 .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
2ae95577 7909 },
f883982d
TI
7910 [ALC280_FIXUP_HP_HEADSET_MIC] = {
7911 .type = HDA_FIXUP_FUNC,
7912 .v.func = alc_fixup_disable_aamix,
7913 .chained = true,
7914 .chain_id = ALC269_FIXUP_HEADSET_MIC,
7915 },
e549d190
HW
7916 [ALC221_FIXUP_HP_FRONT_MIC] = {
7917 .type = HDA_FIXUP_PINS,
7918 .v.pins = (const struct hda_pintbl[]) {
7919 { 0x19, 0x02a19020 }, /* Front Mic */
7920 { }
7921 },
7922 },
c636b95e
SE
7923 [ALC292_FIXUP_TPT460] = {
7924 .type = HDA_FIXUP_FUNC,
7925 .v.func = alc_fixup_tpt440_dock,
7926 .chained = true,
7927 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
7928 },
dd9aa335
HW
7929 [ALC298_FIXUP_SPK_VOLUME] = {
7930 .type = HDA_FIXUP_FUNC,
7931 .v.func = alc298_fixup_speaker_volume,
59ec4b57 7932 .chained = true,
2f726aec 7933 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
dd9aa335 7934 },
f86de9b1
KY
7935 [ALC298_FIXUP_LENOVO_SPK_VOLUME] = {
7936 .type = HDA_FIXUP_FUNC,
7937 .v.func = alc298_fixup_speaker_volume,
7938 },
e312a869
TI
7939 [ALC295_FIXUP_DISABLE_DAC3] = {
7940 .type = HDA_FIXUP_FUNC,
7941 .v.func = alc295_fixup_disable_dac3,
7942 },
d2cd795c
JK
7943 [ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
7944 .type = HDA_FIXUP_FUNC,
7945 .v.func = alc285_fixup_speaker2_to_dac1,
c37c0ab0
HW
7946 .chained = true,
7947 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
d2cd795c 7948 },
fd06c77e
KHF
7949 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
7950 .type = HDA_FIXUP_PINS,
7951 .v.pins = (const struct hda_pintbl[]) {
7952 { 0x1b, 0x90170151 },
7953 { }
7954 },
7955 .chained = true,
7956 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7957 },
823ff161
GM
7958 [ALC269_FIXUP_ATIV_BOOK_8] = {
7959 .type = HDA_FIXUP_FUNC,
7960 .v.func = alc_fixup_auto_mute_via_amp,
7961 .chained = true,
7962 .chain_id = ALC269_FIXUP_NO_SHUTUP
7963 },
4ba5c853
MT
7964 [ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE] = {
7965 .type = HDA_FIXUP_PINS,
7966 .v.pins = (const struct hda_pintbl[]) {
7967 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7968 { 0x1a, 0x01813030 }, /* use as headphone mic, without its own jack detect */
7969 { }
7970 },
7971 .chained = true,
7972 .chain_id = ALC269_FIXUP_HEADSET_MODE
7973 },
9eb5d0e6
KY
7974 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
7975 .type = HDA_FIXUP_PINS,
7976 .v.pins = (const struct hda_pintbl[]) {
7977 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7978 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7979 { }
7980 },
7981 .chained = true,
7982 .chain_id = ALC269_FIXUP_HEADSET_MODE
7983 },
c1732ede
CC
7984 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
7985 .type = HDA_FIXUP_FUNC,
7986 .v.func = alc_fixup_headset_mode,
7987 },
7988 [ALC256_FIXUP_ASUS_MIC] = {
7989 .type = HDA_FIXUP_PINS,
7990 .v.pins = (const struct hda_pintbl[]) {
7991 { 0x13, 0x90a60160 }, /* use as internal mic */
7992 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7993 { }
7994 },
7995 .chained = true,
7996 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7997 },
eeed4cd1 7998 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
ae065f1c
TI
7999 .type = HDA_FIXUP_FUNC,
8000 /* Set up GPIO2 for the speaker amp */
8001 .v.func = alc_fixup_gpio4,
eeed4cd1 8002 },
216d7aeb
CC
8003 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8004 .type = HDA_FIXUP_PINS,
8005 .v.pins = (const struct hda_pintbl[]) {
8006 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8007 { }
8008 },
8009 .chained = true,
8010 .chain_id = ALC269_FIXUP_HEADSET_MIC
8011 },
8012 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
8013 .type = HDA_FIXUP_VERBS,
8014 .v.verbs = (const struct hda_verb[]) {
8015 /* Enables internal speaker */
8016 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
8017 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
8018 {}
8019 },
8020 .chained = true,
8021 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
8022 },
ca169cc2
KY
8023 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
8024 .type = HDA_FIXUP_FUNC,
8025 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
f73bbf63
KHF
8026 .chained = true,
8027 .chain_id = ALC269_FIXUP_GPIO2
ca169cc2 8028 },
ea5c7eba
JHP
8029 [ALC233_FIXUP_ACER_HEADSET_MIC] = {
8030 .type = HDA_FIXUP_VERBS,
8031 .v.verbs = (const struct hda_verb[]) {
8032 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8033 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8034 { }
8035 },
8036 .chained = true,
8037 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
8038 },
f33f79f3
HW
8039 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
8040 .type = HDA_FIXUP_PINS,
8041 .v.pins = (const struct hda_pintbl[]) {
8042 /* Change the mic location from front to right, otherwise there are
8043 two front mics with the same name, pulseaudio can't handle them.
8044 This is just a temporary workaround, after applying this fixup,
8045 there will be one "Front Mic" and one "Mic" in this machine.
8046 */
8047 { 0x1a, 0x04a19040 },
8048 { }
8049 },
8050 },
5f364135
KY
8051 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
8052 .type = HDA_FIXUP_PINS,
8053 .v.pins = (const struct hda_pintbl[]) {
8054 { 0x16, 0x0101102f }, /* Rear Headset HP */
8055 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
8056 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
8057 { 0x1b, 0x02011020 },
8058 { }
8059 },
8060 .chained = true,
52e4e368
KHF
8061 .chain_id = ALC225_FIXUP_S3_POP_NOISE
8062 },
8063 [ALC225_FIXUP_S3_POP_NOISE] = {
8064 .type = HDA_FIXUP_FUNC,
8065 .v.func = alc225_fixup_s3_pop_noise,
8066 .chained = true,
5f364135
KY
8067 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8068 },
b84e8436
PH
8069 [ALC700_FIXUP_INTEL_REFERENCE] = {
8070 .type = HDA_FIXUP_VERBS,
8071 .v.verbs = (const struct hda_verb[]) {
8072 /* Enables internal speaker */
8073 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
8074 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
8075 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
8076 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
8077 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
8078 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
8079 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
8080 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
8081 {}
8082 }
8083 },
92266651
KY
8084 [ALC274_FIXUP_DELL_BIND_DACS] = {
8085 .type = HDA_FIXUP_FUNC,
8086 .v.func = alc274_fixup_bind_dacs,
8087 .chained = true,
8088 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
8089 },
8090 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
8091 .type = HDA_FIXUP_PINS,
8092 .v.pins = (const struct hda_pintbl[]) {
8093 { 0x1b, 0x0401102f },
8094 { }
8095 },
8096 .chained = true,
8097 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
8098 },
399c01aa 8099 [ALC298_FIXUP_TPT470_DOCK_FIX] = {
61fcf8ec
KY
8100 .type = HDA_FIXUP_FUNC,
8101 .v.func = alc_fixup_tpt470_dock,
8102 .chained = true,
8103 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
8104 },
399c01aa
TI
8105 [ALC298_FIXUP_TPT470_DOCK] = {
8106 .type = HDA_FIXUP_FUNC,
8107 .v.func = alc_fixup_tpt470_dacs,
8108 .chained = true,
8109 .chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
8110 },
ae104a21
KY
8111 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
8112 .type = HDA_FIXUP_PINS,
8113 .v.pins = (const struct hda_pintbl[]) {
8114 { 0x14, 0x0201101f },
8115 { }
8116 },
8117 .chained = true,
8118 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8119 },
f0ba9d69
KY
8120 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
8121 .type = HDA_FIXUP_PINS,
8122 .v.pins = (const struct hda_pintbl[]) {
8123 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8124 { }
8125 },
3ce0d5aa
HW
8126 .chained = true,
8127 .chain_id = ALC269_FIXUP_HEADSET_MIC
f0ba9d69 8128 },
bbf8ff6b
TB
8129 [ALC295_FIXUP_HP_X360] = {
8130 .type = HDA_FIXUP_FUNC,
8131 .v.func = alc295_fixup_hp_top_speakers,
8132 .chained = true,
8133 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
8a328ac1
KY
8134 },
8135 [ALC221_FIXUP_HP_HEADSET_MIC] = {
8136 .type = HDA_FIXUP_PINS,
8137 .v.pins = (const struct hda_pintbl[]) {
8138 { 0x19, 0x0181313f},
8139 { }
8140 },
8141 .chained = true,
8142 .chain_id = ALC269_FIXUP_HEADSET_MIC
8143 },
c4cfcf6f
HW
8144 [ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
8145 .type = HDA_FIXUP_FUNC,
8146 .v.func = alc285_fixup_invalidate_dacs,
6ba189c5
HW
8147 .chained = true,
8148 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
c4cfcf6f 8149 },
e8ed64b0
GKK
8150 [ALC295_FIXUP_HP_AUTO_MUTE] = {
8151 .type = HDA_FIXUP_FUNC,
8152 .v.func = alc_fixup_auto_mute_via_amp,
8153 },
33aaebd4
CC
8154 [ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
8155 .type = HDA_FIXUP_PINS,
8156 .v.pins = (const struct hda_pintbl[]) {
8157 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8158 { }
8159 },
8160 .chained = true,
8161 .chain_id = ALC269_FIXUP_HEADSET_MIC
8162 },
d8ae458e
CC
8163 [ALC294_FIXUP_ASUS_MIC] = {
8164 .type = HDA_FIXUP_PINS,
8165 .v.pins = (const struct hda_pintbl[]) {
8166 { 0x13, 0x90a60160 }, /* use as internal mic */
8167 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8168 { }
8169 },
8170 .chained = true,
ef9ddb9d 8171 .chain_id = ALC269_FIXUP_HEADSET_MIC
d8ae458e 8172 },
4e051106
JHP
8173 [ALC294_FIXUP_ASUS_HEADSET_MIC] = {
8174 .type = HDA_FIXUP_PINS,
8175 .v.pins = (const struct hda_pintbl[]) {
82b01149 8176 { 0x19, 0x01a1103c }, /* use as headset mic */
4e051106
JHP
8177 { }
8178 },
8179 .chained = true,
ef9ddb9d 8180 .chain_id = ALC269_FIXUP_HEADSET_MIC
4e051106
JHP
8181 },
8182 [ALC294_FIXUP_ASUS_SPK] = {
8183 .type = HDA_FIXUP_VERBS,
8184 .v.verbs = (const struct hda_verb[]) {
8185 /* Set EAPD high */
8186 { 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
8187 { 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
473fbe13
KY
8188 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8189 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
4e051106
JHP
8190 { }
8191 },
8192 .chained = true,
8193 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8194 },
c8a9afa6 8195 [ALC295_FIXUP_CHROME_BOOK] = {
e854747d 8196 .type = HDA_FIXUP_FUNC,
c8a9afa6 8197 .v.func = alc295_fixup_chromebook,
8983eb60
KY
8198 .chained = true,
8199 .chain_id = ALC225_FIXUP_HEADSET_JACK
8200 },
8201 [ALC225_FIXUP_HEADSET_JACK] = {
8202 .type = HDA_FIXUP_FUNC,
8203 .v.func = alc_fixup_headset_jack,
e854747d 8204 },
89e3a568
JS
8205 [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
8206 .type = HDA_FIXUP_PINS,
8207 .v.pins = (const struct hda_pintbl[]) {
8208 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8209 { }
8210 },
8211 .chained = true,
8212 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8213 },
c8c6ee61
HW
8214 [ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
8215 .type = HDA_FIXUP_VERBS,
8216 .v.verbs = (const struct hda_verb[]) {
8217 /* Disable PCBEEP-IN passthrough */
8218 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
8219 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
8220 { }
8221 },
8222 .chained = true,
8223 .chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
8224 },
cbc05fd6
JHP
8225 [ALC255_FIXUP_ACER_HEADSET_MIC] = {
8226 .type = HDA_FIXUP_PINS,
8227 .v.pins = (const struct hda_pintbl[]) {
8228 { 0x19, 0x03a11130 },
8229 { 0x1a, 0x90a60140 }, /* use as internal mic */
8230 { }
8231 },
8232 .chained = true,
8233 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
8234 },
136824ef
KY
8235 [ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
8236 .type = HDA_FIXUP_PINS,
8237 .v.pins = (const struct hda_pintbl[]) {
8238 { 0x16, 0x01011020 }, /* Rear Line out */
8239 { 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
8240 { }
8241 },
8242 .chained = true,
8243 .chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
8244 },
8245 [ALC225_FIXUP_WYSE_AUTO_MUTE] = {
8246 .type = HDA_FIXUP_FUNC,
8247 .v.func = alc_fixup_auto_mute_via_amp,
8248 .chained = true,
8249 .chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
8250 },
8251 [ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
8252 .type = HDA_FIXUP_FUNC,
8253 .v.func = alc_fixup_disable_mic_vref,
8254 .chained = true,
8255 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8256 },
667a8f73
JHP
8257 [ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
8258 .type = HDA_FIXUP_VERBS,
8259 .v.verbs = (const struct hda_verb[]) {
8260 { 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
8261 { 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
8262 { }
8263 },
8264 .chained = true,
8265 .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
8266 },
8c8967a7
DD
8267 [ALC256_FIXUP_ASUS_HEADSET_MIC] = {
8268 .type = HDA_FIXUP_PINS,
8269 .v.pins = (const struct hda_pintbl[]) {
8270 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
8271 { }
8272 },
8273 .chained = true,
8274 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8275 },
e1037354
JHP
8276 [ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8277 .type = HDA_FIXUP_PINS,
8278 .v.pins = (const struct hda_pintbl[]) {
8279 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8280 { }
8281 },
8282 .chained = true,
8283 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8284 },
e2a829b3
BR
8285 [ALC299_FIXUP_PREDATOR_SPK] = {
8286 .type = HDA_FIXUP_PINS,
8287 .v.pins = (const struct hda_pintbl[]) {
8288 { 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
8289 { }
8290 }
8291 },
bd9c10bc 8292 [ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
60083f9e
JHP
8293 .type = HDA_FIXUP_PINS,
8294 .v.pins = (const struct hda_pintbl[]) {
bd9c10bc
JMG
8295 { 0x19, 0x04a11040 },
8296 { 0x21, 0x04211020 },
60083f9e
JHP
8297 { }
8298 },
8299 .chained = true,
bd9c10bc 8300 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
60083f9e 8301 },
e79c2269 8302 [ALC289_FIXUP_DELL_SPK2] = {
bd9c10bc
JMG
8303 .type = HDA_FIXUP_PINS,
8304 .v.pins = (const struct hda_pintbl[]) {
e79c2269 8305 { 0x17, 0x90170130 }, /* bass spk */
bd9c10bc
JMG
8306 { }
8307 },
8308 .chained = true,
e79c2269 8309 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
bd9c10bc 8310 },
e79c2269
KY
8311 [ALC289_FIXUP_DUAL_SPK] = {
8312 .type = HDA_FIXUP_FUNC,
8313 .v.func = alc285_fixup_speaker2_to_dac1,
8314 .chained = true,
8315 .chain_id = ALC289_FIXUP_DELL_SPK2
8316 },
48e01504
CC
8317 [ALC294_FIXUP_SPK2_TO_DAC1] = {
8318 .type = HDA_FIXUP_FUNC,
8319 .v.func = alc285_fixup_speaker2_to_dac1,
8320 .chained = true,
8321 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8322 },
8323 [ALC294_FIXUP_ASUS_DUAL_SPK] = {
436e2550
JHP
8324 .type = HDA_FIXUP_FUNC,
8325 /* The GPIO must be pulled to initialize the AMP */
8326 .v.func = alc_fixup_gpio4,
8327 .chained = true,
48e01504 8328 .chain_id = ALC294_FIXUP_SPK2_TO_DAC1
436e2550 8329 },
6a6660d0
TI
8330 [ALC285_FIXUP_THINKPAD_X1_GEN7] = {
8331 .type = HDA_FIXUP_FUNC,
8332 .v.func = alc285_fixup_thinkpad_x1_gen7,
8333 .chained = true,
8334 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8335 },
76f7dec0
KY
8336 [ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
8337 .type = HDA_FIXUP_FUNC,
8338 .v.func = alc_fixup_headset_jack,
8339 .chained = true,
6a6660d0 8340 .chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
76f7dec0 8341 },
8b33a134
JHP
8342 [ALC294_FIXUP_ASUS_HPE] = {
8343 .type = HDA_FIXUP_VERBS,
8344 .v.verbs = (const struct hda_verb[]) {
8345 /* Set EAPD high */
8346 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8347 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
8348 { }
8349 },
8350 .chained = true,
8351 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8352 },
c3cdf189
LJ
8353 [ALC294_FIXUP_ASUS_GX502_PINS] = {
8354 .type = HDA_FIXUP_PINS,
8355 .v.pins = (const struct hda_pintbl[]) {
8356 { 0x19, 0x03a11050 }, /* front HP mic */
8357 { 0x1a, 0x01a11830 }, /* rear external mic */
8358 { 0x21, 0x03211020 }, /* front HP out */
8359 { }
8360 },
8361 .chained = true,
8362 .chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
8363 },
8364 [ALC294_FIXUP_ASUS_GX502_VERBS] = {
8365 .type = HDA_FIXUP_VERBS,
8366 .v.verbs = (const struct hda_verb[]) {
8367 /* set 0x15 to HP-OUT ctrl */
8368 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8369 /* unmute the 0x15 amp */
8370 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8371 { }
8372 },
8373 .chained = true,
8374 .chain_id = ALC294_FIXUP_ASUS_GX502_HP
8375 },
8376 [ALC294_FIXUP_ASUS_GX502_HP] = {
8377 .type = HDA_FIXUP_FUNC,
8378 .v.func = alc294_fixup_gx502_hp,
8379 },
c1b55029
DC
8380 [ALC294_FIXUP_ASUS_GU502_PINS] = {
8381 .type = HDA_FIXUP_PINS,
8382 .v.pins = (const struct hda_pintbl[]) {
8383 { 0x19, 0x01a11050 }, /* rear HP mic */
8384 { 0x1a, 0x01a11830 }, /* rear external mic */
8385 { 0x21, 0x012110f0 }, /* rear HP out */
8386 { }
8387 },
8388 .chained = true,
8389 .chain_id = ALC294_FIXUP_ASUS_GU502_VERBS
8390 },
8391 [ALC294_FIXUP_ASUS_GU502_VERBS] = {
8392 .type = HDA_FIXUP_VERBS,
8393 .v.verbs = (const struct hda_verb[]) {
8394 /* set 0x15 to HP-OUT ctrl */
8395 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8396 /* unmute the 0x15 amp */
8397 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8398 /* set 0x1b to HP-OUT */
8399 { 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
8400 { }
8401 },
8402 .chained = true,
8403 .chain_id = ALC294_FIXUP_ASUS_GU502_HP
8404 },
8405 [ALC294_FIXUP_ASUS_GU502_HP] = {
8406 .type = HDA_FIXUP_FUNC,
8407 .v.func = alc294_fixup_gu502_hp,
8408 },
1b94e59d
TI
8409 [ALC294_FIXUP_ASUS_COEF_1B] = {
8410 .type = HDA_FIXUP_VERBS,
8411 .v.verbs = (const struct hda_verb[]) {
8412 /* Set bit 10 to correct noisy output after reboot from
8413 * Windows 10 (due to pop noise reduction?)
8414 */
8415 { 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
8416 { 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
8417 { }
8418 },
f8fbcdfb
TI
8419 .chained = true,
8420 .chain_id = ALC289_FIXUP_ASUS_GA401,
1b94e59d 8421 },
f5a88b0a
KHF
8422 [ALC285_FIXUP_HP_GPIO_LED] = {
8423 .type = HDA_FIXUP_FUNC,
8424 .v.func = alc285_fixup_hp_gpio_led,
8425 },
431e76c3
KY
8426 [ALC285_FIXUP_HP_MUTE_LED] = {
8427 .type = HDA_FIXUP_FUNC,
8428 .v.func = alc285_fixup_hp_mute_led,
8429 },
e7d66cf7
JS
8430 [ALC236_FIXUP_HP_GPIO_LED] = {
8431 .type = HDA_FIXUP_FUNC,
8432 .v.func = alc236_fixup_hp_gpio_led,
8433 },
24164f43
KY
8434 [ALC236_FIXUP_HP_MUTE_LED] = {
8435 .type = HDA_FIXUP_FUNC,
8436 .v.func = alc236_fixup_hp_mute_led,
8437 },
75b62ab6
JW
8438 [ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF] = {
8439 .type = HDA_FIXUP_FUNC,
8440 .v.func = alc236_fixup_hp_mute_led_micmute_vref,
8441 },
a2d57ebe
KM
8442 [ALC298_FIXUP_SAMSUNG_AMP] = {
8443 .type = HDA_FIXUP_FUNC,
8444 .v.func = alc298_fixup_samsung_amp,
8445 .chained = true,
8446 .chain_id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET
8447 },
14425f1f
MP
8448 [ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
8449 .type = HDA_FIXUP_VERBS,
8450 .v.verbs = (const struct hda_verb[]) {
8451 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
8452 { }
8453 },
8454 },
ef248d9b
MK
8455 [ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
8456 .type = HDA_FIXUP_VERBS,
8457 .v.verbs = (const struct hda_verb[]) {
8458 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08},
8459 { 0x20, AC_VERB_SET_PROC_COEF, 0x2fcf},
8460 { }
8461 },
8462 },
9e43342b
CC
8463 [ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8464 .type = HDA_FIXUP_PINS,
8465 .v.pins = (const struct hda_pintbl[]) {
8466 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8467 { }
8468 },
8469 .chained = true,
8470 .chain_id = ALC269_FIXUP_HEADSET_MODE
8471 },
8eae7e9b
JHP
8472 [ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
8473 .type = HDA_FIXUP_PINS,
8474 .v.pins = (const struct hda_pintbl[]) {
8475 { 0x14, 0x90100120 }, /* use as internal speaker */
8476 { 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
8477 { 0x1a, 0x01011020 }, /* use as line out */
8478 { },
8479 },
8480 .chained = true,
8481 .chain_id = ALC269_FIXUP_HEADSET_MIC
8482 },
6e15d126
JHP
8483 [ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
8484 .type = HDA_FIXUP_PINS,
8485 .v.pins = (const struct hda_pintbl[]) {
8486 { 0x18, 0x02a11030 }, /* use as headset mic */
8487 { }
8488 },
8489 .chained = true,
8490 .chain_id = ALC269_FIXUP_HEADSET_MIC
8491 },
781c90c0
JHP
8492 [ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
8493 .type = HDA_FIXUP_PINS,
8494 .v.pins = (const struct hda_pintbl[]) {
8495 { 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
8496 { }
8497 },
8498 .chained = true,
8499 .chain_id = ALC269_FIXUP_HEADSET_MIC
8500 },
293a92c1 8501 [ALC289_FIXUP_ASUS_GA401] = {
c84bfedc
TI
8502 .type = HDA_FIXUP_FUNC,
8503 .v.func = alc289_fixup_asus_ga401,
8504 .chained = true,
8505 .chain_id = ALC289_FIXUP_ASUS_GA502,
ff53664d 8506 },
4b43d05a
AS
8507 [ALC289_FIXUP_ASUS_GA502] = {
8508 .type = HDA_FIXUP_PINS,
8509 .v.pins = (const struct hda_pintbl[]) {
8510 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
8511 { }
8512 },
8513 },
f50a121d
JHP
8514 [ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
8515 .type = HDA_FIXUP_PINS,
8516 .v.pins = (const struct hda_pintbl[]) {
8517 { 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
8518 { }
8519 },
8520 .chained = true,
8521 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8522 },
56496253
KY
8523 [ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
8524 .type = HDA_FIXUP_FUNC,
8525 .v.func = alc285_fixup_hp_gpio_amp_init,
8526 .chained = true,
8527 .chain_id = ALC285_FIXUP_HP_GPIO_LED
8528 },
f1ec5be1
HC
8529 [ALC269_FIXUP_CZC_B20] = {
8530 .type = HDA_FIXUP_PINS,
8531 .v.pins = (const struct hda_pintbl[]) {
8532 { 0x12, 0x411111f0 },
8533 { 0x14, 0x90170110 }, /* speaker */
8534 { 0x15, 0x032f1020 }, /* HP out */
8535 { 0x17, 0x411111f0 },
8536 { 0x18, 0x03ab1040 }, /* mic */
8537 { 0x19, 0xb7a7013f },
8538 { 0x1a, 0x0181305f },
8539 { 0x1b, 0x411111f0 },
8540 { 0x1d, 0x411111f0 },
8541 { 0x1e, 0x411111f0 },
8542 { }
8543 },
8544 .chain_id = ALC269_FIXUP_DMIC,
8545 },
8546 [ALC269_FIXUP_CZC_TMI] = {
8547 .type = HDA_FIXUP_PINS,
8548 .v.pins = (const struct hda_pintbl[]) {
8549 { 0x12, 0x4000c000 },
8550 { 0x14, 0x90170110 }, /* speaker */
8551 { 0x15, 0x0421401f }, /* HP out */
8552 { 0x17, 0x411111f0 },
8553 { 0x18, 0x04a19020 }, /* mic */
8554 { 0x19, 0x411111f0 },
8555 { 0x1a, 0x411111f0 },
8556 { 0x1b, 0x411111f0 },
8557 { 0x1d, 0x40448505 },
8558 { 0x1e, 0x411111f0 },
8559 { 0x20, 0x8000ffff },
8560 { }
8561 },
8562 .chain_id = ALC269_FIXUP_DMIC,
8563 },
8564 [ALC269_FIXUP_CZC_L101] = {
8565 .type = HDA_FIXUP_PINS,
8566 .v.pins = (const struct hda_pintbl[]) {
8567 { 0x12, 0x40000000 },
8568 { 0x14, 0x01014010 }, /* speaker */
8569 { 0x15, 0x411111f0 }, /* HP out */
8570 { 0x16, 0x411111f0 },
8571 { 0x18, 0x01a19020 }, /* mic */
8572 { 0x19, 0x02a19021 },
8573 { 0x1a, 0x0181302f },
8574 { 0x1b, 0x0221401f },
8575 { 0x1c, 0x411111f0 },
8576 { 0x1d, 0x4044c601 },
8577 { 0x1e, 0x411111f0 },
8578 { }
8579 },
8580 .chain_id = ALC269_FIXUP_DMIC,
8581 },
8582 [ALC269_FIXUP_LEMOTE_A1802] = {
8583 .type = HDA_FIXUP_PINS,
8584 .v.pins = (const struct hda_pintbl[]) {
8585 { 0x12, 0x40000000 },
8586 { 0x14, 0x90170110 }, /* speaker */
8587 { 0x17, 0x411111f0 },
8588 { 0x18, 0x03a19040 }, /* mic1 */
8589 { 0x19, 0x90a70130 }, /* mic2 */
8590 { 0x1a, 0x411111f0 },
8591 { 0x1b, 0x411111f0 },
8592 { 0x1d, 0x40489d2d },
8593 { 0x1e, 0x411111f0 },
8594 { 0x20, 0x0003ffff },
8595 { 0x21, 0x03214020 },
8596 { }
8597 },
8598 .chain_id = ALC269_FIXUP_DMIC,
8599 },
8600 [ALC269_FIXUP_LEMOTE_A190X] = {
8601 .type = HDA_FIXUP_PINS,
8602 .v.pins = (const struct hda_pintbl[]) {
8603 { 0x14, 0x99130110 }, /* speaker */
8604 { 0x15, 0x0121401f }, /* HP out */
8605 { 0x18, 0x01a19c20 }, /* rear mic */
8606 { 0x19, 0x99a3092f }, /* front mic */
8607 { 0x1b, 0x0201401f }, /* front lineout */
8608 { }
8609 },
8610 .chain_id = ALC269_FIXUP_DMIC,
8611 },
e2d2fded
KHF
8612 [ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
8613 .type = HDA_FIXUP_PINS,
8614 .v.pins = (const struct hda_pintbl[]) {
8615 { 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8616 { }
8617 },
8618 .chained = true,
8619 .chain_id = ALC269_FIXUP_HEADSET_MODE
8620 },
73e7161e
WS
8621 [ALC256_FIXUP_INTEL_NUC10] = {
8622 .type = HDA_FIXUP_PINS,
8623 .v.pins = (const struct hda_pintbl[]) {
8624 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8625 { }
8626 },
8627 .chained = true,
8628 .chain_id = ALC269_FIXUP_HEADSET_MODE
8629 },
fc19d559
HW
8630 [ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
8631 .type = HDA_FIXUP_VERBS,
8632 .v.verbs = (const struct hda_verb[]) {
8633 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8634 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8635 { }
8636 },
8637 .chained = true,
c84bfedc 8638 .chain_id = ALC289_FIXUP_ASUS_GA502
fc19d559 8639 },
13468bfa
HW
8640 [ALC274_FIXUP_HP_MIC] = {
8641 .type = HDA_FIXUP_VERBS,
8642 .v.verbs = (const struct hda_verb[]) {
8643 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8644 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8645 { }
8646 },
8647 },
8a8de09c
KY
8648 [ALC274_FIXUP_HP_HEADSET_MIC] = {
8649 .type = HDA_FIXUP_FUNC,
8650 .v.func = alc274_fixup_hp_headset_mic,
8651 .chained = true,
8652 .chain_id = ALC274_FIXUP_HP_MIC
8653 },
622464c8
TI
8654 [ALC274_FIXUP_HP_ENVY_GPIO] = {
8655 .type = HDA_FIXUP_FUNC,
8656 .v.func = alc274_fixup_hp_envy_gpio,
8657 },
ef9ce66f
KY
8658 [ALC256_FIXUP_ASUS_HPE] = {
8659 .type = HDA_FIXUP_VERBS,
8660 .v.verbs = (const struct hda_verb[]) {
8661 /* Set EAPD high */
8662 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8663 { 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
8664 { }
8665 },
8666 .chained = true,
8667 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8668 },
446b8185
KY
8669 [ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
8670 .type = HDA_FIXUP_FUNC,
8671 .v.func = alc_fixup_headset_jack,
8672 .chained = true,
8673 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8674 },
a0ccbc53
KY
8675 [ALC287_FIXUP_HP_GPIO_LED] = {
8676 .type = HDA_FIXUP_FUNC,
8677 .v.func = alc287_fixup_hp_gpio_led,
8678 },
9e885770
KY
8679 [ALC256_FIXUP_HP_HEADSET_MIC] = {
8680 .type = HDA_FIXUP_FUNC,
8681 .v.func = alc274_fixup_hp_headset_mic,
8682 },
92666d45
KY
8683 [ALC236_FIXUP_DELL_AIO_HEADSET_MIC] = {
8684 .type = HDA_FIXUP_FUNC,
8685 .v.func = alc_fixup_no_int_mic,
8686 .chained = true,
8687 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8688 },
34cdf405
CC
8689 [ALC282_FIXUP_ACER_DISABLE_LINEOUT] = {
8690 .type = HDA_FIXUP_PINS,
8691 .v.pins = (const struct hda_pintbl[]) {
8692 { 0x1b, 0x411111f0 },
8693 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8694 { },
8695 },
8696 .chained = true,
8697 .chain_id = ALC269_FIXUP_HEADSET_MODE
8698 },
495dc763
CC
8699 [ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST] = {
8700 .type = HDA_FIXUP_FUNC,
8701 .v.func = alc269_fixup_limit_int_mic_boost,
8702 .chained = true,
8703 .chain_id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
8704 },
d0e18561
CC
8705 [ALC256_FIXUP_ACER_HEADSET_MIC] = {
8706 .type = HDA_FIXUP_PINS,
8707 .v.pins = (const struct hda_pintbl[]) {
8708 { 0x19, 0x02a1113c }, /* use as headset mic, without its own jack detect */
8709 { 0x1a, 0x90a1092f }, /* use as internal mic */
8710 { }
8711 },
8712 .chained = true,
8713 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8714 },
26928ca1
TI
8715 [ALC285_FIXUP_IDEAPAD_S740_COEF] = {
8716 .type = HDA_FIXUP_FUNC,
8717 .v.func = alc285_fixup_ideapad_s740_coef,
8718 .chained = true,
8719 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8720 },
bd15b155
KHF
8721 [ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
8722 .type = HDA_FIXUP_FUNC,
8723 .v.func = alc269_fixup_limit_int_mic_boost,
8724 .chained = true,
8725 .chain_id = ALC285_FIXUP_HP_MUTE_LED,
8726 },
8eedd3a7
TI
8727 [ALC295_FIXUP_ASUS_DACS] = {
8728 .type = HDA_FIXUP_FUNC,
8729 .v.func = alc295_fixup_asus_dacs,
8730 },
5d84b531
TI
8731 [ALC295_FIXUP_HP_OMEN] = {
8732 .type = HDA_FIXUP_PINS,
8733 .v.pins = (const struct hda_pintbl[]) {
8734 { 0x12, 0xb7a60130 },
8735 { 0x13, 0x40000000 },
8736 { 0x14, 0x411111f0 },
8737 { 0x16, 0x411111f0 },
8738 { 0x17, 0x90170110 },
8739 { 0x18, 0x411111f0 },
8740 { 0x19, 0x02a11030 },
8741 { 0x1a, 0x411111f0 },
8742 { 0x1b, 0x04a19030 },
8743 { 0x1d, 0x40600001 },
8744 { 0x1e, 0x411111f0 },
8745 { 0x21, 0x03211020 },
8746 {}
8747 },
8748 .chained = true,
8749 .chain_id = ALC269_FIXUP_HP_LINE1_MIC1_LED,
8750 },
f2be77fe 8751 [ALC285_FIXUP_HP_SPECTRE_X360] = {
434591b2
ED
8752 .type = HDA_FIXUP_FUNC,
8753 .v.func = alc285_fixup_hp_spectre_x360,
f2be77fe 8754 },
d94befbb
DB
8755 [ALC285_FIXUP_HP_SPECTRE_X360_EB1] = {
8756 .type = HDA_FIXUP_FUNC,
8757 .v.func = alc285_fixup_hp_spectre_x360_eb1
8758 },
9ebaef05
HW
8759 [ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = {
8760 .type = HDA_FIXUP_FUNC,
8761 .v.func = alc285_fixup_ideapad_s740_coef,
8762 .chained = true,
8763 .chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
8764 },
29c8f40b
PU
8765 [ALC623_FIXUP_LENOVO_THINKSTATION_P340] = {
8766 .type = HDA_FIXUP_FUNC,
8767 .v.func = alc_fixup_no_shutup,
8768 .chained = true,
8769 .chain_id = ALC283_FIXUP_HEADSET_MIC,
8770 },
57c9e21a
HW
8771 [ALC255_FIXUP_ACER_HEADPHONE_AND_MIC] = {
8772 .type = HDA_FIXUP_PINS,
8773 .v.pins = (const struct hda_pintbl[]) {
8774 { 0x21, 0x03211030 }, /* Change the Headphone location to Left */
8775 { }
8776 },
8777 .chained = true,
8778 .chain_id = ALC255_FIXUP_XIAOMI_HEADSET_MIC
8779 },
8903376d
KHF
8780 [ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
8781 .type = HDA_FIXUP_FUNC,
8782 .v.func = alc269_fixup_limit_int_mic_boost,
8783 .chained = true,
8784 .chain_id = ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
8785 },
8f4c9042
BF
8786 [ALC285_FIXUP_LEGION_Y9000X_SPEAKERS] = {
8787 .type = HDA_FIXUP_FUNC,
8788 .v.func = alc285_fixup_ideapad_s740_coef,
8789 .chained = true,
8790 .chain_id = ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
8791 },
8792 [ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE] = {
8793 .type = HDA_FIXUP_FUNC,
8794 .v.func = alc287_fixup_legion_15imhg05_speakers,
8795 .chained = true,
8796 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8797 },
ad7cc2d4
CB
8798 [ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS] = {
8799 .type = HDA_FIXUP_VERBS,
8800 //.v.verbs = legion_15imhg05_coefs,
8801 .v.verbs = (const struct hda_verb[]) {
8802 // set left speaker Legion 7i.
8803 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8804 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
8805
8806 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8807 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8808 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8809 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
8810 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8811
8812 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8813 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8814 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8815 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8816 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8817
8818 // set right speaker Legion 7i.
8819 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8820 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
8821
8822 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8823 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8824 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8825 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
8826 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8827
8828 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8829 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8830 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8831 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8832 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8833 {}
8834 },
8835 .chained = true,
8836 .chain_id = ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
8837 },
8838 [ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE] = {
8839 .type = HDA_FIXUP_FUNC,
8840 .v.func = alc287_fixup_legion_15imhg05_speakers,
8841 .chained = true,
8842 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8843 },
8844 [ALC287_FIXUP_YOGA7_14ITL_SPEAKERS] = {
8845 .type = HDA_FIXUP_VERBS,
8846 .v.verbs = (const struct hda_verb[]) {
8847 // set left speaker Yoga 7i.
8848 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8849 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
8850
8851 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8852 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8853 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8854 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
8855 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8856
8857 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8858 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8859 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8860 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8861 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8862
8863 // set right speaker Yoga 7i.
8864 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8865 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
8866
8867 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8868 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8869 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8870 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
8871 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8872
8873 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8874 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8875 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8876 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8877 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8878 {}
8879 },
8880 .chained = true,
8881 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8882 },
56ec3e75
TI
8883 [ALC298_FIXUP_LENOVO_C940_DUET7] = {
8884 .type = HDA_FIXUP_FUNC,
8885 .v.func = alc298_fixup_lenovo_c940_duet7,
8886 },
ad7cc2d4
CB
8887 [ALC287_FIXUP_13S_GEN2_SPEAKERS] = {
8888 .type = HDA_FIXUP_VERBS,
8889 .v.verbs = (const struct hda_verb[]) {
8890 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8891 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
023a062f 8892 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
ad7cc2d4
CB
8893 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8894 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8895 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8896 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8897 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8898 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
8899 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8900 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8901 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8902 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8903 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8904 {}
8905 },
8906 .chained = true,
8907 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8908 },
619764cc 8909 [ALC256_FIXUP_SET_COEF_DEFAULTS] = {
dd6dd6e3 8910 .type = HDA_FIXUP_FUNC,
619764cc 8911 .v.func = alc256_fixup_set_coef_defaults,
dd6dd6e3 8912 },
5fc462c3
JC
8913 [ALC245_FIXUP_HP_GPIO_LED] = {
8914 .type = HDA_FIXUP_FUNC,
8915 .v.func = alc245_fixup_hp_gpio_led,
8916 },
1278cc5a
JS
8917 [ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
8918 .type = HDA_FIXUP_PINS,
8919 .v.pins = (const struct hda_pintbl[]) {
8920 { 0x19, 0x03a11120 }, /* use as headset mic, without its own jack detect */
8921 { }
8922 },
8923 .chained = true,
8924 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
8925 },
174a7fb3
WS
8926 [ALC233_FIXUP_NO_AUDIO_JACK] = {
8927 .type = HDA_FIXUP_FUNC,
8928 .v.func = alc233_fixup_no_audio_jack,
8929 },
edca7cc4
WS
8930 [ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME] = {
8931 .type = HDA_FIXUP_FUNC,
8932 .v.func = alc256_fixup_mic_no_presence_and_resume,
8933 .chained = true,
8934 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8935 },
d3dca026
LT
8936 [ALC287_FIXUP_LEGION_16ACHG6] = {
8937 .type = HDA_FIXUP_FUNC,
8938 .v.func = alc287_fixup_legion_16achg6_speakers,
8939 },
ae7abe36
SB
8940 [ALC287_FIXUP_CS35L41_I2C_2] = {
8941 .type = HDA_FIXUP_FUNC,
8942 .v.func = cs35l41_fixup_i2c_two,
a6ac60b3
HW
8943 .chained = true,
8944 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
ae7abe36 8945 },
b3fbe536
AC
8946 [ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED] = {
8947 .type = HDA_FIXUP_FUNC,
8948 .v.func = cs35l41_fixup_i2c_two,
8949 .chained = true,
8950 .chain_id = ALC285_FIXUP_HP_MUTE_LED,
ae7abe36 8951 },
07bcab93
LT
8952 [ALC245_FIXUP_CS35L41_SPI_2] = {
8953 .type = HDA_FIXUP_FUNC,
8954 .v.func = cs35l41_fixup_spi_two,
8955 },
ce18f905
KHF
8956 [ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED] = {
8957 .type = HDA_FIXUP_FUNC,
8958 .v.func = cs35l41_fixup_spi_two,
8959 .chained = true,
8960 .chain_id = ALC285_FIXUP_HP_GPIO_LED,
8961 },
07bcab93
LT
8962 [ALC245_FIXUP_CS35L41_SPI_4] = {
8963 .type = HDA_FIXUP_FUNC,
8964 .v.func = cs35l41_fixup_spi_four,
8965 },
8966 [ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED] = {
8967 .type = HDA_FIXUP_FUNC,
864cb14c 8968 .v.func = cs35l41_fixup_spi_four,
07bcab93 8969 .chained = true,
864cb14c 8970 .chain_id = ALC285_FIXUP_HP_GPIO_LED,
07bcab93 8971 },
91502a9a
AS
8972 [ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED] = {
8973 .type = HDA_FIXUP_VERBS,
8974 .v.verbs = (const struct hda_verb[]) {
8975 { 0x20, AC_VERB_SET_COEF_INDEX, 0x19 },
8976 { 0x20, AC_VERB_SET_PROC_COEF, 0x8e11 },
8977 { }
8978 },
8979 .chained = true,
8980 .chain_id = ALC285_FIXUP_HP_MUTE_LED,
8981 },
1efcdd9c
GM
8982 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET] = {
8983 .type = HDA_FIXUP_FUNC,
8984 .v.func = alc_fixup_dell4_mic_no_presence_quiet,
8985 .chained = true,
8986 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
8987 },
309d7363
DH
8988 [ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE] = {
8989 .type = HDA_FIXUP_PINS,
8990 .v.pins = (const struct hda_pintbl[]) {
8991 { 0x19, 0x02a1112c }, /* use as headset mic, without its own jack detect */
8992 { }
8993 },
8994 .chained = true,
8995 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8996 },
1e24881d
LT
8997 [ALC287_FIXUP_LEGION_16ITHG6] = {
8998 .type = HDA_FIXUP_FUNC,
8999 .v.func = alc287_fixup_legion_16ithg6_speakers,
9000 },
3790a3d6
PJ
9001 [ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK] = {
9002 .type = HDA_FIXUP_VERBS,
9003 .v.verbs = (const struct hda_verb[]) {
9004 // enable left speaker
9005 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9006 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9007
9008 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9009 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9010 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9011 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9012 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9013
9014 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9015 { 0x20, AC_VERB_SET_PROC_COEF, 0xf },
9016 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9017 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9018 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9019
9020 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9021 { 0x20, AC_VERB_SET_PROC_COEF, 0x10 },
9022 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9023 { 0x20, AC_VERB_SET_PROC_COEF, 0x40 },
9024 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9025
9026 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9027 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9028 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9029 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9030 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9031
9032 // enable right speaker
9033 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9034 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9035
9036 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9037 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9038 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9039 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9040 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9041
9042 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9043 { 0x20, AC_VERB_SET_PROC_COEF, 0xf },
9044 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9045 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9046 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9047
9048 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9049 { 0x20, AC_VERB_SET_PROC_COEF, 0x10 },
9050 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9051 { 0x20, AC_VERB_SET_PROC_COEF, 0x44 },
9052 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9053
9054 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9055 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9056 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9057 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9058 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9059
9060 { },
9061 },
9062 },
9063 [ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN] = {
9064 .type = HDA_FIXUP_FUNC,
9065 .v.func = alc287_fixup_yoga9_14iap7_bass_spk_pin,
9066 .chained = true,
9067 .chain_id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
9068 },
f1d4e28b
KY
9069};
9070
1d045db9 9071static const struct snd_pci_quirk alc269_fixup_tbl[] = {
a6b92b66 9072 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
693b613d
DH
9073 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
9074 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
aaedfb47 9075 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
7819717b 9076 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
aaedfb47
DH
9077 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
9078 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
02322ac9 9079 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
b1e8972e 9080 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
1a22e775 9081 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
433f894e 9082 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
c8426b27 9083 SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF),
13be30f1 9084 SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK),
705b65f1 9085 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
6e15d126 9086 SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
b9c2fa52 9087 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
495dc763 9088 SND_PCI_QUIRK(0x1025, 0x1094, "Acer Aspire E5-575T", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
c7531e31
CC
9089 SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9090 SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
13be30f1
CC
9091 SND_PCI_QUIRK(0x1025, 0x1166, "Acer Veriton N4640G", ALC269_FIXUP_LIFEBOOK),
9092 SND_PCI_QUIRK(0x1025, 0x1167, "Acer Veriton N6640G", ALC269_FIXUP_LIFEBOOK),
e2a829b3 9093 SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
8eae7e9b 9094 SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
781c90c0 9095 SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
d0e18561 9096 SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
667a8f73
JHP
9097 SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9098 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9099 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
d0e18561 9100 SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
5f3fe25e 9101 SND_PCI_QUIRK(0x1025, 0x129d, "Acer SWIFT SF313-51", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
35171fbf 9102 SND_PCI_QUIRK(0x1025, 0x1300, "Acer SWIFT SF314-56", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
2733cceb 9103 SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
ea5c7eba 9104 SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
cbc05fd6 9105 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
2a5bb694 9106 SND_PCI_QUIRK(0x1025, 0x141f, "Acer Spin SP513-54N", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
0d4867a1 9107 SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
f50a121d 9108 SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
57c9e21a 9109 SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC),
aaedfb47 9110 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
841bdf85 9111 SND_PCI_QUIRK(0x1028, 0x053c, "Dell Latitude E5430", ALC292_FIXUP_DELL_E7X),
6ed1131f 9112 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
86f799b8 9113 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
cf52103a 9114 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
8b99aba7
TI
9115 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
9116 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
0f4881dc 9117 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
73bdd597
DH
9118 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
9119 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
9120 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
0f4881dc
DH
9121 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
9122 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
98070576 9123 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
4275554d 9124 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
0f4881dc 9125 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
a22aa26f
KY
9126 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9127 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
831bfdf9 9128 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
afecb146 9129 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
3a05d12f 9130 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
8b72415d 9131 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
b734304f
KY
9132 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9133 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
c04017ea
DH
9134 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9135 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9136 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9137 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9138 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
fd06c77e 9139 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
3b43b71f 9140 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
c0ca5ece 9141 SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
709ae62e 9142 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
dd9aa335 9143 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
493de342 9144 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
aa143ad3 9145 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
5f364135 9146 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
40e2c4e5
KY
9147 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
9148 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
f0ba9d69
KY
9149 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
9150 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
ae104a21 9151 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
1885ff13 9152 SND_PCI_QUIRK(0x1028, 0x087d, "Dell Precision 5530", ALC289_FIXUP_DUAL_SPK),
136824ef 9153 SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
da484d00 9154 SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
c2a7c55a 9155 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
e79c2269 9156 SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
aa143ad3 9157 SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
78def224
KY
9158 SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
9159 SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
92666d45
KY
9160 SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
9161 SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
1efcdd9c 9162 SND_PCI_QUIRK(0x1028, 0x0a38, "Dell Latitude 7520", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET),
c1e89523 9163 SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC),
da946920 9164 SND_PCI_QUIRK(0x1028, 0x0a61, "Dell XPS 15 9510", ALC289_FIXUP_DUAL_SPK),
eb676622 9165 SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK),
2b987fe8
CC
9166 SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
9167 SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
15dad62f 9168 SND_PCI_QUIRK(0x1028, 0x0b19, "Dell XPS 15 9520", ALC289_FIXUP_DUAL_SPK),
bdc9b739 9169 SND_PCI_QUIRK(0x1028, 0x0b1a, "Dell Precision 5570", ALC289_FIXUP_DUAL_SPK),
a22aa26f
KY
9170 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9171 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
08fb0d0e 9172 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
9f5c6faf 9173 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
8e35cd4a 9174 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
7976eb49 9175 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8a02b164 9176 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8a02b164 9177 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
45461e3b
TI
9178 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9179 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
9180 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9181 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9c5dc3bf
KY
9182 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9183 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9184 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9185 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9c5dc3bf 9186 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9c5dc3bf
KY
9187 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9188 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9189 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9190 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9191 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9c5dc3bf 9192 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
04d5466a 9193 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
45461e3b 9194 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
c60666bd 9195 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd
KY
9196 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9197 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9198 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
45461e3b
TI
9199 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9200 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9201 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9202 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9203 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
9c5dc3bf 9204 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
45461e3b 9205 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
9c5dc3bf 9206 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
45461e3b 9207 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
9c5dc3bf 9208 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
c60666bd 9209 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 9210 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 9211 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 9212 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
45461e3b
TI
9213 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9214 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9215 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9216 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9217 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 9218 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd
KY
9219 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9220 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
45461e3b
TI
9221 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9222 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
9223 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9224 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8a02b164
KY
9225 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9226 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9227 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9228 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4ba5c853 9229 SND_PCI_QUIRK(0x103c, 0x2b5e, "HP 288 Pro G2 MT", ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE),
167897f4
JK
9230 SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9231 SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
1c9d9dfd
KY
9232 SND_PCI_QUIRK(0x103c, 0x8077, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
9233 SND_PCI_QUIRK(0x103c, 0x8158, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
563785ed 9234 SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
e549d190 9235 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
bbf8ff6b 9236 SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
aeedad25 9237 SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
167897f4
JK
9238 SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9239 SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
56e40eb6 9240 SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
901be145 9241 SND_PCI_QUIRK(0x103c, 0x841c, "HP Pavilion 15-CK0xx", ALC269_FIXUP_HP_MUTE_LED_MIC3),
190d0381 9242 SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
5d84b531 9243 SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
d33cd42d 9244 SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
f2be77fe 9245 SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
d296a74b 9246 SND_PCI_QUIRK(0x103c, 0x860f, "HP ZBook 15 G6", ALC285_FIXUP_HP_GPIO_AMP_INIT),
0ac05b25 9247 SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
b2c22910 9248 SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
622464c8 9249 SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
24df5428
IH
9250 SND_PCI_QUIRK(0x103c, 0x86e7, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9251 SND_PCI_QUIRK(0x103c, 0x86e8, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
15d295b5 9252 SND_PCI_QUIRK(0x103c, 0x8716, "HP Elite Dragonfly G2 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
61d3e874 9253 SND_PCI_QUIRK(0x103c, 0x8720, "HP EliteBook x360 1040 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
a598098c 9254 SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
c058493d 9255 SND_PCI_QUIRK(0x103c, 0x8728, "HP EliteBook 840 G7", ALC285_FIXUP_HP_GPIO_LED),
b2c22910 9256 SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
75b62ab6 9257 SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
05ec7161 9258 SND_PCI_QUIRK(0x103c, 0x8735, "HP ProBook 435 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
56496253 9259 SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
08befca4 9260 SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
431e76c3 9261 SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
24164f43 9262 SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
91bc1568
JS
9263 SND_PCI_QUIRK(0x103c, 0x8780, "HP ZBook Fury 17 G7 Mobile Workstation",
9264 ALC285_FIXUP_HP_GPIO_AMP_INIT),
9265 SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation",
9266 ALC285_FIXUP_HP_GPIO_AMP_INIT),
30267718 9267 SND_PCI_QUIRK(0x103c, 0x8786, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
b2e6b3d9 9268 SND_PCI_QUIRK(0x103c, 0x8787, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
375f8426 9269 SND_PCI_QUIRK(0x103c, 0x8788, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
48422958 9270 SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
e7d66cf7 9271 SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
2b70b264 9272 SND_PCI_QUIRK(0x103c, 0x87e7, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
fb3acdb2 9273 SND_PCI_QUIRK(0x103c, 0x87f1, "HP ProBook 630 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
417eadfd 9274 SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
a0ccbc53
KY
9275 SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
9276 SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
93ab3eaf 9277 SND_PCI_QUIRK(0x103c, 0x87f6, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
c3bb2b52 9278 SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
d07149ab 9279 SND_PCI_QUIRK(0x103c, 0x8805, "HP ProBook 650 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
dfc2e8ae 9280 SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
d94befbb
DB
9281 SND_PCI_QUIRK(0x103c, 0x8811, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9282 SND_PCI_QUIRK(0x103c, 0x8812, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
53b861be 9283 SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
c3d2c882 9284 SND_PCI_QUIRK(0x103c, 0x8847, "HP EliteBook x360 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
dfb06401 9285 SND_PCI_QUIRK(0x103c, 0x884b, "HP EliteBook 840 Aero G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
ca688339 9286 SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
8903376d
KHF
9287 SND_PCI_QUIRK(0x103c, 0x8862, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9288 SND_PCI_QUIRK(0x103c, 0x8863, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
50dbfae9 9289 SND_PCI_QUIRK(0x103c, 0x886d, "HP ZBook Fury 17.3 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
e650c1a9 9290 SND_PCI_QUIRK(0x103c, 0x8870, "HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
bbe183e0 9291 SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
600dd2a7 9292 SND_PCI_QUIRK(0x103c, 0x888d, "HP ZBook Power 15.6 inch G8 Mobile Workstation PC", ALC236_FIXUP_HP_GPIO_LED),
91502a9a 9293 SND_PCI_QUIRK(0x103c, 0x8895, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED),
0e68c4b1 9294 SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
bd15b155 9295 SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
42334fbc 9296 SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED),
5f5d8890
AC
9297 SND_PCI_QUIRK(0x103c, 0x896e, "HP EliteBook x360 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9298 SND_PCI_QUIRK(0x103c, 0x8971, "HP EliteBook 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9299 SND_PCI_QUIRK(0x103c, 0x8972, "HP EliteBook 840 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9300 SND_PCI_QUIRK(0x103c, 0x8973, "HP EliteBook 860 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9301 SND_PCI_QUIRK(0x103c, 0x8974, "HP EliteBook 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9302 SND_PCI_QUIRK(0x103c, 0x8975, "HP EliteBook x360 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
07bcab93
LT
9303 SND_PCI_QUIRK(0x103c, 0x8981, "HP Elite Dragonfly G3", ALC245_FIXUP_CS35L41_SPI_4),
9304 SND_PCI_QUIRK(0x103c, 0x898e, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
9305 SND_PCI_QUIRK(0x103c, 0x898f, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
b3fbe536 9306 SND_PCI_QUIRK(0x103c, 0x8991, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
07bcab93 9307 SND_PCI_QUIRK(0x103c, 0x8992, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2),
b3fbe536 9308 SND_PCI_QUIRK(0x103c, 0x8994, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
07bcab93 9309 SND_PCI_QUIRK(0x103c, 0x8995, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2),
e6194c8d
AC
9310 SND_PCI_QUIRK(0x103c, 0x89a4, "HP ProBook 440 G9", ALC236_FIXUP_HP_GPIO_LED),
9311 SND_PCI_QUIRK(0x103c, 0x89a6, "HP ProBook 450 G9", ALC236_FIXUP_HP_GPIO_LED),
024a7ad9 9312 SND_PCI_QUIRK(0x103c, 0x89aa, "HP EliteBook 630 G9", ALC236_FIXUP_HP_GPIO_LED),
e6194c8d
AC
9313 SND_PCI_QUIRK(0x103c, 0x89ac, "HP EliteBook 640 G9", ALC236_FIXUP_HP_GPIO_LED),
9314 SND_PCI_QUIRK(0x103c, 0x89ae, "HP EliteBook 650 G9", ALC236_FIXUP_HP_GPIO_LED),
07bcab93 9315 SND_PCI_QUIRK(0x103c, 0x89c3, "Zbook Studio G9", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
ce18f905 9316 SND_PCI_QUIRK(0x103c, 0x89c6, "Zbook Fury 17 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
f7ac570d 9317 SND_PCI_QUIRK(0x103c, 0x89ca, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
5f3d696e 9318 SND_PCI_QUIRK(0x103c, 0x8a78, "HP Dev One", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
61d30785
JS
9319 SND_PCI_QUIRK(0x103c, 0x8aa0, "HP ProBook 440 G9 (MB 8A9E)", ALC236_FIXUP_HP_GPIO_LED),
9320 SND_PCI_QUIRK(0x103c, 0x8aa3, "HP ProBook 450 G9 (MB 8AA1)", ALC236_FIXUP_HP_GPIO_LED),
9321 SND_PCI_QUIRK(0x103c, 0x8aa8, "HP EliteBook 640 G9 (MB 8AA6)", ALC236_FIXUP_HP_GPIO_LED),
9322 SND_PCI_QUIRK(0x103c, 0x8aab, "HP EliteBook 650 G9 (MB 8AA9)", ALC236_FIXUP_HP_GPIO_LED),
c578d5da
KHF
9323 SND_PCI_QUIRK(0x103c, 0x8ad1, "HP EliteBook 840 14 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9324 SND_PCI_QUIRK(0x103c, 0x8ad2, "HP EliteBook 860 16 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
c1732ede 9325 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
7bba2157 9326 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
3e0d611b 9327 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9cf6533e 9328 SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
c1732ede 9329 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
4eab0ea1 9330 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
3e0d611b 9331 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4eab0ea1 9332 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
3cd0ed63 9333 SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
5cfca596 9334 SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
4eab0ea1
TI
9335 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
9336 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
461122b9 9337 SND_PCI_QUIRK(0x1043, 0x12af, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
c1732ede 9338 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
3cd0ed63 9339 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
f882c4be 9340 SND_PCI_QUIRK(0x1043, 0x1313, "Asus K42JZ", ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE),
c1732ede 9341 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
2cede303 9342 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
23870831 9343 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
b16c8f22
TI
9344 SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
9345 SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
3e0d611b 9346 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
8eedd3a7 9347 SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
48e01504 9348 SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
3cd0ed63 9349 SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
8c8967a7 9350 SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
4963d66b 9351 SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
158ae2f5 9352 SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
4fad4fb9 9353 SND_PCI_QUIRK(0x1043, 0x1970, "ASUS UX550VE", ALC289_FIXUP_ASUS_GA401),
5de3b943 9354 SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE),
8b33a134 9355 SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
7900e817 9356 SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
017f2a10 9357 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
28e8af8a 9358 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
461122b9 9359 SND_PCI_QUIRK(0x1043, 0x1a8f, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
1b94e59d 9360 SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
693b613d 9361 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
615966ad 9362 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
4eab0ea1 9363 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
c1732ede 9364 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
b16c8f22 9365 SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401),
ef9ce66f 9366 SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
4b43d05a 9367 SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
c1b55029 9368 SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
76fae618 9369 SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
293a92c1 9370 SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
eeed4cd1 9371 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
adabb3ec
TI
9372 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
9373 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
9374 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
9375 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
d240d1dc 9376 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
1d045db9
TI
9377 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
9378 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
9379 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
e9bd7d5c 9380 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
cab561f8
TI
9381 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
9382 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
24519911 9383 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
4df3fd17 9384 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
cc7016ab 9385 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
fdcc968a 9386 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
c656f747 9387 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
2041d564 9388 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
b84e8436 9389 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
c656f747 9390 SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
6fa38ef1 9391 SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
ce2e79b2
PH
9392 SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
9393 SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
0fca97a2 9394 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
a33cc48d 9395 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
a2d57ebe
KM
9396 SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
9397 SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_AMP),
9398 SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_AMP),
9399 SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
823ff161 9400 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
a2d57ebe
KM
9401 SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_AMP),
9402 SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_AMP),
ef248d9b 9403 SND_PCI_QUIRK(0x144d, 0xc832, "Samsung Galaxy Book Flex Alpha (NP730QCJ)", ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
abaa2274
AA
9404 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
9405 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
8cd65271 9406 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
6ca653e3 9407 SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK),
b5acfe15 9408 SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
745f260b 9409 SND_PCI_QUIRK(0x1558, 0x1325, "Clevo N15[01][CW]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15
PH
9410 SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9411 SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9412 SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9413 SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9414 SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9415 SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9416 SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
be561ffa 9417 SND_PCI_QUIRK(0x1558, 0x4041, "Clevo NV4[15]PZ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15
PH
9418 SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9419 SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9420 SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1278cc5a
JS
9421 SND_PCI_QUIRK(0x1558, 0x5015, "Clevo NH5[58]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9422 SND_PCI_QUIRK(0x1558, 0x5017, "Clevo NH7[79]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15
PH
9423 SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9424 SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9425 SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9426 SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9427 SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1278cc5a
JS
9428 SND_PCI_QUIRK(0x1558, 0x50e1, "Clevo NH5[58]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9429 SND_PCI_QUIRK(0x1558, 0x50e2, "Clevo NH7[79]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15 9430 SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1d5cfca2 9431 SND_PCI_QUIRK(0x1558, 0x50f2, "Clevo NH50E[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15 9432 SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1d5cfca2
PH
9433 SND_PCI_QUIRK(0x1558, 0x50f5, "Clevo NH55EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9434 SND_PCI_QUIRK(0x1558, 0x50f6, "Clevo NH55DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15
PH
9435 SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9436 SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9437 SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9438 SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9439 SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1d5cfca2
PH
9440 SND_PCI_QUIRK(0x1558, 0x70f2, "Clevo NH79EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9441 SND_PCI_QUIRK(0x1558, 0x70f3, "Clevo NH77DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9442 SND_PCI_QUIRK(0x1558, 0x70f4, "Clevo NH77EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9443 SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
627ce0d6 9444 SND_PCI_QUIRK(0x1558, 0x7716, "Clevo NS50PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
90d74fdb 9445 SND_PCI_QUIRK(0x1558, 0x7717, "Clevo NS70PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11bea269 9446 SND_PCI_QUIRK(0x1558, 0x7718, "Clevo L140PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15
PH
9447 SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9448 SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9449 SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9450 SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9451 SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
745f260b
WS
9452 SND_PCI_QUIRK(0x1558, 0x8550, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9453 SND_PCI_QUIRK(0x1558, 0x8551, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9454 SND_PCI_QUIRK(0x1558, 0x8560, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
9455 SND_PCI_QUIRK(0x1558, 0x8561, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
9456 SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[57][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
b5acfe15 9457 SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9cb72750 9458 SND_PCI_QUIRK(0x1558, 0x866d, "Clevo NP5[05]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
86222af0 9459 SND_PCI_QUIRK(0x1558, 0x867c, "Clevo NP7[01]PNP", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
0c20fce1 9460 SND_PCI_QUIRK(0x1558, 0x867d, "Clevo NP7[01]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15 9461 SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
edca7cc4 9462 SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME),
b5acfe15
PH
9463 SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9464 SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9465 SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9466 SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1d5cfca2 9467 SND_PCI_QUIRK(0x1558, 0x9600, "Clevo N960K[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15
PH
9468 SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9469 SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
745f260b
WS
9470 SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL5[03]RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9471 SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL50NU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1d5cfca2
PH
9472 SND_PCI_QUIRK(0x1558, 0xb018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9473 SND_PCI_QUIRK(0x1558, 0xb019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9474 SND_PCI_QUIRK(0x1558, 0xb022, "Clevo NH77D[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9475 SND_PCI_QUIRK(0x1558, 0xc018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9476 SND_PCI_QUIRK(0x1558, 0xc019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9477 SND_PCI_QUIRK(0x1558, 0xc022, "Clevo NH77[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
ca169cc2 9478 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
29c8f40b 9479 SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
1d045db9
TI
9480 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
9481 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
9482 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
9483 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
9484 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
f552ff54 9485 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
b590b38c 9486 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
c8415a48 9487 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
4407be6b 9488 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
108cc108 9489 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
aaedfb47 9490 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
9a811230 9491 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
1c37c223 9492 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
a12137e7 9493 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
59a51a6b 9494 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
6d16941a 9495 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
7c21539c 9496 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
a4a9e082 9497 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
b6903c0e 9498 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
d05ea7da 9499 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
c0278669 9500 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
61fcf8ec
KY
9501 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9502 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
dab38e43 9503 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
c636b95e 9504 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
61fcf8ec
KY
9505 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
9506 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9507 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
e4c07b3b 9508 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
61fcf8ec
KY
9509 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9510 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9511 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
85981dfd 9512 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9774dc21 9513 SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
ca707b3f 9514 SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
446b8185
KY
9515 SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
9516 SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
ae7abe36
SB
9517 SND_PCI_QUIRK(0x17aa, 0x22f1, "Thinkpad", ALC287_FIXUP_CS35L41_I2C_2),
9518 SND_PCI_QUIRK(0x17aa, 0x22f2, "Thinkpad", ALC287_FIXUP_CS35L41_I2C_2),
9519 SND_PCI_QUIRK(0x17aa, 0x22f3, "Thinkpad", ALC287_FIXUP_CS35L41_I2C_2),
3694cb29 9520 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
6ef2f68f 9521 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
f33f79f3 9522 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
bef33e19 9523 SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
e41fc8c5 9524 SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
65811834 9525 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
8da5bbfc 9526 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
2a36c16e 9527 SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
8a6c55d0
AM
9528 SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
9529 SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
e4efa826 9530 SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
3790a3d6 9531 SND_PCI_QUIRK(0x17aa, 0x3801, "Lenovo Yoga9 14IAP7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
85743a84 9532 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo Yoga DuetITL 2021", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
2aac550d 9533 SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
56ec3e75 9534 SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940 / Yoga Duet 7", ALC298_FIXUP_LENOVO_C940_DUET7),
2aac550d 9535 SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
3b79954f 9536 SND_PCI_QUIRK(0x17aa, 0x3820, "Yoga Duet 7 13ITL6", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
8f4c9042 9537 SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
2aac550d 9538 SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
b81e9e5c 9539 SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
c07f2c7b 9540 SND_PCI_QUIRK(0x17aa, 0x383d, "Legion Y9000X 2019", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
9ebaef05 9541 SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
d3dca026 9542 SND_PCI_QUIRK(0x17aa, 0x3847, "Legion 7 16ACHG6", ALC287_FIXUP_LEGION_16ACHG6),
2aac550d 9543 SND_PCI_QUIRK(0x17aa, 0x384a, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
ad7cc2d4
CB
9544 SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
9545 SND_PCI_QUIRK(0x17aa, 0x3853, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
1e24881d 9546 SND_PCI_QUIRK(0x17aa, 0x3855, "Legion 7 16ITHG6", ALC287_FIXUP_LEGION_16ITHG6),
70cfdd03 9547 SND_PCI_QUIRK(0x17aa, 0x3869, "Lenovo Yoga7 14IAL7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
56f27013 9548 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
fedb2245 9549 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
56df90b6 9550 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
f552ff54 9551 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
a4a9e082 9552 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
1bb3e062 9553 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
c497d9f9 9554 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
cd5302c0 9555 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
f2aa1110 9556 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
80b311d3 9557 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
09ea9976 9558 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
037e1197 9559 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
23adc192 9560 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
0f087ee3 9561 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
9cd25743 9562 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
0f087ee3 9563 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
61fcf8ec
KY
9564 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9565 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9566 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
264fb034 9567 SND_PCI_QUIRK(0x17aa, 0x508b, "Thinkpad X12 Gen 1", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
cd5302c0 9568 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
61fcf8ec
KY
9569 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9570 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
1d045db9 9571 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
174a7fb3 9572 SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_NO_AUDIO_JACK),
0fbf21c3 9573 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
cbcdf8c4 9574 SND_PCI_QUIRK(0x19e5, 0x320f, "Huawei WRT-WX9 ", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
f1ec5be1
HC
9575 SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
9576 SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
9577 SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
02b504d9 9578 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
c656f747
TI
9579 SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
9580 SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
619764cc 9581 SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_SET_COEF_DEFAULTS),
8b3b2392
WS
9582 SND_PCI_QUIRK(0x1d05, 0x1096, "TongFang GMxMRxx", ALC269_FIXUP_NO_SHUTUP),
9583 SND_PCI_QUIRK(0x1d05, 0x1100, "TongFang GKxNRxx", ALC269_FIXUP_NO_SHUTUP),
9584 SND_PCI_QUIRK(0x1d05, 0x1111, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
9585 SND_PCI_QUIRK(0x1d05, 0x1119, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
9586 SND_PCI_QUIRK(0x1d05, 0x1129, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
9587 SND_PCI_QUIRK(0x1d05, 0x1147, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
9588 SND_PCI_QUIRK(0x1d05, 0x115c, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
9589 SND_PCI_QUIRK(0x1d05, 0x121b, "TongFang GMxAGxx", ALC269_FIXUP_NO_SHUTUP),
fc19d559 9590 SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
b95bc12e 9591 SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
695d1ec3 9592 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
9b043a8f 9593 SND_PCI_QUIRK(0x1d72, 0x1945, "Redmi G", ALC256_FIXUP_ASUS_HEADSET_MIC),
e1c86210 9594 SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
d1ee66c5 9595 SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
e2d2fded 9596 SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
73e7161e 9597 SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
309d7363 9598 SND_PCI_QUIRK(0xf111, 0x0001, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
a4297b5d 9599
a7f3eedc 9600#if 0
a4297b5d
TI
9601 /* Below is a quirk table taken from the old code.
9602 * Basically the device should work as is without the fixup table.
9603 * If BIOS doesn't give a proper info, enable the corresponding
9604 * fixup entry.
7d7eb9ea 9605 */
a4297b5d
TI
9606 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
9607 ALC269_FIXUP_AMIC),
9608 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
a4297b5d
TI
9609 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
9610 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
9611 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
9612 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
9613 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
9614 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
9615 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
9616 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
9617 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
9618 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
9619 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
9620 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
9621 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
9622 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
9623 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
9624 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
9625 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
9626 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
9627 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
9628 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
9629 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
9630 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
9631 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
9632 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
9633 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
9634 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
9635 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
9636 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
9637 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
9638 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
9639 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
9640 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
9641 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
9642 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
9643 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
9644 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
9645 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
9646 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
9647#endif
9648 {}
9649};
9650
214eef76
DH
9651static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
9652 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
9653 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
9654 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
9655 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
0fbf21c3 9656 SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
214eef76
DH
9657 {}
9658};
9659
1727a771 9660static const struct hda_model_fixup alc269_fixup_models[] = {
a4297b5d
TI
9661 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
9662 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
6e72aa5f
TI
9663 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
9664 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
9665 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
7c478f03 9666 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
b016951e
TI
9667 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
9668 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
108cc108 9669 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
b590b38c 9670 {.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
9f5c6faf 9671 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
04d5466a 9672 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
e32aa85a
DH
9673 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
9674 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
a26d96c7
TI
9675 {.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
9676 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
be8ef16a 9677 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
0202e99c 9678 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
1c37c223 9679 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
9a811230 9680 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
c636b95e 9681 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
399c01aa 9682 {.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
a26d96c7 9683 {.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
ba90d6a6 9684 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
28d1d6d2 9685 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
a26d96c7
TI
9686 {.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
9687 {.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
9688 {.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
9689 {.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
9690 {.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
9691 {.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
9692 {.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
9693 {.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
9694 {.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
9695 {.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
9696 {.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
9697 {.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
9698 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
9699 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
9700 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
9701 {.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
9702 {.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
9703 {.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
9704 {.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
9705 {.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
9706 {.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
9707 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
9708 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
9709 {.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
9710 {.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
9711 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
9712 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
9713 {.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
9714 {.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
9715 {.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
9716 {.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
9717 {.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
9718 {.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
9719 {.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
9720 {.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
9721 {.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
9722 {.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
9723 {.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
9724 {.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
9725 {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
b3802783 9726 {.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
a26d96c7 9727 {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
c8426b27 9728 {.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"},
a26d96c7
TI
9729 {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
9730 {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
9731 {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
9732 {.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
9733 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
9734 {.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
9735 {.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
9736 {.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
9737 {.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
9738 {.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
9739 {.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
9740 {.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
9741 {.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
9742 {.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
a26d96c7
TI
9743 {.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
9744 {.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
9745 {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
82aa0d7e 9746 {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
a26d96c7 9747 {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
d2cd795c 9748 {.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
a26d96c7
TI
9749 {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
9750 {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
9751 {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
9752 {.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
9753 {.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
9754 {.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
9755 {.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
9756 {.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
9757 {.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
9758 {.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
9759 {.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
9760 {.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
9761 {.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
9762 {.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
9763 {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
9764 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
9765 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
8983eb60
KY
9766 {.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
9767 {.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
e2a829b3 9768 {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
a2ef03fe 9769 {.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
bd9c10bc 9770 {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
a2d57ebe 9771 {.id = ALC298_FIXUP_SAMSUNG_AMP, .name = "alc298-samsung-amp"},
ef248d9b 9772 {.id = ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc256-samsung-headphone"},
fc19d559 9773 {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
13468bfa 9774 {.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
c3bb2b52 9775 {.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
5d84b531 9776 {.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
f2be77fe 9777 {.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
d94befbb 9778 {.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"},
9ebaef05 9779 {.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
3790a3d6 9780 {.id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN, .name = "alc287-yoga9-bass-spk-pin"},
29c8f40b 9781 {.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
57c9e21a 9782 {.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
aa723946 9783 {.id = ALC285_FIXUP_HP_GPIO_AMP_INIT, .name = "alc285-hp-amp-init"},
1d045db9 9784 {}
6dda9f4a 9785};
cfc5a845 9786#define ALC225_STANDARD_PINS \
cfc5a845 9787 {0x21, 0x04211020}
6dda9f4a 9788
e8191a8e
HW
9789#define ALC256_STANDARD_PINS \
9790 {0x12, 0x90a60140}, \
9791 {0x14, 0x90170110}, \
e8191a8e
HW
9792 {0x21, 0x02211020}
9793
fea185e2 9794#define ALC282_STANDARD_PINS \
11580297 9795 {0x14, 0x90170110}
e1e62b98 9796
fea185e2 9797#define ALC290_STANDARD_PINS \
11580297 9798 {0x12, 0x99a30130}
fea185e2
DH
9799
9800#define ALC292_STANDARD_PINS \
9801 {0x14, 0x90170110}, \
11580297 9802 {0x15, 0x0221401f}
977e6276 9803
3f640970
HW
9804#define ALC295_STANDARD_PINS \
9805 {0x12, 0xb7a60130}, \
9806 {0x14, 0x90170110}, \
3f640970
HW
9807 {0x21, 0x04211020}
9808
703867e2
WS
9809#define ALC298_STANDARD_PINS \
9810 {0x12, 0x90a60130}, \
9811 {0x21, 0x03211020}
9812
e1918938 9813static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
8a328ac1
KY
9814 SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
9815 {0x14, 0x01014020},
9816 {0x17, 0x90170110},
9817 {0x18, 0x02a11030},
9818 {0x19, 0x0181303F},
9819 {0x21, 0x0221102f}),
5824ce8d
CC
9820 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
9821 {0x12, 0x90a601c0},
9822 {0x14, 0x90171120},
9823 {0x21, 0x02211030}),
615966ad
CC
9824 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9825 {0x14, 0x90170110},
9826 {0x1b, 0x90a70130},
9827 {0x21, 0x03211020}),
9828 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9829 {0x1a, 0x90a70130},
9830 {0x1b, 0x90170110},
9831 {0x21, 0x03211020}),
2ae95577 9832 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
cfc5a845 9833 ALC225_STANDARD_PINS,
8a132099 9834 {0x12, 0xb7a60130},
cfc5a845 9835 {0x14, 0x901701a0}),
2ae95577 9836 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
cfc5a845 9837 ALC225_STANDARD_PINS,
8a132099 9838 {0x12, 0xb7a60130},
cfc5a845 9839 {0x14, 0x901701b0}),
8a132099
HW
9840 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9841 ALC225_STANDARD_PINS,
9842 {0x12, 0xb7a60150},
9843 {0x14, 0x901701a0}),
9844 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9845 ALC225_STANDARD_PINS,
9846 {0x12, 0xb7a60150},
9847 {0x14, 0x901701b0}),
9848 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9849 ALC225_STANDARD_PINS,
9850 {0x12, 0xb7a60130},
9851 {0x1b, 0x90170110}),
0ce48e17
KHF
9852 SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9853 {0x1b, 0x01111010},
9854 {0x1e, 0x01451130},
9855 {0x21, 0x02211020}),
986376b6
HW
9856 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
9857 {0x12, 0x90a60140},
9858 {0x14, 0x90170110},
9859 {0x19, 0x02a11030},
9860 {0x21, 0x02211020}),
e41fc8c5
HW
9861 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9862 {0x14, 0x90170110},
9863 {0x19, 0x02a11030},
9864 {0x1a, 0x02a11040},
9865 {0x1b, 0x01014020},
9866 {0x21, 0x0221101f}),
d06fb562
HW
9867 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9868 {0x14, 0x90170110},
9869 {0x19, 0x02a11030},
9870 {0x1a, 0x02a11040},
9871 {0x1b, 0x01011020},
9872 {0x21, 0x0221101f}),
c6b17f10
HW
9873 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9874 {0x14, 0x90170110},
9875 {0x19, 0x02a11020},
9876 {0x1a, 0x02a11030},
9877 {0x21, 0x0221101f}),
92666d45
KY
9878 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
9879 {0x21, 0x02211010}),
9e885770
KY
9880 SND_HDA_PIN_QUIRK(0x10ec0236, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
9881 {0x14, 0x90170110},
9882 {0x19, 0x02a11020},
9883 {0x21, 0x02211030}),
c77900e6 9884 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
c77900e6 9885 {0x14, 0x90170110},
c77900e6 9886 {0x21, 0x02211020}),
86c72d1c
HW
9887 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9888 {0x14, 0x90170130},
9889 {0x21, 0x02211040}),
76c2132e
DH
9890 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9891 {0x12, 0x90a60140},
9892 {0x14, 0x90170110},
76c2132e
DH
9893 {0x21, 0x02211020}),
9894 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9895 {0x12, 0x90a60160},
9896 {0x14, 0x90170120},
76c2132e 9897 {0x21, 0x02211030}),
392c9da2
HW
9898 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9899 {0x14, 0x90170110},
9900 {0x1b, 0x02011020},
9901 {0x21, 0x0221101f}),
6aecd871
HW
9902 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9903 {0x14, 0x90170110},
9904 {0x1b, 0x01011020},
9905 {0x21, 0x0221101f}),
cba59972 9906 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
cba59972 9907 {0x14, 0x90170130},
cba59972 9908 {0x1b, 0x01014020},
cba59972 9909 {0x21, 0x0221103f}),
6aecd871
HW
9910 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9911 {0x14, 0x90170130},
9912 {0x1b, 0x01011020},
9913 {0x21, 0x0221103f}),
59ec4b57
HW
9914 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9915 {0x14, 0x90170130},
9916 {0x1b, 0x02011020},
9917 {0x21, 0x0221103f}),
e9c28e16 9918 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
e9c28e16 9919 {0x14, 0x90170150},
e9c28e16 9920 {0x1b, 0x02011020},
e9c28e16
WS
9921 {0x21, 0x0221105f}),
9922 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
e9c28e16 9923 {0x14, 0x90170110},
e9c28e16 9924 {0x1b, 0x01014020},
e9c28e16 9925 {0x21, 0x0221101f}),
76c2132e
DH
9926 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9927 {0x12, 0x90a60160},
9928 {0x14, 0x90170120},
9929 {0x17, 0x90170140},
76c2132e
DH
9930 {0x21, 0x0321102f}),
9931 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9932 {0x12, 0x90a60160},
9933 {0x14, 0x90170130},
76c2132e
DH
9934 {0x21, 0x02211040}),
9935 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9936 {0x12, 0x90a60160},
9937 {0x14, 0x90170140},
76c2132e
DH
9938 {0x21, 0x02211050}),
9939 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9940 {0x12, 0x90a60170},
9941 {0x14, 0x90170120},
76c2132e
DH
9942 {0x21, 0x02211030}),
9943 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9944 {0x12, 0x90a60170},
9945 {0x14, 0x90170130},
76c2132e 9946 {0x21, 0x02211040}),
0a1f90a9
HW
9947 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9948 {0x12, 0x90a60170},
9949 {0x14, 0x90171130},
9950 {0x21, 0x02211040}),
70658b99 9951 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
70658b99
HW
9952 {0x12, 0x90a60170},
9953 {0x14, 0x90170140},
70658b99 9954 {0x21, 0x02211050}),
9b5a4e39 9955 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9b5a4e39
DH
9956 {0x12, 0x90a60180},
9957 {0x14, 0x90170130},
9b5a4e39 9958 {0x21, 0x02211040}),
f90d83b3
AK
9959 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9960 {0x12, 0x90a60180},
9961 {0x14, 0x90170120},
9962 {0x21, 0x02211030}),
989dbe4a
HW
9963 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9964 {0x1b, 0x01011020},
9965 {0x21, 0x02211010}),
c1732ede
CC
9966 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
9967 {0x14, 0x90170110},
9968 {0x1b, 0x90a70130},
9969 {0x21, 0x04211020}),
9970 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
9971 {0x14, 0x90170110},
9972 {0x1b, 0x90a70130},
9973 {0x21, 0x03211020}),
a806ef1c
CC
9974 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
9975 {0x12, 0x90a60130},
9976 {0x14, 0x90170110},
9977 {0x21, 0x03211020}),
6ac371aa
JHP
9978 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
9979 {0x12, 0x90a60130},
9980 {0x14, 0x90170110},
9981 {0x21, 0x04211020}),
e1037354
JHP
9982 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
9983 {0x1a, 0x90a70130},
9984 {0x1b, 0x90170110},
9985 {0x21, 0x03211020}),
9e885770
KY
9986 SND_HDA_PIN_QUIRK(0x10ec0256, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
9987 {0x14, 0x90170110},
9988 {0x19, 0x02a11020},
9989 {0x21, 0x0221101f}),
8a8de09c
KY
9990 SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
9991 {0x17, 0x90170110},
9992 {0x19, 0x03a11030},
9993 {0x21, 0x03211020}),
cf51eb9d
DH
9994 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
9995 {0x12, 0x90a60130},
cf51eb9d
DH
9996 {0x14, 0x90170110},
9997 {0x15, 0x0421101f},
11580297 9998 {0x1a, 0x04a11020}),
0279661b
HW
9999 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
10000 {0x12, 0x90a60140},
0279661b
HW
10001 {0x14, 0x90170110},
10002 {0x15, 0x0421101f},
0279661b 10003 {0x18, 0x02811030},
0279661b 10004 {0x1a, 0x04a1103f},
11580297 10005 {0x1b, 0x02011020}),
42304474 10006 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 10007 ALC282_STANDARD_PINS,
42304474 10008 {0x12, 0x99a30130},
42304474 10009 {0x19, 0x03a11020},
42304474 10010 {0x21, 0x0321101f}),
2c609999 10011 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 10012 ALC282_STANDARD_PINS,
2c609999 10013 {0x12, 0x99a30130},
2c609999 10014 {0x19, 0x03a11020},
2c609999
HW
10015 {0x21, 0x03211040}),
10016 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 10017 ALC282_STANDARD_PINS,
2c609999 10018 {0x12, 0x99a30130},
2c609999 10019 {0x19, 0x03a11030},
2c609999
HW
10020 {0x21, 0x03211020}),
10021 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 10022 ALC282_STANDARD_PINS,
2c609999 10023 {0x12, 0x99a30130},
2c609999 10024 {0x19, 0x04a11020},
2c609999 10025 {0x21, 0x0421101f}),
200afc09 10026 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
aec856d0 10027 ALC282_STANDARD_PINS,
200afc09 10028 {0x12, 0x90a60140},
200afc09 10029 {0x19, 0x04a11030},
200afc09 10030 {0x21, 0x04211020}),
34cdf405
CC
10031 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
10032 ALC282_STANDARD_PINS,
10033 {0x12, 0x90a609c0},
10034 {0x18, 0x03a11830},
10035 {0x19, 0x04a19831},
10036 {0x1a, 0x0481303f},
10037 {0x1b, 0x04211020},
10038 {0x21, 0x0321101f}),
10039 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
10040 ALC282_STANDARD_PINS,
10041 {0x12, 0x90a60940},
10042 {0x18, 0x03a11830},
10043 {0x19, 0x04a19831},
10044 {0x1a, 0x0481303f},
10045 {0x1b, 0x04211020},
10046 {0x21, 0x0321101f}),
76c2132e 10047 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 10048 ALC282_STANDARD_PINS,
76c2132e 10049 {0x12, 0x90a60130},
76c2132e
DH
10050 {0x21, 0x0321101f}),
10051 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10052 {0x12, 0x90a60160},
10053 {0x14, 0x90170120},
76c2132e 10054 {0x21, 0x02211030}),
bc262179 10055 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 10056 ALC282_STANDARD_PINS,
bc262179 10057 {0x12, 0x90a60130},
bc262179 10058 {0x19, 0x03a11020},
bc262179 10059 {0x21, 0x0321101f}),
c8c6ee61 10060 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
266fd994
SL
10061 {0x12, 0x90a60130},
10062 {0x14, 0x90170110},
10063 {0x19, 0x04a11040},
10064 {0x21, 0x04211020}),
10065 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
10066 {0x14, 0x90170110},
10067 {0x19, 0x04a11040},
10068 {0x1d, 0x40600001},
10069 {0x21, 0x04211020}),
10070 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
c4cfcf6f
HW
10071 {0x14, 0x90170110},
10072 {0x19, 0x04a11040},
10073 {0x21, 0x04211020}),
c72b9bfe
HW
10074 SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_HEADSET_JACK,
10075 {0x14, 0x90170110},
10076 {0x17, 0x90170111},
10077 {0x19, 0x03a11030},
10078 {0x21, 0x03211020}),
33aaebd4
CC
10079 SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
10080 {0x12, 0x90a60130},
10081 {0x17, 0x90170110},
10082 {0x21, 0x02211020}),
d44a6864 10083 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
e1e62b98 10084 {0x12, 0x90a60120},
e1e62b98 10085 {0x14, 0x90170110},
e1e62b98 10086 {0x21, 0x0321101f}),
e4442bcf 10087 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 10088 ALC290_STANDARD_PINS,
e4442bcf 10089 {0x15, 0x04211040},
e4442bcf 10090 {0x18, 0x90170112},
11580297 10091 {0x1a, 0x04a11020}),
e4442bcf 10092 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 10093 ALC290_STANDARD_PINS,
e4442bcf 10094 {0x15, 0x04211040},
e4442bcf 10095 {0x18, 0x90170110},
11580297 10096 {0x1a, 0x04a11020}),
e4442bcf 10097 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 10098 ALC290_STANDARD_PINS,
e4442bcf 10099 {0x15, 0x0421101f},
11580297 10100 {0x1a, 0x04a11020}),
e4442bcf 10101 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 10102 ALC290_STANDARD_PINS,
e4442bcf 10103 {0x15, 0x04211020},
11580297 10104 {0x1a, 0x04a11040}),
e4442bcf 10105 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 10106 ALC290_STANDARD_PINS,
e4442bcf
HW
10107 {0x14, 0x90170110},
10108 {0x15, 0x04211020},
11580297 10109 {0x1a, 0x04a11040}),
e4442bcf 10110 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 10111 ALC290_STANDARD_PINS,
e4442bcf
HW
10112 {0x14, 0x90170110},
10113 {0x15, 0x04211020},
11580297 10114 {0x1a, 0x04a11020}),
e4442bcf 10115 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 10116 ALC290_STANDARD_PINS,
e4442bcf
HW
10117 {0x14, 0x90170110},
10118 {0x15, 0x0421101f},
11580297 10119 {0x1a, 0x04a11020}),
e8818fa8 10120 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
aec856d0 10121 ALC292_STANDARD_PINS,
e8818fa8 10122 {0x12, 0x90a60140},
e8818fa8 10123 {0x16, 0x01014020},
11580297 10124 {0x19, 0x01a19030}),
e8818fa8 10125 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
aec856d0 10126 ALC292_STANDARD_PINS,
e8818fa8 10127 {0x12, 0x90a60140},
e8818fa8
HW
10128 {0x16, 0x01014020},
10129 {0x18, 0x02a19031},
11580297 10130 {0x19, 0x01a1903e}),
76c2132e 10131 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
aec856d0 10132 ALC292_STANDARD_PINS,
11580297 10133 {0x12, 0x90a60140}),
76c2132e 10134 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 10135 ALC292_STANDARD_PINS,
76c2132e 10136 {0x13, 0x90a60140},
76c2132e 10137 {0x16, 0x21014020},
11580297 10138 {0x19, 0x21a19030}),
e03fdbde 10139 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 10140 ALC292_STANDARD_PINS,
11580297 10141 {0x13, 0x90a60140}),
eeacd80f
JHP
10142 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_HPE,
10143 {0x17, 0x90170110},
10144 {0x21, 0x04211020}),
d8ae458e
CC
10145 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
10146 {0x14, 0x90170110},
10147 {0x1b, 0x90a70130},
10148 {0x21, 0x04211020}),
8bb37a2a
JHP
10149 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
10150 {0x12, 0x90a60130},
10151 {0x17, 0x90170110},
10152 {0x21, 0x03211020}),
0bea4cc8
JHP
10153 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
10154 {0x12, 0x90a60130},
10155 {0x17, 0x90170110},
10156 {0x21, 0x04211020}),
3887c26c
TI
10157 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
10158 {0x12, 0x90a60130},
10159 {0x17, 0x90170110},
10160 {0x21, 0x03211020}),
9e43342b 10161 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
ad97d667
JHP
10162 {0x12, 0x90a60120},
10163 {0x17, 0x90170110},
10164 {0x21, 0x04211030}),
10165 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
9e43342b
CC
10166 {0x12, 0x90a60130},
10167 {0x17, 0x90170110},
10168 {0x21, 0x03211020}),
10169 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
10170 {0x12, 0x90a60130},
10171 {0x17, 0x90170110},
10172 {0x21, 0x03211020}),
fbc57129 10173 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
0a29c57b
KY
10174 {0x14, 0x90170110},
10175 {0x21, 0x04211020}),
fbc57129
KY
10176 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
10177 {0x14, 0x90170110},
10178 {0x21, 0x04211030}),
3f640970 10179 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
f771d5bb
HW
10180 ALC295_STANDARD_PINS,
10181 {0x17, 0x21014020},
10182 {0x18, 0x21a19030}),
10183 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10184 ALC295_STANDARD_PINS,
10185 {0x17, 0x21014040},
10186 {0x18, 0x21a19050}),
3f307834
HW
10187 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10188 ALC295_STANDARD_PINS),
9f502ff5
TI
10189 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
10190 ALC298_STANDARD_PINS,
10191 {0x17, 0x90170110}),
977e6276 10192 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
703867e2
WS
10193 ALC298_STANDARD_PINS,
10194 {0x17, 0x90170140}),
10195 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
10196 ALC298_STANDARD_PINS,
9f502ff5 10197 {0x17, 0x90170150}),
9f1bc2c4
KHF
10198 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
10199 {0x12, 0xb7a60140},
10200 {0x13, 0xb7a60150},
10201 {0x17, 0x90170110},
10202 {0x1a, 0x03011020},
10203 {0x21, 0x03211030}),
54324221
JM
10204 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
10205 {0x12, 0xb7a60140},
10206 {0x17, 0x90170110},
10207 {0x1a, 0x03a11030},
10208 {0x21, 0x03211020}),
fcc6c877
KY
10209 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
10210 ALC225_STANDARD_PINS,
10211 {0x12, 0xb7a60130},
fcc6c877 10212 {0x17, 0x90170110}),
573fcbfd
HW
10213 SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
10214 {0x14, 0x01014010},
10215 {0x17, 0x90170120},
10216 {0x18, 0x02a11030},
10217 {0x19, 0x02a1103f},
10218 {0x21, 0x0221101f}),
e1918938
HW
10219 {}
10220};
6dda9f4a 10221
7c0a6939
HW
10222/* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
10223 * more machines, don't need to match all valid pins, just need to match
10224 * all the pins defined in the tbl. Just because of this reason, it is possible
10225 * that a single machine matches multiple tbls, so there is one limitation:
10226 * at most one tbl is allowed to define for the same vendor and same codec
10227 */
10228static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
10229 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
10230 {0x19, 0x40000000},
10231 {0x1b, 0x40000000}),
aed8c7f4
HW
10232 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10233 {0x19, 0x40000000},
10234 {0x1a, 0x40000000}),
d64ebdbf
HW
10235 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10236 {0x19, 0x40000000},
10237 {0x1a, 0x40000000}),
5815bdfd
HW
10238 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
10239 {0x19, 0x40000000},
10240 {0x1a, 0x40000000}),
7c0a6939
HW
10241 {}
10242};
10243
546bb678 10244static void alc269_fill_coef(struct hda_codec *codec)
1d045db9 10245{
526af6eb 10246 struct alc_spec *spec = codec->spec;
1d045db9 10247 int val;
ebb83eeb 10248
526af6eb 10249 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
546bb678 10250 return;
526af6eb 10251
1bb7e43e 10252 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
1d045db9
TI
10253 alc_write_coef_idx(codec, 0xf, 0x960b);
10254 alc_write_coef_idx(codec, 0xe, 0x8817);
10255 }
ebb83eeb 10256
1bb7e43e 10257 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
1d045db9
TI
10258 alc_write_coef_idx(codec, 0xf, 0x960b);
10259 alc_write_coef_idx(codec, 0xe, 0x8814);
10260 }
ebb83eeb 10261
1bb7e43e 10262 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
1d045db9 10263 /* Power up output pin */
98b24883 10264 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
1d045db9 10265 }
ebb83eeb 10266
1bb7e43e 10267 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
1d045db9 10268 val = alc_read_coef_idx(codec, 0xd);
f3ee07d8 10269 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
1d045db9
TI
10270 /* Capless ramp up clock control */
10271 alc_write_coef_idx(codec, 0xd, val | (1<<10));
10272 }
10273 val = alc_read_coef_idx(codec, 0x17);
f3ee07d8 10274 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
1d045db9
TI
10275 /* Class D power on reset */
10276 alc_write_coef_idx(codec, 0x17, val | (1<<7));
10277 }
10278 }
ebb83eeb 10279
98b24883
TI
10280 /* HP */
10281 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
1d045db9 10282}
a7f2371f 10283
1d045db9
TI
10284/*
10285 */
1d045db9
TI
10286static int patch_alc269(struct hda_codec *codec)
10287{
10288 struct alc_spec *spec;
3de95173 10289 int err;
f1d4e28b 10290
3de95173 10291 err = alc_alloc_spec(codec, 0x0b);
e16fb6d1 10292 if (err < 0)
3de95173
TI
10293 return err;
10294
10295 spec = codec->spec;
08c189f2 10296 spec->gen.shared_mic_vref_pin = 0x18;
317d9313 10297 codec->power_save_node = 0;
e16fb6d1 10298
225068ab
TI
10299#ifdef CONFIG_PM
10300 codec->patch_ops.suspend = alc269_suspend;
10301 codec->patch_ops.resume = alc269_resume;
10302#endif
c2d6af53
KY
10303 spec->shutup = alc_default_shutup;
10304 spec->init_hook = alc_default_init;
225068ab 10305
7639a06c 10306 switch (codec->core.vendor_id) {
065380f0 10307 case 0x10ec0269:
1d045db9 10308 spec->codec_variant = ALC269_TYPE_ALC269VA;
1bb7e43e
TI
10309 switch (alc_get_coef0(codec) & 0x00f0) {
10310 case 0x0010:
5100cd07
TI
10311 if (codec->bus->pci &&
10312 codec->bus->pci->subsystem_vendor == 0x1025 &&
e16fb6d1 10313 spec->cdefine.platform_type == 1)
20ca0c35 10314 err = alc_codec_rename(codec, "ALC271X");
1d045db9 10315 spec->codec_variant = ALC269_TYPE_ALC269VB;
1bb7e43e
TI
10316 break;
10317 case 0x0020:
5100cd07
TI
10318 if (codec->bus->pci &&
10319 codec->bus->pci->subsystem_vendor == 0x17aa &&
e16fb6d1 10320 codec->bus->pci->subsystem_device == 0x21f3)
20ca0c35 10321 err = alc_codec_rename(codec, "ALC3202");
1d045db9 10322 spec->codec_variant = ALC269_TYPE_ALC269VC;
1bb7e43e 10323 break;
adcc70b2
KY
10324 case 0x0030:
10325 spec->codec_variant = ALC269_TYPE_ALC269VD;
10326 break;
1bb7e43e 10327 default:
1d045db9 10328 alc_fix_pll_init(codec, 0x20, 0x04, 15);
1bb7e43e 10329 }
e16fb6d1
TI
10330 if (err < 0)
10331 goto error;
c2d6af53 10332 spec->shutup = alc269_shutup;
546bb678 10333 spec->init_hook = alc269_fill_coef;
1d045db9 10334 alc269_fill_coef(codec);
065380f0
KY
10335 break;
10336
10337 case 0x10ec0280:
10338 case 0x10ec0290:
10339 spec->codec_variant = ALC269_TYPE_ALC280;
10340 break;
10341 case 0x10ec0282:
065380f0 10342 spec->codec_variant = ALC269_TYPE_ALC282;
7b5c7a02
KY
10343 spec->shutup = alc282_shutup;
10344 spec->init_hook = alc282_init;
065380f0 10345 break;
2af02be7
KY
10346 case 0x10ec0233:
10347 case 0x10ec0283:
10348 spec->codec_variant = ALC269_TYPE_ALC283;
10349 spec->shutup = alc283_shutup;
10350 spec->init_hook = alc283_init;
10351 break;
065380f0
KY
10352 case 0x10ec0284:
10353 case 0x10ec0292:
10354 spec->codec_variant = ALC269_TYPE_ALC284;
10355 break;
161ebf29 10356 case 0x10ec0293:
4731d5de 10357 spec->codec_variant = ALC269_TYPE_ALC293;
161ebf29 10358 break;
7fc7d047 10359 case 0x10ec0286:
7c665932 10360 case 0x10ec0288:
7fc7d047
KY
10361 spec->codec_variant = ALC269_TYPE_ALC286;
10362 break;
506b62c3
KY
10363 case 0x10ec0298:
10364 spec->codec_variant = ALC269_TYPE_ALC298;
10365 break;
ea04a1db 10366 case 0x10ec0235:
1d04c9de
KY
10367 case 0x10ec0255:
10368 spec->codec_variant = ALC269_TYPE_ALC255;
ab3b8e51
KY
10369 spec->shutup = alc256_shutup;
10370 spec->init_hook = alc256_init;
1d04c9de 10371 break;
1948fc06 10372 case 0x10ec0230:
736f20a7 10373 case 0x10ec0236:
4344aec8 10374 case 0x10ec0256:
527f4643 10375 case 0x19e58326:
4344aec8 10376 spec->codec_variant = ALC269_TYPE_ALC256;
4a219ef8
KY
10377 spec->shutup = alc256_shutup;
10378 spec->init_hook = alc256_init;
7d1b6e29 10379 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
4344aec8 10380 break;
f429e7e4
KY
10381 case 0x10ec0257:
10382 spec->codec_variant = ALC269_TYPE_ALC257;
88d42b2b
KY
10383 spec->shutup = alc256_shutup;
10384 spec->init_hook = alc256_init;
f429e7e4
KY
10385 spec->gen.mixer_nid = 0;
10386 break;
0a6f0600 10387 case 0x10ec0215:
7fbdcd83 10388 case 0x10ec0245:
0a6f0600
KY
10389 case 0x10ec0285:
10390 case 0x10ec0289:
60571929
KY
10391 if (alc_get_coef0(codec) & 0x0010)
10392 spec->codec_variant = ALC269_TYPE_ALC245;
10393 else
10394 spec->codec_variant = ALC269_TYPE_ALC215;
1b6832be
KY
10395 spec->shutup = alc225_shutup;
10396 spec->init_hook = alc225_init;
0a6f0600
KY
10397 spec->gen.mixer_nid = 0;
10398 break;
4231430d 10399 case 0x10ec0225:
7d727869 10400 case 0x10ec0295:
28f1f9b2 10401 case 0x10ec0299:
4231430d 10402 spec->codec_variant = ALC269_TYPE_ALC225;
da911b1f
KY
10403 spec->shutup = alc225_shutup;
10404 spec->init_hook = alc225_init;
c1350bff 10405 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
4231430d 10406 break;
99cee034
KY
10407 case 0x10ec0287:
10408 spec->codec_variant = ALC269_TYPE_ALC287;
10409 spec->shutup = alc225_shutup;
10410 spec->init_hook = alc225_init;
10411 spec->gen.mixer_nid = 0; /* no loopback on ALC287 */
10412 break;
dcd4f0db
KY
10413 case 0x10ec0234:
10414 case 0x10ec0274:
10415 case 0x10ec0294:
10416 spec->codec_variant = ALC269_TYPE_ALC294;
532a7784 10417 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
71683c32 10418 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
693abe11 10419 spec->init_hook = alc294_init;
dcd4f0db 10420 break;
1078bef0
KY
10421 case 0x10ec0300:
10422 spec->codec_variant = ALC269_TYPE_ALC300;
10423 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
dcd4f0db 10424 break;
f0778871
KY
10425 case 0x10ec0623:
10426 spec->codec_variant = ALC269_TYPE_ALC623;
10427 break;
6fbae35a
KY
10428 case 0x10ec0700:
10429 case 0x10ec0701:
10430 case 0x10ec0703:
83629532 10431 case 0x10ec0711:
6fbae35a
KY
10432 spec->codec_variant = ALC269_TYPE_ALC700;
10433 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
2d7fe618 10434 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
693abe11 10435 spec->init_hook = alc294_init;
6fbae35a
KY
10436 break;
10437
1d045db9 10438 }
6dda9f4a 10439
ad60d502 10440 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
97a26570 10441 spec->has_alc5505_dsp = 1;
ad60d502
KY
10442 spec->init_hook = alc5505_dsp_init;
10443 }
10444
c9af753f
TI
10445 alc_pre_init(codec);
10446
efe55732
TI
10447 snd_hda_pick_fixup(codec, alc269_fixup_models,
10448 alc269_fixup_tbl, alc269_fixups);
13d9c6b9
TI
10449 /* FIXME: both TX300 and ROG Strix G17 have the same SSID, and
10450 * the quirk breaks the latter (bko#214101).
10451 * Clear the wrong entry.
10452 */
10453 if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 &&
10454 codec->core.vendor_id == 0x10ec0294) {
10455 codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n");
10456 codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
10457 }
10458
0fc1e447 10459 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
7c0a6939 10460 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
efe55732
TI
10461 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
10462 alc269_fixups);
10463 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
10464
10465 alc_auto_parse_customize_define(codec);
10466
10467 if (has_cdefine_beep(codec))
10468 spec->gen.beep_nid = 0x01;
10469
a4297b5d
TI
10470 /* automatic parse from the BIOS config */
10471 err = alc269_parse_auto_config(codec);
e16fb6d1
TI
10472 if (err < 0)
10473 goto error;
6dda9f4a 10474
fea80fae
TI
10475 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
10476 err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
10477 if (err < 0)
10478 goto error;
10479 }
f1d4e28b 10480
1727a771 10481 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 10482
1d045db9 10483 return 0;
e16fb6d1
TI
10484
10485 error:
10486 alc_free(codec);
10487 return err;
1d045db9 10488}
f1d4e28b 10489
1d045db9
TI
10490/*
10491 * ALC861
10492 */
622e84cd 10493
1d045db9 10494static int alc861_parse_auto_config(struct hda_codec *codec)
6dda9f4a 10495{
1d045db9 10496 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
3e6179b8
TI
10497 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
10498 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
604401a9
TI
10499}
10500
1d045db9
TI
10501/* Pin config fixes */
10502enum {
e652f4c8
TI
10503 ALC861_FIXUP_FSC_AMILO_PI1505,
10504 ALC861_FIXUP_AMP_VREF_0F,
10505 ALC861_FIXUP_NO_JACK_DETECT,
10506 ALC861_FIXUP_ASUS_A6RP,
6ddf0fd1 10507 ALC660_FIXUP_ASUS_W7J,
1d045db9 10508};
7085ec12 10509
31150f23
TI
10510/* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
10511static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
1727a771 10512 const struct hda_fixup *fix, int action)
31150f23
TI
10513{
10514 struct alc_spec *spec = codec->spec;
10515 unsigned int val;
10516
1727a771 10517 if (action != HDA_FIXUP_ACT_INIT)
31150f23 10518 return;
d3f02d60 10519 val = snd_hda_codec_get_pin_target(codec, 0x0f);
31150f23
TI
10520 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
10521 val |= AC_PINCTL_IN_EN;
10522 val |= AC_PINCTL_VREF_50;
cdd03ced 10523 snd_hda_set_pin_ctl(codec, 0x0f, val);
08c189f2 10524 spec->gen.keep_vref_in_automute = 1;
31150f23
TI
10525}
10526
e652f4c8
TI
10527/* suppress the jack-detection */
10528static void alc_fixup_no_jack_detect(struct hda_codec *codec,
1727a771 10529 const struct hda_fixup *fix, int action)
e652f4c8 10530{
1727a771 10531 if (action == HDA_FIXUP_ACT_PRE_PROBE)
e652f4c8 10532 codec->no_jack_detect = 1;
7d7eb9ea 10533}
e652f4c8 10534
1727a771 10535static const struct hda_fixup alc861_fixups[] = {
e652f4c8 10536 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
1727a771
TI
10537 .type = HDA_FIXUP_PINS,
10538 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
10539 { 0x0b, 0x0221101f }, /* HP */
10540 { 0x0f, 0x90170310 }, /* speaker */
10541 { }
10542 }
10543 },
e652f4c8 10544 [ALC861_FIXUP_AMP_VREF_0F] = {
1727a771 10545 .type = HDA_FIXUP_FUNC,
31150f23 10546 .v.func = alc861_fixup_asus_amp_vref_0f,
3b25eb69 10547 },
e652f4c8 10548 [ALC861_FIXUP_NO_JACK_DETECT] = {
1727a771 10549 .type = HDA_FIXUP_FUNC,
e652f4c8
TI
10550 .v.func = alc_fixup_no_jack_detect,
10551 },
10552 [ALC861_FIXUP_ASUS_A6RP] = {
1727a771 10553 .type = HDA_FIXUP_FUNC,
e652f4c8
TI
10554 .v.func = alc861_fixup_asus_amp_vref_0f,
10555 .chained = true,
10556 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
6ddf0fd1
TI
10557 },
10558 [ALC660_FIXUP_ASUS_W7J] = {
10559 .type = HDA_FIXUP_VERBS,
10560 .v.verbs = (const struct hda_verb[]) {
10561 /* ASUS W7J needs a magic pin setup on unused NID 0x10
10562 * for enabling outputs
10563 */
10564 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10565 { }
10566 },
e652f4c8 10567 }
1d045db9 10568};
7085ec12 10569
1d045db9 10570static const struct snd_pci_quirk alc861_fixup_tbl[] = {
6ddf0fd1 10571 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
e7ca237b 10572 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
e652f4c8
TI
10573 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
10574 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
10575 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
defce244 10576 SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F),
e652f4c8 10577 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
1d045db9
TI
10578 {}
10579};
3af9ee6b 10580
1d045db9
TI
10581/*
10582 */
1d045db9 10583static int patch_alc861(struct hda_codec *codec)
7085ec12 10584{
1d045db9 10585 struct alc_spec *spec;
1d045db9 10586 int err;
7085ec12 10587
3de95173
TI
10588 err = alc_alloc_spec(codec, 0x15);
10589 if (err < 0)
10590 return err;
1d045db9 10591
3de95173 10592 spec = codec->spec;
2722b535
TI
10593 if (has_cdefine_beep(codec))
10594 spec->gen.beep_nid = 0x23;
1d045db9 10595
225068ab
TI
10596#ifdef CONFIG_PM
10597 spec->power_hook = alc_power_eapd;
10598#endif
10599
c9af753f
TI
10600 alc_pre_init(codec);
10601
1727a771
TI
10602 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
10603 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
3af9ee6b 10604
cb4e4824
TI
10605 /* automatic parse from the BIOS config */
10606 err = alc861_parse_auto_config(codec);
e16fb6d1
TI
10607 if (err < 0)
10608 goto error;
3af9ee6b 10609
fea80fae
TI
10610 if (!spec->gen.no_analog) {
10611 err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
10612 if (err < 0)
10613 goto error;
10614 }
7085ec12 10615
1727a771 10616 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 10617
1d045db9 10618 return 0;
e16fb6d1
TI
10619
10620 error:
10621 alc_free(codec);
10622 return err;
7085ec12
TI
10623}
10624
1d045db9
TI
10625/*
10626 * ALC861-VD support
10627 *
10628 * Based on ALC882
10629 *
10630 * In addition, an independent DAC
10631 */
1d045db9 10632static int alc861vd_parse_auto_config(struct hda_codec *codec)
bc9f98a9 10633{
1d045db9 10634 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
3e6179b8
TI
10635 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
10636 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
ce764ab2
TI
10637}
10638
1d045db9 10639enum {
8fdcb6fe
TI
10640 ALC660VD_FIX_ASUS_GPIO1,
10641 ALC861VD_FIX_DALLAS,
1d045db9 10642};
ce764ab2 10643
8fdcb6fe
TI
10644/* exclude VREF80 */
10645static void alc861vd_fixup_dallas(struct hda_codec *codec,
1727a771 10646 const struct hda_fixup *fix, int action)
8fdcb6fe 10647{
1727a771 10648 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
b78562b1
TI
10649 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
10650 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
8fdcb6fe
TI
10651 }
10652}
10653
df73d83f
TI
10654/* reset GPIO1 */
10655static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
10656 const struct hda_fixup *fix, int action)
10657{
10658 struct alc_spec *spec = codec->spec;
10659
10660 if (action == HDA_FIXUP_ACT_PRE_PROBE)
10661 spec->gpio_mask |= 0x02;
10662 alc_fixup_gpio(codec, action, 0x01);
10663}
10664
1727a771 10665static const struct hda_fixup alc861vd_fixups[] = {
1d045db9 10666 [ALC660VD_FIX_ASUS_GPIO1] = {
df73d83f
TI
10667 .type = HDA_FIXUP_FUNC,
10668 .v.func = alc660vd_fixup_asus_gpio1,
1d045db9 10669 },
8fdcb6fe 10670 [ALC861VD_FIX_DALLAS] = {
1727a771 10671 .type = HDA_FIXUP_FUNC,
8fdcb6fe
TI
10672 .v.func = alc861vd_fixup_dallas,
10673 },
1d045db9 10674};
ce764ab2 10675
1d045db9 10676static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
8fdcb6fe 10677 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
1d045db9 10678 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
8fdcb6fe 10679 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
1d045db9
TI
10680 {}
10681};
ce764ab2 10682
1d045db9
TI
10683/*
10684 */
1d045db9 10685static int patch_alc861vd(struct hda_codec *codec)
ce764ab2 10686{
1d045db9 10687 struct alc_spec *spec;
cb4e4824 10688 int err;
ce764ab2 10689
3de95173
TI
10690 err = alc_alloc_spec(codec, 0x0b);
10691 if (err < 0)
10692 return err;
1d045db9 10693
3de95173 10694 spec = codec->spec;
2722b535
TI
10695 if (has_cdefine_beep(codec))
10696 spec->gen.beep_nid = 0x23;
1d045db9 10697
225068ab
TI
10698 spec->shutup = alc_eapd_shutup;
10699
c9af753f
TI
10700 alc_pre_init(codec);
10701
1727a771
TI
10702 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
10703 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1d045db9 10704
cb4e4824
TI
10705 /* automatic parse from the BIOS config */
10706 err = alc861vd_parse_auto_config(codec);
e16fb6d1
TI
10707 if (err < 0)
10708 goto error;
ce764ab2 10709
fea80fae
TI
10710 if (!spec->gen.no_analog) {
10711 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10712 if (err < 0)
10713 goto error;
10714 }
1d045db9 10715
1727a771 10716 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 10717
ce764ab2 10718 return 0;
e16fb6d1
TI
10719
10720 error:
10721 alc_free(codec);
10722 return err;
ce764ab2
TI
10723}
10724
1d045db9
TI
10725/*
10726 * ALC662 support
10727 *
10728 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
10729 * configuration. Each pin widget can choose any input DACs and a mixer.
10730 * Each ADC is connected from a mixer of all inputs. This makes possible
10731 * 6-channel independent captures.
10732 *
10733 * In addition, an independent DAC for the multi-playback (not used in this
10734 * driver yet).
10735 */
1d045db9
TI
10736
10737/*
10738 * BIOS auto configuration
10739 */
10740
bc9f98a9
KY
10741static int alc662_parse_auto_config(struct hda_codec *codec)
10742{
4c6d72d1 10743 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
3e6179b8
TI
10744 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
10745 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
10746 const hda_nid_t *ssids;
ee979a14 10747
7639a06c
TI
10748 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
10749 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
10750 codec->core.vendor_id == 0x10ec0671)
3e6179b8 10751 ssids = alc663_ssids;
6227cdce 10752 else
3e6179b8
TI
10753 ssids = alc662_ssids;
10754 return alc_parse_auto_config(codec, alc662_ignore, ssids);
bc9f98a9
KY
10755}
10756
6be7948f 10757static void alc272_fixup_mario(struct hda_codec *codec,
1727a771 10758 const struct hda_fixup *fix, int action)
6fc398cb 10759{
9bb1f06f 10760 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6fc398cb 10761 return;
6be7948f
TB
10762 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
10763 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
10764 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
10765 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
10766 (0 << AC_AMPCAP_MUTE_SHIFT)))
4e76a883 10767 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
6be7948f
TB
10768}
10769
8e383953
TI
10770static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
10771 { .channels = 2,
10772 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
10773 { .channels = 4,
10774 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
10775 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
10776 { }
10777};
10778
10779/* override the 2.1 chmap */
eb9ca3ab 10780static void alc_fixup_bass_chmap(struct hda_codec *codec,
8e383953
TI
10781 const struct hda_fixup *fix, int action)
10782{
10783 if (action == HDA_FIXUP_ACT_BUILD) {
10784 struct alc_spec *spec = codec->spec;
bbbc7e85 10785 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
8e383953
TI
10786 }
10787}
10788
bf68665d
TI
10789/* avoid D3 for keeping GPIO up */
10790static unsigned int gpio_led_power_filter(struct hda_codec *codec,
10791 hda_nid_t nid,
10792 unsigned int power_state)
10793{
10794 struct alc_spec *spec = codec->spec;
d261eec8 10795 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
bf68665d
TI
10796 return AC_PWRST_D0;
10797 return power_state;
10798}
10799
3e887f37
TI
10800static void alc662_fixup_led_gpio1(struct hda_codec *codec,
10801 const struct hda_fixup *fix, int action)
10802{
10803 struct alc_spec *spec = codec->spec;
3e887f37 10804
01e4a275 10805 alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
3e887f37 10806 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
0f32fd19 10807 spec->mute_led_polarity = 1;
bf68665d 10808 codec->power_filter = gpio_led_power_filter;
3e887f37
TI
10809 }
10810}
10811
c6790c8e
KY
10812static void alc662_usi_automute_hook(struct hda_codec *codec,
10813 struct hda_jack_callback *jack)
10814{
10815 struct alc_spec *spec = codec->spec;
10816 int vref;
10817 msleep(200);
10818 snd_hda_gen_hp_automute(codec, jack);
10819
10820 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
10821 msleep(100);
10822 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10823 vref);
10824}
10825
10826static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
10827 const struct hda_fixup *fix, int action)
10828{
10829 struct alc_spec *spec = codec->spec;
10830 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10831 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
10832 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
10833 }
10834}
10835
00066e97
SB
10836static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
10837 struct hda_jack_callback *cb)
10838{
10839 /* surround speakers at 0x1b already get muted automatically when
10840 * headphones are plugged in, but we have to mute/unmute the remaining
10841 * channels manually:
10842 * 0x15 - front left/front right
10843 * 0x18 - front center/ LFE
10844 */
10845 if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
10846 snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
10847 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
10848 } else {
10849 snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
10850 snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
10851 }
10852}
10853
10854static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
10855 const struct hda_fixup *fix, int action)
10856{
10857 /* Pin 0x1b: shared headphones jack and surround speakers */
10858 if (!is_jack_detectable(codec, 0x1b))
10859 return;
10860
10861 switch (action) {
10862 case HDA_FIXUP_ACT_PRE_PROBE:
10863 snd_hda_jack_detect_enable_callback(codec, 0x1b,
10864 alc662_aspire_ethos_mute_speakers);
336820c4
TI
10865 /* subwoofer needs an extra GPIO setting to become audible */
10866 alc_setup_gpio(codec, 0x02);
00066e97
SB
10867 break;
10868 case HDA_FIXUP_ACT_INIT:
10869 /* Make sure to start in a correct state, i.e. if
10870 * headphones have been plugged in before powering up the system
10871 */
10872 alc662_aspire_ethos_mute_speakers(codec, NULL);
10873 break;
10874 }
10875}
10876
5af29028
KY
10877static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
10878 const struct hda_fixup *fix, int action)
10879{
10880 struct alc_spec *spec = codec->spec;
10881
10882 static const struct hda_pintbl pincfgs[] = {
10883 { 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
10884 { 0x1b, 0x0181304f },
10885 { }
10886 };
10887
10888 switch (action) {
10889 case HDA_FIXUP_ACT_PRE_PROBE:
10890 spec->gen.mixer_nid = 0;
10891 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
10892 snd_hda_apply_pincfgs(codec, pincfgs);
10893 break;
10894 case HDA_FIXUP_ACT_INIT:
10895 alc_write_coef_idx(codec, 0x19, 0xa054);
10896 break;
10897 }
10898}
10899
d7f32791
KY
10900static void alc897_hp_automute_hook(struct hda_codec *codec,
10901 struct hda_jack_callback *jack)
10902{
10903 struct alc_spec *spec = codec->spec;
10904 int vref;
10905
10906 snd_hda_gen_hp_automute(codec, jack);
10907 vref = spec->gen.hp_jack_present ? (PIN_HP | AC_PINCTL_VREF_100) : PIN_HP;
10908 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10909 vref);
10910}
10911
10912static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec,
10913 const struct hda_fixup *fix, int action)
10914{
10915 struct alc_spec *spec = codec->spec;
10916 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10917 spec->gen.hp_automute_hook = alc897_hp_automute_hook;
10918 }
10919}
10920
6b0f95c4 10921static const struct coef_fw alc668_coefs[] = {
f3f9185f
KY
10922 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
10923 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
10924 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
10925 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
10926 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
10927 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
10928 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
10929 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
10930 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
10931 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
10932 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
10933 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
10934 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
10935 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
10936 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
10937 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
10938 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
10939 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
10940 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
10941 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
10942 {}
10943};
10944
10945static void alc668_restore_default_value(struct hda_codec *codec)
10946{
10947 alc_process_coef_fw(codec, alc668_coefs);
10948}
10949
6cb3b707 10950enum {
2df03514 10951 ALC662_FIXUP_ASPIRE,
3e887f37 10952 ALC662_FIXUP_LED_GPIO1,
6cb3b707 10953 ALC662_FIXUP_IDEAPAD,
6be7948f 10954 ALC272_FIXUP_MARIO,
f1ec5be1 10955 ALC662_FIXUP_CZC_ET26,
d2ebd479 10956 ALC662_FIXUP_CZC_P10T,
94024cd1 10957 ALC662_FIXUP_SKU_IGNORE,
e59ea3ed 10958 ALC662_FIXUP_HP_RP5800,
53c334ad
TI
10959 ALC662_FIXUP_ASUS_MODE1,
10960 ALC662_FIXUP_ASUS_MODE2,
10961 ALC662_FIXUP_ASUS_MODE3,
10962 ALC662_FIXUP_ASUS_MODE4,
10963 ALC662_FIXUP_ASUS_MODE5,
10964 ALC662_FIXUP_ASUS_MODE6,
10965 ALC662_FIXUP_ASUS_MODE7,
10966 ALC662_FIXUP_ASUS_MODE8,
1565cc35 10967 ALC662_FIXUP_NO_JACK_DETECT,
edfe3bfc 10968 ALC662_FIXUP_ZOTAC_Z68,
125821ae 10969 ALC662_FIXUP_INV_DMIC,
1f8b46cd 10970 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
73bdd597 10971 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
1f8b46cd 10972 ALC662_FIXUP_HEADSET_MODE,
73bdd597 10973 ALC668_FIXUP_HEADSET_MODE,
8e54b4ac 10974 ALC662_FIXUP_BASS_MODE4_CHMAP,
61a75f13 10975 ALC662_FIXUP_BASS_16,
a30c9aaa 10976 ALC662_FIXUP_BASS_1A,
8e54b4ac 10977 ALC662_FIXUP_BASS_CHMAP,
493a52a9 10978 ALC668_FIXUP_AUTO_MUTE,
5e6db669 10979 ALC668_FIXUP_DELL_DISABLE_AAMIX,
033b0a7c 10980 ALC668_FIXUP_DELL_XPS13,
9d4dc584 10981 ALC662_FIXUP_ASUS_Nx50,
fc7438b1 10982 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
3231e205 10983 ALC668_FIXUP_ASUS_Nx51,
5b7c5e1f 10984 ALC668_FIXUP_MIC_COEF,
11ba6111 10985 ALC668_FIXUP_ASUS_G751,
78f4f7c2
KY
10986 ALC891_FIXUP_HEADSET_MODE,
10987 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
9b51fe3e 10988 ALC662_FIXUP_ACER_VERITON,
1a3f0991 10989 ALC892_FIXUP_ASROCK_MOBO,
c6790c8e
KY
10990 ALC662_FIXUP_USI_FUNC,
10991 ALC662_FIXUP_USI_HEADSET_MODE,
ca169cc2 10992 ALC662_FIXUP_LENOVO_MULTI_CODECS,
00066e97 10993 ALC669_FIXUP_ACER_ASPIRE_ETHOS,
00066e97 10994 ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
5af29028 10995 ALC671_FIXUP_HP_HEADSET_MIC2,
d858c706 10996 ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
a124458a 10997 ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
a3fd1a98
HW
10998 ALC668_FIXUP_ASUS_NO_HEADSET_MIC,
10999 ALC668_FIXUP_HEADSET_MIC,
11000 ALC668_FIXUP_MIC_DET_COEF,
d7f32791
KY
11001 ALC897_FIXUP_LENOVO_HEADSET_MIC,
11002 ALC897_FIXUP_HEADSET_MIC_PIN,
fe6900bd 11003 ALC897_FIXUP_HP_HSMIC_VERB,
6cb3b707
DH
11004};
11005
1727a771 11006static const struct hda_fixup alc662_fixups[] = {
2df03514 11007 [ALC662_FIXUP_ASPIRE] = {
1727a771
TI
11008 .type = HDA_FIXUP_PINS,
11009 .v.pins = (const struct hda_pintbl[]) {
2df03514
DC
11010 { 0x15, 0x99130112 }, /* subwoofer */
11011 { }
11012 }
11013 },
3e887f37
TI
11014 [ALC662_FIXUP_LED_GPIO1] = {
11015 .type = HDA_FIXUP_FUNC,
11016 .v.func = alc662_fixup_led_gpio1,
11017 },
6cb3b707 11018 [ALC662_FIXUP_IDEAPAD] = {
1727a771
TI
11019 .type = HDA_FIXUP_PINS,
11020 .v.pins = (const struct hda_pintbl[]) {
6cb3b707
DH
11021 { 0x17, 0x99130112 }, /* subwoofer */
11022 { }
3e887f37
TI
11023 },
11024 .chained = true,
11025 .chain_id = ALC662_FIXUP_LED_GPIO1,
6cb3b707 11026 },
6be7948f 11027 [ALC272_FIXUP_MARIO] = {
1727a771 11028 .type = HDA_FIXUP_FUNC,
b5bfbc67 11029 .v.func = alc272_fixup_mario,
d2ebd479 11030 },
f1ec5be1
HC
11031 [ALC662_FIXUP_CZC_ET26] = {
11032 .type = HDA_FIXUP_PINS,
11033 .v.pins = (const struct hda_pintbl[]) {
11034 {0x12, 0x403cc000},
11035 {0x14, 0x90170110}, /* speaker */
11036 {0x15, 0x411111f0},
11037 {0x16, 0x411111f0},
11038 {0x18, 0x01a19030}, /* mic */
11039 {0x19, 0x90a7013f}, /* int-mic */
11040 {0x1a, 0x01014020},
11041 {0x1b, 0x0121401f},
11042 {0x1c, 0x411111f0},
11043 {0x1d, 0x411111f0},
11044 {0x1e, 0x40478e35},
11045 {}
11046 },
11047 .chained = true,
11048 .chain_id = ALC662_FIXUP_SKU_IGNORE
11049 },
d2ebd479 11050 [ALC662_FIXUP_CZC_P10T] = {
1727a771 11051 .type = HDA_FIXUP_VERBS,
d2ebd479
AA
11052 .v.verbs = (const struct hda_verb[]) {
11053 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
11054 {}
11055 }
11056 },
94024cd1 11057 [ALC662_FIXUP_SKU_IGNORE] = {
1727a771 11058 .type = HDA_FIXUP_FUNC,
23d30f28 11059 .v.func = alc_fixup_sku_ignore,
c6b35874 11060 },
e59ea3ed 11061 [ALC662_FIXUP_HP_RP5800] = {
1727a771
TI
11062 .type = HDA_FIXUP_PINS,
11063 .v.pins = (const struct hda_pintbl[]) {
e59ea3ed
TI
11064 { 0x14, 0x0221201f }, /* HP out */
11065 { }
11066 },
11067 .chained = true,
11068 .chain_id = ALC662_FIXUP_SKU_IGNORE
11069 },
53c334ad 11070 [ALC662_FIXUP_ASUS_MODE1] = {
1727a771
TI
11071 .type = HDA_FIXUP_PINS,
11072 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
11073 { 0x14, 0x99130110 }, /* speaker */
11074 { 0x18, 0x01a19c20 }, /* mic */
11075 { 0x19, 0x99a3092f }, /* int-mic */
11076 { 0x21, 0x0121401f }, /* HP out */
11077 { }
11078 },
11079 .chained = true,
11080 .chain_id = ALC662_FIXUP_SKU_IGNORE
11081 },
11082 [ALC662_FIXUP_ASUS_MODE2] = {
1727a771
TI
11083 .type = HDA_FIXUP_PINS,
11084 .v.pins = (const struct hda_pintbl[]) {
2996bdba
TI
11085 { 0x14, 0x99130110 }, /* speaker */
11086 { 0x18, 0x01a19820 }, /* mic */
11087 { 0x19, 0x99a3092f }, /* int-mic */
11088 { 0x1b, 0x0121401f }, /* HP out */
11089 { }
11090 },
53c334ad
TI
11091 .chained = true,
11092 .chain_id = ALC662_FIXUP_SKU_IGNORE
11093 },
11094 [ALC662_FIXUP_ASUS_MODE3] = {
1727a771
TI
11095 .type = HDA_FIXUP_PINS,
11096 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
11097 { 0x14, 0x99130110 }, /* speaker */
11098 { 0x15, 0x0121441f }, /* HP */
11099 { 0x18, 0x01a19840 }, /* mic */
11100 { 0x19, 0x99a3094f }, /* int-mic */
11101 { 0x21, 0x01211420 }, /* HP2 */
11102 { }
11103 },
11104 .chained = true,
11105 .chain_id = ALC662_FIXUP_SKU_IGNORE
11106 },
11107 [ALC662_FIXUP_ASUS_MODE4] = {
1727a771
TI
11108 .type = HDA_FIXUP_PINS,
11109 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
11110 { 0x14, 0x99130110 }, /* speaker */
11111 { 0x16, 0x99130111 }, /* speaker */
11112 { 0x18, 0x01a19840 }, /* mic */
11113 { 0x19, 0x99a3094f }, /* int-mic */
11114 { 0x21, 0x0121441f }, /* HP */
11115 { }
11116 },
11117 .chained = true,
11118 .chain_id = ALC662_FIXUP_SKU_IGNORE
11119 },
11120 [ALC662_FIXUP_ASUS_MODE5] = {
1727a771
TI
11121 .type = HDA_FIXUP_PINS,
11122 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
11123 { 0x14, 0x99130110 }, /* speaker */
11124 { 0x15, 0x0121441f }, /* HP */
11125 { 0x16, 0x99130111 }, /* speaker */
11126 { 0x18, 0x01a19840 }, /* mic */
11127 { 0x19, 0x99a3094f }, /* int-mic */
11128 { }
11129 },
11130 .chained = true,
11131 .chain_id = ALC662_FIXUP_SKU_IGNORE
11132 },
11133 [ALC662_FIXUP_ASUS_MODE6] = {
1727a771
TI
11134 .type = HDA_FIXUP_PINS,
11135 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
11136 { 0x14, 0x99130110 }, /* speaker */
11137 { 0x15, 0x01211420 }, /* HP2 */
11138 { 0x18, 0x01a19840 }, /* mic */
11139 { 0x19, 0x99a3094f }, /* int-mic */
11140 { 0x1b, 0x0121441f }, /* HP */
11141 { }
11142 },
11143 .chained = true,
11144 .chain_id = ALC662_FIXUP_SKU_IGNORE
11145 },
11146 [ALC662_FIXUP_ASUS_MODE7] = {
1727a771
TI
11147 .type = HDA_FIXUP_PINS,
11148 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
11149 { 0x14, 0x99130110 }, /* speaker */
11150 { 0x17, 0x99130111 }, /* speaker */
11151 { 0x18, 0x01a19840 }, /* mic */
11152 { 0x19, 0x99a3094f }, /* int-mic */
11153 { 0x1b, 0x01214020 }, /* HP */
11154 { 0x21, 0x0121401f }, /* HP */
11155 { }
11156 },
11157 .chained = true,
11158 .chain_id = ALC662_FIXUP_SKU_IGNORE
11159 },
11160 [ALC662_FIXUP_ASUS_MODE8] = {
1727a771
TI
11161 .type = HDA_FIXUP_PINS,
11162 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
11163 { 0x14, 0x99130110 }, /* speaker */
11164 { 0x12, 0x99a30970 }, /* int-mic */
11165 { 0x15, 0x01214020 }, /* HP */
11166 { 0x17, 0x99130111 }, /* speaker */
11167 { 0x18, 0x01a19840 }, /* mic */
11168 { 0x21, 0x0121401f }, /* HP */
11169 { }
11170 },
11171 .chained = true,
11172 .chain_id = ALC662_FIXUP_SKU_IGNORE
2996bdba 11173 },
1565cc35 11174 [ALC662_FIXUP_NO_JACK_DETECT] = {
1727a771 11175 .type = HDA_FIXUP_FUNC,
1565cc35
TI
11176 .v.func = alc_fixup_no_jack_detect,
11177 },
edfe3bfc 11178 [ALC662_FIXUP_ZOTAC_Z68] = {
1727a771
TI
11179 .type = HDA_FIXUP_PINS,
11180 .v.pins = (const struct hda_pintbl[]) {
edfe3bfc
DH
11181 { 0x1b, 0x02214020 }, /* Front HP */
11182 { }
11183 }
11184 },
125821ae 11185 [ALC662_FIXUP_INV_DMIC] = {
1727a771 11186 .type = HDA_FIXUP_FUNC,
9d36a7dc 11187 .v.func = alc_fixup_inv_dmic,
125821ae 11188 },
033b0a7c
GM
11189 [ALC668_FIXUP_DELL_XPS13] = {
11190 .type = HDA_FIXUP_FUNC,
11191 .v.func = alc_fixup_dell_xps13,
11192 .chained = true,
11193 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
11194 },
5e6db669
GM
11195 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
11196 .type = HDA_FIXUP_FUNC,
11197 .v.func = alc_fixup_disable_aamix,
11198 .chained = true,
11199 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
11200 },
493a52a9
HW
11201 [ALC668_FIXUP_AUTO_MUTE] = {
11202 .type = HDA_FIXUP_FUNC,
11203 .v.func = alc_fixup_auto_mute_via_amp,
11204 .chained = true,
11205 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
11206 },
1f8b46cd
DH
11207 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
11208 .type = HDA_FIXUP_PINS,
11209 .v.pins = (const struct hda_pintbl[]) {
11210 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
11211 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
11212 { }
11213 },
11214 .chained = true,
11215 .chain_id = ALC662_FIXUP_HEADSET_MODE
11216 },
11217 [ALC662_FIXUP_HEADSET_MODE] = {
11218 .type = HDA_FIXUP_FUNC,
11219 .v.func = alc_fixup_headset_mode_alc662,
11220 },
73bdd597
DH
11221 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
11222 .type = HDA_FIXUP_PINS,
11223 .v.pins = (const struct hda_pintbl[]) {
11224 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
11225 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
11226 { }
11227 },
11228 .chained = true,
11229 .chain_id = ALC668_FIXUP_HEADSET_MODE
11230 },
11231 [ALC668_FIXUP_HEADSET_MODE] = {
11232 .type = HDA_FIXUP_FUNC,
11233 .v.func = alc_fixup_headset_mode_alc668,
11234 },
8e54b4ac 11235 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
8e383953 11236 .type = HDA_FIXUP_FUNC,
eb9ca3ab 11237 .v.func = alc_fixup_bass_chmap,
8e383953
TI
11238 .chained = true,
11239 .chain_id = ALC662_FIXUP_ASUS_MODE4
11240 },
61a75f13
DH
11241 [ALC662_FIXUP_BASS_16] = {
11242 .type = HDA_FIXUP_PINS,
11243 .v.pins = (const struct hda_pintbl[]) {
11244 {0x16, 0x80106111}, /* bass speaker */
11245 {}
11246 },
11247 .chained = true,
11248 .chain_id = ALC662_FIXUP_BASS_CHMAP,
11249 },
a30c9aaa
TI
11250 [ALC662_FIXUP_BASS_1A] = {
11251 .type = HDA_FIXUP_PINS,
11252 .v.pins = (const struct hda_pintbl[]) {
11253 {0x1a, 0x80106111}, /* bass speaker */
11254 {}
11255 },
8e54b4ac
DH
11256 .chained = true,
11257 .chain_id = ALC662_FIXUP_BASS_CHMAP,
a30c9aaa 11258 },
8e54b4ac 11259 [ALC662_FIXUP_BASS_CHMAP] = {
a30c9aaa 11260 .type = HDA_FIXUP_FUNC,
eb9ca3ab 11261 .v.func = alc_fixup_bass_chmap,
a30c9aaa 11262 },
9d4dc584
BM
11263 [ALC662_FIXUP_ASUS_Nx50] = {
11264 .type = HDA_FIXUP_FUNC,
11265 .v.func = alc_fixup_auto_mute_via_amp,
11266 .chained = true,
11267 .chain_id = ALC662_FIXUP_BASS_1A
11268 },
fc7438b1
MP
11269 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
11270 .type = HDA_FIXUP_FUNC,
11271 .v.func = alc_fixup_headset_mode_alc668,
11272 .chain_id = ALC662_FIXUP_BASS_CHMAP
11273 },
3231e205
YP
11274 [ALC668_FIXUP_ASUS_Nx51] = {
11275 .type = HDA_FIXUP_PINS,
11276 .v.pins = (const struct hda_pintbl[]) {
fc7438b1
MP
11277 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
11278 { 0x1a, 0x90170151 }, /* bass speaker */
11279 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
3231e205
YP
11280 {}
11281 },
11282 .chained = true,
fc7438b1 11283 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
3231e205 11284 },
5b7c5e1f 11285 [ALC668_FIXUP_MIC_COEF] = {
11ba6111
TI
11286 .type = HDA_FIXUP_VERBS,
11287 .v.verbs = (const struct hda_verb[]) {
11288 { 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
11289 { 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
11290 {}
11291 },
11292 },
5b7c5e1f
TI
11293 [ALC668_FIXUP_ASUS_G751] = {
11294 .type = HDA_FIXUP_PINS,
11295 .v.pins = (const struct hda_pintbl[]) {
11296 { 0x16, 0x0421101f }, /* HP */
11297 {}
11298 },
11299 .chained = true,
11300 .chain_id = ALC668_FIXUP_MIC_COEF
11301 },
78f4f7c2
KY
11302 [ALC891_FIXUP_HEADSET_MODE] = {
11303 .type = HDA_FIXUP_FUNC,
11304 .v.func = alc_fixup_headset_mode,
11305 },
11306 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
11307 .type = HDA_FIXUP_PINS,
11308 .v.pins = (const struct hda_pintbl[]) {
11309 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
11310 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
11311 { }
11312 },
11313 .chained = true,
11314 .chain_id = ALC891_FIXUP_HEADSET_MODE
11315 },
9b51fe3e
SB
11316 [ALC662_FIXUP_ACER_VERITON] = {
11317 .type = HDA_FIXUP_PINS,
11318 .v.pins = (const struct hda_pintbl[]) {
11319 { 0x15, 0x50170120 }, /* no internal speaker */
11320 { }
11321 }
11322 },
1a3f0991
TI
11323 [ALC892_FIXUP_ASROCK_MOBO] = {
11324 .type = HDA_FIXUP_PINS,
11325 .v.pins = (const struct hda_pintbl[]) {
11326 { 0x15, 0x40f000f0 }, /* disabled */
11327 { 0x16, 0x40f000f0 }, /* disabled */
1a3f0991
TI
11328 { }
11329 }
11330 },
c6790c8e
KY
11331 [ALC662_FIXUP_USI_FUNC] = {
11332 .type = HDA_FIXUP_FUNC,
11333 .v.func = alc662_fixup_usi_headset_mic,
11334 },
11335 [ALC662_FIXUP_USI_HEADSET_MODE] = {
11336 .type = HDA_FIXUP_PINS,
11337 .v.pins = (const struct hda_pintbl[]) {
11338 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
11339 { 0x18, 0x01a1903d },
11340 { }
11341 },
11342 .chained = true,
11343 .chain_id = ALC662_FIXUP_USI_FUNC
11344 },
ca169cc2
KY
11345 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
11346 .type = HDA_FIXUP_FUNC,
11347 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
11348 },
00066e97
SB
11349 [ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
11350 .type = HDA_FIXUP_FUNC,
11351 .v.func = alc662_fixup_aspire_ethos_hp,
11352 },
00066e97
SB
11353 [ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
11354 .type = HDA_FIXUP_PINS,
11355 .v.pins = (const struct hda_pintbl[]) {
11356 { 0x15, 0x92130110 }, /* front speakers */
11357 { 0x18, 0x99130111 }, /* center/subwoofer */
11358 { 0x1b, 0x11130012 }, /* surround plus jack for HP */
11359 { }
11360 },
11361 .chained = true,
336820c4 11362 .chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
00066e97 11363 },
5af29028
KY
11364 [ALC671_FIXUP_HP_HEADSET_MIC2] = {
11365 .type = HDA_FIXUP_FUNC,
11366 .v.func = alc671_fixup_hp_headset_mic2,
11367 },
d858c706
JHP
11368 [ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
11369 .type = HDA_FIXUP_PINS,
11370 .v.pins = (const struct hda_pintbl[]) {
11371 { 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
11372 { }
11373 },
11374 .chained = true,
11375 .chain_id = ALC662_FIXUP_USI_FUNC
11376 },
a124458a
JHP
11377 [ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
11378 .type = HDA_FIXUP_PINS,
11379 .v.pins = (const struct hda_pintbl[]) {
11380 { 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
11381 { 0x1b, 0x0221144f },
11382 { }
11383 },
11384 .chained = true,
11385 .chain_id = ALC662_FIXUP_USI_FUNC
11386 },
a3fd1a98
HW
11387 [ALC668_FIXUP_ASUS_NO_HEADSET_MIC] = {
11388 .type = HDA_FIXUP_PINS,
11389 .v.pins = (const struct hda_pintbl[]) {
11390 { 0x1b, 0x04a1112c },
11391 { }
11392 },
11393 .chained = true,
11394 .chain_id = ALC668_FIXUP_HEADSET_MIC
11395 },
11396 [ALC668_FIXUP_HEADSET_MIC] = {
11397 .type = HDA_FIXUP_FUNC,
11398 .v.func = alc269_fixup_headset_mic,
11399 .chained = true,
11400 .chain_id = ALC668_FIXUP_MIC_DET_COEF
11401 },
11402 [ALC668_FIXUP_MIC_DET_COEF] = {
11403 .type = HDA_FIXUP_VERBS,
11404 .v.verbs = (const struct hda_verb[]) {
11405 { 0x20, AC_VERB_SET_COEF_INDEX, 0x15 },
11406 { 0x20, AC_VERB_SET_PROC_COEF, 0x0d60 },
11407 {}
11408 },
11409 },
d7f32791
KY
11410 [ALC897_FIXUP_LENOVO_HEADSET_MIC] = {
11411 .type = HDA_FIXUP_FUNC,
11412 .v.func = alc897_fixup_lenovo_headset_mic,
11413 },
11414 [ALC897_FIXUP_HEADSET_MIC_PIN] = {
11415 .type = HDA_FIXUP_PINS,
11416 .v.pins = (const struct hda_pintbl[]) {
11417 { 0x1a, 0x03a11050 },
11418 { }
11419 },
11420 .chained = true,
11421 .chain_id = ALC897_FIXUP_LENOVO_HEADSET_MIC
11422 },
fe6900bd
KY
11423 [ALC897_FIXUP_HP_HSMIC_VERB] = {
11424 .type = HDA_FIXUP_PINS,
11425 .v.pins = (const struct hda_pintbl[]) {
11426 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
11427 { }
11428 },
11429 },
6cb3b707
DH
11430};
11431
a9111321 11432static const struct snd_pci_quirk alc662_fixup_tbl[] = {
53c334ad 11433 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
d3d3835c 11434 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
02f6ff90 11435 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
a6c47a85 11436 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
94024cd1 11437 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
125821ae 11438 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
1801928e 11439 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
2df03514 11440 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
9edeb110 11441 SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
a124458a 11442 SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
d858c706 11443 SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
73bdd597
DH
11444 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
11445 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
c5d019c3 11446 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
033b0a7c 11447 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
467e1436 11448 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
09d2014f 11449 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
ad8ff99e 11450 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8dc9abb9
KY
11451 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
11452 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
6a98e34b 11453 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
e59ea3ed 11454 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
fe6900bd 11455 SND_PCI_QUIRK(0x103c, 0x8719, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
148ebf54 11456 SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
dbe75d31 11457 SND_PCI_QUIRK(0x103c, 0x877e, "HP 288 Pro G6", ALC671_FIXUP_HP_HEADSET_MIC2),
882bd07f 11458 SND_PCI_QUIRK(0x103c, 0x885f, "HP 288 Pro G8", ALC671_FIXUP_HP_HEADSET_MIC2),
2da2dc9e 11459 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
83a9efb5 11460 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
9d4dc584 11461 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
11ba6111 11462 SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
9edeb110 11463 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
8e54b4ac 11464 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
61a75f13 11465 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
3231e205
YP
11466 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
11467 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
a3fd1a98 11468 SND_PCI_QUIRK(0x1043, 0x185d, "ASUS G551JW", ALC668_FIXUP_ASUS_NO_HEADSET_MIC),
c7efff92 11469 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
61a75f13 11470 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
8e54b4ac 11471 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
1565cc35 11472 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
53c334ad 11473 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
a0e90acc 11474 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
c6790c8e 11475 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
ca169cc2 11476 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
5a873857 11477 SND_PCI_QUIRK(0x17aa, 0x1057, "Lenovo P360", ALC897_FIXUP_HEADSET_MIC_PIN),
d7f32791
KY
11478 SND_PCI_QUIRK(0x17aa, 0x32ca, "Lenovo ThinkCentre M80", ALC897_FIXUP_HEADSET_MIC_PIN),
11479 SND_PCI_QUIRK(0x17aa, 0x32cb, "Lenovo ThinkCentre M70", ALC897_FIXUP_HEADSET_MIC_PIN),
11480 SND_PCI_QUIRK(0x17aa, 0x32cf, "Lenovo ThinkCentre M950", ALC897_FIXUP_HEADSET_MIC_PIN),
11481 SND_PCI_QUIRK(0x17aa, 0x32f7, "Lenovo ThinkCentre M90", ALC897_FIXUP_HEADSET_MIC_PIN),
d4118588 11482 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
6cb3b707 11483 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
1a3f0991 11484 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
edfe3bfc 11485 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
9b51fe3e 11486 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
f1ec5be1 11487 SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
d2ebd479 11488 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
53c334ad
TI
11489
11490#if 0
11491 /* Below is a quirk table taken from the old code.
11492 * Basically the device should work as is without the fixup table.
11493 * If BIOS doesn't give a proper info, enable the corresponding
11494 * fixup entry.
7d7eb9ea 11495 */
53c334ad
TI
11496 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
11497 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
11498 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
11499 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
11500 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
11501 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11502 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
11503 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
11504 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
11505 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11506 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
11507 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
11508 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
11509 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
11510 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
11511 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11512 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
11513 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
11514 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11515 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
11516 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
11517 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11518 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
11519 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
11520 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
11521 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11522 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
11523 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
11524 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11525 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
11526 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11527 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11528 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
11529 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
11530 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
11531 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
11532 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
11533 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
11534 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
11535 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11536 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
11537 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
11538 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
11539 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
11540 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
11541 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
11542 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
11543 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
11544 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
11545 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
11546#endif
6cb3b707
DH
11547 {}
11548};
11549
1727a771 11550static const struct hda_model_fixup alc662_fixup_models[] = {
aa3841b5
TI
11551 {.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
11552 {.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
6be7948f 11553 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
aa3841b5 11554 {.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
53c334ad
TI
11555 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
11556 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
11557 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
11558 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
11559 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
11560 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
11561 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
11562 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
aa3841b5 11563 {.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
6e72aa5f 11564 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
aa3841b5 11565 {.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
e32aa85a 11566 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
aa3841b5
TI
11567 {.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
11568 {.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
11569 {.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
11570 {.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
11571 {.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
11572 {.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
11573 {.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
11574 {.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
40c51675 11575 {.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
aa3841b5
TI
11576 {.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
11577 {.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
11578 {.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
11579 {.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
11580 {.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
ba90d6a6 11581 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
00066e97 11582 {.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
6be7948f
TB
11583 {}
11584};
6cb3b707 11585
532895c5 11586static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
78f4f7c2
KY
11587 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
11588 {0x17, 0x02211010},
11589 {0x18, 0x01a19030},
11590 {0x1a, 0x01813040},
11591 {0x21, 0x01014020}),
4b4e0e32
HW
11592 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
11593 {0x16, 0x01813030},
11594 {0x17, 0x02211010},
11595 {0x18, 0x01a19040},
11596 {0x21, 0x01014020}),
1f8b46cd 11597 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
1f8b46cd 11598 {0x14, 0x01014010},
1f8b46cd 11599 {0x18, 0x01a19020},
1f8b46cd 11600 {0x1a, 0x0181302f},
11580297 11601 {0x1b, 0x0221401f}),
76c2132e
DH
11602 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
11603 {0x12, 0x99a30130},
11604 {0x14, 0x90170110},
11605 {0x15, 0x0321101f},
11580297 11606 {0x16, 0x03011020}),
76c2132e
DH
11607 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
11608 {0x12, 0x99a30140},
11609 {0x14, 0x90170110},
11610 {0x15, 0x0321101f},
11580297 11611 {0x16, 0x03011020}),
76c2132e
DH
11612 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
11613 {0x12, 0x99a30150},
11614 {0x14, 0x90170110},
11615 {0x15, 0x0321101f},
11580297 11616 {0x16, 0x03011020}),
76c2132e 11617 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
76c2132e
DH
11618 {0x14, 0x90170110},
11619 {0x15, 0x0321101f},
11580297 11620 {0x16, 0x03011020}),
76c2132e
DH
11621 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
11622 {0x12, 0x90a60130},
11623 {0x14, 0x90170110},
11580297 11624 {0x15, 0x0321101f}),
5af29028
KY
11625 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
11626 {0x14, 0x01014010},
11627 {0x17, 0x90170150},
f2adbae0 11628 {0x19, 0x02a11060},
5af29028
KY
11629 {0x1b, 0x01813030},
11630 {0x21, 0x02211020}),
11631 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
11632 {0x14, 0x01014010},
11633 {0x18, 0x01a19040},
11634 {0x1b, 0x01813030},
11635 {0x21, 0x02211020}),
11636 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
11637 {0x14, 0x01014020},
11638 {0x17, 0x90170110},
11639 {0x18, 0x01a19050},
11640 {0x1b, 0x01813040},
11641 {0x21, 0x02211030}),
532895c5
HW
11642 {}
11643};
11644
1d045db9
TI
11645/*
11646 */
bc9f98a9
KY
11647static int patch_alc662(struct hda_codec *codec)
11648{
11649 struct alc_spec *spec;
3de95173 11650 int err;
bc9f98a9 11651
3de95173
TI
11652 err = alc_alloc_spec(codec, 0x0b);
11653 if (err < 0)
11654 return err;
bc9f98a9 11655
3de95173 11656 spec = codec->spec;
1f0f4b80 11657
225068ab
TI
11658 spec->shutup = alc_eapd_shutup;
11659
53c334ad
TI
11660 /* handle multiple HPs as is */
11661 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
11662
2c3bf9ab
TI
11663 alc_fix_pll_init(codec, 0x20, 0x04, 15);
11664
7639a06c 11665 switch (codec->core.vendor_id) {
f3f9185f
KY
11666 case 0x10ec0668:
11667 spec->init_hook = alc668_restore_default_value;
11668 break;
f3f9185f 11669 }
8663ff75 11670
c9af753f
TI
11671 alc_pre_init(codec);
11672
1727a771 11673 snd_hda_pick_fixup(codec, alc662_fixup_models,
8e5a0509 11674 alc662_fixup_tbl, alc662_fixups);
0fc1e447 11675 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
1727a771 11676 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
8e5a0509
TI
11677
11678 alc_auto_parse_customize_define(codec);
11679
7504b6cd
TI
11680 if (has_cdefine_beep(codec))
11681 spec->gen.beep_nid = 0x01;
11682
1bb7e43e 11683 if ((alc_get_coef0(codec) & (1 << 14)) &&
5100cd07 11684 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
e16fb6d1 11685 spec->cdefine.platform_type == 1) {
6134b1a2
WY
11686 err = alc_codec_rename(codec, "ALC272X");
11687 if (err < 0)
e16fb6d1 11688 goto error;
20ca0c35 11689 }
274693f3 11690
b9c5106c
TI
11691 /* automatic parse from the BIOS config */
11692 err = alc662_parse_auto_config(codec);
e16fb6d1
TI
11693 if (err < 0)
11694 goto error;
bc9f98a9 11695
7504b6cd 11696 if (!spec->gen.no_analog && spec->gen.beep_nid) {
7639a06c 11697 switch (codec->core.vendor_id) {
da00c244 11698 case 0x10ec0662:
fea80fae 11699 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
da00c244
KY
11700 break;
11701 case 0x10ec0272:
11702 case 0x10ec0663:
11703 case 0x10ec0665:
9ad54547 11704 case 0x10ec0668:
fea80fae 11705 err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
da00c244
KY
11706 break;
11707 case 0x10ec0273:
fea80fae 11708 err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
da00c244
KY
11709 break;
11710 }
fea80fae
TI
11711 if (err < 0)
11712 goto error;
cec27c89 11713 }
2134ea4f 11714
1727a771 11715 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 11716
bc9f98a9 11717 return 0;
801f49d3 11718
e16fb6d1
TI
11719 error:
11720 alc_free(codec);
11721 return err;
b478b998
KY
11722}
11723
d1eb57f4
KY
11724/*
11725 * ALC680 support
11726 */
d1eb57f4 11727
d1eb57f4
KY
11728static int alc680_parse_auto_config(struct hda_codec *codec)
11729{
3e6179b8 11730 return alc_parse_auto_config(codec, NULL, NULL);
d1eb57f4
KY
11731}
11732
d1eb57f4 11733/*
d1eb57f4 11734 */
d1eb57f4
KY
11735static int patch_alc680(struct hda_codec *codec)
11736{
d1eb57f4
KY
11737 int err;
11738
1f0f4b80 11739 /* ALC680 has no aa-loopback mixer */
3de95173
TI
11740 err = alc_alloc_spec(codec, 0);
11741 if (err < 0)
11742 return err;
1f0f4b80 11743
1ebec5f2
TI
11744 /* automatic parse from the BIOS config */
11745 err = alc680_parse_auto_config(codec);
11746 if (err < 0) {
11747 alc_free(codec);
11748 return err;
d1eb57f4
KY
11749 }
11750
d1eb57f4
KY
11751 return 0;
11752}
11753
1da177e4
LT
11754/*
11755 * patch entries
11756 */
b9a94a9c 11757static const struct hda_device_id snd_hda_id_realtek[] = {
0a6f0600 11758 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
b9a94a9c 11759 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
2a36c16e 11760 HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
4231430d 11761 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
1948fc06 11762 HDA_CODEC_ENTRY(0x10ec0230, "ALC236", patch_alc269),
b9a94a9c
TI
11763 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
11764 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
dcd4f0db 11765 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
b9a94a9c 11766 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
736f20a7 11767 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
7fbdcd83 11768 HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
b9a94a9c
TI
11769 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
11770 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
f429e7e4 11771 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
b9a94a9c
TI
11772 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
11773 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
11774 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
11775 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
11776 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
11777 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
11778 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
dcd4f0db 11779 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
b9a94a9c
TI
11780 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
11781 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
11782 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
11783 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
11784 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
11785 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
0a6f0600 11786 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
b9a94a9c 11787 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
630e3612 11788 HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
b9a94a9c 11789 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
0a6f0600 11790 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
b9a94a9c
TI
11791 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
11792 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
11793 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
dcd4f0db 11794 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
7d727869 11795 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
b9a94a9c 11796 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
28f1f9b2 11797 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
1078bef0 11798 HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
f0778871 11799 HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
b9a94a9c
TI
11800 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
11801 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
11802 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
11803 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
11804 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
11805 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
11806 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
11807 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
11808 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
11809 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
11810 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
11811 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
11812 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
11813 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
6fbae35a
KY
11814 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
11815 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
11816 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
83629532 11817 HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
78f4f7c2 11818 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
b9a94a9c
TI
11819 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
11820 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
11821 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
11822 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
11823 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
11824 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
11825 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
11826 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
11827 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
11828 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
11829 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
e5782a5d 11830 HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
b9a94a9c
TI
11831 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
11832 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
6d9ffcff 11833 HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
65553b12 11834 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
a535ad57 11835 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
527f4643 11836 HDA_CODEC_ENTRY(0x19e58326, "HW8326", patch_alc269),
1da177e4
LT
11837 {} /* terminator */
11838};
b9a94a9c 11839MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
1289e9e8
TI
11840
11841MODULE_LICENSE("GPL");
11842MODULE_DESCRIPTION("Realtek HD-audio codec");
11843
d8a766a1 11844static struct hda_codec_driver realtek_driver = {
b9a94a9c 11845 .id = snd_hda_id_realtek,
1289e9e8
TI
11846};
11847
d8a766a1 11848module_hda_codec_driver(realtek_driver);