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