]> git.ipfire.org Git - thirdparty/linux.git/blame - sound/pci/hda/patch_realtek.c
ALSA: hda/realtek: Add some Clove SSID in the ALC293(ALC1220)
[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"
1da177e4 28
cd63a5ff
TI
29/* keep halting ALC5505 DSP, for power saving */
30#define HALT_REALTEK_ALC5505
31
4a79ba34
TI
32/* extra amp-initialization sequence types */
33enum {
1c76aa5f 34 ALC_INIT_UNDEFINED,
4a79ba34
TI
35 ALC_INIT_NONE,
36 ALC_INIT_DEFAULT,
4a79ba34
TI
37};
38
73bdd597
DH
39enum {
40 ALC_HEADSET_MODE_UNKNOWN,
41 ALC_HEADSET_MODE_UNPLUGGED,
42 ALC_HEADSET_MODE_HEADSET,
43 ALC_HEADSET_MODE_MIC,
44 ALC_HEADSET_MODE_HEADPHONE,
45};
46
47enum {
48 ALC_HEADSET_TYPE_UNKNOWN,
49 ALC_HEADSET_TYPE_CTIA,
50 ALC_HEADSET_TYPE_OMTP,
51};
52
c7b60a89
HW
53enum {
54 ALC_KEY_MICMUTE_INDEX,
55};
56
da00c244
KY
57struct alc_customize_define {
58 unsigned int sku_cfg;
59 unsigned char port_connectivity;
60 unsigned char check_sum;
61 unsigned char customization;
62 unsigned char external_amp;
63 unsigned int enable_pcbeep:1;
64 unsigned int platform_type:1;
65 unsigned int swap:1;
66 unsigned int override:1;
90622917 67 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
da00c244
KY
68};
69
766538ac
TI
70struct alc_coef_led {
71 unsigned int idx;
72 unsigned int mask;
73 unsigned int on;
74 unsigned int off;
75};
76
1da177e4 77struct alc_spec {
08c189f2 78 struct hda_gen_spec gen; /* must be at head */
23d30f28 79
1da177e4 80 /* codec parameterization */
da00c244 81 struct alc_customize_define cdefine;
08c189f2 82 unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
834be88d 83
5579cd6f
TI
84 /* GPIO bits */
85 unsigned int gpio_mask;
86 unsigned int gpio_dir;
87 unsigned int gpio_data;
215c850c 88 bool gpio_write_delay; /* add a delay before writing gpio_data */
5579cd6f 89
8d3d1ece 90 /* mute LED for HP laptops, see vref_mute_led_set() */
08fb0d0e 91 int mute_led_polarity;
dbd13179 92 int micmute_led_polarity;
08fb0d0e 93 hda_nid_t mute_led_nid;
9c5dc3bf 94 hda_nid_t cap_mute_led_nid;
08fb0d0e 95
0f32fd19
TI
96 unsigned int gpio_mute_led_mask;
97 unsigned int gpio_mic_led_mask;
766538ac
TI
98 struct alc_coef_led mute_led_coef;
99 struct alc_coef_led mic_led_coef;
9f5c6faf 100
73bdd597
DH
101 hda_nid_t headset_mic_pin;
102 hda_nid_t headphone_mic_pin;
103 int current_headset_mode;
104 int current_headset_type;
105
ae6b813a
TI
106 /* hooks */
107 void (*init_hook)(struct hda_codec *codec);
83012a7c 108#ifdef CONFIG_PM
c97259df 109 void (*power_hook)(struct hda_codec *codec);
f5de24b0 110#endif
1c716153 111 void (*shutup)(struct hda_codec *codec);
70a0976b 112 void (*reboot_notify)(struct hda_codec *codec);
d922b51d 113
4a79ba34 114 int init_amp;
d433a678 115 int codec_variant; /* flag for other variants */
97a26570
KY
116 unsigned int has_alc5505_dsp:1;
117 unsigned int no_depop_delay:1;
693abe11 118 unsigned int done_hp_init:1;
c0ca5ece 119 unsigned int no_shutup_pins:1;
d3ba58bb 120 unsigned int ultra_low_power:1;
476c02e0 121 unsigned int has_hs_key:1;
e64f14f4 122
2c3bf9ab
TI
123 /* for PLL fix */
124 hda_nid_t pll_nid;
125 unsigned int pll_coef_idx, pll_coef_bit;
1bb7e43e 126 unsigned int coef0;
33f4acd3 127 struct input_dev *kb_dev;
c7b60a89 128 u8 alc_mute_keycode_map[1];
df694daa
KY
129};
130
f2a227cd
TI
131/*
132 * COEF access helper functions
133 */
134
135static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
136 unsigned int coef_idx)
137{
138 unsigned int val;
139
140 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
141 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
142 return val;
143}
144
145#define alc_read_coef_idx(codec, coef_idx) \
146 alc_read_coefex_idx(codec, 0x20, coef_idx)
147
148static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
149 unsigned int coef_idx, unsigned int coef_val)
150{
151 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
152 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
153}
154
155#define alc_write_coef_idx(codec, coef_idx, coef_val) \
156 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
157
98b24883
TI
158static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
159 unsigned int coef_idx, unsigned int mask,
160 unsigned int bits_set)
161{
162 unsigned int val = alc_read_coefex_idx(codec, nid, coef_idx);
163
164 if (val != -1)
165 alc_write_coefex_idx(codec, nid, coef_idx,
166 (val & ~mask) | bits_set);
167}
168
169#define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
170 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
171
f2a227cd
TI
172/* a special bypass for COEF 0; read the cached value at the second time */
173static unsigned int alc_get_coef0(struct hda_codec *codec)
174{
175 struct alc_spec *spec = codec->spec;
176
177 if (!spec->coef0)
178 spec->coef0 = alc_read_coef_idx(codec, 0);
179 return spec->coef0;
180}
181
54db6c39
TI
182/* coef writes/updates batch */
183struct coef_fw {
184 unsigned char nid;
185 unsigned char idx;
186 unsigned short mask;
187 unsigned short val;
188};
189
190#define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
191 { .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
192#define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
193#define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
194#define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
195
196static void alc_process_coef_fw(struct hda_codec *codec,
197 const struct coef_fw *fw)
198{
199 for (; fw->nid; fw++) {
200 if (fw->mask == (unsigned short)-1)
201 alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
202 else
203 alc_update_coefex_idx(codec, fw->nid, fw->idx,
204 fw->mask, fw->val);
205 }
206}
207
df694daa 208/*
1d045db9 209 * GPIO setup tables, used in initialization
df694daa 210 */
5579cd6f 211
bc9f98a9 212/* Enable GPIO mask and set output */
5579cd6f
TI
213static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
214{
215 struct alc_spec *spec = codec->spec;
bc9f98a9 216
5579cd6f
TI
217 spec->gpio_mask |= mask;
218 spec->gpio_dir |= mask;
219 spec->gpio_data |= mask;
220}
bc9f98a9 221
5579cd6f
TI
222static void alc_write_gpio_data(struct hda_codec *codec)
223{
224 struct alc_spec *spec = codec->spec;
225
226 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
227 spec->gpio_data);
228}
229
aaf312de
TI
230static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
231 bool on)
232{
233 struct alc_spec *spec = codec->spec;
234 unsigned int oldval = spec->gpio_data;
235
236 if (on)
237 spec->gpio_data |= mask;
238 else
239 spec->gpio_data &= ~mask;
240 if (oldval != spec->gpio_data)
241 alc_write_gpio_data(codec);
242}
243
5579cd6f
TI
244static void alc_write_gpio(struct hda_codec *codec)
245{
246 struct alc_spec *spec = codec->spec;
247
248 if (!spec->gpio_mask)
249 return;
250
251 snd_hda_codec_write(codec, codec->core.afg, 0,
252 AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
253 snd_hda_codec_write(codec, codec->core.afg, 0,
254 AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir);
215c850c
TI
255 if (spec->gpio_write_delay)
256 msleep(1);
5579cd6f
TI
257 alc_write_gpio_data(codec);
258}
259
260static void alc_fixup_gpio(struct hda_codec *codec, int action,
261 unsigned int mask)
262{
263 if (action == HDA_FIXUP_ACT_PRE_PROBE)
264 alc_setup_gpio(codec, mask);
265}
266
267static void alc_fixup_gpio1(struct hda_codec *codec,
268 const struct hda_fixup *fix, int action)
269{
270 alc_fixup_gpio(codec, action, 0x01);
271}
272
273static void alc_fixup_gpio2(struct hda_codec *codec,
274 const struct hda_fixup *fix, int action)
275{
276 alc_fixup_gpio(codec, action, 0x02);
277}
278
279static void alc_fixup_gpio3(struct hda_codec *codec,
280 const struct hda_fixup *fix, int action)
281{
282 alc_fixup_gpio(codec, action, 0x03);
283}
bdd148a3 284
ae065f1c
TI
285static void alc_fixup_gpio4(struct hda_codec *codec,
286 const struct hda_fixup *fix, int action)
287{
288 alc_fixup_gpio(codec, action, 0x04);
289}
290
8a503555
TI
291static void alc_fixup_micmute_led(struct hda_codec *codec,
292 const struct hda_fixup *fix, int action)
293{
294 if (action == HDA_FIXUP_ACT_PROBE)
295 snd_hda_gen_add_micmute_led_cdev(codec, NULL);
296}
297
2c3bf9ab
TI
298/*
299 * Fix hardware PLL issue
300 * On some codecs, the analog PLL gating control must be off while
301 * the default value is 1.
302 */
303static void alc_fix_pll(struct hda_codec *codec)
304{
305 struct alc_spec *spec = codec->spec;
2c3bf9ab 306
98b24883
TI
307 if (spec->pll_nid)
308 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
309 1 << spec->pll_coef_bit, 0);
2c3bf9ab
TI
310}
311
312static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
313 unsigned int coef_idx, unsigned int coef_bit)
314{
315 struct alc_spec *spec = codec->spec;
316 spec->pll_nid = nid;
317 spec->pll_coef_idx = coef_idx;
318 spec->pll_coef_bit = coef_bit;
319 alc_fix_pll(codec);
320}
321
cf5a2279 322/* update the master volume per volume-knob's unsol event */
1a4f69d5
TI
323static void alc_update_knob_master(struct hda_codec *codec,
324 struct hda_jack_callback *jack)
cf5a2279
TI
325{
326 unsigned int val;
327 struct snd_kcontrol *kctl;
328 struct snd_ctl_elem_value *uctl;
329
330 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
331 if (!kctl)
332 return;
333 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
334 if (!uctl)
335 return;
2ebab40e 336 val = snd_hda_codec_read(codec, jack->nid, 0,
cf5a2279
TI
337 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
338 val &= HDA_AMP_VOLMASK;
339 uctl->value.integer.value[0] = val;
340 uctl->value.integer.value[1] = val;
341 kctl->put(kctl, uctl);
342 kfree(uctl);
343}
344
29adc4b9 345static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
f21d78e2 346{
29adc4b9
DH
347 /* For some reason, the res given from ALC880 is broken.
348 Here we adjust it properly. */
349 snd_hda_jack_unsol_event(codec, res >> 2);
f21d78e2
TI
350}
351
394c97f8
KY
352/* Change EAPD to verb control */
353static void alc_fill_eapd_coef(struct hda_codec *codec)
354{
355 int coef;
356
357 coef = alc_get_coef0(codec);
358
7639a06c 359 switch (codec->core.vendor_id) {
394c97f8
KY
360 case 0x10ec0262:
361 alc_update_coef_idx(codec, 0x7, 0, 1<<5);
362 break;
363 case 0x10ec0267:
364 case 0x10ec0268:
365 alc_update_coef_idx(codec, 0x7, 0, 1<<13);
366 break;
367 case 0x10ec0269:
368 if ((coef & 0x00f0) == 0x0010)
369 alc_update_coef_idx(codec, 0xd, 0, 1<<14);
370 if ((coef & 0x00f0) == 0x0020)
371 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
372 if ((coef & 0x00f0) == 0x0030)
373 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
374 break;
375 case 0x10ec0280:
376 case 0x10ec0284:
377 case 0x10ec0290:
378 case 0x10ec0292:
379 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
380 break;
4231430d 381 case 0x10ec0225:
44be77c5
TI
382 case 0x10ec0295:
383 case 0x10ec0299:
384 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
c0dbbdad 385 fallthrough;
44be77c5 386 case 0x10ec0215:
394c97f8 387 case 0x10ec0233:
ea04a1db 388 case 0x10ec0235:
c4473744 389 case 0x10ec0236:
7fbdcd83 390 case 0x10ec0245:
394c97f8 391 case 0x10ec0255:
c4473744 392 case 0x10ec0256:
f429e7e4 393 case 0x10ec0257:
394c97f8
KY
394 case 0x10ec0282:
395 case 0x10ec0283:
396 case 0x10ec0286:
630e3612 397 case 0x10ec0287:
394c97f8 398 case 0x10ec0288:
0a6f0600 399 case 0x10ec0285:
506b62c3 400 case 0x10ec0298:
0a6f0600 401 case 0x10ec0289:
1078bef0 402 case 0x10ec0300:
394c97f8
KY
403 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
404 break;
3aabf94c
KY
405 case 0x10ec0275:
406 alc_update_coef_idx(codec, 0xe, 0, 1<<0);
407 break;
394c97f8
KY
408 case 0x10ec0293:
409 alc_update_coef_idx(codec, 0xa, 1<<13, 0);
410 break;
dcd4f0db
KY
411 case 0x10ec0234:
412 case 0x10ec0274:
413 case 0x10ec0294:
6fbae35a
KY
414 case 0x10ec0700:
415 case 0x10ec0701:
416 case 0x10ec0703:
83629532 417 case 0x10ec0711:
dcd4f0db
KY
418 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
419 break;
394c97f8
KY
420 case 0x10ec0662:
421 if ((coef & 0x00f0) == 0x0030)
422 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
423 break;
424 case 0x10ec0272:
425 case 0x10ec0273:
426 case 0x10ec0663:
427 case 0x10ec0665:
428 case 0x10ec0670:
429 case 0x10ec0671:
430 case 0x10ec0672:
431 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
432 break;
9194a1eb 433 case 0x10ec0222:
f0778871
KY
434 case 0x10ec0623:
435 alc_update_coef_idx(codec, 0x19, 1<<13, 0);
436 break;
394c97f8
KY
437 case 0x10ec0668:
438 alc_update_coef_idx(codec, 0x7, 3<<13, 0);
439 break;
440 case 0x10ec0867:
441 alc_update_coef_idx(codec, 0x4, 1<<10, 0);
442 break;
443 case 0x10ec0888:
444 if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
445 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
446 break;
447 case 0x10ec0892:
448 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
449 break;
450 case 0x10ec0899:
451 case 0x10ec0900:
6d9ffcff 452 case 0x10ec0b00:
65553b12 453 case 0x10ec1168:
a535ad57 454 case 0x10ec1220:
394c97f8
KY
455 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
456 break;
457 }
458}
459
f9423e7a
KY
460/* additional initialization for ALC888 variants */
461static void alc888_coef_init(struct hda_codec *codec)
462{
1df8874b
KY
463 switch (alc_get_coef0(codec) & 0x00f0) {
464 /* alc888-VA */
465 case 0x00:
466 /* alc888-VB */
467 case 0x10:
468 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
469 break;
470 }
87a8c370
JK
471}
472
3fb4a508
TI
473/* turn on/off EAPD control (only if available) */
474static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
475{
476 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
477 return;
478 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
479 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
480 on ? 2 : 0);
481}
482
691f1fcc
TI
483/* turn on/off EAPD controls of the codec */
484static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
485{
486 /* We currently only handle front, HP */
caf3c043 487 static const hda_nid_t pins[] = {
af95b414 488 0x0f, 0x10, 0x14, 0x15, 0x17, 0
39fa84e9 489 };
caf3c043 490 const hda_nid_t *p;
39fa84e9
TI
491 for (p = pins; *p; p++)
492 set_eapd(codec, *p, on);
691f1fcc
TI
493}
494
dad3197d
KY
495static int find_ext_mic_pin(struct hda_codec *codec);
496
497static void alc_headset_mic_no_shutup(struct hda_codec *codec)
498{
499 const struct hda_pincfg *pin;
500 int mic_pin = find_ext_mic_pin(codec);
501 int i;
502
503 /* don't shut up pins when unloading the driver; otherwise it breaks
504 * the default pin setup at the next load of the driver
505 */
506 if (codec->bus->shutdown)
507 return;
508
509 snd_array_for_each(&codec->init_pins, i, pin) {
510 /* use read here for syncing after issuing each verb */
511 if (pin->nid != mic_pin)
512 snd_hda_codec_read(codec, pin->nid, 0,
513 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
514 }
515
516 codec->pins_shutup = 1;
517}
518
c0ca5ece
TI
519static void alc_shutup_pins(struct hda_codec *codec)
520{
521 struct alc_spec *spec = codec->spec;
522
dad3197d 523 switch (codec->core.vendor_id) {
66c5d718 524 case 0x10ec0283:
dad3197d
KY
525 case 0x10ec0286:
526 case 0x10ec0288:
527 case 0x10ec0298:
528 alc_headset_mic_no_shutup(codec);
529 break;
530 default:
531 if (!spec->no_shutup_pins)
532 snd_hda_shutup_pins(codec);
533 break;
534 }
c0ca5ece
TI
535}
536
1c716153 537/* generic shutup callback;
4ce8e6a5 538 * just turning off EAPD and a little pause for avoiding pop-noise
1c716153
TI
539 */
540static void alc_eapd_shutup(struct hda_codec *codec)
541{
97a26570
KY
542 struct alc_spec *spec = codec->spec;
543
1c716153 544 alc_auto_setup_eapd(codec, false);
97a26570
KY
545 if (!spec->no_depop_delay)
546 msleep(200);
c0ca5ece 547 alc_shutup_pins(codec);
1c716153
TI
548}
549
1d045db9 550/* generic EAPD initialization */
4a79ba34 551static void alc_auto_init_amp(struct hda_codec *codec, int type)
bc9f98a9 552{
39fa84e9 553 alc_auto_setup_eapd(codec, true);
5579cd6f 554 alc_write_gpio(codec);
4a79ba34 555 switch (type) {
4a79ba34 556 case ALC_INIT_DEFAULT:
7639a06c 557 switch (codec->core.vendor_id) {
c9b58006 558 case 0x10ec0260:
98b24883 559 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
c9b58006 560 break;
c9b58006
KY
561 case 0x10ec0880:
562 case 0x10ec0882:
563 case 0x10ec0883:
564 case 0x10ec0885:
1df8874b 565 alc_update_coef_idx(codec, 7, 0, 0x2030);
c9b58006 566 break;
f9423e7a 567 case 0x10ec0888:
4a79ba34 568 alc888_coef_init(codec);
f9423e7a 569 break;
bc9f98a9 570 }
4a79ba34
TI
571 break;
572 }
573}
574
35a39f98
TI
575/* get a primary headphone pin if available */
576static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
577{
578 if (spec->gen.autocfg.hp_pins[0])
579 return spec->gen.autocfg.hp_pins[0];
580 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
581 return spec->gen.autocfg.line_out_pins[0];
582 return 0;
583}
08c189f2 584
1d045db9 585/*
08c189f2 586 * Realtek SSID verification
1d045db9 587 */
42cf0d01 588
08c189f2
TI
589/* Could be any non-zero and even value. When used as fixup, tells
590 * the driver to ignore any present sku defines.
591 */
592#define ALC_FIXUP_SKU_IGNORE (2)
1a1455de 593
08c189f2
TI
594static void alc_fixup_sku_ignore(struct hda_codec *codec,
595 const struct hda_fixup *fix, int action)
1a1455de 596{
1a1455de 597 struct alc_spec *spec = codec->spec;
08c189f2
TI
598 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
599 spec->cdefine.fixup = 1;
600 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
1a1455de 601 }
1a1455de
TI
602}
603
b5c6611f
ML
604static void alc_fixup_no_depop_delay(struct hda_codec *codec,
605 const struct hda_fixup *fix, int action)
606{
607 struct alc_spec *spec = codec->spec;
608
84d2dc3e 609 if (action == HDA_FIXUP_ACT_PROBE) {
b5c6611f 610 spec->no_depop_delay = 1;
84d2dc3e
ML
611 codec->depop_delay = 0;
612 }
b5c6611f
ML
613}
614
08c189f2 615static int alc_auto_parse_customize_define(struct hda_codec *codec)
4a79ba34 616{
08c189f2
TI
617 unsigned int ass, tmp, i;
618 unsigned nid = 0;
4a79ba34
TI
619 struct alc_spec *spec = codec->spec;
620
08c189f2 621 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
4a79ba34 622
08c189f2
TI
623 if (spec->cdefine.fixup) {
624 ass = spec->cdefine.sku_cfg;
625 if (ass == ALC_FIXUP_SKU_IGNORE)
626 return -1;
627 goto do_sku;
bb35febd
TI
628 }
629
5100cd07
TI
630 if (!codec->bus->pci)
631 return -1;
7639a06c 632 ass = codec->core.subsystem_id & 0xffff;
08c189f2
TI
633 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
634 goto do_sku;
4a79ba34 635
08c189f2 636 nid = 0x1d;
7639a06c 637 if (codec->core.vendor_id == 0x10ec0260)
08c189f2
TI
638 nid = 0x17;
639 ass = snd_hda_codec_get_pincfg(codec, nid);
42cf0d01 640
08c189f2 641 if (!(ass & 1)) {
4e76a883 642 codec_info(codec, "%s: SKU not ready 0x%08x\n",
7639a06c 643 codec->core.chip_name, ass);
08c189f2 644 return -1;
42cf0d01
DH
645 }
646
08c189f2
TI
647 /* check sum */
648 tmp = 0;
649 for (i = 1; i < 16; i++) {
650 if ((ass >> i) & 1)
651 tmp++;
ae8a60a5 652 }
08c189f2
TI
653 if (((ass >> 16) & 0xf) != tmp)
654 return -1;
ae8a60a5 655
da00c244
KY
656 spec->cdefine.port_connectivity = ass >> 30;
657 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
658 spec->cdefine.check_sum = (ass >> 16) & 0xf;
659 spec->cdefine.customization = ass >> 8;
660do_sku:
661 spec->cdefine.sku_cfg = ass;
662 spec->cdefine.external_amp = (ass & 0x38) >> 3;
663 spec->cdefine.platform_type = (ass & 0x4) >> 2;
664 spec->cdefine.swap = (ass & 0x2) >> 1;
665 spec->cdefine.override = ass & 0x1;
666
4e76a883 667 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
da00c244 668 nid, spec->cdefine.sku_cfg);
4e76a883 669 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
da00c244 670 spec->cdefine.port_connectivity);
4e76a883
TI
671 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
672 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
673 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
674 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
675 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
676 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
677 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
da00c244
KY
678
679 return 0;
680}
681
08c189f2
TI
682/* return the position of NID in the list, or -1 if not found */
683static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
684{
685 int i;
686 for (i = 0; i < nums; i++)
687 if (list[i] == nid)
688 return i;
689 return -1;
690}
1d045db9 691/* return true if the given NID is found in the list */
3af9ee6b
TI
692static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
693{
21268961 694 return find_idx_in_nid_list(nid, list, nums) >= 0;
3af9ee6b
TI
695}
696
4a79ba34
TI
697/* check subsystem ID and set up device-specific initialization;
698 * return 1 if initialized, 0 if invalid SSID
699 */
700/* 32-bit subsystem ID for BIOS loading in HD Audio codec.
701 * 31 ~ 16 : Manufacture ID
702 * 15 ~ 8 : SKU ID
703 * 7 ~ 0 : Assembly ID
704 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
705 */
58c57cfa 706static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
4a79ba34
TI
707{
708 unsigned int ass, tmp, i;
709 unsigned nid;
710 struct alc_spec *spec = codec->spec;
711
90622917
DH
712 if (spec->cdefine.fixup) {
713 ass = spec->cdefine.sku_cfg;
714 if (ass == ALC_FIXUP_SKU_IGNORE)
715 return 0;
716 goto do_sku;
717 }
718
7639a06c 719 ass = codec->core.subsystem_id & 0xffff;
5100cd07
TI
720 if (codec->bus->pci &&
721 ass != codec->bus->pci->subsystem_device && (ass & 1))
4a79ba34
TI
722 goto do_sku;
723
724 /* invalid SSID, check the special NID pin defcfg instead */
725 /*
def319f9 726 * 31~30 : port connectivity
4a79ba34
TI
727 * 29~21 : reserve
728 * 20 : PCBEEP input
729 * 19~16 : Check sum (15:1)
730 * 15~1 : Custom
731 * 0 : override
732 */
733 nid = 0x1d;
7639a06c 734 if (codec->core.vendor_id == 0x10ec0260)
4a79ba34
TI
735 nid = 0x17;
736 ass = snd_hda_codec_get_pincfg(codec, nid);
4e76a883
TI
737 codec_dbg(codec,
738 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
cb6605c1 739 ass, nid);
6227cdce 740 if (!(ass & 1))
4a79ba34
TI
741 return 0;
742 if ((ass >> 30) != 1) /* no physical connection */
743 return 0;
744
745 /* check sum */
746 tmp = 0;
747 for (i = 1; i < 16; i++) {
748 if ((ass >> i) & 1)
749 tmp++;
750 }
751 if (((ass >> 16) & 0xf) != tmp)
752 return 0;
753do_sku:
4e76a883 754 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
7639a06c 755 ass & 0xffff, codec->core.vendor_id);
4a79ba34
TI
756 /*
757 * 0 : override
758 * 1 : Swap Jack
759 * 2 : 0 --> Desktop, 1 --> Laptop
760 * 3~5 : External Amplifier control
761 * 7~6 : Reserved
762 */
763 tmp = (ass & 0x38) >> 3; /* external Amp control */
1c76aa5f
TI
764 if (spec->init_amp == ALC_INIT_UNDEFINED) {
765 switch (tmp) {
766 case 1:
5579cd6f 767 alc_setup_gpio(codec, 0x01);
1c76aa5f
TI
768 break;
769 case 3:
5579cd6f 770 alc_setup_gpio(codec, 0x02);
1c76aa5f
TI
771 break;
772 case 7:
5579cd6f 773 alc_setup_gpio(codec, 0x03);
1c76aa5f
TI
774 break;
775 case 5:
776 default:
777 spec->init_amp = ALC_INIT_DEFAULT;
778 break;
779 }
bc9f98a9 780 }
ea1fb29a 781
8c427226 782 /* is laptop or Desktop and enable the function "Mute internal speaker
c9b58006
KY
783 * when the external headphone out jack is plugged"
784 */
8c427226 785 if (!(ass & 0x8000))
4a79ba34 786 return 1;
c9b58006
KY
787 /*
788 * 10~8 : Jack location
789 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
790 * 14~13: Resvered
791 * 15 : 1 --> enable the function "Mute internal speaker
792 * when the external headphone out jack is plugged"
793 */
35a39f98 794 if (!alc_get_hp_pin(spec)) {
01d4825d 795 hda_nid_t nid;
c9b58006 796 tmp = (ass >> 11) & 0x3; /* HP to chassis */
58c57cfa 797 nid = ports[tmp];
08c189f2
TI
798 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
799 spec->gen.autocfg.line_outs))
3af9ee6b 800 return 1;
08c189f2 801 spec->gen.autocfg.hp_pins[0] = nid;
c9b58006 802 }
4a79ba34
TI
803 return 1;
804}
ea1fb29a 805
3e6179b8
TI
806/* Check the validity of ALC subsystem-id
807 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
808static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
4a79ba34 809{
58c57cfa 810 if (!alc_subsystem_id(codec, ports)) {
4a79ba34 811 struct alc_spec *spec = codec->spec;
67791202
TI
812 if (spec->init_amp == ALC_INIT_UNDEFINED) {
813 codec_dbg(codec,
814 "realtek: Enable default setup for auto mode as fallback\n");
815 spec->init_amp = ALC_INIT_DEFAULT;
816 }
4a79ba34 817 }
21268961 818}
1a1455de 819
1d045db9 820/*
ef8ef5fb 821 */
f9e336f6 822
9d36a7dc
DH
823static void alc_fixup_inv_dmic(struct hda_codec *codec,
824 const struct hda_fixup *fix, int action)
125821ae
TI
825{
826 struct alc_spec *spec = codec->spec;
668d1e96 827
9d36a7dc 828 spec->gen.inv_dmic_split = 1;
6e72aa5f
TI
829}
830
e9edcee0 831
08c189f2 832static int alc_build_controls(struct hda_codec *codec)
1d045db9 833{
a5cb463a 834 int err;
e9427969 835
08c189f2
TI
836 err = snd_hda_gen_build_controls(codec);
837 if (err < 0)
838 return err;
1da177e4 839
1727a771 840 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
1c4a54b4 841 return 0;
a361d84b
KY
842}
843
a361d84b 844
df694daa 845/*
08c189f2 846 * Common callbacks
df694daa 847 */
a361d84b 848
c9af753f
TI
849static void alc_pre_init(struct hda_codec *codec)
850{
851 alc_fill_eapd_coef(codec);
852}
853
aeac1a0d
KY
854#define is_s3_resume(codec) \
855 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
c9af753f
TI
856#define is_s4_resume(codec) \
857 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
858
08c189f2 859static int alc_init(struct hda_codec *codec)
1d045db9
TI
860{
861 struct alc_spec *spec = codec->spec;
a361d84b 862
c9af753f
TI
863 /* hibernation resume needs the full chip initialization */
864 if (is_s4_resume(codec))
865 alc_pre_init(codec);
866
08c189f2
TI
867 if (spec->init_hook)
868 spec->init_hook(codec);
a361d84b 869
89781d08 870 spec->gen.skip_verbs = 1; /* applied in below */
607ca3bd 871 snd_hda_gen_init(codec);
08c189f2
TI
872 alc_fix_pll(codec);
873 alc_auto_init_amp(codec, spec->init_amp);
89781d08 874 snd_hda_apply_verbs(codec); /* apply verbs here after own init */
3abf2f36 875
1727a771 876 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
a361d84b 877
1d045db9
TI
878 return 0;
879}
a361d84b 880
08c189f2 881static inline void alc_shutup(struct hda_codec *codec)
1d045db9
TI
882{
883 struct alc_spec *spec = codec->spec;
a361d84b 884
c7273bd6
TI
885 if (!snd_hda_get_bool_hint(codec, "shutup"))
886 return; /* disabled explicitly by hints */
887
08c189f2
TI
888 if (spec && spec->shutup)
889 spec->shutup(codec);
9bfb2844 890 else
c0ca5ece 891 alc_shutup_pins(codec);
1d045db9
TI
892}
893
70a0976b
TI
894static void alc_reboot_notify(struct hda_codec *codec)
895{
896 struct alc_spec *spec = codec->spec;
897
898 if (spec && spec->reboot_notify)
899 spec->reboot_notify(codec);
900 else
901 alc_shutup(codec);
902}
903
8a02c0cc 904#define alc_free snd_hda_gen_free
2134ea4f 905
08c189f2
TI
906#ifdef CONFIG_PM
907static void alc_power_eapd(struct hda_codec *codec)
1d045db9 908{
08c189f2 909 alc_auto_setup_eapd(codec, false);
1d045db9 910}
2134ea4f 911
08c189f2 912static int alc_suspend(struct hda_codec *codec)
1d045db9
TI
913{
914 struct alc_spec *spec = codec->spec;
08c189f2
TI
915 alc_shutup(codec);
916 if (spec && spec->power_hook)
917 spec->power_hook(codec);
a361d84b
KY
918 return 0;
919}
08c189f2 920#endif
a361d84b 921
08c189f2
TI
922#ifdef CONFIG_PM
923static int alc_resume(struct hda_codec *codec)
1d045db9 924{
97a26570
KY
925 struct alc_spec *spec = codec->spec;
926
927 if (!spec->no_depop_delay)
928 msleep(150); /* to avoid pop noise */
08c189f2 929 codec->patch_ops.init(codec);
1a462be5 930 snd_hda_regmap_sync(codec);
08c189f2
TI
931 hda_call_check_power_status(codec, 0x01);
932 return 0;
1d045db9 933}
08c189f2 934#endif
f6a92248 935
1d045db9 936/*
1d045db9 937 */
08c189f2
TI
938static const struct hda_codec_ops alc_patch_ops = {
939 .build_controls = alc_build_controls,
940 .build_pcms = snd_hda_gen_build_pcms,
941 .init = alc_init,
942 .free = alc_free,
943 .unsol_event = snd_hda_jack_unsol_event,
944#ifdef CONFIG_PM
945 .resume = alc_resume,
08c189f2 946 .suspend = alc_suspend,
fce52a3b 947 .check_power_status = snd_hda_gen_check_power_status,
08c189f2 948#endif
70a0976b 949 .reboot_notify = alc_reboot_notify,
08c189f2 950};
f6a92248 951
f53281e6 952
ded255be 953#define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
e01bf509 954
e4770629 955/*
4b016931 956 * Rename codecs appropriately from COEF value or subvendor id
e4770629 957 */
08c189f2
TI
958struct alc_codec_rename_table {
959 unsigned int vendor_id;
960 unsigned short coef_mask;
961 unsigned short coef_bits;
962 const char *name;
963};
84898e87 964
4b016931
KY
965struct alc_codec_rename_pci_table {
966 unsigned int codec_vendor_id;
967 unsigned short pci_subvendor;
968 unsigned short pci_subdevice;
969 const char *name;
970};
971
6b0f95c4 972static const struct alc_codec_rename_table rename_tbl[] = {
e6e5f7ad 973 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
08c189f2
TI
974 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
975 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
976 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
977 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
978 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
979 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
980 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
981 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
e6e5f7ad 982 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
08c189f2
TI
983 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
984 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
985 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
986 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
987 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
988 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
989 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
990 { } /* terminator */
991};
84898e87 992
6b0f95c4 993static const struct alc_codec_rename_pci_table rename_pci_tbl[] = {
4b016931
KY
994 { 0x10ec0280, 0x1028, 0, "ALC3220" },
995 { 0x10ec0282, 0x1028, 0, "ALC3221" },
996 { 0x10ec0283, 0x1028, 0, "ALC3223" },
193177de 997 { 0x10ec0288, 0x1028, 0, "ALC3263" },
4b016931 998 { 0x10ec0292, 0x1028, 0, "ALC3226" },
193177de 999 { 0x10ec0293, 0x1028, 0, "ALC3235" },
4b016931
KY
1000 { 0x10ec0255, 0x1028, 0, "ALC3234" },
1001 { 0x10ec0668, 0x1028, 0, "ALC3661" },
e6e5f7ad
KY
1002 { 0x10ec0275, 0x1028, 0, "ALC3260" },
1003 { 0x10ec0899, 0x1028, 0, "ALC3861" },
2c674fac 1004 { 0x10ec0298, 0x1028, 0, "ALC3266" },
736f20a7 1005 { 0x10ec0236, 0x1028, 0, "ALC3204" },
82324502 1006 { 0x10ec0256, 0x1028, 0, "ALC3246" },
4231430d 1007 { 0x10ec0225, 0x1028, 0, "ALC3253" },
7d727869 1008 { 0x10ec0295, 0x1028, 0, "ALC3254" },
28f1f9b2 1009 { 0x10ec0299, 0x1028, 0, "ALC3271" },
e6e5f7ad
KY
1010 { 0x10ec0670, 0x1025, 0, "ALC669X" },
1011 { 0x10ec0676, 0x1025, 0, "ALC679X" },
1012 { 0x10ec0282, 0x1043, 0, "ALC3229" },
1013 { 0x10ec0233, 0x1043, 0, "ALC3236" },
1014 { 0x10ec0280, 0x103c, 0, "ALC3228" },
1015 { 0x10ec0282, 0x103c, 0, "ALC3227" },
1016 { 0x10ec0286, 0x103c, 0, "ALC3242" },
1017 { 0x10ec0290, 0x103c, 0, "ALC3241" },
1018 { 0x10ec0668, 0x103c, 0, "ALC3662" },
1019 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
1020 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
4b016931
KY
1021 { } /* terminator */
1022};
1023
08c189f2 1024static int alc_codec_rename_from_preset(struct hda_codec *codec)
1d045db9 1025{
08c189f2 1026 const struct alc_codec_rename_table *p;
4b016931 1027 const struct alc_codec_rename_pci_table *q;
60db6b53 1028
08c189f2 1029 for (p = rename_tbl; p->vendor_id; p++) {
7639a06c 1030 if (p->vendor_id != codec->core.vendor_id)
08c189f2
TI
1031 continue;
1032 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
1033 return alc_codec_rename(codec, p->name);
1d045db9 1034 }
4b016931 1035
5100cd07
TI
1036 if (!codec->bus->pci)
1037 return 0;
4b016931 1038 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
7639a06c 1039 if (q->codec_vendor_id != codec->core.vendor_id)
4b016931
KY
1040 continue;
1041 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1042 continue;
1043 if (!q->pci_subdevice ||
1044 q->pci_subdevice == codec->bus->pci->subsystem_device)
1045 return alc_codec_rename(codec, q->name);
1046 }
1047
08c189f2 1048 return 0;
1d045db9 1049}
f53281e6 1050
e4770629 1051
1d045db9
TI
1052/*
1053 * Digital-beep handlers
1054 */
1055#ifdef CONFIG_SND_HDA_INPUT_BEEP
fea80fae
TI
1056
1057/* additional beep mixers; private_value will be overwritten */
1058static const struct snd_kcontrol_new alc_beep_mixer[] = {
1059 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1060 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1061};
1062
1063/* set up and create beep controls */
1064static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1065 int idx, int dir)
1066{
1067 struct snd_kcontrol_new *knew;
1068 unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1069 int i;
1070
1071 for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1072 knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1073 &alc_beep_mixer[i]);
1074 if (!knew)
1075 return -ENOMEM;
1076 knew->private_value = beep_amp;
1077 }
1078 return 0;
1079}
84898e87 1080
6317e5eb 1081static const struct snd_pci_quirk beep_allow_list[] = {
7110005e 1082 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
a4b7f21d 1083 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
1d045db9 1084 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
8554ee40 1085 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
1d045db9
TI
1086 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1087 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1088 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
78f8baf1 1089 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
1d045db9 1090 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
6317e5eb 1091 /* denylist -- no beep available */
051c78af
TI
1092 SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
1093 SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
1d045db9 1094 {}
fe3eb0a7
KY
1095};
1096
1d045db9
TI
1097static inline int has_cdefine_beep(struct hda_codec *codec)
1098{
1099 struct alc_spec *spec = codec->spec;
1100 const struct snd_pci_quirk *q;
6317e5eb 1101 q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list);
1d045db9
TI
1102 if (q)
1103 return q->value;
1104 return spec->cdefine.enable_pcbeep;
1105}
1106#else
fea80fae 1107#define set_beep_amp(spec, nid, idx, dir) 0
1d045db9
TI
1108#define has_cdefine_beep(codec) 0
1109#endif
84898e87 1110
1d045db9
TI
1111/* parse the BIOS configuration and set up the alc_spec */
1112/* return 1 if successful, 0 if the proper config is not found,
1113 * or a negative error code
1114 */
3e6179b8
TI
1115static int alc_parse_auto_config(struct hda_codec *codec,
1116 const hda_nid_t *ignore_nids,
1117 const hda_nid_t *ssid_nids)
1d045db9
TI
1118{
1119 struct alc_spec *spec = codec->spec;
08c189f2 1120 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
1d045db9 1121 int err;
26f5df26 1122
53c334ad
TI
1123 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1124 spec->parse_flags);
1d045db9
TI
1125 if (err < 0)
1126 return err;
3e6179b8
TI
1127
1128 if (ssid_nids)
1129 alc_ssid_check(codec, ssid_nids);
64154835 1130
08c189f2
TI
1131 err = snd_hda_gen_parse_auto_config(codec, cfg);
1132 if (err < 0)
1133 return err;
070cff4c 1134
1d045db9 1135 return 1;
60db6b53 1136}
f6a92248 1137
3de95173
TI
1138/* common preparation job for alc_spec */
1139static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1140{
1141 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1142 int err;
1143
1144 if (!spec)
1145 return -ENOMEM;
1146 codec->spec = spec;
08c189f2
TI
1147 snd_hda_gen_spec_init(&spec->gen);
1148 spec->gen.mixer_nid = mixer_nid;
1149 spec->gen.own_eapd_ctl = 1;
1098b7c2 1150 codec->single_adc_amp = 1;
08c189f2
TI
1151 /* FIXME: do we need this for all Realtek codec models? */
1152 codec->spdif_status_reset = 1;
a6e7d0a4 1153 codec->forced_resume = 1;
225068ab 1154 codec->patch_ops = alc_patch_ops;
3de95173
TI
1155
1156 err = alc_codec_rename_from_preset(codec);
1157 if (err < 0) {
1158 kfree(spec);
1159 return err;
1160 }
1161 return 0;
1162}
1163
3e6179b8
TI
1164static int alc880_parse_auto_config(struct hda_codec *codec)
1165{
1166 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
7d7eb9ea 1167 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3e6179b8
TI
1168 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1169}
1170
ee3b2969
TI
1171/*
1172 * ALC880 fix-ups
1173 */
1174enum {
411225a0 1175 ALC880_FIXUP_GPIO1,
ee3b2969
TI
1176 ALC880_FIXUP_GPIO2,
1177 ALC880_FIXUP_MEDION_RIM,
dc6af52d 1178 ALC880_FIXUP_LG,
db8a38e5 1179 ALC880_FIXUP_LG_LW25,
f02aab5d 1180 ALC880_FIXUP_W810,
27e917f8 1181 ALC880_FIXUP_EAPD_COEF,
b9368f5c 1182 ALC880_FIXUP_TCL_S700,
cf5a2279
TI
1183 ALC880_FIXUP_VOL_KNOB,
1184 ALC880_FIXUP_FUJITSU,
ba533818 1185 ALC880_FIXUP_F1734,
817de92f 1186 ALC880_FIXUP_UNIWILL,
967b88c4 1187 ALC880_FIXUP_UNIWILL_DIG,
96e225f6 1188 ALC880_FIXUP_Z71V,
487a588d 1189 ALC880_FIXUP_ASUS_W5A,
67b6ec31
TI
1190 ALC880_FIXUP_3ST_BASE,
1191 ALC880_FIXUP_3ST,
1192 ALC880_FIXUP_3ST_DIG,
1193 ALC880_FIXUP_5ST_BASE,
1194 ALC880_FIXUP_5ST,
1195 ALC880_FIXUP_5ST_DIG,
1196 ALC880_FIXUP_6ST_BASE,
1197 ALC880_FIXUP_6ST,
1198 ALC880_FIXUP_6ST_DIG,
5397145f 1199 ALC880_FIXUP_6ST_AUTOMUTE,
ee3b2969
TI
1200};
1201
cf5a2279
TI
1202/* enable the volume-knob widget support on NID 0x21 */
1203static void alc880_fixup_vol_knob(struct hda_codec *codec,
1727a771 1204 const struct hda_fixup *fix, int action)
cf5a2279 1205{
1727a771 1206 if (action == HDA_FIXUP_ACT_PROBE)
62f949bf
TI
1207 snd_hda_jack_detect_enable_callback(codec, 0x21,
1208 alc_update_knob_master);
cf5a2279
TI
1209}
1210
1727a771 1211static const struct hda_fixup alc880_fixups[] = {
411225a0 1212 [ALC880_FIXUP_GPIO1] = {
5579cd6f
TI
1213 .type = HDA_FIXUP_FUNC,
1214 .v.func = alc_fixup_gpio1,
411225a0 1215 },
ee3b2969 1216 [ALC880_FIXUP_GPIO2] = {
5579cd6f
TI
1217 .type = HDA_FIXUP_FUNC,
1218 .v.func = alc_fixup_gpio2,
ee3b2969
TI
1219 },
1220 [ALC880_FIXUP_MEDION_RIM] = {
1727a771 1221 .type = HDA_FIXUP_VERBS,
ee3b2969
TI
1222 .v.verbs = (const struct hda_verb[]) {
1223 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1224 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1225 { }
1226 },
1227 .chained = true,
1228 .chain_id = ALC880_FIXUP_GPIO2,
1229 },
dc6af52d 1230 [ALC880_FIXUP_LG] = {
1727a771
TI
1231 .type = HDA_FIXUP_PINS,
1232 .v.pins = (const struct hda_pintbl[]) {
dc6af52d
TI
1233 /* disable bogus unused pins */
1234 { 0x16, 0x411111f0 },
1235 { 0x18, 0x411111f0 },
1236 { 0x1a, 0x411111f0 },
1237 { }
1238 }
1239 },
db8a38e5
TI
1240 [ALC880_FIXUP_LG_LW25] = {
1241 .type = HDA_FIXUP_PINS,
1242 .v.pins = (const struct hda_pintbl[]) {
1243 { 0x1a, 0x0181344f }, /* line-in */
1244 { 0x1b, 0x0321403f }, /* headphone */
1245 { }
1246 }
1247 },
f02aab5d 1248 [ALC880_FIXUP_W810] = {
1727a771
TI
1249 .type = HDA_FIXUP_PINS,
1250 .v.pins = (const struct hda_pintbl[]) {
f02aab5d
TI
1251 /* disable bogus unused pins */
1252 { 0x17, 0x411111f0 },
1253 { }
1254 },
1255 .chained = true,
1256 .chain_id = ALC880_FIXUP_GPIO2,
1257 },
27e917f8 1258 [ALC880_FIXUP_EAPD_COEF] = {
1727a771 1259 .type = HDA_FIXUP_VERBS,
27e917f8
TI
1260 .v.verbs = (const struct hda_verb[]) {
1261 /* change to EAPD mode */
1262 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1263 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1264 {}
1265 },
1266 },
b9368f5c 1267 [ALC880_FIXUP_TCL_S700] = {
1727a771 1268 .type = HDA_FIXUP_VERBS,
b9368f5c
TI
1269 .v.verbs = (const struct hda_verb[]) {
1270 /* change to EAPD mode */
1271 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1272 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1273 {}
1274 },
1275 .chained = true,
1276 .chain_id = ALC880_FIXUP_GPIO2,
1277 },
cf5a2279 1278 [ALC880_FIXUP_VOL_KNOB] = {
1727a771 1279 .type = HDA_FIXUP_FUNC,
cf5a2279
TI
1280 .v.func = alc880_fixup_vol_knob,
1281 },
1282 [ALC880_FIXUP_FUJITSU] = {
1283 /* override all pins as BIOS on old Amilo is broken */
1727a771
TI
1284 .type = HDA_FIXUP_PINS,
1285 .v.pins = (const struct hda_pintbl[]) {
bb148bde 1286 { 0x14, 0x0121401f }, /* HP */
cf5a2279
TI
1287 { 0x15, 0x99030120 }, /* speaker */
1288 { 0x16, 0x99030130 }, /* bass speaker */
1289 { 0x17, 0x411111f0 }, /* N/A */
1290 { 0x18, 0x411111f0 }, /* N/A */
1291 { 0x19, 0x01a19950 }, /* mic-in */
1292 { 0x1a, 0x411111f0 }, /* N/A */
1293 { 0x1b, 0x411111f0 }, /* N/A */
1294 { 0x1c, 0x411111f0 }, /* N/A */
1295 { 0x1d, 0x411111f0 }, /* N/A */
1296 { 0x1e, 0x01454140 }, /* SPDIF out */
1297 { }
1298 },
1299 .chained = true,
1300 .chain_id = ALC880_FIXUP_VOL_KNOB,
1301 },
ba533818
TI
1302 [ALC880_FIXUP_F1734] = {
1303 /* almost compatible with FUJITSU, but no bass and SPDIF */
1727a771
TI
1304 .type = HDA_FIXUP_PINS,
1305 .v.pins = (const struct hda_pintbl[]) {
bb148bde 1306 { 0x14, 0x0121401f }, /* HP */
ba533818
TI
1307 { 0x15, 0x99030120 }, /* speaker */
1308 { 0x16, 0x411111f0 }, /* N/A */
1309 { 0x17, 0x411111f0 }, /* N/A */
1310 { 0x18, 0x411111f0 }, /* N/A */
1311 { 0x19, 0x01a19950 }, /* mic-in */
1312 { 0x1a, 0x411111f0 }, /* N/A */
1313 { 0x1b, 0x411111f0 }, /* N/A */
1314 { 0x1c, 0x411111f0 }, /* N/A */
1315 { 0x1d, 0x411111f0 }, /* N/A */
1316 { 0x1e, 0x411111f0 }, /* N/A */
1317 { }
1318 },
1319 .chained = true,
1320 .chain_id = ALC880_FIXUP_VOL_KNOB,
1321 },
817de92f
TI
1322 [ALC880_FIXUP_UNIWILL] = {
1323 /* need to fix HP and speaker pins to be parsed correctly */
1727a771
TI
1324 .type = HDA_FIXUP_PINS,
1325 .v.pins = (const struct hda_pintbl[]) {
817de92f
TI
1326 { 0x14, 0x0121411f }, /* HP */
1327 { 0x15, 0x99030120 }, /* speaker */
1328 { 0x16, 0x99030130 }, /* bass speaker */
1329 { }
1330 },
1331 },
967b88c4 1332 [ALC880_FIXUP_UNIWILL_DIG] = {
1727a771
TI
1333 .type = HDA_FIXUP_PINS,
1334 .v.pins = (const struct hda_pintbl[]) {
967b88c4
TI
1335 /* disable bogus unused pins */
1336 { 0x17, 0x411111f0 },
1337 { 0x19, 0x411111f0 },
1338 { 0x1b, 0x411111f0 },
1339 { 0x1f, 0x411111f0 },
1340 { }
1341 }
1342 },
96e225f6 1343 [ALC880_FIXUP_Z71V] = {
1727a771
TI
1344 .type = HDA_FIXUP_PINS,
1345 .v.pins = (const struct hda_pintbl[]) {
96e225f6
TI
1346 /* set up the whole pins as BIOS is utterly broken */
1347 { 0x14, 0x99030120 }, /* speaker */
1348 { 0x15, 0x0121411f }, /* HP */
1349 { 0x16, 0x411111f0 }, /* N/A */
1350 { 0x17, 0x411111f0 }, /* N/A */
1351 { 0x18, 0x01a19950 }, /* mic-in */
1352 { 0x19, 0x411111f0 }, /* N/A */
1353 { 0x1a, 0x01813031 }, /* line-in */
1354 { 0x1b, 0x411111f0 }, /* N/A */
1355 { 0x1c, 0x411111f0 }, /* N/A */
1356 { 0x1d, 0x411111f0 }, /* N/A */
1357 { 0x1e, 0x0144111e }, /* SPDIF */
1358 { }
1359 }
1360 },
487a588d
TI
1361 [ALC880_FIXUP_ASUS_W5A] = {
1362 .type = HDA_FIXUP_PINS,
1363 .v.pins = (const struct hda_pintbl[]) {
1364 /* set up the whole pins as BIOS is utterly broken */
1365 { 0x14, 0x0121411f }, /* HP */
1366 { 0x15, 0x411111f0 }, /* N/A */
1367 { 0x16, 0x411111f0 }, /* N/A */
1368 { 0x17, 0x411111f0 }, /* N/A */
1369 { 0x18, 0x90a60160 }, /* mic */
1370 { 0x19, 0x411111f0 }, /* N/A */
1371 { 0x1a, 0x411111f0 }, /* N/A */
1372 { 0x1b, 0x411111f0 }, /* N/A */
1373 { 0x1c, 0x411111f0 }, /* N/A */
1374 { 0x1d, 0x411111f0 }, /* N/A */
1375 { 0x1e, 0xb743111e }, /* SPDIF out */
1376 { }
1377 },
1378 .chained = true,
1379 .chain_id = ALC880_FIXUP_GPIO1,
1380 },
67b6ec31 1381 [ALC880_FIXUP_3ST_BASE] = {
1727a771
TI
1382 .type = HDA_FIXUP_PINS,
1383 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1384 { 0x14, 0x01014010 }, /* line-out */
1385 { 0x15, 0x411111f0 }, /* N/A */
1386 { 0x16, 0x411111f0 }, /* N/A */
1387 { 0x17, 0x411111f0 }, /* N/A */
1388 { 0x18, 0x01a19c30 }, /* mic-in */
1389 { 0x19, 0x0121411f }, /* HP */
1390 { 0x1a, 0x01813031 }, /* line-in */
1391 { 0x1b, 0x02a19c40 }, /* front-mic */
1392 { 0x1c, 0x411111f0 }, /* N/A */
1393 { 0x1d, 0x411111f0 }, /* N/A */
1394 /* 0x1e is filled in below */
1395 { 0x1f, 0x411111f0 }, /* N/A */
1396 { }
1397 }
1398 },
1399 [ALC880_FIXUP_3ST] = {
1727a771
TI
1400 .type = HDA_FIXUP_PINS,
1401 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1402 { 0x1e, 0x411111f0 }, /* N/A */
1403 { }
1404 },
1405 .chained = true,
1406 .chain_id = ALC880_FIXUP_3ST_BASE,
1407 },
1408 [ALC880_FIXUP_3ST_DIG] = {
1727a771
TI
1409 .type = HDA_FIXUP_PINS,
1410 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1411 { 0x1e, 0x0144111e }, /* SPDIF */
1412 { }
1413 },
1414 .chained = true,
1415 .chain_id = ALC880_FIXUP_3ST_BASE,
1416 },
1417 [ALC880_FIXUP_5ST_BASE] = {
1727a771
TI
1418 .type = HDA_FIXUP_PINS,
1419 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1420 { 0x14, 0x01014010 }, /* front */
1421 { 0x15, 0x411111f0 }, /* N/A */
1422 { 0x16, 0x01011411 }, /* CLFE */
1423 { 0x17, 0x01016412 }, /* surr */
1424 { 0x18, 0x01a19c30 }, /* mic-in */
1425 { 0x19, 0x0121411f }, /* HP */
1426 { 0x1a, 0x01813031 }, /* line-in */
1427 { 0x1b, 0x02a19c40 }, /* front-mic */
1428 { 0x1c, 0x411111f0 }, /* N/A */
1429 { 0x1d, 0x411111f0 }, /* N/A */
1430 /* 0x1e is filled in below */
1431 { 0x1f, 0x411111f0 }, /* N/A */
1432 { }
1433 }
1434 },
1435 [ALC880_FIXUP_5ST] = {
1727a771
TI
1436 .type = HDA_FIXUP_PINS,
1437 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1438 { 0x1e, 0x411111f0 }, /* N/A */
1439 { }
1440 },
1441 .chained = true,
1442 .chain_id = ALC880_FIXUP_5ST_BASE,
1443 },
1444 [ALC880_FIXUP_5ST_DIG] = {
1727a771
TI
1445 .type = HDA_FIXUP_PINS,
1446 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1447 { 0x1e, 0x0144111e }, /* SPDIF */
1448 { }
1449 },
1450 .chained = true,
1451 .chain_id = ALC880_FIXUP_5ST_BASE,
1452 },
1453 [ALC880_FIXUP_6ST_BASE] = {
1727a771
TI
1454 .type = HDA_FIXUP_PINS,
1455 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1456 { 0x14, 0x01014010 }, /* front */
1457 { 0x15, 0x01016412 }, /* surr */
1458 { 0x16, 0x01011411 }, /* CLFE */
1459 { 0x17, 0x01012414 }, /* side */
1460 { 0x18, 0x01a19c30 }, /* mic-in */
1461 { 0x19, 0x02a19c40 }, /* front-mic */
1462 { 0x1a, 0x01813031 }, /* line-in */
1463 { 0x1b, 0x0121411f }, /* HP */
1464 { 0x1c, 0x411111f0 }, /* N/A */
1465 { 0x1d, 0x411111f0 }, /* N/A */
1466 /* 0x1e is filled in below */
1467 { 0x1f, 0x411111f0 }, /* N/A */
1468 { }
1469 }
1470 },
1471 [ALC880_FIXUP_6ST] = {
1727a771
TI
1472 .type = HDA_FIXUP_PINS,
1473 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1474 { 0x1e, 0x411111f0 }, /* N/A */
1475 { }
1476 },
1477 .chained = true,
1478 .chain_id = ALC880_FIXUP_6ST_BASE,
1479 },
1480 [ALC880_FIXUP_6ST_DIG] = {
1727a771
TI
1481 .type = HDA_FIXUP_PINS,
1482 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1483 { 0x1e, 0x0144111e }, /* SPDIF */
1484 { }
1485 },
1486 .chained = true,
1487 .chain_id = ALC880_FIXUP_6ST_BASE,
1488 },
5397145f
TI
1489 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1490 .type = HDA_FIXUP_PINS,
1491 .v.pins = (const struct hda_pintbl[]) {
1492 { 0x1b, 0x0121401f }, /* HP with jack detect */
1493 { }
1494 },
1495 .chained_before = true,
1496 .chain_id = ALC880_FIXUP_6ST_BASE,
1497 },
ee3b2969
TI
1498};
1499
1500static const struct snd_pci_quirk alc880_fixup_tbl[] = {
f02aab5d 1501 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
487a588d 1502 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
96e225f6 1503 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
29e3fdcc 1504 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
6538de03 1505 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
29e3fdcc 1506 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
27e917f8 1507 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
967b88c4 1508 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
ba533818 1509 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
817de92f 1510 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
7833c7e8 1511 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
f02aab5d 1512 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
ee3b2969 1513 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
5397145f 1514 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
a161574e 1515 SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
cf5a2279 1516 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
ba533818 1517 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
cf5a2279 1518 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
dc6af52d
TI
1519 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1520 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1521 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
db8a38e5 1522 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
b9368f5c 1523 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
67b6ec31
TI
1524
1525 /* Below is the copied entries from alc880_quirks.c.
1526 * It's not quite sure whether BIOS sets the correct pin-config table
1527 * on these machines, thus they are kept to be compatible with
1528 * the old static quirks. Once when it's confirmed to work without
1529 * these overrides, it'd be better to remove.
1530 */
1531 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1532 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1533 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1534 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1535 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1536 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1537 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1538 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1539 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1540 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1541 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1542 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1543 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1544 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1545 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1546 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1547 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1548 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1549 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1550 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1551 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1552 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1553 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1554 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1555 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1556 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1557 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1558 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1559 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1560 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1561 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1562 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1563 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1564 /* default Intel */
1565 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1566 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1567 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1568 {}
1569};
1570
1727a771 1571static const struct hda_model_fixup alc880_fixup_models[] = {
67b6ec31
TI
1572 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1573 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1574 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1575 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1576 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1577 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
5397145f 1578 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
ee3b2969
TI
1579 {}
1580};
1581
1582
1d045db9
TI
1583/*
1584 * OK, here we have finally the patch for ALC880
1585 */
1d045db9 1586static int patch_alc880(struct hda_codec *codec)
60db6b53 1587{
1d045db9 1588 struct alc_spec *spec;
1d045db9 1589 int err;
f6a92248 1590
3de95173
TI
1591 err = alc_alloc_spec(codec, 0x0b);
1592 if (err < 0)
1593 return err;
64154835 1594
3de95173 1595 spec = codec->spec;
08c189f2 1596 spec->gen.need_dac_fix = 1;
7504b6cd 1597 spec->gen.beep_nid = 0x01;
f53281e6 1598
225068ab
TI
1599 codec->patch_ops.unsol_event = alc880_unsol_event;
1600
c9af753f
TI
1601 alc_pre_init(codec);
1602
1727a771 1603 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
67b6ec31 1604 alc880_fixups);
1727a771 1605 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
ee3b2969 1606
67b6ec31
TI
1607 /* automatic parse from the BIOS config */
1608 err = alc880_parse_auto_config(codec);
1609 if (err < 0)
1610 goto error;
fe3eb0a7 1611
fea80fae
TI
1612 if (!spec->gen.no_analog) {
1613 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1614 if (err < 0)
1615 goto error;
1616 }
f53281e6 1617
1727a771 1618 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 1619
1d045db9 1620 return 0;
e16fb6d1
TI
1621
1622 error:
1623 alc_free(codec);
1624 return err;
226b1ec8
KY
1625}
1626
1d045db9 1627
60db6b53 1628/*
1d045db9 1629 * ALC260 support
60db6b53 1630 */
1d045db9 1631static int alc260_parse_auto_config(struct hda_codec *codec)
f6a92248 1632{
1d045db9 1633 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
3e6179b8
TI
1634 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1635 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
f6a92248
KY
1636}
1637
1d045db9
TI
1638/*
1639 * Pin config fixes
1640 */
1641enum {
ca8f0424
TI
1642 ALC260_FIXUP_HP_DC5750,
1643 ALC260_FIXUP_HP_PIN_0F,
1644 ALC260_FIXUP_COEF,
15317ab2 1645 ALC260_FIXUP_GPIO1,
20f7d928
TI
1646 ALC260_FIXUP_GPIO1_TOGGLE,
1647 ALC260_FIXUP_REPLACER,
0a1c4fa2 1648 ALC260_FIXUP_HP_B1900,
118cb4a4 1649 ALC260_FIXUP_KN1,
39aedee7 1650 ALC260_FIXUP_FSC_S7020,
5ebd3bbd 1651 ALC260_FIXUP_FSC_S7020_JWSE,
d08c5ef2 1652 ALC260_FIXUP_VAIO_PINS,
1d045db9
TI
1653};
1654
20f7d928
TI
1655static void alc260_gpio1_automute(struct hda_codec *codec)
1656{
1657 struct alc_spec *spec = codec->spec;
aaf312de
TI
1658
1659 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
20f7d928
TI
1660}
1661
1662static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1727a771 1663 const struct hda_fixup *fix, int action)
20f7d928
TI
1664{
1665 struct alc_spec *spec = codec->spec;
1727a771 1666 if (action == HDA_FIXUP_ACT_PROBE) {
20f7d928
TI
1667 /* although the machine has only one output pin, we need to
1668 * toggle GPIO1 according to the jack state
1669 */
08c189f2
TI
1670 spec->gen.automute_hook = alc260_gpio1_automute;
1671 spec->gen.detect_hp = 1;
1672 spec->gen.automute_speaker = 1;
1673 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
62f949bf 1674 snd_hda_jack_detect_enable_callback(codec, 0x0f,
08c189f2 1675 snd_hda_gen_hp_automute);
5579cd6f 1676 alc_setup_gpio(codec, 0x01);
20f7d928
TI
1677 }
1678}
1679
118cb4a4 1680static void alc260_fixup_kn1(struct hda_codec *codec,
1727a771 1681 const struct hda_fixup *fix, int action)
118cb4a4
TI
1682{
1683 struct alc_spec *spec = codec->spec;
1727a771 1684 static const struct hda_pintbl pincfgs[] = {
118cb4a4
TI
1685 { 0x0f, 0x02214000 }, /* HP/speaker */
1686 { 0x12, 0x90a60160 }, /* int mic */
1687 { 0x13, 0x02a19000 }, /* ext mic */
1688 { 0x18, 0x01446000 }, /* SPDIF out */
1689 /* disable bogus I/O pins */
1690 { 0x10, 0x411111f0 },
1691 { 0x11, 0x411111f0 },
1692 { 0x14, 0x411111f0 },
1693 { 0x15, 0x411111f0 },
1694 { 0x16, 0x411111f0 },
1695 { 0x17, 0x411111f0 },
1696 { 0x19, 0x411111f0 },
1697 { }
1698 };
1699
1700 switch (action) {
1727a771
TI
1701 case HDA_FIXUP_ACT_PRE_PROBE:
1702 snd_hda_apply_pincfgs(codec, pincfgs);
118cb4a4
TI
1703 spec->init_amp = ALC_INIT_NONE;
1704 break;
1705 }
1706}
1707
39aedee7
TI
1708static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1709 const struct hda_fixup *fix, int action)
1710{
1711 struct alc_spec *spec = codec->spec;
1c76aa5f 1712 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5ebd3bbd
TI
1713 spec->init_amp = ALC_INIT_NONE;
1714}
39aedee7 1715
5ebd3bbd
TI
1716static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1717 const struct hda_fixup *fix, int action)
1718{
1719 struct alc_spec *spec = codec->spec;
1720 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
f811c3cf 1721 spec->gen.add_jack_modes = 1;
5ebd3bbd 1722 spec->gen.hp_mic = 1;
e6e0ee50 1723 }
39aedee7
TI
1724}
1725
1727a771 1726static const struct hda_fixup alc260_fixups[] = {
ca8f0424 1727 [ALC260_FIXUP_HP_DC5750] = {
1727a771
TI
1728 .type = HDA_FIXUP_PINS,
1729 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
1730 { 0x11, 0x90130110 }, /* speaker */
1731 { }
1732 }
1733 },
ca8f0424 1734 [ALC260_FIXUP_HP_PIN_0F] = {
1727a771
TI
1735 .type = HDA_FIXUP_PINS,
1736 .v.pins = (const struct hda_pintbl[]) {
ca8f0424
TI
1737 { 0x0f, 0x01214000 }, /* HP */
1738 { }
1739 }
1740 },
1741 [ALC260_FIXUP_COEF] = {
1727a771 1742 .type = HDA_FIXUP_VERBS,
ca8f0424 1743 .v.verbs = (const struct hda_verb[]) {
e30cf2d2
RM
1744 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1745 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
ca8f0424
TI
1746 { }
1747 },
ca8f0424 1748 },
15317ab2 1749 [ALC260_FIXUP_GPIO1] = {
5579cd6f
TI
1750 .type = HDA_FIXUP_FUNC,
1751 .v.func = alc_fixup_gpio1,
15317ab2 1752 },
20f7d928 1753 [ALC260_FIXUP_GPIO1_TOGGLE] = {
1727a771 1754 .type = HDA_FIXUP_FUNC,
20f7d928
TI
1755 .v.func = alc260_fixup_gpio1_toggle,
1756 .chained = true,
1757 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1758 },
1759 [ALC260_FIXUP_REPLACER] = {
1727a771 1760 .type = HDA_FIXUP_VERBS,
20f7d928 1761 .v.verbs = (const struct hda_verb[]) {
192a98e2
TI
1762 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1763 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
20f7d928
TI
1764 { }
1765 },
1766 .chained = true,
1767 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1768 },
0a1c4fa2 1769 [ALC260_FIXUP_HP_B1900] = {
1727a771 1770 .type = HDA_FIXUP_FUNC,
0a1c4fa2
TI
1771 .v.func = alc260_fixup_gpio1_toggle,
1772 .chained = true,
1773 .chain_id = ALC260_FIXUP_COEF,
118cb4a4
TI
1774 },
1775 [ALC260_FIXUP_KN1] = {
1727a771 1776 .type = HDA_FIXUP_FUNC,
118cb4a4
TI
1777 .v.func = alc260_fixup_kn1,
1778 },
39aedee7
TI
1779 [ALC260_FIXUP_FSC_S7020] = {
1780 .type = HDA_FIXUP_FUNC,
1781 .v.func = alc260_fixup_fsc_s7020,
1782 },
5ebd3bbd
TI
1783 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1784 .type = HDA_FIXUP_FUNC,
1785 .v.func = alc260_fixup_fsc_s7020_jwse,
1786 .chained = true,
1787 .chain_id = ALC260_FIXUP_FSC_S7020,
1788 },
d08c5ef2
TI
1789 [ALC260_FIXUP_VAIO_PINS] = {
1790 .type = HDA_FIXUP_PINS,
1791 .v.pins = (const struct hda_pintbl[]) {
1792 /* Pin configs are missing completely on some VAIOs */
1793 { 0x0f, 0x01211020 },
1794 { 0x10, 0x0001003f },
1795 { 0x11, 0x411111f0 },
1796 { 0x12, 0x01a15930 },
1797 { 0x13, 0x411111f0 },
1798 { 0x14, 0x411111f0 },
1799 { 0x15, 0x411111f0 },
1800 { 0x16, 0x411111f0 },
1801 { 0x17, 0x411111f0 },
1802 { 0x18, 0x411111f0 },
1803 { 0x19, 0x411111f0 },
1804 { }
1805 }
1806 },
1d045db9
TI
1807};
1808
1809static const struct snd_pci_quirk alc260_fixup_tbl[] = {
15317ab2 1810 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
ca8f0424 1811 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
15317ab2 1812 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
ca8f0424 1813 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
0a1c4fa2 1814 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
d08c5ef2 1815 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
0f5a5b85 1816 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
39aedee7 1817 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
b1f58085 1818 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
118cb4a4 1819 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
20f7d928 1820 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
ca8f0424 1821 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
1d045db9
TI
1822 {}
1823};
1824
5ebd3bbd
TI
1825static const struct hda_model_fixup alc260_fixup_models[] = {
1826 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1827 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1828 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1829 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1830 {}
1831};
1832
1d045db9
TI
1833/*
1834 */
1d045db9 1835static int patch_alc260(struct hda_codec *codec)
977ddd6b 1836{
1d045db9 1837 struct alc_spec *spec;
c3c2c9e7 1838 int err;
1d045db9 1839
3de95173
TI
1840 err = alc_alloc_spec(codec, 0x07);
1841 if (err < 0)
1842 return err;
1d045db9 1843
3de95173 1844 spec = codec->spec;
ea46c3c8
TI
1845 /* as quite a few machines require HP amp for speaker outputs,
1846 * it's easier to enable it unconditionally; even if it's unneeded,
1847 * it's almost harmless.
1848 */
1849 spec->gen.prefer_hp_amp = 1;
7504b6cd 1850 spec->gen.beep_nid = 0x01;
1d045db9 1851
225068ab
TI
1852 spec->shutup = alc_eapd_shutup;
1853
c9af753f
TI
1854 alc_pre_init(codec);
1855
5ebd3bbd
TI
1856 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1857 alc260_fixups);
1727a771 1858 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
977ddd6b 1859
c3c2c9e7
TI
1860 /* automatic parse from the BIOS config */
1861 err = alc260_parse_auto_config(codec);
1862 if (err < 0)
1863 goto error;
977ddd6b 1864
fea80fae
TI
1865 if (!spec->gen.no_analog) {
1866 err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1867 if (err < 0)
1868 goto error;
1869 }
977ddd6b 1870
1727a771 1871 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 1872
1d045db9 1873 return 0;
e16fb6d1
TI
1874
1875 error:
1876 alc_free(codec);
1877 return err;
6981d184
TI
1878}
1879
1d045db9
TI
1880
1881/*
1882 * ALC882/883/885/888/889 support
1883 *
1884 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1885 * configuration. Each pin widget can choose any input DACs and a mixer.
1886 * Each ADC is connected from a mixer of all inputs. This makes possible
1887 * 6-channel independent captures.
1888 *
1889 * In addition, an independent DAC for the multi-playback (not used in this
1890 * driver yet).
1891 */
1d045db9
TI
1892
1893/*
1894 * Pin config fixes
1895 */
ff818c24 1896enum {
5c0ebfbe
TI
1897 ALC882_FIXUP_ABIT_AW9D_MAX,
1898 ALC882_FIXUP_LENOVO_Y530,
1899 ALC882_FIXUP_PB_M5210,
1900 ALC882_FIXUP_ACER_ASPIRE_7736,
1901 ALC882_FIXUP_ASUS_W90V,
8f239214 1902 ALC889_FIXUP_CD,
b2c53e20 1903 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
5c0ebfbe 1904 ALC889_FIXUP_VAIO_TT,
0e7cc2e7 1905 ALC888_FIXUP_EEE1601,
177943a3 1906 ALC882_FIXUP_EAPD,
7a6069bf 1907 ALC883_FIXUP_EAPD,
8812c4f9 1908 ALC883_FIXUP_ACER_EAPD,
1a97b7f2
TI
1909 ALC882_FIXUP_GPIO1,
1910 ALC882_FIXUP_GPIO2,
eb844d51 1911 ALC882_FIXUP_GPIO3,
68ef0561
TI
1912 ALC889_FIXUP_COEF,
1913 ALC882_FIXUP_ASUS_W2JC,
c3e837bb
TI
1914 ALC882_FIXUP_ACER_ASPIRE_4930G,
1915 ALC882_FIXUP_ACER_ASPIRE_8930G,
1916 ALC882_FIXUP_ASPIRE_8930G_VERBS,
5671087f 1917 ALC885_FIXUP_MACPRO_GPIO,
02a237b2 1918 ALC889_FIXUP_DAC_ROUTE,
1a97b7f2
TI
1919 ALC889_FIXUP_MBP_VREF,
1920 ALC889_FIXUP_IMAC91_VREF,
e7729a41 1921 ALC889_FIXUP_MBA11_VREF,
0756f09c 1922 ALC889_FIXUP_MBA21_VREF,
c20f31ec 1923 ALC889_FIXUP_MP11_VREF,
9f660a1c 1924 ALC889_FIXUP_MP41_VREF,
6e72aa5f 1925 ALC882_FIXUP_INV_DMIC,
e427c237 1926 ALC882_FIXUP_NO_PRIMARY_HP,
1f0bbf03 1927 ALC887_FIXUP_ASUS_BASS,
eb9ca3ab 1928 ALC887_FIXUP_BASS_CHMAP,
7beb3a6e 1929 ALC1220_FIXUP_GB_DUAL_CODECS,
0202f5cd 1930 ALC1220_FIXUP_CLEVO_P950,
80690a27
RS
1931 ALC1220_FIXUP_CLEVO_PB51ED,
1932 ALC1220_FIXUP_CLEVO_PB51ED_PINS,
ca184355
JHP
1933 ALC887_FIXUP_ASUS_AUDIO,
1934 ALC887_FIXUP_ASUS_HMIC,
ff818c24
TI
1935};
1936
68ef0561 1937static void alc889_fixup_coef(struct hda_codec *codec,
1727a771 1938 const struct hda_fixup *fix, int action)
68ef0561 1939{
1727a771 1940 if (action != HDA_FIXUP_ACT_INIT)
68ef0561 1941 return;
1df8874b 1942 alc_update_coef_idx(codec, 7, 0, 0x2030);
68ef0561
TI
1943}
1944
5671087f
TI
1945/* set up GPIO at initialization */
1946static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
1727a771 1947 const struct hda_fixup *fix, int action)
5671087f 1948{
215c850c
TI
1949 struct alc_spec *spec = codec->spec;
1950
1951 spec->gpio_write_delay = true;
1952 alc_fixup_gpio3(codec, fix, action);
5671087f
TI
1953}
1954
02a237b2
TI
1955/* Fix the connection of some pins for ALC889:
1956 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
1957 * work correctly (bko#42740)
1958 */
1959static void alc889_fixup_dac_route(struct hda_codec *codec,
1727a771 1960 const struct hda_fixup *fix, int action)
02a237b2 1961{
1727a771 1962 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
ef8d60fb 1963 /* fake the connections during parsing the tree */
caf3c043
MM
1964 static const hda_nid_t conn1[] = { 0x0c, 0x0d };
1965 static const hda_nid_t conn2[] = { 0x0e, 0x0f };
1966 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
1967 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
1968 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
1969 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
1727a771 1970 } else if (action == HDA_FIXUP_ACT_PROBE) {
ef8d60fb 1971 /* restore the connections */
caf3c043
MM
1972 static const hda_nid_t conn[] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
1973 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
1974 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
1975 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
1976 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
02a237b2
TI
1977 }
1978}
1979
1a97b7f2
TI
1980/* Set VREF on HP pin */
1981static void alc889_fixup_mbp_vref(struct hda_codec *codec,
1727a771 1982 const struct hda_fixup *fix, int action)
1a97b7f2 1983{
caf3c043 1984 static const hda_nid_t nids[] = { 0x14, 0x15, 0x19 };
1a97b7f2 1985 struct alc_spec *spec = codec->spec;
1a97b7f2
TI
1986 int i;
1987
1727a771 1988 if (action != HDA_FIXUP_ACT_INIT)
1a97b7f2
TI
1989 return;
1990 for (i = 0; i < ARRAY_SIZE(nids); i++) {
1991 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
1992 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
1993 continue;
d3f02d60 1994 val = snd_hda_codec_get_pin_target(codec, nids[i]);
1a97b7f2 1995 val |= AC_PINCTL_VREF_80;
cdd03ced 1996 snd_hda_set_pin_ctl(codec, nids[i], val);
08c189f2 1997 spec->gen.keep_vref_in_automute = 1;
1a97b7f2
TI
1998 break;
1999 }
2000}
2001
0756f09c
TI
2002static void alc889_fixup_mac_pins(struct hda_codec *codec,
2003 const hda_nid_t *nids, int num_nids)
1a97b7f2
TI
2004{
2005 struct alc_spec *spec = codec->spec;
1a97b7f2
TI
2006 int i;
2007
0756f09c 2008 for (i = 0; i < num_nids; i++) {
1a97b7f2 2009 unsigned int val;
d3f02d60 2010 val = snd_hda_codec_get_pin_target(codec, nids[i]);
1a97b7f2 2011 val |= AC_PINCTL_VREF_50;
cdd03ced 2012 snd_hda_set_pin_ctl(codec, nids[i], val);
1a97b7f2 2013 }
08c189f2 2014 spec->gen.keep_vref_in_automute = 1;
1a97b7f2
TI
2015}
2016
0756f09c
TI
2017/* Set VREF on speaker pins on imac91 */
2018static void alc889_fixup_imac91_vref(struct hda_codec *codec,
2019 const struct hda_fixup *fix, int action)
2020{
caf3c043 2021 static const hda_nid_t nids[] = { 0x18, 0x1a };
0756f09c
TI
2022
2023 if (action == HDA_FIXUP_ACT_INIT)
2024 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2025}
2026
e7729a41
AV
2027/* Set VREF on speaker pins on mba11 */
2028static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2029 const struct hda_fixup *fix, int action)
2030{
caf3c043 2031 static const hda_nid_t nids[] = { 0x18 };
e7729a41
AV
2032
2033 if (action == HDA_FIXUP_ACT_INIT)
2034 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2035}
2036
0756f09c
TI
2037/* Set VREF on speaker pins on mba21 */
2038static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2039 const struct hda_fixup *fix, int action)
2040{
caf3c043 2041 static const hda_nid_t nids[] = { 0x18, 0x19 };
0756f09c
TI
2042
2043 if (action == HDA_FIXUP_ACT_INIT)
2044 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2045}
2046
e427c237 2047/* Don't take HP output as primary
d9111496
FLVC
2048 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2049 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
e427c237
TI
2050 */
2051static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
1727a771 2052 const struct hda_fixup *fix, int action)
e427c237
TI
2053{
2054 struct alc_spec *spec = codec->spec;
da96fb5b 2055 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
08c189f2 2056 spec->gen.no_primary_hp = 1;
da96fb5b
TI
2057 spec->gen.no_multi_io = 1;
2058 }
e427c237
TI
2059}
2060
eb9ca3ab
TI
2061static void alc_fixup_bass_chmap(struct hda_codec *codec,
2062 const struct hda_fixup *fix, int action);
2063
7beb3a6e
TI
2064/* For dual-codec configuration, we need to disable some features to avoid
2065 * conflicts of kctls and PCM streams
2066 */
2067static void alc_fixup_dual_codecs(struct hda_codec *codec,
2068 const struct hda_fixup *fix, int action)
2069{
2070 struct alc_spec *spec = codec->spec;
2071
2072 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2073 return;
2074 /* disable vmaster */
2075 spec->gen.suppress_vmaster = 1;
2076 /* auto-mute and auto-mic switch don't work with multiple codecs */
2077 spec->gen.suppress_auto_mute = 1;
2078 spec->gen.suppress_auto_mic = 1;
2079 /* disable aamix as well */
2080 spec->gen.mixer_nid = 0;
2081 /* add location prefix to avoid conflicts */
2082 codec->force_pin_prefix = 1;
2083}
2084
2085static void rename_ctl(struct hda_codec *codec, const char *oldname,
2086 const char *newname)
2087{
2088 struct snd_kcontrol *kctl;
2089
2090 kctl = snd_hda_find_mixer_ctl(codec, oldname);
2091 if (kctl)
2092 strcpy(kctl->id.name, newname);
2093}
2094
2095static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2096 const struct hda_fixup *fix,
2097 int action)
2098{
2099 alc_fixup_dual_codecs(codec, fix, action);
2100 switch (action) {
2101 case HDA_FIXUP_ACT_PRE_PROBE:
2102 /* override card longname to provide a unique UCM profile */
2103 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2104 break;
2105 case HDA_FIXUP_ACT_BUILD:
2106 /* rename Capture controls depending on the codec */
2107 rename_ctl(codec, "Capture Volume",
2108 codec->addr == 0 ?
2109 "Rear-Panel Capture Volume" :
2110 "Front-Panel Capture Volume");
2111 rename_ctl(codec, "Capture Switch",
2112 codec->addr == 0 ?
2113 "Rear-Panel Capture Switch" :
2114 "Front-Panel Capture Switch");
2115 break;
2116 }
2117}
2118
0202f5cd
P
2119static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2120 const struct hda_fixup *fix,
2121 int action)
2122{
caf3c043 2123 static const hda_nid_t conn1[] = { 0x0c };
0202f5cd
P
2124
2125 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2126 return;
2127
2128 alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2129 /* We therefore want to make sure 0x14 (front headphone) and
2130 * 0x1b (speakers) use the stereo DAC 0x02
2131 */
caf3c043
MM
2132 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2133 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
0202f5cd
P
2134}
2135
7f665b1c
JS
2136static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2137 const struct hda_fixup *fix, int action);
2138
80690a27 2139static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
7f665b1c
JS
2140 const struct hda_fixup *fix,
2141 int action)
2142{
2143 alc1220_fixup_clevo_p950(codec, fix, action);
2144 alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2145}
2146
ca184355
JHP
2147static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
2148 struct hda_jack_callback *jack)
2149{
2150 struct alc_spec *spec = codec->spec;
2151 unsigned int vref;
2152
2153 snd_hda_gen_hp_automute(codec, jack);
2154
2155 if (spec->gen.hp_jack_present)
2156 vref = AC_PINCTL_VREF_80;
2157 else
2158 vref = AC_PINCTL_VREF_HIZ;
2159 snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
2160}
2161
2162static void alc887_fixup_asus_jack(struct hda_codec *codec,
2163 const struct hda_fixup *fix, int action)
2164{
2165 struct alc_spec *spec = codec->spec;
2166 if (action != HDA_FIXUP_ACT_PROBE)
2167 return;
2168 snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
2169 spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook;
2170}
2171
1727a771 2172static const struct hda_fixup alc882_fixups[] = {
5c0ebfbe 2173 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
1727a771
TI
2174 .type = HDA_FIXUP_PINS,
2175 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
2176 { 0x15, 0x01080104 }, /* side */
2177 { 0x16, 0x01011012 }, /* rear */
2178 { 0x17, 0x01016011 }, /* clfe */
2785591a 2179 { }
145a902b
DH
2180 }
2181 },
5c0ebfbe 2182 [ALC882_FIXUP_LENOVO_Y530] = {
1727a771
TI
2183 .type = HDA_FIXUP_PINS,
2184 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
2185 { 0x15, 0x99130112 }, /* rear int speakers */
2186 { 0x16, 0x99130111 }, /* subwoofer */
ac612407
DH
2187 { }
2188 }
2189 },
5c0ebfbe 2190 [ALC882_FIXUP_PB_M5210] = {
fd108215
TI
2191 .type = HDA_FIXUP_PINCTLS,
2192 .v.pins = (const struct hda_pintbl[]) {
2193 { 0x19, PIN_VREF50 },
357f915e
KY
2194 {}
2195 }
2196 },
5c0ebfbe 2197 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
1727a771 2198 .type = HDA_FIXUP_FUNC,
23d30f28 2199 .v.func = alc_fixup_sku_ignore,
6981d184 2200 },
5c0ebfbe 2201 [ALC882_FIXUP_ASUS_W90V] = {
1727a771
TI
2202 .type = HDA_FIXUP_PINS,
2203 .v.pins = (const struct hda_pintbl[]) {
5cdf745e
TI
2204 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
2205 { }
2206 }
2207 },
8f239214 2208 [ALC889_FIXUP_CD] = {
1727a771
TI
2209 .type = HDA_FIXUP_PINS,
2210 .v.pins = (const struct hda_pintbl[]) {
8f239214
MB
2211 { 0x1c, 0x993301f0 }, /* CD */
2212 { }
2213 }
2214 },
b2c53e20
DH
2215 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2216 .type = HDA_FIXUP_PINS,
2217 .v.pins = (const struct hda_pintbl[]) {
2218 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2219 { }
2220 },
2221 .chained = true,
2222 .chain_id = ALC889_FIXUP_CD,
2223 },
5c0ebfbe 2224 [ALC889_FIXUP_VAIO_TT] = {
1727a771
TI
2225 .type = HDA_FIXUP_PINS,
2226 .v.pins = (const struct hda_pintbl[]) {
5c0ebfbe
TI
2227 { 0x17, 0x90170111 }, /* hidden surround speaker */
2228 { }
2229 }
2230 },
0e7cc2e7 2231 [ALC888_FIXUP_EEE1601] = {
1727a771 2232 .type = HDA_FIXUP_VERBS,
0e7cc2e7
TI
2233 .v.verbs = (const struct hda_verb[]) {
2234 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2235 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
2236 { }
2237 }
177943a3
TI
2238 },
2239 [ALC882_FIXUP_EAPD] = {
1727a771 2240 .type = HDA_FIXUP_VERBS,
177943a3
TI
2241 .v.verbs = (const struct hda_verb[]) {
2242 /* change to EAPD mode */
2243 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2244 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2245 { }
2246 }
2247 },
7a6069bf 2248 [ALC883_FIXUP_EAPD] = {
1727a771 2249 .type = HDA_FIXUP_VERBS,
7a6069bf
TI
2250 .v.verbs = (const struct hda_verb[]) {
2251 /* change to EAPD mode */
2252 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2253 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2254 { }
2255 }
2256 },
8812c4f9 2257 [ALC883_FIXUP_ACER_EAPD] = {
1727a771 2258 .type = HDA_FIXUP_VERBS,
8812c4f9
TI
2259 .v.verbs = (const struct hda_verb[]) {
2260 /* eanable EAPD on Acer laptops */
2261 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2262 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2263 { }
2264 }
2265 },
1a97b7f2 2266 [ALC882_FIXUP_GPIO1] = {
5579cd6f
TI
2267 .type = HDA_FIXUP_FUNC,
2268 .v.func = alc_fixup_gpio1,
1a97b7f2
TI
2269 },
2270 [ALC882_FIXUP_GPIO2] = {
5579cd6f
TI
2271 .type = HDA_FIXUP_FUNC,
2272 .v.func = alc_fixup_gpio2,
1a97b7f2 2273 },
eb844d51 2274 [ALC882_FIXUP_GPIO3] = {
5579cd6f
TI
2275 .type = HDA_FIXUP_FUNC,
2276 .v.func = alc_fixup_gpio3,
eb844d51 2277 },
68ef0561 2278 [ALC882_FIXUP_ASUS_W2JC] = {
5579cd6f
TI
2279 .type = HDA_FIXUP_FUNC,
2280 .v.func = alc_fixup_gpio1,
68ef0561
TI
2281 .chained = true,
2282 .chain_id = ALC882_FIXUP_EAPD,
2283 },
2284 [ALC889_FIXUP_COEF] = {
1727a771 2285 .type = HDA_FIXUP_FUNC,
68ef0561
TI
2286 .v.func = alc889_fixup_coef,
2287 },
c3e837bb 2288 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
1727a771
TI
2289 .type = HDA_FIXUP_PINS,
2290 .v.pins = (const struct hda_pintbl[]) {
c3e837bb
TI
2291 { 0x16, 0x99130111 }, /* CLFE speaker */
2292 { 0x17, 0x99130112 }, /* surround speaker */
2293 { }
038d4fef
TI
2294 },
2295 .chained = true,
2296 .chain_id = ALC882_FIXUP_GPIO1,
c3e837bb
TI
2297 },
2298 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
1727a771
TI
2299 .type = HDA_FIXUP_PINS,
2300 .v.pins = (const struct hda_pintbl[]) {
c3e837bb
TI
2301 { 0x16, 0x99130111 }, /* CLFE speaker */
2302 { 0x1b, 0x99130112 }, /* surround speaker */
2303 { }
2304 },
2305 .chained = true,
2306 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2307 },
2308 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2309 /* additional init verbs for Acer Aspire 8930G */
1727a771 2310 .type = HDA_FIXUP_VERBS,
c3e837bb
TI
2311 .v.verbs = (const struct hda_verb[]) {
2312 /* Enable all DACs */
2313 /* DAC DISABLE/MUTE 1? */
2314 /* setting bits 1-5 disables DAC nids 0x02-0x06
2315 * apparently. Init=0x38 */
2316 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2317 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2318 /* DAC DISABLE/MUTE 2? */
2319 /* some bit here disables the other DACs.
2320 * Init=0x4900 */
2321 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2322 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2323 /* DMIC fix
2324 * This laptop has a stereo digital microphone.
2325 * The mics are only 1cm apart which makes the stereo
2326 * useless. However, either the mic or the ALC889
2327 * makes the signal become a difference/sum signal
2328 * instead of standard stereo, which is annoying.
2329 * So instead we flip this bit which makes the
2330 * codec replicate the sum signal to both channels,
2331 * turning it into a normal mono mic.
2332 */
2333 /* DMIC_CONTROL? Init value = 0x0001 */
2334 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2335 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2336 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2337 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2338 { }
038d4fef
TI
2339 },
2340 .chained = true,
2341 .chain_id = ALC882_FIXUP_GPIO1,
c3e837bb 2342 },
5671087f 2343 [ALC885_FIXUP_MACPRO_GPIO] = {
1727a771 2344 .type = HDA_FIXUP_FUNC,
5671087f
TI
2345 .v.func = alc885_fixup_macpro_gpio,
2346 },
02a237b2 2347 [ALC889_FIXUP_DAC_ROUTE] = {
1727a771 2348 .type = HDA_FIXUP_FUNC,
02a237b2
TI
2349 .v.func = alc889_fixup_dac_route,
2350 },
1a97b7f2 2351 [ALC889_FIXUP_MBP_VREF] = {
1727a771 2352 .type = HDA_FIXUP_FUNC,
1a97b7f2
TI
2353 .v.func = alc889_fixup_mbp_vref,
2354 .chained = true,
2355 .chain_id = ALC882_FIXUP_GPIO1,
2356 },
2357 [ALC889_FIXUP_IMAC91_VREF] = {
1727a771 2358 .type = HDA_FIXUP_FUNC,
1a97b7f2
TI
2359 .v.func = alc889_fixup_imac91_vref,
2360 .chained = true,
2361 .chain_id = ALC882_FIXUP_GPIO1,
2362 },
e7729a41
AV
2363 [ALC889_FIXUP_MBA11_VREF] = {
2364 .type = HDA_FIXUP_FUNC,
2365 .v.func = alc889_fixup_mba11_vref,
2366 .chained = true,
2367 .chain_id = ALC889_FIXUP_MBP_VREF,
2368 },
0756f09c
TI
2369 [ALC889_FIXUP_MBA21_VREF] = {
2370 .type = HDA_FIXUP_FUNC,
2371 .v.func = alc889_fixup_mba21_vref,
2372 .chained = true,
2373 .chain_id = ALC889_FIXUP_MBP_VREF,
2374 },
c20f31ec
TI
2375 [ALC889_FIXUP_MP11_VREF] = {
2376 .type = HDA_FIXUP_FUNC,
2377 .v.func = alc889_fixup_mba11_vref,
2378 .chained = true,
2379 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2380 },
9f660a1c
MK
2381 [ALC889_FIXUP_MP41_VREF] = {
2382 .type = HDA_FIXUP_FUNC,
2383 .v.func = alc889_fixup_mbp_vref,
2384 .chained = true,
2385 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2386 },
6e72aa5f 2387 [ALC882_FIXUP_INV_DMIC] = {
1727a771 2388 .type = HDA_FIXUP_FUNC,
9d36a7dc 2389 .v.func = alc_fixup_inv_dmic,
6e72aa5f 2390 },
e427c237 2391 [ALC882_FIXUP_NO_PRIMARY_HP] = {
1727a771 2392 .type = HDA_FIXUP_FUNC,
e427c237
TI
2393 .v.func = alc882_fixup_no_primary_hp,
2394 },
1f0bbf03
TI
2395 [ALC887_FIXUP_ASUS_BASS] = {
2396 .type = HDA_FIXUP_PINS,
2397 .v.pins = (const struct hda_pintbl[]) {
2398 {0x16, 0x99130130}, /* bass speaker */
2399 {}
2400 },
eb9ca3ab
TI
2401 .chained = true,
2402 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2403 },
2404 [ALC887_FIXUP_BASS_CHMAP] = {
2405 .type = HDA_FIXUP_FUNC,
2406 .v.func = alc_fixup_bass_chmap,
1f0bbf03 2407 },
7beb3a6e
TI
2408 [ALC1220_FIXUP_GB_DUAL_CODECS] = {
2409 .type = HDA_FIXUP_FUNC,
2410 .v.func = alc1220_fixup_gb_dual_codecs,
2411 },
0202f5cd
P
2412 [ALC1220_FIXUP_CLEVO_P950] = {
2413 .type = HDA_FIXUP_FUNC,
2414 .v.func = alc1220_fixup_clevo_p950,
2415 },
80690a27 2416 [ALC1220_FIXUP_CLEVO_PB51ED] = {
7f665b1c 2417 .type = HDA_FIXUP_FUNC,
80690a27 2418 .v.func = alc1220_fixup_clevo_pb51ed,
7f665b1c 2419 },
80690a27 2420 [ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
7f665b1c
JS
2421 .type = HDA_FIXUP_PINS,
2422 .v.pins = (const struct hda_pintbl[]) {
2423 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2424 {}
2425 },
2426 .chained = true,
80690a27 2427 .chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
7f665b1c 2428 },
ca184355
JHP
2429 [ALC887_FIXUP_ASUS_AUDIO] = {
2430 .type = HDA_FIXUP_PINS,
2431 .v.pins = (const struct hda_pintbl[]) {
2432 { 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */
2433 { 0x19, 0x22219420 },
2434 {}
2435 },
2436 },
2437 [ALC887_FIXUP_ASUS_HMIC] = {
2438 .type = HDA_FIXUP_FUNC,
2439 .v.func = alc887_fixup_asus_jack,
2440 .chained = true,
2441 .chain_id = ALC887_FIXUP_ASUS_AUDIO,
2442 },
ff818c24
TI
2443};
2444
1d045db9 2445static const struct snd_pci_quirk alc882_fixup_tbl[] = {
8812c4f9
TI
2446 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2447 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
b5d724b1 2448 SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
8812c4f9
TI
2449 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2450 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2451 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2452 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
c3e837bb
TI
2453 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2454 ALC882_FIXUP_ACER_ASPIRE_4930G),
2455 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2456 ALC882_FIXUP_ACER_ASPIRE_4930G),
2457 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2458 ALC882_FIXUP_ACER_ASPIRE_8930G),
2459 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2460 ALC882_FIXUP_ACER_ASPIRE_8930G),
2461 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2462 ALC882_FIXUP_ACER_ASPIRE_4930G),
2463 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2464 ALC882_FIXUP_ACER_ASPIRE_4930G),
2465 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2466 ALC882_FIXUP_ACER_ASPIRE_4930G),
5c0ebfbe 2467 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
f5c53d89
TI
2468 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2469 ALC882_FIXUP_ACER_ASPIRE_4930G),
02a237b2 2470 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
fe97da1f 2471 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
ac9b1cdd 2472 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
177943a3 2473 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
5c0ebfbe 2474 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
68ef0561 2475 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
ca184355 2476 SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC),
0e7cc2e7 2477 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
1f0bbf03 2478 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
85bcf96c 2479 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
ac9b1cdd 2480 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
e427c237 2481 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
3f3c3714 2482 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
12e31a78 2483 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
c44d9b11 2484 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
5671087f
TI
2485
2486 /* All Apple entries are in codec SSIDs */
1a97b7f2
TI
2487 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2488 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2489 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
c20f31ec 2490 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
5671087f
TI
2491 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2492 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
1a97b7f2
TI
2493 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2494 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
5671087f 2495 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
e7729a41 2496 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
0756f09c 2497 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
1a97b7f2
TI
2498 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2499 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
5671087f 2500 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
1a97b7f2
TI
2501 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2502 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2503 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
9f660a1c 2504 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
05193639 2505 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
1a97b7f2
TI
2506 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2507 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
649ccd08 2508 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
5671087f 2509
7a6069bf 2510 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
b2c53e20 2511 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
7beb3a6e 2512 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
0d45e86d 2513 SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_CLEVO_P950),
d9e8fe0c 2514 SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_CLEVO_P950),
a0b03952 2515 SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
a655e2b1 2516 SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
1d3aa4a5 2517 SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
7dafba37 2518 SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
cc5049ae 2519 SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
d2c3b14e 2520 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
63691587 2521 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
d2c3b14e 2522 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
5c0ebfbe 2523 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
0202f5cd 2524 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
b5acfe15
PH
2525 SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
2526 SND_PCI_QUIRK(0x1558, 0x950A, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
f3d737b6 2527 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2f0d520a 2528 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
b5acfe15
PH
2529 SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
2530 SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950),
2531 SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950),
2532 SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950),
503d90b3
RS
2533 SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2534 SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
b5acfe15
PH
2535 SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
2536 SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
503d90b3 2537 SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
b5acfe15
PH
2538 SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2539 SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
503d90b3 2540 SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
b5acfe15 2541 SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
259eb824
PH
2542 SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2543 SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
7a6069bf
TI
2544 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2545 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
ac9b1cdd 2546 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
68ef0561 2547 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
ff818c24
TI
2548 {}
2549};
2550
1727a771 2551static const struct hda_model_fixup alc882_fixup_models[] = {
772c2917
TI
2552 {.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2553 {.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2554 {.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2555 {.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2556 {.id = ALC889_FIXUP_CD, .name = "cd"},
2557 {.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2558 {.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2559 {.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2560 {.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2561 {.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2562 {.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2563 {.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2564 {.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2565 {.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2566 {.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
912093bc
TI
2567 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2568 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2569 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
772c2917
TI
2570 {.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2571 {.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2572 {.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2573 {.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2574 {.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2575 {.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2576 {.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2577 {.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
6e72aa5f 2578 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
e427c237 2579 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
772c2917 2580 {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
ba90d6a6 2581 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
772c2917 2582 {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
912093bc
TI
2583 {}
2584};
2585
f6a92248 2586/*
1d045db9 2587 * BIOS auto configuration
f6a92248 2588 */
1d045db9
TI
2589/* almost identical with ALC880 parser... */
2590static int alc882_parse_auto_config(struct hda_codec *codec)
2591{
1d045db9 2592 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
3e6179b8
TI
2593 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2594 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
1d045db9 2595}
b896b4eb 2596
1d045db9
TI
2597/*
2598 */
1d045db9 2599static int patch_alc882(struct hda_codec *codec)
f6a92248
KY
2600{
2601 struct alc_spec *spec;
1a97b7f2 2602 int err;
f6a92248 2603
3de95173
TI
2604 err = alc_alloc_spec(codec, 0x0b);
2605 if (err < 0)
2606 return err;
f6a92248 2607
3de95173 2608 spec = codec->spec;
1f0f4b80 2609
7639a06c 2610 switch (codec->core.vendor_id) {
1d045db9
TI
2611 case 0x10ec0882:
2612 case 0x10ec0885:
acf08081 2613 case 0x10ec0900:
6d9ffcff 2614 case 0x10ec0b00:
a535ad57 2615 case 0x10ec1220:
1d045db9
TI
2616 break;
2617 default:
2618 /* ALC883 and variants */
2619 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2620 break;
c793bec5 2621 }
977ddd6b 2622
c9af753f
TI
2623 alc_pre_init(codec);
2624
1727a771 2625 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
912093bc 2626 alc882_fixups);
1727a771 2627 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
ff818c24 2628
1d045db9
TI
2629 alc_auto_parse_customize_define(codec);
2630
7504b6cd
TI
2631 if (has_cdefine_beep(codec))
2632 spec->gen.beep_nid = 0x01;
2633
1a97b7f2
TI
2634 /* automatic parse from the BIOS config */
2635 err = alc882_parse_auto_config(codec);
2636 if (err < 0)
2637 goto error;
f6a92248 2638
fea80fae
TI
2639 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2640 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2641 if (err < 0)
2642 goto error;
2643 }
f6a92248 2644
1727a771 2645 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 2646
f6a92248 2647 return 0;
e16fb6d1
TI
2648
2649 error:
2650 alc_free(codec);
2651 return err;
f6a92248
KY
2652}
2653
df694daa 2654
df694daa 2655/*
1d045db9 2656 * ALC262 support
df694daa 2657 */
1d045db9 2658static int alc262_parse_auto_config(struct hda_codec *codec)
df694daa 2659{
1d045db9 2660 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
3e6179b8
TI
2661 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2662 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
df694daa
KY
2663}
2664
df694daa 2665/*
1d045db9 2666 * Pin config fixes
df694daa 2667 */
cfc9b06f 2668enum {
ea4e7af1 2669 ALC262_FIXUP_FSC_H270,
7513e6da 2670 ALC262_FIXUP_FSC_S7110,
ea4e7af1
TI
2671 ALC262_FIXUP_HP_Z200,
2672 ALC262_FIXUP_TYAN,
c470150c 2673 ALC262_FIXUP_LENOVO_3000,
b42590b8
TI
2674 ALC262_FIXUP_BENQ,
2675 ALC262_FIXUP_BENQ_T31,
6e72aa5f 2676 ALC262_FIXUP_INV_DMIC,
b5c6611f 2677 ALC262_FIXUP_INTEL_BAYLEYBAY,
cfc9b06f
TI
2678};
2679
1727a771 2680static const struct hda_fixup alc262_fixups[] = {
ea4e7af1 2681 [ALC262_FIXUP_FSC_H270] = {
1727a771
TI
2682 .type = HDA_FIXUP_PINS,
2683 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
2684 { 0x14, 0x99130110 }, /* speaker */
2685 { 0x15, 0x0221142f }, /* front HP */
2686 { 0x1b, 0x0121141f }, /* rear HP */
2687 { }
2688 }
2689 },
7513e6da
TI
2690 [ALC262_FIXUP_FSC_S7110] = {
2691 .type = HDA_FIXUP_PINS,
2692 .v.pins = (const struct hda_pintbl[]) {
2693 { 0x15, 0x90170110 }, /* speaker */
2694 { }
2695 },
2696 .chained = true,
2697 .chain_id = ALC262_FIXUP_BENQ,
2698 },
ea4e7af1 2699 [ALC262_FIXUP_HP_Z200] = {
1727a771
TI
2700 .type = HDA_FIXUP_PINS,
2701 .v.pins = (const struct hda_pintbl[]) {
1d045db9 2702 { 0x16, 0x99130120 }, /* internal speaker */
73413b12
TI
2703 { }
2704 }
cfc9b06f 2705 },
ea4e7af1 2706 [ALC262_FIXUP_TYAN] = {
1727a771
TI
2707 .type = HDA_FIXUP_PINS,
2708 .v.pins = (const struct hda_pintbl[]) {
ea4e7af1
TI
2709 { 0x14, 0x1993e1f0 }, /* int AUX */
2710 { }
2711 }
2712 },
c470150c 2713 [ALC262_FIXUP_LENOVO_3000] = {
fd108215
TI
2714 .type = HDA_FIXUP_PINCTLS,
2715 .v.pins = (const struct hda_pintbl[]) {
2716 { 0x19, PIN_VREF50 },
b42590b8
TI
2717 {}
2718 },
2719 .chained = true,
2720 .chain_id = ALC262_FIXUP_BENQ,
2721 },
2722 [ALC262_FIXUP_BENQ] = {
1727a771 2723 .type = HDA_FIXUP_VERBS,
b42590b8 2724 .v.verbs = (const struct hda_verb[]) {
c470150c
TI
2725 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2726 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2727 {}
2728 }
2729 },
b42590b8 2730 [ALC262_FIXUP_BENQ_T31] = {
1727a771 2731 .type = HDA_FIXUP_VERBS,
b42590b8
TI
2732 .v.verbs = (const struct hda_verb[]) {
2733 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2734 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2735 {}
2736 }
2737 },
6e72aa5f 2738 [ALC262_FIXUP_INV_DMIC] = {
1727a771 2739 .type = HDA_FIXUP_FUNC,
9d36a7dc 2740 .v.func = alc_fixup_inv_dmic,
6e72aa5f 2741 },
b5c6611f
ML
2742 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2743 .type = HDA_FIXUP_FUNC,
2744 .v.func = alc_fixup_no_depop_delay,
2745 },
cfc9b06f
TI
2746};
2747
1d045db9 2748static const struct snd_pci_quirk alc262_fixup_tbl[] = {
ea4e7af1 2749 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
7513e6da 2750 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
3dcd3be3 2751 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
ea4e7af1 2752 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
275ec0cb 2753 SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
ea4e7af1 2754 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
c470150c 2755 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
b42590b8
TI
2756 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2757 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
b5c6611f 2758 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
cfc9b06f
TI
2759 {}
2760};
df694daa 2761
1727a771 2762static const struct hda_model_fixup alc262_fixup_models[] = {
6e72aa5f 2763 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
e43c44d6
TI
2764 {.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2765 {.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2766 {.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2767 {.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2768 {.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2769 {.id = ALC262_FIXUP_BENQ, .name = "benq"},
2770 {.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2771 {.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
6e72aa5f
TI
2772 {}
2773};
1d045db9 2774
1d045db9
TI
2775/*
2776 */
1d045db9 2777static int patch_alc262(struct hda_codec *codec)
df694daa
KY
2778{
2779 struct alc_spec *spec;
df694daa
KY
2780 int err;
2781
3de95173
TI
2782 err = alc_alloc_spec(codec, 0x0b);
2783 if (err < 0)
2784 return err;
df694daa 2785
3de95173 2786 spec = codec->spec;
08c189f2 2787 spec->gen.shared_mic_vref_pin = 0x18;
1d045db9 2788
225068ab
TI
2789 spec->shutup = alc_eapd_shutup;
2790
1d045db9
TI
2791#if 0
2792 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2793 * under-run
2794 */
98b24883 2795 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
1d045db9 2796#endif
1d045db9
TI
2797 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2798
c9af753f
TI
2799 alc_pre_init(codec);
2800
1727a771 2801 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
6e72aa5f 2802 alc262_fixups);
1727a771 2803 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
9c7f852e 2804
af741c15
TI
2805 alc_auto_parse_customize_define(codec);
2806
7504b6cd
TI
2807 if (has_cdefine_beep(codec))
2808 spec->gen.beep_nid = 0x01;
2809
42399f7a
TI
2810 /* automatic parse from the BIOS config */
2811 err = alc262_parse_auto_config(codec);
2812 if (err < 0)
2813 goto error;
df694daa 2814
fea80fae
TI
2815 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2816 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2817 if (err < 0)
2818 goto error;
2819 }
2134ea4f 2820
1727a771 2821 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 2822
1da177e4 2823 return 0;
e16fb6d1
TI
2824
2825 error:
2826 alc_free(codec);
2827 return err;
1da177e4
LT
2828}
2829
f32610ed 2830/*
1d045db9 2831 * ALC268
f32610ed 2832 */
1d045db9 2833/* bind Beep switches of both NID 0x0f and 0x10 */
a717777d
TI
2834static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2835 struct snd_ctl_elem_value *ucontrol)
2836{
2837 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2838 unsigned long pval;
2839 int err;
2840
2841 mutex_lock(&codec->control_mutex);
2842 pval = kcontrol->private_value;
2843 kcontrol->private_value = (pval & ~0xff) | 0x0f;
2844 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2845 if (err >= 0) {
2846 kcontrol->private_value = (pval & ~0xff) | 0x10;
2847 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2848 }
2849 kcontrol->private_value = pval;
2850 mutex_unlock(&codec->control_mutex);
2851 return err;
2852}
f32610ed 2853
1d045db9
TI
2854static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2855 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
a717777d
TI
2856 {
2857 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2858 .name = "Beep Playback Switch",
2859 .subdevice = HDA_SUBDEV_AMP_FLAG,
2860 .info = snd_hda_mixer_amp_switch_info,
2861 .get = snd_hda_mixer_amp_switch_get,
2862 .put = alc268_beep_switch_put,
2863 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
2864 },
f32610ed
JS
2865};
2866
1d045db9
TI
2867/* set PCBEEP vol = 0, mute connections */
2868static const struct hda_verb alc268_beep_init_verbs[] = {
2869 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2870 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2871 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2872 { }
f32610ed
JS
2873};
2874
6e72aa5f
TI
2875enum {
2876 ALC268_FIXUP_INV_DMIC,
cb766404 2877 ALC268_FIXUP_HP_EAPD,
24eff328 2878 ALC268_FIXUP_SPDIF,
6e72aa5f
TI
2879};
2880
1727a771 2881static const struct hda_fixup alc268_fixups[] = {
6e72aa5f 2882 [ALC268_FIXUP_INV_DMIC] = {
1727a771 2883 .type = HDA_FIXUP_FUNC,
9d36a7dc 2884 .v.func = alc_fixup_inv_dmic,
6e72aa5f 2885 },
cb766404 2886 [ALC268_FIXUP_HP_EAPD] = {
1727a771 2887 .type = HDA_FIXUP_VERBS,
cb766404
TI
2888 .v.verbs = (const struct hda_verb[]) {
2889 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
2890 {}
2891 }
2892 },
24eff328
TI
2893 [ALC268_FIXUP_SPDIF] = {
2894 .type = HDA_FIXUP_PINS,
2895 .v.pins = (const struct hda_pintbl[]) {
2896 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
2897 {}
2898 }
2899 },
6e72aa5f
TI
2900};
2901
1727a771 2902static const struct hda_model_fixup alc268_fixup_models[] = {
6e72aa5f 2903 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
cb766404 2904 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
03bf11c9 2905 {.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
cb766404
TI
2906 {}
2907};
2908
2909static const struct snd_pci_quirk alc268_fixup_tbl[] = {
24eff328 2910 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
fcd8f3b1 2911 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
cb766404
TI
2912 /* below is codec SSID since multiple Toshiba laptops have the
2913 * same PCI SSID 1179:ff00
2914 */
2915 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
6e72aa5f
TI
2916 {}
2917};
2918
f32610ed
JS
2919/*
2920 * BIOS auto configuration
2921 */
1d045db9 2922static int alc268_parse_auto_config(struct hda_codec *codec)
f32610ed 2923{
3e6179b8 2924 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
7504b6cd 2925 return alc_parse_auto_config(codec, NULL, alc268_ssids);
f32610ed
JS
2926}
2927
1d045db9
TI
2928/*
2929 */
1d045db9 2930static int patch_alc268(struct hda_codec *codec)
f32610ed
JS
2931{
2932 struct alc_spec *spec;
a5cb463a 2933 int i, err;
f32610ed 2934
1d045db9 2935 /* ALC268 has no aa-loopback mixer */
3de95173
TI
2936 err = alc_alloc_spec(codec, 0);
2937 if (err < 0)
2938 return err;
2939
2940 spec = codec->spec;
2722b535
TI
2941 if (has_cdefine_beep(codec))
2942 spec->gen.beep_nid = 0x01;
1f0f4b80 2943
225068ab
TI
2944 spec->shutup = alc_eapd_shutup;
2945
c9af753f
TI
2946 alc_pre_init(codec);
2947
1727a771
TI
2948 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
2949 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
6e72aa5f 2950
6ebb8053
TI
2951 /* automatic parse from the BIOS config */
2952 err = alc268_parse_auto_config(codec);
e16fb6d1
TI
2953 if (err < 0)
2954 goto error;
f32610ed 2955
7504b6cd
TI
2956 if (err > 0 && !spec->gen.no_analog &&
2957 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
a5cb463a
TI
2958 for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
2959 if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
2960 &alc268_beep_mixer[i])) {
2961 err = -ENOMEM;
2962 goto error;
2963 }
2964 }
7504b6cd 2965 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
1d045db9
TI
2966 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
2967 /* override the amp caps for beep generator */
2968 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
2969 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
2970 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
2971 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
2972 (0 << AC_AMPCAP_MUTE_SHIFT));
2f893286
KY
2973 }
2974
1727a771 2975 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
6e72aa5f 2976
f32610ed 2977 return 0;
e16fb6d1
TI
2978
2979 error:
2980 alc_free(codec);
2981 return err;
f32610ed
JS
2982}
2983
bc9f98a9 2984/*
1d045db9 2985 * ALC269
bc9f98a9 2986 */
08c189f2 2987
1d045db9 2988static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
1d045db9 2989 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
bc9f98a9
KY
2990};
2991
1d045db9 2992static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
1d045db9 2993 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
bc9f98a9 2994};
291702f0 2995
1d045db9
TI
2996/* different alc269-variants */
2997enum {
2998 ALC269_TYPE_ALC269VA,
2999 ALC269_TYPE_ALC269VB,
3000 ALC269_TYPE_ALC269VC,
adcc70b2 3001 ALC269_TYPE_ALC269VD,
065380f0
KY
3002 ALC269_TYPE_ALC280,
3003 ALC269_TYPE_ALC282,
2af02be7 3004 ALC269_TYPE_ALC283,
065380f0 3005 ALC269_TYPE_ALC284,
4731d5de 3006 ALC269_TYPE_ALC293,
7fc7d047 3007 ALC269_TYPE_ALC286,
506b62c3 3008 ALC269_TYPE_ALC298,
1d04c9de 3009 ALC269_TYPE_ALC255,
4344aec8 3010 ALC269_TYPE_ALC256,
f429e7e4 3011 ALC269_TYPE_ALC257,
0a6f0600 3012 ALC269_TYPE_ALC215,
4231430d 3013 ALC269_TYPE_ALC225,
dcd4f0db 3014 ALC269_TYPE_ALC294,
1078bef0 3015 ALC269_TYPE_ALC300,
f0778871 3016 ALC269_TYPE_ALC623,
6fbae35a 3017 ALC269_TYPE_ALC700,
bc9f98a9
KY
3018};
3019
3020/*
1d045db9 3021 * BIOS auto configuration
bc9f98a9 3022 */
1d045db9
TI
3023static int alc269_parse_auto_config(struct hda_codec *codec)
3024{
1d045db9 3025 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
3e6179b8
TI
3026 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
3027 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3028 struct alc_spec *spec = codec->spec;
adcc70b2
KY
3029 const hda_nid_t *ssids;
3030
3031 switch (spec->codec_variant) {
3032 case ALC269_TYPE_ALC269VA:
3033 case ALC269_TYPE_ALC269VC:
065380f0
KY
3034 case ALC269_TYPE_ALC280:
3035 case ALC269_TYPE_ALC284:
4731d5de 3036 case ALC269_TYPE_ALC293:
adcc70b2
KY
3037 ssids = alc269va_ssids;
3038 break;
3039 case ALC269_TYPE_ALC269VB:
3040 case ALC269_TYPE_ALC269VD:
065380f0 3041 case ALC269_TYPE_ALC282:
2af02be7 3042 case ALC269_TYPE_ALC283:
7fc7d047 3043 case ALC269_TYPE_ALC286:
506b62c3 3044 case ALC269_TYPE_ALC298:
1d04c9de 3045 case ALC269_TYPE_ALC255:
4344aec8 3046 case ALC269_TYPE_ALC256:
f429e7e4 3047 case ALC269_TYPE_ALC257:
0a6f0600 3048 case ALC269_TYPE_ALC215:
4231430d 3049 case ALC269_TYPE_ALC225:
dcd4f0db 3050 case ALC269_TYPE_ALC294:
1078bef0 3051 case ALC269_TYPE_ALC300:
f0778871 3052 case ALC269_TYPE_ALC623:
6fbae35a 3053 case ALC269_TYPE_ALC700:
adcc70b2
KY
3054 ssids = alc269_ssids;
3055 break;
3056 default:
3057 ssids = alc269_ssids;
3058 break;
3059 }
bc9f98a9 3060
3e6179b8 3061 return alc_parse_auto_config(codec, alc269_ignore, ssids);
1d045db9 3062}
bc9f98a9 3063
476c02e0
HW
3064static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
3065 { SND_JACK_BTN_0, KEY_PLAYPAUSE },
3066 { SND_JACK_BTN_1, KEY_VOICECOMMAND },
3067 { SND_JACK_BTN_2, KEY_VOLUMEUP },
3068 { SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3069 {}
3070};
3071
3072static void alc_headset_btn_callback(struct hda_codec *codec,
3073 struct hda_jack_callback *jack)
3074{
3075 int report = 0;
3076
3077 if (jack->unsol_res & (7 << 13))
3078 report |= SND_JACK_BTN_0;
3079
3080 if (jack->unsol_res & (1 << 16 | 3 << 8))
3081 report |= SND_JACK_BTN_1;
3082
3083 /* Volume up key */
3084 if (jack->unsol_res & (7 << 23))
3085 report |= SND_JACK_BTN_2;
3086
3087 /* Volume down key */
3088 if (jack->unsol_res & (7 << 10))
3089 report |= SND_JACK_BTN_3;
3090
3091 jack->jack->button_state = report;
3092}
3093
3094static void alc_disable_headset_jack_key(struct hda_codec *codec)
3095{
3096 struct alc_spec *spec = codec->spec;
3097
3098 if (!spec->has_hs_key)
3099 return;
3100
3101 switch (codec->core.vendor_id) {
3102 case 0x10ec0215:
3103 case 0x10ec0225:
3104 case 0x10ec0285:
3105 case 0x10ec0295:
3106 case 0x10ec0289:
3107 case 0x10ec0299:
3108 alc_write_coef_idx(codec, 0x48, 0x0);
3109 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3110 alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3111 break;
3112 case 0x10ec0236:
3113 case 0x10ec0256:
3114 alc_write_coef_idx(codec, 0x48, 0x0);
3115 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3116 break;
3117 }
3118}
3119
3120static void alc_enable_headset_jack_key(struct hda_codec *codec)
3121{
3122 struct alc_spec *spec = codec->spec;
3123
3124 if (!spec->has_hs_key)
3125 return;
3126
3127 switch (codec->core.vendor_id) {
3128 case 0x10ec0215:
3129 case 0x10ec0225:
3130 case 0x10ec0285:
3131 case 0x10ec0295:
3132 case 0x10ec0289:
3133 case 0x10ec0299:
3134 alc_write_coef_idx(codec, 0x48, 0xd011);
3135 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3136 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3137 break;
3138 case 0x10ec0236:
3139 case 0x10ec0256:
3140 alc_write_coef_idx(codec, 0x48, 0xd011);
3141 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3142 break;
3143 }
3144}
3145
3146static void alc_fixup_headset_jack(struct hda_codec *codec,
3147 const struct hda_fixup *fix, int action)
3148{
3149 struct alc_spec *spec = codec->spec;
3150
3151 switch (action) {
3152 case HDA_FIXUP_ACT_PRE_PROBE:
3153 spec->has_hs_key = 1;
3154 snd_hda_jack_detect_enable_callback(codec, 0x55,
3155 alc_headset_btn_callback);
3156 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack", false,
3157 SND_JACK_HEADSET, alc_headset_btn_keymap);
3158 break;
3159 case HDA_FIXUP_ACT_INIT:
3160 alc_enable_headset_jack_key(codec);
3161 break;
3162 }
3163}
3164
1387e2d1 3165static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
1d045db9 3166{
98b24883 3167 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
1d045db9 3168}
291702f0 3169
1d045db9
TI
3170static void alc269_shutup(struct hda_codec *codec)
3171{
adcc70b2
KY
3172 struct alc_spec *spec = codec->spec;
3173
1387e2d1
KY
3174 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3175 alc269vb_toggle_power_output(codec, 0);
3176 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3177 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
1d045db9
TI
3178 msleep(150);
3179 }
c0ca5ece 3180 alc_shutup_pins(codec);
1d045db9 3181}
291702f0 3182
6b0f95c4 3183static const struct coef_fw alc282_coefs[] = {
54db6c39 3184 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
32fa7e49 3185 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
54db6c39
TI
3186 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3187 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3188 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3189 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3190 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3191 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3192 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3193 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3194 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3195 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3196 WRITE_COEF(0x34, 0xa0c0), /* ANC */
3197 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3198 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3199 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3200 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3201 WRITE_COEF(0x63, 0x2902), /* PLL */
3202 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3203 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3204 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3205 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3206 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3207 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3208 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3209 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3210 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3211 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3212 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3213 {}
3214};
3215
cb149cb3
KY
3216static void alc282_restore_default_value(struct hda_codec *codec)
3217{
54db6c39 3218 alc_process_coef_fw(codec, alc282_coefs);
cb149cb3
KY
3219}
3220
7b5c7a02
KY
3221static void alc282_init(struct hda_codec *codec)
3222{
3223 struct alc_spec *spec = codec->spec;
35a39f98 3224 hda_nid_t hp_pin = alc_get_hp_pin(spec);
7b5c7a02
KY
3225 bool hp_pin_sense;
3226 int coef78;
3227
cb149cb3
KY
3228 alc282_restore_default_value(codec);
3229
7b5c7a02
KY
3230 if (!hp_pin)
3231 return;
3232 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3233 coef78 = alc_read_coef_idx(codec, 0x78);
3234
3235 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3236 /* Headphone capless set to high power mode */
3237 alc_write_coef_idx(codec, 0x78, 0x9004);
3238
3239 if (hp_pin_sense)
3240 msleep(2);
3241
3242 snd_hda_codec_write(codec, hp_pin, 0,
3243 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3244
3245 if (hp_pin_sense)
3246 msleep(85);
3247
3248 snd_hda_codec_write(codec, hp_pin, 0,
3249 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3250
3251 if (hp_pin_sense)
3252 msleep(100);
3253
3254 /* Headphone capless set to normal mode */
3255 alc_write_coef_idx(codec, 0x78, coef78);
3256}
3257
3258static void alc282_shutup(struct hda_codec *codec)
3259{
3260 struct alc_spec *spec = codec->spec;
35a39f98 3261 hda_nid_t hp_pin = alc_get_hp_pin(spec);
7b5c7a02
KY
3262 bool hp_pin_sense;
3263 int coef78;
3264
3265 if (!hp_pin) {
3266 alc269_shutup(codec);
3267 return;
3268 }
3269
3270 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3271 coef78 = alc_read_coef_idx(codec, 0x78);
3272 alc_write_coef_idx(codec, 0x78, 0x9004);
3273
3274 if (hp_pin_sense)
3275 msleep(2);
3276
3277 snd_hda_codec_write(codec, hp_pin, 0,
3278 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3279
3280 if (hp_pin_sense)
3281 msleep(85);
3282
c0ca5ece
TI
3283 if (!spec->no_shutup_pins)
3284 snd_hda_codec_write(codec, hp_pin, 0,
3285 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
7b5c7a02
KY
3286
3287 if (hp_pin_sense)
3288 msleep(100);
3289
3290 alc_auto_setup_eapd(codec, false);
c0ca5ece 3291 alc_shutup_pins(codec);
7b5c7a02
KY
3292 alc_write_coef_idx(codec, 0x78, coef78);
3293}
3294
6b0f95c4 3295static const struct coef_fw alc283_coefs[] = {
54db6c39 3296 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
56779864 3297 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
54db6c39
TI
3298 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3299 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3300 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3301 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3302 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3303 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3304 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3305 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3306 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3307 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3308 WRITE_COEF(0x22, 0xa0c0), /* ANC */
3309 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3310 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3311 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3312 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3313 WRITE_COEF(0x2e, 0x2902), /* PLL */
3314 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3315 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3316 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3317 WRITE_COEF(0x36, 0x0), /* capless control 5 */
3318 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3319 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3320 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3321 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3322 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3323 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3324 WRITE_COEF(0x49, 0x0), /* test mode */
3325 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3326 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3327 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
56779864 3328 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
54db6c39
TI
3329 {}
3330};
3331
6bd55b04
KY
3332static void alc283_restore_default_value(struct hda_codec *codec)
3333{
54db6c39 3334 alc_process_coef_fw(codec, alc283_coefs);
6bd55b04
KY
3335}
3336
2af02be7
KY
3337static void alc283_init(struct hda_codec *codec)
3338{
3339 struct alc_spec *spec = codec->spec;
35a39f98 3340 hda_nid_t hp_pin = alc_get_hp_pin(spec);
2af02be7 3341 bool hp_pin_sense;
2af02be7 3342
6bd55b04
KY
3343 alc283_restore_default_value(codec);
3344
2af02be7
KY
3345 if (!hp_pin)
3346 return;
a59d7199
KY
3347
3348 msleep(30);
2af02be7
KY
3349 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3350
3351 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3352 /* Headphone capless set to high power mode */
3353 alc_write_coef_idx(codec, 0x43, 0x9004);
3354
3355 snd_hda_codec_write(codec, hp_pin, 0,
3356 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3357
3358 if (hp_pin_sense)
3359 msleep(85);
3360
3361 snd_hda_codec_write(codec, hp_pin, 0,
3362 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3363
3364 if (hp_pin_sense)
3365 msleep(85);
3366 /* Index 0x46 Combo jack auto switch control 2 */
3367 /* 3k pull low control for Headset jack. */
98b24883 3368 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
2af02be7
KY
3369 /* Headphone capless set to normal mode */
3370 alc_write_coef_idx(codec, 0x43, 0x9614);
3371}
3372
3373static void alc283_shutup(struct hda_codec *codec)
3374{
3375 struct alc_spec *spec = codec->spec;
35a39f98 3376 hda_nid_t hp_pin = alc_get_hp_pin(spec);
2af02be7 3377 bool hp_pin_sense;
2af02be7
KY
3378
3379 if (!hp_pin) {
3380 alc269_shutup(codec);
3381 return;
3382 }
3383
3384 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3385
3386 alc_write_coef_idx(codec, 0x43, 0x9004);
3387
b450b17c
HP
3388 /*depop hp during suspend*/
3389 alc_write_coef_idx(codec, 0x06, 0x2100);
3390
2af02be7
KY
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)
88011c09 3395 msleep(100);
2af02be7 3396
c0ca5ece
TI
3397 if (!spec->no_shutup_pins)
3398 snd_hda_codec_write(codec, hp_pin, 0,
3399 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
2af02be7 3400
98b24883 3401 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
2af02be7
KY
3402
3403 if (hp_pin_sense)
88011c09 3404 msleep(100);
0435b3ff 3405 alc_auto_setup_eapd(codec, false);
c0ca5ece 3406 alc_shutup_pins(codec);
2af02be7
KY
3407 alc_write_coef_idx(codec, 0x43, 0x9614);
3408}
3409
4a219ef8
KY
3410static void alc256_init(struct hda_codec *codec)
3411{
3412 struct alc_spec *spec = codec->spec;
35a39f98 3413 hda_nid_t hp_pin = alc_get_hp_pin(spec);
4a219ef8
KY
3414 bool hp_pin_sense;
3415
3416 if (!hp_pin)
6447c962 3417 hp_pin = 0x21;
4a219ef8
KY
3418
3419 msleep(30);
3420
3421 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3422
3423 if (hp_pin_sense)
3424 msleep(2);
3425
3426 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
6447c962
KY
3427 if (spec->ultra_low_power) {
3428 alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3429 alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3430 alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3431 alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3432 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3433 msleep(30);
3434 }
4a219ef8
KY
3435
3436 snd_hda_codec_write(codec, hp_pin, 0,
3437 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3438
6447c962 3439 if (hp_pin_sense || spec->ultra_low_power)
4a219ef8
KY
3440 msleep(85);
3441
3442 snd_hda_codec_write(codec, hp_pin, 0,
3443 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3444
6447c962 3445 if (hp_pin_sense || spec->ultra_low_power)
4a219ef8
KY
3446 msleep(100);
3447
3448 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3449 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
88d42b2b
KY
3450 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3451 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
c4473744
TH
3452 /*
3453 * Expose headphone mic (or possibly Line In on some machines) instead
3454 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3455 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3456 * this register.
3457 */
3458 alc_write_coef_idx(codec, 0x36, 0x5757);
4a219ef8
KY
3459}
3460
3461static void alc256_shutup(struct hda_codec *codec)
3462{
3463 struct alc_spec *spec = codec->spec;
35a39f98 3464 hda_nid_t hp_pin = alc_get_hp_pin(spec);
4a219ef8
KY
3465 bool hp_pin_sense;
3466
6447c962
KY
3467 if (!hp_pin)
3468 hp_pin = 0x21;
4a219ef8
KY
3469
3470 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3471
3472 if (hp_pin_sense)
3473 msleep(2);
3474
3475 snd_hda_codec_write(codec, hp_pin, 0,
3476 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3477
6447c962 3478 if (hp_pin_sense || spec->ultra_low_power)
4a219ef8
KY
3479 msleep(85);
3480
1c9609e3
TI
3481 /* 3k pull low control for Headset jack. */
3482 /* NOTE: call this before clearing the pin, otherwise codec stalls */
3f742490
HW
3483 /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
3484 * when booting with headset plugged. So skip setting it for the codec alc257
3485 */
3486 if (codec->core.vendor_id != 0x10ec0257)
3487 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
1c9609e3 3488
c0ca5ece
TI
3489 if (!spec->no_shutup_pins)
3490 snd_hda_codec_write(codec, hp_pin, 0,
3491 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4a219ef8 3492
6447c962 3493 if (hp_pin_sense || spec->ultra_low_power)
4a219ef8
KY
3494 msleep(100);
3495
3496 alc_auto_setup_eapd(codec, false);
c0ca5ece 3497 alc_shutup_pins(codec);
6447c962
KY
3498 if (spec->ultra_low_power) {
3499 msleep(50);
3500 alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3501 alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3502 alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3503 alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3504 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3505 msleep(30);
3506 }
4a219ef8
KY
3507}
3508
da911b1f
KY
3509static void alc225_init(struct hda_codec *codec)
3510{
3511 struct alc_spec *spec = codec->spec;
35a39f98 3512 hda_nid_t hp_pin = alc_get_hp_pin(spec);
da911b1f
KY
3513 bool hp1_pin_sense, hp2_pin_sense;
3514
3515 if (!hp_pin)
d3ba58bb 3516 hp_pin = 0x21;
da911b1f
KY
3517 msleep(30);
3518
3519 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3520 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3521
3522 if (hp1_pin_sense || hp2_pin_sense)
3523 msleep(2);
3524
3525 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
d3ba58bb
KY
3526 if (spec->ultra_low_power) {
3527 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3528 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3529 alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3530 msleep(30);
3531 }
da911b1f 3532
d3ba58bb 3533 if (hp1_pin_sense || spec->ultra_low_power)
da911b1f
KY
3534 snd_hda_codec_write(codec, hp_pin, 0,
3535 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3536 if (hp2_pin_sense)
3537 snd_hda_codec_write(codec, 0x16, 0,
3538 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3539
d3ba58bb 3540 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
da911b1f
KY
3541 msleep(85);
3542
d3ba58bb 3543 if (hp1_pin_sense || spec->ultra_low_power)
da911b1f
KY
3544 snd_hda_codec_write(codec, hp_pin, 0,
3545 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3546 if (hp2_pin_sense)
3547 snd_hda_codec_write(codec, 0x16, 0,
3548 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3549
d3ba58bb 3550 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
da911b1f
KY
3551 msleep(100);
3552
3553 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3554 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3555}
3556
3557static void alc225_shutup(struct hda_codec *codec)
3558{
3559 struct alc_spec *spec = codec->spec;
35a39f98 3560 hda_nid_t hp_pin = alc_get_hp_pin(spec);
da911b1f
KY
3561 bool hp1_pin_sense, hp2_pin_sense;
3562
d3ba58bb
KY
3563 if (!hp_pin)
3564 hp_pin = 0x21;
476c02e0
HW
3565
3566 alc_disable_headset_jack_key(codec);
da911b1f
KY
3567 /* 3k pull low control for Headset jack. */
3568 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3569
3570 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3571 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3572
3573 if (hp1_pin_sense || hp2_pin_sense)
3574 msleep(2);
3575
d3ba58bb 3576 if (hp1_pin_sense || spec->ultra_low_power)
da911b1f
KY
3577 snd_hda_codec_write(codec, hp_pin, 0,
3578 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3579 if (hp2_pin_sense)
3580 snd_hda_codec_write(codec, 0x16, 0,
3581 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3582
d3ba58bb 3583 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
da911b1f
KY
3584 msleep(85);
3585
d3ba58bb 3586 if (hp1_pin_sense || spec->ultra_low_power)
da911b1f
KY
3587 snd_hda_codec_write(codec, hp_pin, 0,
3588 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3589 if (hp2_pin_sense)
3590 snd_hda_codec_write(codec, 0x16, 0,
3591 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3592
d3ba58bb 3593 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
da911b1f
KY
3594 msleep(100);
3595
3596 alc_auto_setup_eapd(codec, false);
c0ca5ece 3597 alc_shutup_pins(codec);
d3ba58bb
KY
3598 if (spec->ultra_low_power) {
3599 msleep(50);
3600 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3601 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3602 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3603 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3604 msleep(30);
3605 }
476c02e0
HW
3606
3607 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3608 alc_enable_headset_jack_key(codec);
da911b1f
KY
3609}
3610
c2d6af53
KY
3611static void alc_default_init(struct hda_codec *codec)
3612{
3613 struct alc_spec *spec = codec->spec;
35a39f98 3614 hda_nid_t hp_pin = alc_get_hp_pin(spec);
c2d6af53
KY
3615 bool hp_pin_sense;
3616
3617 if (!hp_pin)
3618 return;
3619
3620 msleep(30);
3621
3622 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3623
3624 if (hp_pin_sense)
3625 msleep(2);
3626
3627 snd_hda_codec_write(codec, hp_pin, 0,
3628 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3629
3630 if (hp_pin_sense)
3631 msleep(85);
3632
3633 snd_hda_codec_write(codec, hp_pin, 0,
3634 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3635
3636 if (hp_pin_sense)
3637 msleep(100);
3638}
3639
3640static void alc_default_shutup(struct hda_codec *codec)
3641{
3642 struct alc_spec *spec = codec->spec;
35a39f98 3643 hda_nid_t hp_pin = alc_get_hp_pin(spec);
c2d6af53
KY
3644 bool hp_pin_sense;
3645
3646 if (!hp_pin) {
3647 alc269_shutup(codec);
3648 return;
3649 }
3650
3651 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3652
3653 if (hp_pin_sense)
3654 msleep(2);
3655
3656 snd_hda_codec_write(codec, hp_pin, 0,
3657 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3658
3659 if (hp_pin_sense)
3660 msleep(85);
3661
c0ca5ece
TI
3662 if (!spec->no_shutup_pins)
3663 snd_hda_codec_write(codec, hp_pin, 0,
3664 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
c2d6af53
KY
3665
3666 if (hp_pin_sense)
3667 msleep(100);
3668
3669 alc_auto_setup_eapd(codec, false);
c0ca5ece 3670 alc_shutup_pins(codec);
c2d6af53
KY
3671}
3672
693abe11
KY
3673static void alc294_hp_init(struct hda_codec *codec)
3674{
3675 struct alc_spec *spec = codec->spec;
35a39f98 3676 hda_nid_t hp_pin = alc_get_hp_pin(spec);
693abe11
KY
3677 int i, val;
3678
3679 if (!hp_pin)
3680 return;
3681
3682 snd_hda_codec_write(codec, hp_pin, 0,
3683 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3684
3685 msleep(100);
3686
c0ca5ece
TI
3687 if (!spec->no_shutup_pins)
3688 snd_hda_codec_write(codec, hp_pin, 0,
3689 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
693abe11
KY
3690
3691 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3692 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3693
3694 /* Wait for depop procedure finish */
3695 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3696 for (i = 0; i < 20 && val & 0x0080; i++) {
3697 msleep(50);
3698 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3699 }
3700 /* Set HP depop to auto mode */
3701 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3702 msleep(50);
3703}
3704
3705static void alc294_init(struct hda_codec *codec)
3706{
3707 struct alc_spec *spec = codec->spec;
3708
f6ef4e0e
TI
3709 /* required only at boot or S4 resume time */
3710 if (!spec->done_hp_init ||
3711 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
693abe11
KY
3712 alc294_hp_init(codec);
3713 spec->done_hp_init = true;
3714 }
3715 alc_default_init(codec);
3716}
3717
ad60d502
KY
3718static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3719 unsigned int val)
3720{
3721 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3722 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3723 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3724}
3725
3726static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3727{
3728 unsigned int val;
3729
3730 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3731 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3732 & 0xffff;
3733 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3734 << 16;
3735 return val;
3736}
3737
3738static void alc5505_dsp_halt(struct hda_codec *codec)
3739{
3740 unsigned int val;
3741
3742 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3743 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3744 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3745 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3746 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3747 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3748 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3749 val = alc5505_coef_get(codec, 0x6220);
3750 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3751}
3752
3753static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3754{
3755 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3756 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3757 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3758 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3759 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3760 alc5505_coef_set(codec, 0x880c, 0x00000004);
3761}
3762
3763static void alc5505_dsp_init(struct hda_codec *codec)
3764{
3765 unsigned int val;
3766
3767 alc5505_dsp_halt(codec);
3768 alc5505_dsp_back_from_halt(codec);
3769 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3770 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3771 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3772 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3773 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3774 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3775 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3776 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3777 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3778 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3779 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3780 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3781 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3782
3783 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3784 if (val <= 3)
3785 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3786 else
3787 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3788
3789 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3790 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3791 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3792 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3793 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3794 alc5505_coef_set(codec, 0x880c, 0x00000003);
3795 alc5505_coef_set(codec, 0x880c, 0x00000010);
cd63a5ff
TI
3796
3797#ifdef HALT_REALTEK_ALC5505
3798 alc5505_dsp_halt(codec);
3799#endif
ad60d502
KY
3800}
3801
cd63a5ff 3802#ifdef HALT_REALTEK_ALC5505
8a71821f
PLB
3803#define alc5505_dsp_suspend(codec) do { } while (0) /* NOP */
3804#define alc5505_dsp_resume(codec) do { } while (0) /* NOP */
cd63a5ff
TI
3805#else
3806#define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
3807#define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
3808#endif
3809
2a43952a 3810#ifdef CONFIG_PM
ad60d502
KY
3811static int alc269_suspend(struct hda_codec *codec)
3812{
3813 struct alc_spec *spec = codec->spec;
3814
3815 if (spec->has_alc5505_dsp)
cd63a5ff 3816 alc5505_dsp_suspend(codec);
ad60d502
KY
3817 return alc_suspend(codec);
3818}
3819
1d045db9
TI
3820static int alc269_resume(struct hda_codec *codec)
3821{
adcc70b2
KY
3822 struct alc_spec *spec = codec->spec;
3823
1387e2d1
KY
3824 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3825 alc269vb_toggle_power_output(codec, 0);
3826 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
adcc70b2 3827 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
1d045db9
TI
3828 msleep(150);
3829 }
8c427226 3830
1d045db9 3831 codec->patch_ops.init(codec);
f1d4e28b 3832
1387e2d1
KY
3833 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3834 alc269vb_toggle_power_output(codec, 1);
3835 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
adcc70b2 3836 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
1d045db9
TI
3837 msleep(200);
3838 }
f1d4e28b 3839
1a462be5 3840 snd_hda_regmap_sync(codec);
1d045db9 3841 hda_call_check_power_status(codec, 0x01);
f475371a
HW
3842
3843 /* on some machine, the BIOS will clear the codec gpio data when enter
3844 * suspend, and won't restore the data after resume, so we restore it
3845 * in the driver.
3846 */
d261eec8
TI
3847 if (spec->gpio_data)
3848 alc_write_gpio_data(codec);
f475371a 3849
ad60d502 3850 if (spec->has_alc5505_dsp)
cd63a5ff 3851 alc5505_dsp_resume(codec);
c5177c86 3852
1d045db9
TI
3853 return 0;
3854}
2a43952a 3855#endif /* CONFIG_PM */
f1d4e28b 3856
108cc108 3857static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
1727a771 3858 const struct hda_fixup *fix, int action)
108cc108
DH
3859{
3860 struct alc_spec *spec = codec->spec;
3861
1727a771 3862 if (action == HDA_FIXUP_ACT_PRE_PROBE)
108cc108
DH
3863 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
3864}
3865
fdcc968a
JMG
3866static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
3867 const struct hda_fixup *fix,
3868 int action)
3869{
3870 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
3871 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
3872
3873 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
3874 snd_hda_codec_set_pincfg(codec, 0x19,
3875 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
3876 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
3877}
3878
1d045db9 3879static void alc269_fixup_hweq(struct hda_codec *codec,
1727a771 3880 const struct hda_fixup *fix, int action)
1d045db9 3881{
98b24883
TI
3882 if (action == HDA_FIXUP_ACT_INIT)
3883 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
1d045db9 3884}
f1d4e28b 3885
7c478f03
DH
3886static void alc269_fixup_headset_mic(struct hda_codec *codec,
3887 const struct hda_fixup *fix, int action)
3888{
3889 struct alc_spec *spec = codec->spec;
3890
3891 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3892 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3893}
3894
1d045db9 3895static void alc271_fixup_dmic(struct hda_codec *codec,
1727a771 3896 const struct hda_fixup *fix, int action)
1d045db9
TI
3897{
3898 static const struct hda_verb verbs[] = {
3899 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
3900 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
3901 {}
3902 };
3903 unsigned int cfg;
f1d4e28b 3904
7639a06c
TI
3905 if (strcmp(codec->core.chip_name, "ALC271X") &&
3906 strcmp(codec->core.chip_name, "ALC269VB"))
1d045db9
TI
3907 return;
3908 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
3909 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
3910 snd_hda_sequence_write(codec, verbs);
3911}
f1d4e28b 3912
017f2a10 3913static void alc269_fixup_pcm_44k(struct hda_codec *codec,
1727a771 3914 const struct hda_fixup *fix, int action)
017f2a10
TI
3915{
3916 struct alc_spec *spec = codec->spec;
3917
1727a771 3918 if (action != HDA_FIXUP_ACT_PROBE)
017f2a10
TI
3919 return;
3920
3921 /* Due to a hardware problem on Lenovo Ideadpad, we need to
3922 * fix the sample rate of analog I/O to 44.1kHz
3923 */
08c189f2
TI
3924 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
3925 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
017f2a10
TI
3926}
3927
adabb3ec 3928static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
1727a771 3929 const struct hda_fixup *fix, int action)
adabb3ec 3930{
adabb3ec
TI
3931 /* The digital-mic unit sends PDM (differential signal) instead of
3932 * the standard PCM, thus you can't record a valid mono stream as is.
3933 * Below is a workaround specific to ALC269 to control the dmic
3934 * signal source as mono.
3935 */
98b24883
TI
3936 if (action == HDA_FIXUP_ACT_INIT)
3937 alc_update_coef_idx(codec, 0x07, 0, 0x80);
adabb3ec
TI
3938}
3939
24519911
TI
3940static void alc269_quanta_automute(struct hda_codec *codec)
3941{
08c189f2 3942 snd_hda_gen_update_outputs(codec);
24519911 3943
1687ccc8
TI
3944 alc_write_coef_idx(codec, 0x0c, 0x680);
3945 alc_write_coef_idx(codec, 0x0c, 0x480);
24519911
TI
3946}
3947
3948static void alc269_fixup_quanta_mute(struct hda_codec *codec,
1727a771 3949 const struct hda_fixup *fix, int action)
24519911
TI
3950{
3951 struct alc_spec *spec = codec->spec;
1727a771 3952 if (action != HDA_FIXUP_ACT_PROBE)
24519911 3953 return;
08c189f2 3954 spec->gen.automute_hook = alc269_quanta_automute;
24519911
TI
3955}
3956
d240d1dc 3957static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
1a4f69d5 3958 struct hda_jack_callback *jack)
d240d1dc
DH
3959{
3960 struct alc_spec *spec = codec->spec;
3961 int vref;
3962 msleep(200);
3963 snd_hda_gen_hp_automute(codec, jack);
3964
3965 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
3966 msleep(100);
3967 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3968 vref);
3969 msleep(500);
3970 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3971 vref);
3972}
3973
a2ef03fe
TE
3974/*
3975 * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
3976 */
3977struct hda_alc298_mbxinit {
3978 unsigned char value_0x23;
3979 unsigned char value_0x25;
3980};
3981
3982static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
3983 const struct hda_alc298_mbxinit *initval,
3984 bool first)
3985{
3986 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
3987 alc_write_coef_idx(codec, 0x26, 0xb000);
3988
3989 if (first)
3990 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
3991
3992 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
3993 alc_write_coef_idx(codec, 0x26, 0xf000);
3994 alc_write_coef_idx(codec, 0x23, initval->value_0x23);
3995
3996 if (initval->value_0x23 != 0x1e)
3997 alc_write_coef_idx(codec, 0x25, initval->value_0x25);
3998
3999 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4000 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4001}
4002
4003static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
4004 const struct hda_fixup *fix,
4005 int action)
4006{
4007 /* Initialization magic */
4008 static const struct hda_alc298_mbxinit dac_init[] = {
4009 {0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
4010 {0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
4011 {0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
4012 {0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
4013 {0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
4014 {0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
4015 {0x2f, 0x00},
4016 {0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
4017 {0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
4018 {0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
4019 {}
4020 };
4021 const struct hda_alc298_mbxinit *seq;
4022
4023 if (action != HDA_FIXUP_ACT_INIT)
4024 return;
4025
4026 /* Start */
4027 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4028 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4029 alc_write_coef_idx(codec, 0x26, 0xf000);
4030 alc_write_coef_idx(codec, 0x22, 0x31);
4031 alc_write_coef_idx(codec, 0x23, 0x0b);
4032 alc_write_coef_idx(codec, 0x25, 0x00);
4033 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4034 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4035
4036 for (seq = dac_init; seq->value_0x23; seq++)
4037 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4038}
4039
d240d1dc
DH
4040static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4041 const struct hda_fixup *fix, int action)
4042{
4043 struct alc_spec *spec = codec->spec;
4044 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4045 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4046 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
4047 }
4048}
4049
766538ac
TI
4050static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4051 bool polarity, bool on)
4052{
4053 unsigned int pinval;
4054
4055 if (!pin)
4056 return;
4057 if (polarity)
4058 on = !on;
4059 pinval = snd_hda_codec_get_pin_target(codec, pin);
4060 pinval &= ~AC_PINCTL_VREFEN;
4061 pinval |= on ? AC_PINCTL_VREF_80 : AC_PINCTL_VREF_HIZ;
4062 /* temporarily power up/down for setting VREF */
4063 snd_hda_power_up_pm(codec);
4064 snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4065 snd_hda_power_down_pm(codec);
4066}
d240d1dc 4067
08fb0d0e 4068/* update mute-LED according to the speaker mute state via mic VREF pin */
8d3d1ece
TI
4069static int vref_mute_led_set(struct led_classdev *led_cdev,
4070 enum led_brightness brightness)
6d3cd5d4 4071{
8d3d1ece 4072 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
08fb0d0e 4073 struct alc_spec *spec = codec->spec;
08fb0d0e 4074
766538ac
TI
4075 alc_update_vref_led(codec, spec->mute_led_nid,
4076 spec->mute_led_polarity, brightness);
8d3d1ece 4077 return 0;
6d3cd5d4
DH
4078}
4079
d5b6b65e
DH
4080/* Make sure the led works even in runtime suspend */
4081static unsigned int led_power_filter(struct hda_codec *codec,
4082 hda_nid_t nid,
4083 unsigned int power_state)
4084{
4085 struct alc_spec *spec = codec->spec;
4086
50dd9050
HW
4087 if (power_state != AC_PWRST_D3 || nid == 0 ||
4088 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
d5b6b65e
DH
4089 return power_state;
4090
4091 /* Set pin ctl again, it might have just been set to 0 */
4092 snd_hda_set_pin_ctl(codec, nid,
4093 snd_hda_codec_get_pin_target(codec, nid));
4094
cffd3966 4095 return snd_hda_gen_path_power_filter(codec, nid, power_state);
d5b6b65e
DH
4096}
4097
08fb0d0e
TI
4098static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4099 const struct hda_fixup *fix, int action)
6d3cd5d4
DH
4100{
4101 struct alc_spec *spec = codec->spec;
08fb0d0e
TI
4102 const struct dmi_device *dev = NULL;
4103
4104 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4105 return;
4106
4107 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4108 int pol, pin;
4109 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4110 continue;
4111 if (pin < 0x0a || pin >= 0x10)
4112 break;
4113 spec->mute_led_polarity = pol;
4114 spec->mute_led_nid = pin - 0x0a + 0x18;
8d3d1ece 4115 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
d5b6b65e 4116 codec->power_filter = led_power_filter;
4e76a883
TI
4117 codec_dbg(codec,
4118 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
08fb0d0e 4119 spec->mute_led_polarity);
6d3cd5d4
DH
4120 break;
4121 }
4122}
4123
85c467dc
TI
4124static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4125 const struct hda_fixup *fix,
4126 int action, hda_nid_t pin)
d06ac143
DH
4127{
4128 struct alc_spec *spec = codec->spec;
85c467dc 4129
d06ac143
DH
4130 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4131 spec->mute_led_polarity = 0;
85c467dc 4132 spec->mute_led_nid = pin;
8d3d1ece 4133 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
d5b6b65e 4134 codec->power_filter = led_power_filter;
d06ac143
DH
4135 }
4136}
4137
85c467dc
TI
4138static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4139 const struct hda_fixup *fix, int action)
4140{
4141 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4142}
4143
08fb0d0e
TI
4144static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4145 const struct hda_fixup *fix, int action)
420b0feb 4146{
85c467dc 4147 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
420b0feb
TI
4148}
4149
7f783bd5
TB
4150static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4151 const struct hda_fixup *fix, int action)
4152{
85c467dc 4153 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
7f783bd5
TB
4154}
4155
0f32fd19
TI
4156/* update LED status via GPIO */
4157static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
dbd13179 4158 int polarity, bool enabled)
9f5c6faf 4159{
dbd13179 4160 if (polarity)
0f32fd19 4161 enabled = !enabled;
d261eec8 4162 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
9f5c6faf
TI
4163}
4164
0f32fd19 4165/* turn on/off mute LED via GPIO per vmaster hook */
8d3d1ece
TI
4166static int gpio_mute_led_set(struct led_classdev *led_cdev,
4167 enum led_brightness brightness)
9f5c6faf 4168{
8d3d1ece 4169 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
9f5c6faf 4170 struct alc_spec *spec = codec->spec;
9f5c6faf 4171
dbd13179 4172 alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
8d3d1ece
TI
4173 spec->mute_led_polarity, !brightness);
4174 return 0;
0f32fd19 4175}
9f5c6faf 4176
0f32fd19 4177/* turn on/off mic-mute LED via GPIO per capture hook */
87dc3648
KHF
4178static int micmute_led_set(struct led_classdev *led_cdev,
4179 enum led_brightness brightness)
4180{
4181 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4182 struct alc_spec *spec = codec->spec;
4183
4184 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
40469064 4185 spec->micmute_led_polarity, !brightness);
87dc3648
KHF
4186 return 0;
4187}
4188
01e4a275
TI
4189/* setup mute and mic-mute GPIO bits, add hooks appropriately */
4190static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4191 int action,
4192 unsigned int mute_mask,
4193 unsigned int micmute_mask)
9f5c6faf
TI
4194{
4195 struct alc_spec *spec = codec->spec;
9f5c6faf 4196
01e4a275
TI
4197 alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4198
4199 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4200 return;
4201 if (mute_mask) {
4202 spec->gpio_mute_led_mask = mute_mask;
8d3d1ece 4203 snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
01e4a275
TI
4204 }
4205 if (micmute_mask) {
4206 spec->gpio_mic_led_mask = micmute_mask;
7cdf8c49 4207 snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
9f5c6faf
TI
4208 }
4209}
4210
01e4a275 4211static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
eaa8e5ef
KY
4212 const struct hda_fixup *fix, int action)
4213{
01e4a275
TI
4214 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4215}
eaa8e5ef 4216
f5a88b0a
KHF
4217static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4218 const struct hda_fixup *fix, int action)
4219{
3e0650ab 4220 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
f5a88b0a
KHF
4221}
4222
01e4a275
TI
4223static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4224 const struct hda_fixup *fix, int action)
4225{
4226 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
9f5c6faf
TI
4227}
4228
8a503555
TI
4229/* turn on/off mic-mute LED per capture hook via VREF change */
4230static int vref_micmute_led_set(struct led_classdev *led_cdev,
4231 enum led_brightness brightness)
9c5dc3bf 4232{
8a503555 4233 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
9c5dc3bf 4234 struct alc_spec *spec = codec->spec;
9c5dc3bf 4235
766538ac
TI
4236 alc_update_vref_led(codec, spec->cap_mute_led_nid,
4237 spec->micmute_led_polarity, brightness);
8a503555 4238 return 0;
9c5dc3bf
KY
4239}
4240
4241static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4242 const struct hda_fixup *fix, int action)
4243{
4244 struct alc_spec *spec = codec->spec;
9c5dc3bf 4245
01e4a275 4246 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
9c5dc3bf 4247 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
01e4a275
TI
4248 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4249 * enable headphone amp
4250 */
4251 spec->gpio_mask |= 0x10;
4252 spec->gpio_dir |= 0x10;
9c5dc3bf 4253 spec->cap_mute_led_nid = 0x18;
8a503555 4254 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
50dd9050 4255 codec->power_filter = led_power_filter;
9c5dc3bf
KY
4256 }
4257}
4258
7a5255f1
DH
4259static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4260 const struct hda_fixup *fix, int action)
4261{
7a5255f1 4262 struct alc_spec *spec = codec->spec;
7a5255f1 4263
01e4a275 4264 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
7a5255f1 4265 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
7a5255f1 4266 spec->cap_mute_led_nid = 0x18;
8a503555 4267 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
7a5255f1
DH
4268 codec->power_filter = led_power_filter;
4269 }
4270}
4271
766538ac
TI
4272static void alc_update_coef_led(struct hda_codec *codec,
4273 struct alc_coef_led *led,
4274 bool polarity, bool on)
4275{
4276 if (polarity)
4277 on = !on;
4278 /* temporarily power up/down for setting COEF bit */
4279 alc_update_coef_idx(codec, led->idx, led->mask,
4280 on ? led->on : led->off);
4281}
4282
431e76c3 4283/* update mute-LED according to the speaker mute state via COEF bit */
8d3d1ece
TI
4284static int coef_mute_led_set(struct led_classdev *led_cdev,
4285 enum led_brightness brightness)
431e76c3 4286{
8d3d1ece 4287 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
431e76c3
KY
4288 struct alc_spec *spec = codec->spec;
4289
766538ac
TI
4290 alc_update_coef_led(codec, &spec->mute_led_coef,
4291 spec->mute_led_polarity, brightness);
8d3d1ece 4292 return 0;
431e76c3
KY
4293}
4294
4295static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4296 const struct hda_fixup *fix,
4297 int action)
4298{
4299 struct alc_spec *spec = codec->spec;
4300
4301 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4302 spec->mute_led_polarity = 0;
766538ac
TI
4303 spec->mute_led_coef.idx = 0x0b;
4304 spec->mute_led_coef.mask = 1 << 3;
4305 spec->mute_led_coef.on = 1 << 3;
4306 spec->mute_led_coef.off = 0;
8d3d1ece 4307 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
431e76c3
KY
4308 }
4309}
4310
24164f43
KY
4311static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4312 const struct hda_fixup *fix,
4313 int action)
4314{
4315 struct alc_spec *spec = codec->spec;
4316
4317 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4318 spec->mute_led_polarity = 0;
766538ac
TI
4319 spec->mute_led_coef.idx = 0x34;
4320 spec->mute_led_coef.mask = 1 << 5;
4321 spec->mute_led_coef.on = 0;
4322 spec->mute_led_coef.off = 1 << 5;
8d3d1ece 4323 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
24164f43
KY
4324 }
4325}
4326
431e76c3 4327/* turn on/off mic-mute LED per capture hook by coef bit */
8a503555
TI
4328static int coef_micmute_led_set(struct led_classdev *led_cdev,
4329 enum led_brightness brightness)
431e76c3 4330{
8a503555 4331 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
431e76c3
KY
4332 struct alc_spec *spec = codec->spec;
4333
766538ac
TI
4334 alc_update_coef_led(codec, &spec->mic_led_coef,
4335 spec->micmute_led_polarity, brightness);
8a503555 4336 return 0;
431e76c3
KY
4337}
4338
4339static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4340 const struct hda_fixup *fix, int action)
4341{
4342 struct alc_spec *spec = codec->spec;
4343
4344 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
766538ac
TI
4345 spec->mic_led_coef.idx = 0x19;
4346 spec->mic_led_coef.mask = 1 << 13;
4347 spec->mic_led_coef.on = 1 << 13;
4348 spec->mic_led_coef.off = 0;
8a503555 4349 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
431e76c3
KY
4350 }
4351}
4352
24164f43
KY
4353static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4354 const struct hda_fixup *fix, int action)
4355{
4356 struct alc_spec *spec = codec->spec;
4357
4358 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
766538ac
TI
4359 spec->mic_led_coef.idx = 0x35;
4360 spec->mic_led_coef.mask = 3 << 2;
4361 spec->mic_led_coef.on = 2 << 2;
4362 spec->mic_led_coef.off = 1 << 2;
8a503555 4363 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
24164f43
KY
4364 }
4365}
4366
431e76c3
KY
4367static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4368 const struct hda_fixup *fix, int action)
4369{
4370 alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4371 alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4372}
4373
24164f43
KY
4374static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4375 const struct hda_fixup *fix, int action)
4376{
4377 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4378 alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4379}
4380
6a30abaa 4381#if IS_REACHABLE(CONFIG_INPUT)
33f4acd3
DH
4382static void gpio2_mic_hotkey_event(struct hda_codec *codec,
4383 struct hda_jack_callback *event)
4384{
4385 struct alc_spec *spec = codec->spec;
4386
4387 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
4388 send both key on and key off event for every interrupt. */
c7b60a89 4389 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
33f4acd3 4390 input_sync(spec->kb_dev);
c7b60a89 4391 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
33f4acd3
DH
4392 input_sync(spec->kb_dev);
4393}
33f4acd3 4394
3694cb29
K
4395static int alc_register_micmute_input_device(struct hda_codec *codec)
4396{
4397 struct alc_spec *spec = codec->spec;
c7b60a89 4398 int i;
3694cb29
K
4399
4400 spec->kb_dev = input_allocate_device();
4401 if (!spec->kb_dev) {
4402 codec_err(codec, "Out of memory (input_allocate_device)\n");
4403 return -ENOMEM;
4404 }
c7b60a89
HW
4405
4406 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
4407
3694cb29
K
4408 spec->kb_dev->name = "Microphone Mute Button";
4409 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
c7b60a89
HW
4410 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
4411 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
4412 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
4413 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
4414 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
3694cb29
K
4415
4416 if (input_register_device(spec->kb_dev)) {
4417 codec_err(codec, "input_register_device failed\n");
4418 input_free_device(spec->kb_dev);
4419 spec->kb_dev = NULL;
4420 return -ENOMEM;
4421 }
4422
4423 return 0;
4424}
4425
01e4a275
TI
4426/* GPIO1 = set according to SKU external amp
4427 * GPIO2 = mic mute hotkey
4428 * GPIO3 = mute LED
4429 * GPIO4 = mic mute LED
4430 */
33f4acd3
DH
4431static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4432 const struct hda_fixup *fix, int action)
4433{
33f4acd3
DH
4434 struct alc_spec *spec = codec->spec;
4435
01e4a275 4436 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
33f4acd3 4437 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1c76aa5f 4438 spec->init_amp = ALC_INIT_DEFAULT;
3694cb29 4439 if (alc_register_micmute_input_device(codec) != 0)
33f4acd3 4440 return;
33f4acd3 4441
01e4a275
TI
4442 spec->gpio_mask |= 0x06;
4443 spec->gpio_dir |= 0x02;
4444 spec->gpio_data |= 0x02;
7639a06c 4445 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
33f4acd3 4446 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
7639a06c 4447 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
33f4acd3 4448 gpio2_mic_hotkey_event);
33f4acd3
DH
4449 return;
4450 }
4451
4452 if (!spec->kb_dev)
4453 return;
4454
4455 switch (action) {
33f4acd3
DH
4456 case HDA_FIXUP_ACT_FREE:
4457 input_unregister_device(spec->kb_dev);
33f4acd3
DH
4458 spec->kb_dev = NULL;
4459 }
33f4acd3
DH
4460}
4461
01e4a275
TI
4462/* Line2 = mic mute hotkey
4463 * GPIO2 = mic mute LED
4464 */
3694cb29
K
4465static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4466 const struct hda_fixup *fix, int action)
4467{
3694cb29
K
4468 struct alc_spec *spec = codec->spec;
4469
01e4a275 4470 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
3694cb29 4471 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1c76aa5f 4472 spec->init_amp = ALC_INIT_DEFAULT;
3694cb29
K
4473 if (alc_register_micmute_input_device(codec) != 0)
4474 return;
4475
3694cb29
K
4476 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4477 gpio2_mic_hotkey_event);
3694cb29
K
4478 return;
4479 }
4480
4481 if (!spec->kb_dev)
4482 return;
4483
4484 switch (action) {
3694cb29
K
4485 case HDA_FIXUP_ACT_FREE:
4486 input_unregister_device(spec->kb_dev);
4487 spec->kb_dev = NULL;
4488 }
4489}
c469652b
TI
4490#else /* INPUT */
4491#define alc280_fixup_hp_gpio2_mic_hotkey NULL
4492#define alc233_fixup_lenovo_line2_mic_hotkey NULL
4493#endif /* INPUT */
3694cb29 4494
9c5dc3bf
KY
4495static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4496 const struct hda_fixup *fix, int action)
4497{
4498 struct alc_spec *spec = codec->spec;
4499
1bce62a6 4500 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
9c5dc3bf 4501 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
9c5dc3bf 4502 spec->cap_mute_led_nid = 0x18;
8a503555 4503 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
9c5dc3bf
KY
4504 }
4505}
4506
6b0f95c4 4507static const struct coef_fw alc225_pre_hsmode[] = {
5a36767a
KY
4508 UPDATE_COEF(0x4a, 1<<8, 0),
4509 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4510 UPDATE_COEF(0x63, 3<<14, 3<<14),
4511 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4512 UPDATE_COEF(0x4a, 3<<10, 3<<10),
4513 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4514 UPDATE_COEF(0x4a, 3<<10, 0),
4515 {}
4516};
4517
73bdd597
DH
4518static void alc_headset_mode_unplugged(struct hda_codec *codec)
4519{
6b0f95c4 4520 static const struct coef_fw coef0255[] = {
717f43d8 4521 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
54db6c39
TI
4522 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4523 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4524 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4525 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4526 {}
4527 };
6b0f95c4 4528 static const struct coef_fw coef0256[] = {
e69e7e03 4529 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
717f43d8
KY
4530 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4531 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4532 WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
4533 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
e69e7e03
KY
4534 {}
4535 };
6b0f95c4 4536 static const struct coef_fw coef0233[] = {
54db6c39
TI
4537 WRITE_COEF(0x1b, 0x0c0b),
4538 WRITE_COEF(0x45, 0xc429),
4539 UPDATE_COEF(0x35, 0x4000, 0),
4540 WRITE_COEF(0x06, 0x2104),
4541 WRITE_COEF(0x1a, 0x0001),
4542 WRITE_COEF(0x26, 0x0004),
4543 WRITE_COEF(0x32, 0x42a3),
4544 {}
4545 };
6b0f95c4 4546 static const struct coef_fw coef0288[] = {
f3b70332
KY
4547 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4548 UPDATE_COEF(0x50, 0x2000, 0x2000),
4549 UPDATE_COEF(0x56, 0x0006, 0x0006),
4550 UPDATE_COEF(0x66, 0x0008, 0),
4551 UPDATE_COEF(0x67, 0x2000, 0),
4552 {}
4553 };
6b0f95c4 4554 static const struct coef_fw coef0298[] = {
89542936
KY
4555 UPDATE_COEF(0x19, 0x1300, 0x0300),
4556 {}
4557 };
6b0f95c4 4558 static const struct coef_fw coef0292[] = {
54db6c39
TI
4559 WRITE_COEF(0x76, 0x000e),
4560 WRITE_COEF(0x6c, 0x2400),
4561 WRITE_COEF(0x18, 0x7308),
4562 WRITE_COEF(0x6b, 0xc429),
4563 {}
4564 };
6b0f95c4 4565 static const struct coef_fw coef0293[] = {
54db6c39
TI
4566 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
4567 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
4568 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
4569 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
4570 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
4571 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4572 {}
4573 };
6b0f95c4 4574 static const struct coef_fw coef0668[] = {
54db6c39
TI
4575 WRITE_COEF(0x15, 0x0d40),
4576 WRITE_COEF(0xb7, 0x802b),
4577 {}
4578 };
6b0f95c4 4579 static const struct coef_fw coef0225[] = {
5a36767a 4580 UPDATE_COEF(0x63, 3<<14, 0),
4cc9b9d6
KY
4581 {}
4582 };
6b0f95c4 4583 static const struct coef_fw coef0274[] = {
71683c32
KY
4584 UPDATE_COEF(0x4a, 0x0100, 0),
4585 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
4586 UPDATE_COEF(0x6b, 0xf000, 0x5000),
4587 UPDATE_COEF(0x4a, 0x0010, 0),
4588 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
4589 WRITE_COEF(0x45, 0x5289),
4590 UPDATE_COEF(0x4a, 0x0c00, 0),
4591 {}
4592 };
54db6c39 4593
7639a06c 4594 switch (codec->core.vendor_id) {
9a22a8f5 4595 case 0x10ec0255:
e69e7e03
KY
4596 alc_process_coef_fw(codec, coef0255);
4597 break;
736f20a7 4598 case 0x10ec0236:
7081adf3 4599 case 0x10ec0256:
e69e7e03 4600 alc_process_coef_fw(codec, coef0256);
9a22a8f5 4601 break;
71683c32
KY
4602 case 0x10ec0234:
4603 case 0x10ec0274:
4604 case 0x10ec0294:
4605 alc_process_coef_fw(codec, coef0274);
4606 break;
13fd08a3 4607 case 0x10ec0233:
73bdd597 4608 case 0x10ec0283:
54db6c39 4609 alc_process_coef_fw(codec, coef0233);
73bdd597 4610 break;
f3b70332
KY
4611 case 0x10ec0286:
4612 case 0x10ec0288:
89542936
KY
4613 alc_process_coef_fw(codec, coef0288);
4614 break;
1a5bc8d9 4615 case 0x10ec0298:
89542936 4616 alc_process_coef_fw(codec, coef0298);
f3b70332
KY
4617 alc_process_coef_fw(codec, coef0288);
4618 break;
73bdd597 4619 case 0x10ec0292:
54db6c39 4620 alc_process_coef_fw(codec, coef0292);
73bdd597 4621 break;
a22aa26f 4622 case 0x10ec0293:
54db6c39 4623 alc_process_coef_fw(codec, coef0293);
a22aa26f 4624 break;
73bdd597 4625 case 0x10ec0668:
54db6c39 4626 alc_process_coef_fw(codec, coef0668);
73bdd597 4627 break;
c2b691ee 4628 case 0x10ec0215:
4cc9b9d6 4629 case 0x10ec0225:
c2b691ee 4630 case 0x10ec0285:
7d727869 4631 case 0x10ec0295:
c2b691ee 4632 case 0x10ec0289:
28f1f9b2 4633 case 0x10ec0299:
4d4b0c52 4634 alc_process_coef_fw(codec, alc225_pre_hsmode);
4cc9b9d6
KY
4635 alc_process_coef_fw(codec, coef0225);
4636 break;
78f4f7c2
KY
4637 case 0x10ec0867:
4638 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4639 break;
73bdd597 4640 }
4e76a883 4641 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
73bdd597
DH
4642}
4643
4644
4645static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
4646 hda_nid_t mic_pin)
4647{
6b0f95c4 4648 static const struct coef_fw coef0255[] = {
54db6c39
TI
4649 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
4650 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4651 {}
4652 };
6b0f95c4 4653 static const struct coef_fw coef0256[] = {
717f43d8
KY
4654 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
4655 WRITE_COEFEX(0x57, 0x03, 0x09a3),
4656 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4657 {}
4658 };
6b0f95c4 4659 static const struct coef_fw coef0233[] = {
54db6c39
TI
4660 UPDATE_COEF(0x35, 0, 1<<14),
4661 WRITE_COEF(0x06, 0x2100),
4662 WRITE_COEF(0x1a, 0x0021),
4663 WRITE_COEF(0x26, 0x008c),
4664 {}
4665 };
6b0f95c4 4666 static const struct coef_fw coef0288[] = {
89542936 4667 UPDATE_COEF(0x4f, 0x00c0, 0),
f3b70332
KY
4668 UPDATE_COEF(0x50, 0x2000, 0),
4669 UPDATE_COEF(0x56, 0x0006, 0),
4670 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4671 UPDATE_COEF(0x66, 0x0008, 0x0008),
4672 UPDATE_COEF(0x67, 0x2000, 0x2000),
4673 {}
4674 };
6b0f95c4 4675 static const struct coef_fw coef0292[] = {
54db6c39
TI
4676 WRITE_COEF(0x19, 0xa208),
4677 WRITE_COEF(0x2e, 0xacf0),
4678 {}
4679 };
6b0f95c4 4680 static const struct coef_fw coef0293[] = {
54db6c39
TI
4681 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
4682 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
4683 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4684 {}
4685 };
6b0f95c4 4686 static const struct coef_fw coef0688[] = {
54db6c39
TI
4687 WRITE_COEF(0xb7, 0x802b),
4688 WRITE_COEF(0xb5, 0x1040),
4689 UPDATE_COEF(0xc3, 0, 1<<12),
4690 {}
4691 };
6b0f95c4 4692 static const struct coef_fw coef0225[] = {
4cc9b9d6
KY
4693 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
4694 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4695 UPDATE_COEF(0x63, 3<<14, 0),
4696 {}
4697 };
6b0f95c4 4698 static const struct coef_fw coef0274[] = {
71683c32
KY
4699 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
4700 UPDATE_COEF(0x4a, 0x0010, 0),
4701 UPDATE_COEF(0x6b, 0xf000, 0),
4702 {}
4703 };
54db6c39 4704
7639a06c 4705 switch (codec->core.vendor_id) {
9a22a8f5
KY
4706 case 0x10ec0255:
4707 alc_write_coef_idx(codec, 0x45, 0xc489);
4708 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 4709 alc_process_coef_fw(codec, coef0255);
9a22a8f5
KY
4710 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4711 break;
717f43d8
KY
4712 case 0x10ec0236:
4713 case 0x10ec0256:
4714 alc_write_coef_idx(codec, 0x45, 0xc489);
4715 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4716 alc_process_coef_fw(codec, coef0256);
4717 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4718 break;
71683c32
KY
4719 case 0x10ec0234:
4720 case 0x10ec0274:
4721 case 0x10ec0294:
4722 alc_write_coef_idx(codec, 0x45, 0x4689);
4723 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4724 alc_process_coef_fw(codec, coef0274);
4725 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4726 break;
13fd08a3 4727 case 0x10ec0233:
73bdd597
DH
4728 case 0x10ec0283:
4729 alc_write_coef_idx(codec, 0x45, 0xc429);
4730 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 4731 alc_process_coef_fw(codec, coef0233);
73bdd597
DH
4732 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4733 break;
f3b70332
KY
4734 case 0x10ec0286:
4735 case 0x10ec0288:
1a5bc8d9 4736 case 0x10ec0298:
f3b70332
KY
4737 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4738 alc_process_coef_fw(codec, coef0288);
4739 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4740 break;
73bdd597
DH
4741 case 0x10ec0292:
4742 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 4743 alc_process_coef_fw(codec, coef0292);
73bdd597 4744 break;
a22aa26f
KY
4745 case 0x10ec0293:
4746 /* Set to TRS mode */
4747 alc_write_coef_idx(codec, 0x45, 0xc429);
4748 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 4749 alc_process_coef_fw(codec, coef0293);
a22aa26f
KY
4750 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4751 break;
78f4f7c2
KY
4752 case 0x10ec0867:
4753 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
c0dbbdad 4754 fallthrough;
9eb5d0e6 4755 case 0x10ec0221:
1f8b46cd
DH
4756 case 0x10ec0662:
4757 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4758 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4759 break;
73bdd597
DH
4760 case 0x10ec0668:
4761 alc_write_coef_idx(codec, 0x11, 0x0001);
4762 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 4763 alc_process_coef_fw(codec, coef0688);
73bdd597
DH
4764 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4765 break;
c2b691ee 4766 case 0x10ec0215:
4cc9b9d6 4767 case 0x10ec0225:
c2b691ee 4768 case 0x10ec0285:
7d727869 4769 case 0x10ec0295:
c2b691ee 4770 case 0x10ec0289:
28f1f9b2 4771 case 0x10ec0299:
5a36767a 4772 alc_process_coef_fw(codec, alc225_pre_hsmode);
4cc9b9d6
KY
4773 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
4774 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4775 alc_process_coef_fw(codec, coef0225);
4776 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4777 break;
73bdd597 4778 }
4e76a883 4779 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
73bdd597
DH
4780}
4781
4782static void alc_headset_mode_default(struct hda_codec *codec)
4783{
6b0f95c4 4784 static const struct coef_fw coef0225[] = {
5a36767a
KY
4785 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
4786 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
4787 UPDATE_COEF(0x49, 3<<8, 0<<8),
4788 UPDATE_COEF(0x4a, 3<<4, 3<<4),
4789 UPDATE_COEF(0x63, 3<<14, 0),
4790 UPDATE_COEF(0x67, 0xf000, 0x3000),
2ae95577
DH
4791 {}
4792 };
6b0f95c4 4793 static const struct coef_fw coef0255[] = {
54db6c39
TI
4794 WRITE_COEF(0x45, 0xc089),
4795 WRITE_COEF(0x45, 0xc489),
4796 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4797 WRITE_COEF(0x49, 0x0049),
4798 {}
4799 };
6b0f95c4 4800 static const struct coef_fw coef0256[] = {
717f43d8
KY
4801 WRITE_COEF(0x45, 0xc489),
4802 WRITE_COEFEX(0x57, 0x03, 0x0da3),
4803 WRITE_COEF(0x49, 0x0049),
4804 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4805 WRITE_COEF(0x06, 0x6100),
4806 {}
4807 };
6b0f95c4 4808 static const struct coef_fw coef0233[] = {
54db6c39
TI
4809 WRITE_COEF(0x06, 0x2100),
4810 WRITE_COEF(0x32, 0x4ea3),
4811 {}
4812 };
6b0f95c4 4813 static const struct coef_fw coef0288[] = {
f3b70332
KY
4814 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
4815 UPDATE_COEF(0x50, 0x2000, 0x2000),
4816 UPDATE_COEF(0x56, 0x0006, 0x0006),
4817 UPDATE_COEF(0x66, 0x0008, 0),
4818 UPDATE_COEF(0x67, 0x2000, 0),
4819 {}
4820 };
6b0f95c4 4821 static const struct coef_fw coef0292[] = {
54db6c39
TI
4822 WRITE_COEF(0x76, 0x000e),
4823 WRITE_COEF(0x6c, 0x2400),
4824 WRITE_COEF(0x6b, 0xc429),
4825 WRITE_COEF(0x18, 0x7308),
4826 {}
4827 };
6b0f95c4 4828 static const struct coef_fw coef0293[] = {
54db6c39
TI
4829 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4830 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
4831 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4832 {}
4833 };
6b0f95c4 4834 static const struct coef_fw coef0688[] = {
54db6c39
TI
4835 WRITE_COEF(0x11, 0x0041),
4836 WRITE_COEF(0x15, 0x0d40),
4837 WRITE_COEF(0xb7, 0x802b),
4838 {}
4839 };
6b0f95c4 4840 static const struct coef_fw coef0274[] = {
71683c32
KY
4841 WRITE_COEF(0x45, 0x4289),
4842 UPDATE_COEF(0x4a, 0x0010, 0x0010),
4843 UPDATE_COEF(0x6b, 0x0f00, 0),
4844 UPDATE_COEF(0x49, 0x0300, 0x0300),
4845 {}
4846 };
54db6c39 4847
7639a06c 4848 switch (codec->core.vendor_id) {
c2b691ee 4849 case 0x10ec0215:
2ae95577 4850 case 0x10ec0225:
c2b691ee 4851 case 0x10ec0285:
7d727869 4852 case 0x10ec0295:
c2b691ee 4853 case 0x10ec0289:
28f1f9b2 4854 case 0x10ec0299:
5a36767a 4855 alc_process_coef_fw(codec, alc225_pre_hsmode);
2ae95577
DH
4856 alc_process_coef_fw(codec, coef0225);
4857 break;
9a22a8f5 4858 case 0x10ec0255:
54db6c39 4859 alc_process_coef_fw(codec, coef0255);
9a22a8f5 4860 break;
717f43d8
KY
4861 case 0x10ec0236:
4862 case 0x10ec0256:
4863 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
4864 alc_write_coef_idx(codec, 0x45, 0xc089);
4865 msleep(50);
4866 alc_process_coef_fw(codec, coef0256);
4867 break;
71683c32
KY
4868 case 0x10ec0234:
4869 case 0x10ec0274:
4870 case 0x10ec0294:
4871 alc_process_coef_fw(codec, coef0274);
4872 break;
13fd08a3 4873 case 0x10ec0233:
73bdd597 4874 case 0x10ec0283:
54db6c39 4875 alc_process_coef_fw(codec, coef0233);
73bdd597 4876 break;
f3b70332
KY
4877 case 0x10ec0286:
4878 case 0x10ec0288:
1a5bc8d9 4879 case 0x10ec0298:
f3b70332
KY
4880 alc_process_coef_fw(codec, coef0288);
4881 break;
73bdd597 4882 case 0x10ec0292:
54db6c39 4883 alc_process_coef_fw(codec, coef0292);
73bdd597 4884 break;
a22aa26f 4885 case 0x10ec0293:
54db6c39 4886 alc_process_coef_fw(codec, coef0293);
a22aa26f 4887 break;
73bdd597 4888 case 0x10ec0668:
54db6c39 4889 alc_process_coef_fw(codec, coef0688);
73bdd597 4890 break;
78f4f7c2
KY
4891 case 0x10ec0867:
4892 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4893 break;
73bdd597 4894 }
4e76a883 4895 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
73bdd597
DH
4896}
4897
4898/* Iphone type */
4899static void alc_headset_mode_ctia(struct hda_codec *codec)
4900{
89542936
KY
4901 int val;
4902
6b0f95c4 4903 static const struct coef_fw coef0255[] = {
54db6c39
TI
4904 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
4905 WRITE_COEF(0x1b, 0x0c2b),
4906 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4907 {}
4908 };
6b0f95c4 4909 static const struct coef_fw coef0256[] = {
e69e7e03 4910 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
717f43d8 4911 WRITE_COEF(0x1b, 0x0e6b),
e69e7e03
KY
4912 {}
4913 };
6b0f95c4 4914 static const struct coef_fw coef0233[] = {
54db6c39
TI
4915 WRITE_COEF(0x45, 0xd429),
4916 WRITE_COEF(0x1b, 0x0c2b),
4917 WRITE_COEF(0x32, 0x4ea3),
4918 {}
4919 };
6b0f95c4 4920 static const struct coef_fw coef0288[] = {
f3b70332
KY
4921 UPDATE_COEF(0x50, 0x2000, 0x2000),
4922 UPDATE_COEF(0x56, 0x0006, 0x0006),
4923 UPDATE_COEF(0x66, 0x0008, 0),
4924 UPDATE_COEF(0x67, 0x2000, 0),
4925 {}
4926 };
6b0f95c4 4927 static const struct coef_fw coef0292[] = {
54db6c39
TI
4928 WRITE_COEF(0x6b, 0xd429),
4929 WRITE_COEF(0x76, 0x0008),
4930 WRITE_COEF(0x18, 0x7388),
4931 {}
4932 };
6b0f95c4 4933 static const struct coef_fw coef0293[] = {
54db6c39
TI
4934 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
4935 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
4936 {}
4937 };
6b0f95c4 4938 static const struct coef_fw coef0688[] = {
54db6c39
TI
4939 WRITE_COEF(0x11, 0x0001),
4940 WRITE_COEF(0x15, 0x0d60),
4941 WRITE_COEF(0xc3, 0x0000),
4942 {}
4943 };
6b0f95c4 4944 static const struct coef_fw coef0225_1[] = {
4cc9b9d6 4945 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5a36767a
KY
4946 UPDATE_COEF(0x63, 3<<14, 2<<14),
4947 {}
4948 };
6b0f95c4 4949 static const struct coef_fw coef0225_2[] = {
5a36767a
KY
4950 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
4951 UPDATE_COEF(0x63, 3<<14, 1<<14),
4cc9b9d6
KY
4952 {}
4953 };
54db6c39 4954
7639a06c 4955 switch (codec->core.vendor_id) {
9a22a8f5 4956 case 0x10ec0255:
54db6c39 4957 alc_process_coef_fw(codec, coef0255);
9a22a8f5 4958 break;
736f20a7 4959 case 0x10ec0236:
e69e7e03
KY
4960 case 0x10ec0256:
4961 alc_process_coef_fw(codec, coef0256);
4962 break;
71683c32
KY
4963 case 0x10ec0234:
4964 case 0x10ec0274:
4965 case 0x10ec0294:
4966 alc_write_coef_idx(codec, 0x45, 0xd689);
4967 break;
13fd08a3 4968 case 0x10ec0233:
73bdd597 4969 case 0x10ec0283:
54db6c39 4970 alc_process_coef_fw(codec, coef0233);
73bdd597 4971 break;
1a5bc8d9 4972 case 0x10ec0298:
89542936
KY
4973 val = alc_read_coef_idx(codec, 0x50);
4974 if (val & (1 << 12)) {
4975 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
4976 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4977 msleep(300);
4978 } else {
4979 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
4980 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4981 msleep(300);
4982 }
4983 break;
f3b70332
KY
4984 case 0x10ec0286:
4985 case 0x10ec0288:
4986 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4987 msleep(300);
4988 alc_process_coef_fw(codec, coef0288);
4989 break;
73bdd597 4990 case 0x10ec0292:
54db6c39 4991 alc_process_coef_fw(codec, coef0292);
73bdd597 4992 break;
a22aa26f 4993 case 0x10ec0293:
54db6c39 4994 alc_process_coef_fw(codec, coef0293);
a22aa26f 4995 break;
73bdd597 4996 case 0x10ec0668:
54db6c39 4997 alc_process_coef_fw(codec, coef0688);
73bdd597 4998 break;
c2b691ee 4999 case 0x10ec0215:
4cc9b9d6 5000 case 0x10ec0225:
c2b691ee 5001 case 0x10ec0285:
7d727869 5002 case 0x10ec0295:
c2b691ee 5003 case 0x10ec0289:
28f1f9b2 5004 case 0x10ec0299:
5a36767a
KY
5005 val = alc_read_coef_idx(codec, 0x45);
5006 if (val & (1 << 9))
5007 alc_process_coef_fw(codec, coef0225_2);
5008 else
5009 alc_process_coef_fw(codec, coef0225_1);
4cc9b9d6 5010 break;
78f4f7c2
KY
5011 case 0x10ec0867:
5012 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5013 break;
73bdd597 5014 }
4e76a883 5015 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
73bdd597
DH
5016}
5017
5018/* Nokia type */
5019static void alc_headset_mode_omtp(struct hda_codec *codec)
5020{
6b0f95c4 5021 static const struct coef_fw coef0255[] = {
54db6c39
TI
5022 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5023 WRITE_COEF(0x1b, 0x0c2b),
5024 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5025 {}
5026 };
6b0f95c4 5027 static const struct coef_fw coef0256[] = {
e69e7e03 5028 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
717f43d8 5029 WRITE_COEF(0x1b, 0x0e6b),
e69e7e03
KY
5030 {}
5031 };
6b0f95c4 5032 static const struct coef_fw coef0233[] = {
54db6c39
TI
5033 WRITE_COEF(0x45, 0xe429),
5034 WRITE_COEF(0x1b, 0x0c2b),
5035 WRITE_COEF(0x32, 0x4ea3),
5036 {}
5037 };
6b0f95c4 5038 static const struct coef_fw coef0288[] = {
f3b70332
KY
5039 UPDATE_COEF(0x50, 0x2000, 0x2000),
5040 UPDATE_COEF(0x56, 0x0006, 0x0006),
5041 UPDATE_COEF(0x66, 0x0008, 0),
5042 UPDATE_COEF(0x67, 0x2000, 0),
5043 {}
5044 };
6b0f95c4 5045 static const struct coef_fw coef0292[] = {
54db6c39
TI
5046 WRITE_COEF(0x6b, 0xe429),
5047 WRITE_COEF(0x76, 0x0008),
5048 WRITE_COEF(0x18, 0x7388),
5049 {}
5050 };
6b0f95c4 5051 static const struct coef_fw coef0293[] = {
54db6c39
TI
5052 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5053 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5054 {}
5055 };
6b0f95c4 5056 static const struct coef_fw coef0688[] = {
54db6c39
TI
5057 WRITE_COEF(0x11, 0x0001),
5058 WRITE_COEF(0x15, 0x0d50),
5059 WRITE_COEF(0xc3, 0x0000),
5060 {}
5061 };
6b0f95c4 5062 static const struct coef_fw coef0225[] = {
4cc9b9d6 5063 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
5a36767a 5064 UPDATE_COEF(0x63, 3<<14, 2<<14),
4cc9b9d6
KY
5065 {}
5066 };
54db6c39 5067
7639a06c 5068 switch (codec->core.vendor_id) {
9a22a8f5 5069 case 0x10ec0255:
54db6c39 5070 alc_process_coef_fw(codec, coef0255);
9a22a8f5 5071 break;
736f20a7 5072 case 0x10ec0236:
e69e7e03
KY
5073 case 0x10ec0256:
5074 alc_process_coef_fw(codec, coef0256);
5075 break;
71683c32
KY
5076 case 0x10ec0234:
5077 case 0x10ec0274:
5078 case 0x10ec0294:
5079 alc_write_coef_idx(codec, 0x45, 0xe689);
5080 break;
13fd08a3 5081 case 0x10ec0233:
73bdd597 5082 case 0x10ec0283:
54db6c39 5083 alc_process_coef_fw(codec, coef0233);
73bdd597 5084 break;
1a5bc8d9
KY
5085 case 0x10ec0298:
5086 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
89542936
KY
5087 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5088 msleep(300);
5089 break;
f3b70332
KY
5090 case 0x10ec0286:
5091 case 0x10ec0288:
5092 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5093 msleep(300);
5094 alc_process_coef_fw(codec, coef0288);
5095 break;
73bdd597 5096 case 0x10ec0292:
54db6c39 5097 alc_process_coef_fw(codec, coef0292);
73bdd597 5098 break;
a22aa26f 5099 case 0x10ec0293:
54db6c39 5100 alc_process_coef_fw(codec, coef0293);
a22aa26f 5101 break;
73bdd597 5102 case 0x10ec0668:
54db6c39 5103 alc_process_coef_fw(codec, coef0688);
73bdd597 5104 break;
c2b691ee 5105 case 0x10ec0215:
4cc9b9d6 5106 case 0x10ec0225:
c2b691ee 5107 case 0x10ec0285:
7d727869 5108 case 0x10ec0295:
c2b691ee 5109 case 0x10ec0289:
28f1f9b2 5110 case 0x10ec0299:
4cc9b9d6
KY
5111 alc_process_coef_fw(codec, coef0225);
5112 break;
73bdd597 5113 }
4e76a883 5114 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
73bdd597
DH
5115}
5116
5117static void alc_determine_headset_type(struct hda_codec *codec)
5118{
5119 int val;
5120 bool is_ctia = false;
5121 struct alc_spec *spec = codec->spec;
6b0f95c4 5122 static const struct coef_fw coef0255[] = {
54db6c39
TI
5123 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5124 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5125 conteol) */
5126 {}
5127 };
6b0f95c4 5128 static const struct coef_fw coef0288[] = {
f3b70332
KY
5129 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5130 {}
5131 };
6b0f95c4 5132 static const struct coef_fw coef0298[] = {
89542936
KY
5133 UPDATE_COEF(0x50, 0x2000, 0x2000),
5134 UPDATE_COEF(0x56, 0x0006, 0x0006),
5135 UPDATE_COEF(0x66, 0x0008, 0),
5136 UPDATE_COEF(0x67, 0x2000, 0),
5137 UPDATE_COEF(0x19, 0x1300, 0x1300),
5138 {}
5139 };
6b0f95c4 5140 static const struct coef_fw coef0293[] = {
54db6c39
TI
5141 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5142 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5143 {}
5144 };
6b0f95c4 5145 static const struct coef_fw coef0688[] = {
54db6c39
TI
5146 WRITE_COEF(0x11, 0x0001),
5147 WRITE_COEF(0xb7, 0x802b),
5148 WRITE_COEF(0x15, 0x0d60),
5149 WRITE_COEF(0xc3, 0x0c00),
5150 {}
5151 };
6b0f95c4 5152 static const struct coef_fw coef0274[] = {
71683c32
KY
5153 UPDATE_COEF(0x4a, 0x0010, 0),
5154 UPDATE_COEF(0x4a, 0x8000, 0),
5155 WRITE_COEF(0x45, 0xd289),
5156 UPDATE_COEF(0x49, 0x0300, 0x0300),
5157 {}
5158 };
73bdd597 5159
7639a06c 5160 switch (codec->core.vendor_id) {
9a22a8f5 5161 case 0x10ec0255:
717f43d8
KY
5162 alc_process_coef_fw(codec, coef0255);
5163 msleep(300);
5164 val = alc_read_coef_idx(codec, 0x46);
5165 is_ctia = (val & 0x0070) == 0x0070;
5166 break;
5167 case 0x10ec0236:
7081adf3 5168 case 0x10ec0256:
717f43d8
KY
5169 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5170 alc_write_coef_idx(codec, 0x06, 0x6104);
5171 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5172
5173 snd_hda_codec_write(codec, 0x21, 0,
5174 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5175 msleep(80);
5176 snd_hda_codec_write(codec, 0x21, 0,
5177 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5178
54db6c39 5179 alc_process_coef_fw(codec, coef0255);
9a22a8f5
KY
5180 msleep(300);
5181 val = alc_read_coef_idx(codec, 0x46);
5182 is_ctia = (val & 0x0070) == 0x0070;
717f43d8
KY
5183
5184 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5185 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5186
5187 snd_hda_codec_write(codec, 0x21, 0,
5188 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5189 msleep(80);
5190 snd_hda_codec_write(codec, 0x21, 0,
5191 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
9a22a8f5 5192 break;
71683c32
KY
5193 case 0x10ec0234:
5194 case 0x10ec0274:
5195 case 0x10ec0294:
5196 alc_process_coef_fw(codec, coef0274);
5197 msleep(80);
5198 val = alc_read_coef_idx(codec, 0x46);
5199 is_ctia = (val & 0x00f0) == 0x00f0;
5200 break;
13fd08a3 5201 case 0x10ec0233:
73bdd597
DH
5202 case 0x10ec0283:
5203 alc_write_coef_idx(codec, 0x45, 0xd029);
5204 msleep(300);
5205 val = alc_read_coef_idx(codec, 0x46);
5206 is_ctia = (val & 0x0070) == 0x0070;
5207 break;
1a5bc8d9 5208 case 0x10ec0298:
89542936
KY
5209 snd_hda_codec_write(codec, 0x21, 0,
5210 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5211 msleep(100);
5212 snd_hda_codec_write(codec, 0x21, 0,
5213 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5214 msleep(200);
5215
5216 val = alc_read_coef_idx(codec, 0x50);
5217 if (val & (1 << 12)) {
5218 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5219 alc_process_coef_fw(codec, coef0288);
5220 msleep(350);
5221 val = alc_read_coef_idx(codec, 0x50);
5222 is_ctia = (val & 0x0070) == 0x0070;
5223 } else {
5224 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5225 alc_process_coef_fw(codec, coef0288);
5226 msleep(350);
5227 val = alc_read_coef_idx(codec, 0x50);
5228 is_ctia = (val & 0x0070) == 0x0070;
5229 }
5230 alc_process_coef_fw(codec, coef0298);
5231 snd_hda_codec_write(codec, 0x21, 0,
5232 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5233 msleep(75);
5234 snd_hda_codec_write(codec, 0x21, 0,
5235 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5236 break;
f3b70332
KY
5237 case 0x10ec0286:
5238 case 0x10ec0288:
5239 alc_process_coef_fw(codec, coef0288);
5240 msleep(350);
5241 val = alc_read_coef_idx(codec, 0x50);
5242 is_ctia = (val & 0x0070) == 0x0070;
5243 break;
73bdd597
DH
5244 case 0x10ec0292:
5245 alc_write_coef_idx(codec, 0x6b, 0xd429);
5246 msleep(300);
5247 val = alc_read_coef_idx(codec, 0x6c);
5248 is_ctia = (val & 0x001c) == 0x001c;
5249 break;
a22aa26f 5250 case 0x10ec0293:
54db6c39 5251 alc_process_coef_fw(codec, coef0293);
a22aa26f
KY
5252 msleep(300);
5253 val = alc_read_coef_idx(codec, 0x46);
5254 is_ctia = (val & 0x0070) == 0x0070;
5255 break;
73bdd597 5256 case 0x10ec0668:
54db6c39 5257 alc_process_coef_fw(codec, coef0688);
73bdd597
DH
5258 msleep(300);
5259 val = alc_read_coef_idx(codec, 0xbe);
5260 is_ctia = (val & 0x1c02) == 0x1c02;
5261 break;
c2b691ee 5262 case 0x10ec0215:
4cc9b9d6 5263 case 0x10ec0225:
c2b691ee 5264 case 0x10ec0285:
7d727869 5265 case 0x10ec0295:
c2b691ee 5266 case 0x10ec0289:
28f1f9b2 5267 case 0x10ec0299:
da911b1f
KY
5268 snd_hda_codec_write(codec, 0x21, 0,
5269 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5270 msleep(80);
5271 snd_hda_codec_write(codec, 0x21, 0,
5272 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5273
5a36767a
KY
5274 alc_process_coef_fw(codec, alc225_pre_hsmode);
5275 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5276 val = alc_read_coef_idx(codec, 0x45);
5277 if (val & (1 << 9)) {
5278 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5279 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5280 msleep(800);
5281 val = alc_read_coef_idx(codec, 0x46);
5282 is_ctia = (val & 0x00f0) == 0x00f0;
5283 } else {
5284 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5285 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5286 msleep(800);
5287 val = alc_read_coef_idx(codec, 0x46);
5288 is_ctia = (val & 0x00f0) == 0x00f0;
5289 }
5290 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
5291 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
5292 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
da911b1f
KY
5293
5294 snd_hda_codec_write(codec, 0x21, 0,
5295 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5296 msleep(80);
5297 snd_hda_codec_write(codec, 0x21, 0,
5298 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
4cc9b9d6 5299 break;
78f4f7c2
KY
5300 case 0x10ec0867:
5301 is_ctia = true;
5302 break;
73bdd597
DH
5303 }
5304
4e76a883 5305 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
73bdd597
DH
5306 is_ctia ? "yes" : "no");
5307 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
5308}
5309
5310static void alc_update_headset_mode(struct hda_codec *codec)
5311{
5312 struct alc_spec *spec = codec->spec;
5313
5314 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
35a39f98 5315 hda_nid_t hp_pin = alc_get_hp_pin(spec);
73bdd597
DH
5316
5317 int new_headset_mode;
5318
5319 if (!snd_hda_jack_detect(codec, hp_pin))
5320 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
5321 else if (mux_pin == spec->headset_mic_pin)
5322 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
5323 else if (mux_pin == spec->headphone_mic_pin)
5324 new_headset_mode = ALC_HEADSET_MODE_MIC;
5325 else
5326 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
5327
5959a6bc
DH
5328 if (new_headset_mode == spec->current_headset_mode) {
5329 snd_hda_gen_update_outputs(codec);
73bdd597 5330 return;
5959a6bc 5331 }
73bdd597
DH
5332
5333 switch (new_headset_mode) {
5334 case ALC_HEADSET_MODE_UNPLUGGED:
5335 alc_headset_mode_unplugged(codec);
aeac1a0d
KY
5336 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5337 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
73bdd597
DH
5338 spec->gen.hp_jack_present = false;
5339 break;
5340 case ALC_HEADSET_MODE_HEADSET:
5341 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
5342 alc_determine_headset_type(codec);
5343 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
5344 alc_headset_mode_ctia(codec);
5345 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
5346 alc_headset_mode_omtp(codec);
5347 spec->gen.hp_jack_present = true;
5348 break;
5349 case ALC_HEADSET_MODE_MIC:
5350 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
5351 spec->gen.hp_jack_present = false;
5352 break;
5353 case ALC_HEADSET_MODE_HEADPHONE:
5354 alc_headset_mode_default(codec);
5355 spec->gen.hp_jack_present = true;
5356 break;
5357 }
5358 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
5359 snd_hda_set_pin_ctl_cache(codec, hp_pin,
5360 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
1f8b46cd 5361 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
73bdd597
DH
5362 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
5363 PIN_VREFHIZ);
5364 }
5365 spec->current_headset_mode = new_headset_mode;
5366
5367 snd_hda_gen_update_outputs(codec);
5368}
5369
5370static void alc_update_headset_mode_hook(struct hda_codec *codec,
7fe30711
TI
5371 struct snd_kcontrol *kcontrol,
5372 struct snd_ctl_elem_value *ucontrol)
73bdd597
DH
5373{
5374 alc_update_headset_mode(codec);
5375}
5376
1a4f69d5
TI
5377static void alc_update_headset_jack_cb(struct hda_codec *codec,
5378 struct hda_jack_callback *jack)
73bdd597 5379{
73bdd597
DH
5380 snd_hda_gen_hp_automute(codec, jack);
5381}
5382
5383static void alc_probe_headset_mode(struct hda_codec *codec)
5384{
5385 int i;
5386 struct alc_spec *spec = codec->spec;
5387 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5388
5389 /* Find mic pins */
5390 for (i = 0; i < cfg->num_inputs; i++) {
5391 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
5392 spec->headset_mic_pin = cfg->inputs[i].pin;
5393 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
5394 spec->headphone_mic_pin = cfg->inputs[i].pin;
5395 }
5396
0bed2aa3 5397 WARN_ON(spec->gen.cap_sync_hook);
73bdd597
DH
5398 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
5399 spec->gen.automute_hook = alc_update_headset_mode;
5400 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
5401}
5402
5403static void alc_fixup_headset_mode(struct hda_codec *codec,
5404 const struct hda_fixup *fix, int action)
5405{
5406 struct alc_spec *spec = codec->spec;
5407
5408 switch (action) {
5409 case HDA_FIXUP_ACT_PRE_PROBE:
5410 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
5411 break;
5412 case HDA_FIXUP_ACT_PROBE:
5413 alc_probe_headset_mode(codec);
5414 break;
5415 case HDA_FIXUP_ACT_INIT:
aeac1a0d
KY
5416 if (is_s3_resume(codec) || is_s4_resume(codec)) {
5417 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5418 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5419 }
73bdd597
DH
5420 alc_update_headset_mode(codec);
5421 break;
5422 }
5423}
5424
5425static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
5426 const struct hda_fixup *fix, int action)
5427{
5428 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5429 struct alc_spec *spec = codec->spec;
5430 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5431 }
5432 else
5433 alc_fixup_headset_mode(codec, fix, action);
5434}
5435
31278997
KY
5436static void alc255_set_default_jack_type(struct hda_codec *codec)
5437{
5438 /* Set to iphone type */
6b0f95c4 5439 static const struct coef_fw alc255fw[] = {
54db6c39
TI
5440 WRITE_COEF(0x1b, 0x880b),
5441 WRITE_COEF(0x45, 0xd089),
5442 WRITE_COEF(0x1b, 0x080b),
5443 WRITE_COEF(0x46, 0x0004),
5444 WRITE_COEF(0x1b, 0x0c0b),
5445 {}
5446 };
6b0f95c4 5447 static const struct coef_fw alc256fw[] = {
e69e7e03
KY
5448 WRITE_COEF(0x1b, 0x884b),
5449 WRITE_COEF(0x45, 0xd089),
5450 WRITE_COEF(0x1b, 0x084b),
5451 WRITE_COEF(0x46, 0x0004),
5452 WRITE_COEF(0x1b, 0x0c4b),
5453 {}
5454 };
5455 switch (codec->core.vendor_id) {
5456 case 0x10ec0255:
5457 alc_process_coef_fw(codec, alc255fw);
5458 break;
736f20a7 5459 case 0x10ec0236:
e69e7e03
KY
5460 case 0x10ec0256:
5461 alc_process_coef_fw(codec, alc256fw);
5462 break;
5463 }
31278997
KY
5464 msleep(30);
5465}
5466
9a22a8f5
KY
5467static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
5468 const struct hda_fixup *fix, int action)
5469{
5470 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
31278997 5471 alc255_set_default_jack_type(codec);
9a22a8f5
KY
5472 }
5473 alc_fixup_headset_mode(codec, fix, action);
5474}
5475
31278997
KY
5476static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
5477 const struct hda_fixup *fix, int action)
5478{
5479 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5480 struct alc_spec *spec = codec->spec;
5481 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5482 alc255_set_default_jack_type(codec);
5483 }
5484 else
5485 alc_fixup_headset_mode(codec, fix, action);
5486}
5487
e1e62b98
KY
5488static void alc288_update_headset_jack_cb(struct hda_codec *codec,
5489 struct hda_jack_callback *jack)
5490{
5491 struct alc_spec *spec = codec->spec;
e1e62b98
KY
5492
5493 alc_update_headset_jack_cb(codec, jack);
5494 /* Headset Mic enable or disable, only for Dell Dino */
d44a6864 5495 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
e1e62b98
KY
5496}
5497
5498static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5499 const struct hda_fixup *fix, int action)
5500{
5501 alc_fixup_headset_mode(codec, fix, action);
5502 if (action == HDA_FIXUP_ACT_PROBE) {
5503 struct alc_spec *spec = codec->spec;
d44a6864
TI
5504 /* toggled via hp_automute_hook */
5505 spec->gpio_mask |= 0x40;
5506 spec->gpio_dir |= 0x40;
e1e62b98
KY
5507 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
5508 }
5509}
5510
493a52a9
HW
5511static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5512 const struct hda_fixup *fix, int action)
5513{
5514 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5515 struct alc_spec *spec = codec->spec;
5516 spec->gen.auto_mute_via_amp = 1;
5517 }
5518}
5519
9b745ab8
TI
5520static void alc_fixup_no_shutup(struct hda_codec *codec,
5521 const struct hda_fixup *fix, int action)
5522{
efe55732 5523 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
9b745ab8 5524 struct alc_spec *spec = codec->spec;
c0ca5ece 5525 spec->no_shutup_pins = 1;
9b745ab8
TI
5526 }
5527}
5528
5e6db669
GM
5529static void alc_fixup_disable_aamix(struct hda_codec *codec,
5530 const struct hda_fixup *fix, int action)
5531{
5532 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5533 struct alc_spec *spec = codec->spec;
5534 /* Disable AA-loopback as it causes white noise */
5535 spec->gen.mixer_nid = 0;
5536 }
5537}
5538
7f57d803
TI
5539/* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
5540static void alc_fixup_tpt440_dock(struct hda_codec *codec,
5541 const struct hda_fixup *fix, int action)
5542{
5543 static const struct hda_pintbl pincfgs[] = {
5544 { 0x16, 0x21211010 }, /* dock headphone */
5545 { 0x19, 0x21a11010 }, /* dock mic */
5546 { }
5547 };
5548 struct alc_spec *spec = codec->spec;
5549
5550 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
871b9066 5551 spec->reboot_notify = snd_hda_gen_reboot_notify; /* reduce noise */
7f57d803
TI
5552 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5553 codec->power_save_node = 0; /* avoid click noises */
5554 snd_hda_apply_pincfgs(codec, pincfgs);
5555 }
5556}
5557
61fcf8ec
KY
5558static void alc_fixup_tpt470_dock(struct hda_codec *codec,
5559 const struct hda_fixup *fix, int action)
5560{
5561 static const struct hda_pintbl pincfgs[] = {
5562 { 0x17, 0x21211010 }, /* dock headphone */
5563 { 0x19, 0x21a11010 }, /* dock mic */
5564 { }
5565 };
5566 struct alc_spec *spec = codec->spec;
5567
5568 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5569 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
71db96dd
TI
5570 snd_hda_apply_pincfgs(codec, pincfgs);
5571 } else if (action == HDA_FIXUP_ACT_INIT) {
61fcf8ec
KY
5572 /* Enable DOCK device */
5573 snd_hda_codec_write(codec, 0x17, 0,
5574 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5575 /* Enable DOCK device */
5576 snd_hda_codec_write(codec, 0x19, 0,
5577 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
61fcf8ec
KY
5578 }
5579}
5580
399c01aa
TI
5581static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
5582 const struct hda_fixup *fix, int action)
5583{
5584 /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
5585 * the speaker output becomes too low by some reason on Thinkpads with
5586 * ALC298 codec
5587 */
5588 static const hda_nid_t preferred_pairs[] = {
5589 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
5590 0
5591 };
5592 struct alc_spec *spec = codec->spec;
5593
5594 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5595 spec->gen.preferred_dacs = preferred_pairs;
5596}
5597
9476d369 5598static void alc_shutup_dell_xps13(struct hda_codec *codec)
033b0a7c
GM
5599{
5600 struct alc_spec *spec = codec->spec;
35a39f98 5601 int hp_pin = alc_get_hp_pin(spec);
033b0a7c 5602
9476d369
GM
5603 /* Prevent pop noises when headphones are plugged in */
5604 snd_hda_codec_write(codec, hp_pin, 0,
5605 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5606 msleep(20);
033b0a7c
GM
5607}
5608
5609static void alc_fixup_dell_xps13(struct hda_codec *codec,
5610 const struct hda_fixup *fix, int action)
5611{
3e1b0c4a
TI
5612 struct alc_spec *spec = codec->spec;
5613 struct hda_input_mux *imux = &spec->gen.input_mux;
5614 int i;
f38663ab 5615
3e1b0c4a
TI
5616 switch (action) {
5617 case HDA_FIXUP_ACT_PRE_PROBE:
5618 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
5619 * it causes a click noise at start up
5620 */
5621 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
efe55732 5622 spec->shutup = alc_shutup_dell_xps13;
3e1b0c4a
TI
5623 break;
5624 case HDA_FIXUP_ACT_PROBE:
f38663ab
GM
5625 /* Make the internal mic the default input source. */
5626 for (i = 0; i < imux->num_items; i++) {
5627 if (spec->gen.imux_pins[i] == 0x12) {
5628 spec->gen.cur_mux[0] = i;
5629 break;
5630 }
5631 }
3e1b0c4a 5632 break;
033b0a7c
GM
5633 }
5634}
5635
1f8b46cd
DH
5636static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
5637 const struct hda_fixup *fix, int action)
5638{
5639 struct alc_spec *spec = codec->spec;
5640
5641 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5642 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5643 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
b40eda64
DH
5644
5645 /* Disable boost for mic-in permanently. (This code is only called
5646 from quirks that guarantee that the headphone is at NID 0x1b.) */
5647 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
5648 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
1f8b46cd
DH
5649 } else
5650 alc_fixup_headset_mode(codec, fix, action);
5651}
5652
73bdd597
DH
5653static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
5654 const struct hda_fixup *fix, int action)
5655{
5656 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
73bdd597 5657 alc_write_coef_idx(codec, 0xc4, 0x8000);
98b24883 5658 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
73bdd597
DH
5659 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
5660 }
5661 alc_fixup_headset_mode(codec, fix, action);
5662}
5663
bde7bc60
CCC
5664/* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
5665static int find_ext_mic_pin(struct hda_codec *codec)
5666{
5667 struct alc_spec *spec = codec->spec;
5668 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5669 hda_nid_t nid;
5670 unsigned int defcfg;
5671 int i;
5672
5673 for (i = 0; i < cfg->num_inputs; i++) {
5674 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5675 continue;
5676 nid = cfg->inputs[i].pin;
5677 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5678 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
5679 continue;
5680 return nid;
5681 }
5682
5683 return 0;
5684}
5685
08a978db 5686static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
1727a771 5687 const struct hda_fixup *fix,
08a978db
DR
5688 int action)
5689{
5690 struct alc_spec *spec = codec->spec;
5691
0db75790 5692 if (action == HDA_FIXUP_ACT_PROBE) {
bde7bc60 5693 int mic_pin = find_ext_mic_pin(codec);
35a39f98 5694 int hp_pin = alc_get_hp_pin(spec);
bde7bc60
CCC
5695
5696 if (snd_BUG_ON(!mic_pin || !hp_pin))
0db75790 5697 return;
bde7bc60 5698 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
0db75790 5699 }
08a978db 5700}
693b613d 5701
3e0d611b
DH
5702static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
5703 const struct hda_fixup *fix,
5704 int action)
5705{
5706 struct alc_spec *spec = codec->spec;
5707 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5708 int i;
5709
5710 /* The mic boosts on level 2 and 3 are too noisy
5711 on the internal mic input.
5712 Therefore limit the boost to 0 or 1. */
5713
5714 if (action != HDA_FIXUP_ACT_PROBE)
5715 return;
5716
5717 for (i = 0; i < cfg->num_inputs; i++) {
5718 hda_nid_t nid = cfg->inputs[i].pin;
5719 unsigned int defcfg;
5720 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5721 continue;
5722 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5723 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
5724 continue;
5725
5726 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
5727 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
5728 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
5729 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
5730 (0 << AC_AMPCAP_MUTE_SHIFT));
5731 }
5732}
5733
cd217a63 5734static void alc283_hp_automute_hook(struct hda_codec *codec,
1a4f69d5 5735 struct hda_jack_callback *jack)
cd217a63
KY
5736{
5737 struct alc_spec *spec = codec->spec;
5738 int vref;
5739
5740 msleep(200);
5741 snd_hda_gen_hp_automute(codec, jack);
5742
5743 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
5744
5745 msleep(600);
5746 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5747 vref);
5748}
5749
cd217a63
KY
5750static void alc283_fixup_chromebook(struct hda_codec *codec,
5751 const struct hda_fixup *fix, int action)
5752{
5753 struct alc_spec *spec = codec->spec;
cd217a63
KY
5754
5755 switch (action) {
5756 case HDA_FIXUP_ACT_PRE_PROBE:
0202e99c 5757 snd_hda_override_wcaps(codec, 0x03, 0);
d2e92709
TI
5758 /* Disable AA-loopback as it causes white noise */
5759 spec->gen.mixer_nid = 0;
38070219 5760 break;
0202e99c 5761 case HDA_FIXUP_ACT_INIT:
de9481cb
KY
5762 /* MIC2-VREF control */
5763 /* Set to manual mode */
98b24883 5764 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
0202e99c 5765 /* Enable Line1 input control by verb */
98b24883 5766 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
0202e99c
KY
5767 break;
5768 }
5769}
5770
5771static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
5772 const struct hda_fixup *fix, int action)
5773{
5774 struct alc_spec *spec = codec->spec;
0202e99c
KY
5775
5776 switch (action) {
5777 case HDA_FIXUP_ACT_PRE_PROBE:
cd217a63 5778 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
38070219
KY
5779 break;
5780 case HDA_FIXUP_ACT_INIT:
cd217a63
KY
5781 /* MIC2-VREF control */
5782 /* Set to manual mode */
98b24883 5783 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
cd217a63
KY
5784 break;
5785 }
5786}
5787
7bba2157
TI
5788/* mute tablet speaker pin (0x14) via dock plugging in addition */
5789static void asus_tx300_automute(struct hda_codec *codec)
5790{
5791 struct alc_spec *spec = codec->spec;
5792 snd_hda_gen_update_outputs(codec);
5793 if (snd_hda_jack_detect(codec, 0x1b))
5794 spec->gen.mute_bits |= (1ULL << 0x14);
5795}
5796
5797static void alc282_fixup_asus_tx300(struct hda_codec *codec,
5798 const struct hda_fixup *fix, int action)
5799{
5800 struct alc_spec *spec = codec->spec;
7bba2157
TI
5801 static const struct hda_pintbl dock_pins[] = {
5802 { 0x1b, 0x21114000 }, /* dock speaker pin */
5803 {}
5804 };
7bba2157
TI
5805
5806 switch (action) {
5807 case HDA_FIXUP_ACT_PRE_PROBE:
1c76aa5f 5808 spec->init_amp = ALC_INIT_DEFAULT;
ae065f1c
TI
5809 /* TX300 needs to set up GPIO2 for the speaker amp */
5810 alc_setup_gpio(codec, 0x04);
7bba2157
TI
5811 snd_hda_apply_pincfgs(codec, dock_pins);
5812 spec->gen.auto_mute_via_amp = 1;
5813 spec->gen.automute_hook = asus_tx300_automute;
5814 snd_hda_jack_detect_enable_callback(codec, 0x1b,
7bba2157
TI
5815 snd_hda_gen_hp_automute);
5816 break;
5579cd6f
TI
5817 case HDA_FIXUP_ACT_PROBE:
5818 spec->init_amp = ALC_INIT_DEFAULT;
5819 break;
7bba2157
TI
5820 case HDA_FIXUP_ACT_BUILD:
5821 /* this is a bit tricky; give more sane names for the main
5822 * (tablet) speaker and the dock speaker, respectively
5823 */
56798e6b
TI
5824 rename_ctl(codec, "Speaker Playback Switch",
5825 "Dock Speaker Playback Switch");
5826 rename_ctl(codec, "Bass Speaker Playback Switch",
5827 "Speaker Playback Switch");
7bba2157
TI
5828 break;
5829 }
5830}
5831
338cae56
DH
5832static void alc290_fixup_mono_speakers(struct hda_codec *codec,
5833 const struct hda_fixup *fix, int action)
5834{
0f4881dc
DH
5835 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5836 /* DAC node 0x03 is giving mono output. We therefore want to
5837 make sure 0x14 (front speaker) and 0x15 (headphones) use the
5838 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
caf3c043
MM
5839 static const hda_nid_t conn1[] = { 0x0c };
5840 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
5841 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
0f4881dc 5842 }
338cae56
DH
5843}
5844
dd9aa335
HW
5845static void alc298_fixup_speaker_volume(struct hda_codec *codec,
5846 const struct hda_fixup *fix, int action)
5847{
5848 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5849 /* The speaker is routed to the Node 0x06 by a mistake, as a result
5850 we can't adjust the speaker's volume since this node does not has
5851 Amp-out capability. we change the speaker's route to:
5852 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
5853 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
5854 speaker's volume now. */
5855
caf3c043
MM
5856 static const hda_nid_t conn1[] = { 0x0c };
5857 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
dd9aa335
HW
5858 }
5859}
5860
e312a869
TI
5861/* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
5862static void alc295_fixup_disable_dac3(struct hda_codec *codec,
5863 const struct hda_fixup *fix, int action)
5864{
5865 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
caf3c043
MM
5866 static const hda_nid_t conn[] = { 0x02, 0x03 };
5867 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
e312a869
TI
5868 }
5869}
5870
d2cd795c
JK
5871/* force NID 0x17 (Bass Speaker) to DAC1 to share it with the main speaker */
5872static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
5873 const struct hda_fixup *fix, int action)
5874{
5875 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
caf3c043
MM
5876 static const hda_nid_t conn[] = { 0x02 };
5877 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
d2cd795c
JK
5878 }
5879}
5880
98973f2f
KP
5881/* Hook to update amp GPIO4 for automute */
5882static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
5883 struct hda_jack_callback *jack)
5884{
5885 struct alc_spec *spec = codec->spec;
5886
5887 snd_hda_gen_hp_automute(codec, jack);
5888 /* mute_led_polarity is set to 0, so we pass inverted value here */
dbd13179
KHF
5889 alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
5890 !spec->gen.hp_jack_present);
98973f2f
KP
5891}
5892
5893/* Manage GPIOs for HP EliteBook Folio 9480m.
5894 *
5895 * GPIO4 is the headphone amplifier power control
5896 * GPIO3 is the audio output mute indicator LED
5897 */
5898
5899static void alc280_fixup_hp_9480m(struct hda_codec *codec,
5900 const struct hda_fixup *fix,
5901 int action)
5902{
5903 struct alc_spec *spec = codec->spec;
98973f2f 5904
01e4a275 5905 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
98973f2f 5906 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
01e4a275
TI
5907 /* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
5908 spec->gpio_mask |= 0x10;
5909 spec->gpio_dir |= 0x10;
98973f2f 5910 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
98973f2f
KP
5911 }
5912}
5913
ae065f1c
TI
5914static void alc275_fixup_gpio4_off(struct hda_codec *codec,
5915 const struct hda_fixup *fix,
5916 int action)
5917{
5918 struct alc_spec *spec = codec->spec;
5919
5920 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5921 spec->gpio_mask |= 0x04;
5922 spec->gpio_dir |= 0x04;
5923 /* set data bit low */
5924 }
5925}
5926
6a6660d0
TI
5927/* Quirk for Thinkpad X1 7th and 8th Gen
5928 * The following fixed routing needed
5929 * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
5930 * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
5931 * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
5932 */
5933static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
5934 const struct hda_fixup *fix, int action)
5935{
5936 static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
5937 static const hda_nid_t preferred_pairs[] = {
5938 0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
5939 };
5940 struct alc_spec *spec = codec->spec;
5941
5942 switch (action) {
5943 case HDA_FIXUP_ACT_PRE_PROBE:
5944 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
5945 spec->gen.preferred_dacs = preferred_pairs;
5946 break;
5947 case HDA_FIXUP_ACT_BUILD:
5948 /* The generic parser creates somewhat unintuitive volume ctls
5949 * with the fixed routing above, and the shared DAC2 may be
5950 * confusing for PA.
5951 * Rename those to unique names so that PA doesn't touch them
5952 * and use only Master volume.
5953 */
5954 rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
5955 rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
5956 break;
5957 }
5958}
5959
ca169cc2
KY
5960static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
5961 const struct hda_fixup *fix,
5962 int action)
5963{
5964 alc_fixup_dual_codecs(codec, fix, action);
5965 switch (action) {
5966 case HDA_FIXUP_ACT_PRE_PROBE:
5967 /* override card longname to provide a unique UCM profile */
5968 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
5969 break;
5970 case HDA_FIXUP_ACT_BUILD:
5971 /* rename Capture controls depending on the codec */
5972 rename_ctl(codec, "Capture Volume",
5973 codec->addr == 0 ?
5974 "Rear-Panel Capture Volume" :
5975 "Front-Panel Capture Volume");
5976 rename_ctl(codec, "Capture Switch",
5977 codec->addr == 0 ?
5978 "Rear-Panel Capture Switch" :
5979 "Front-Panel Capture Switch");
5980 break;
5981 }
5982}
5983
52e4e368
KHF
5984static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
5985 const struct hda_fixup *fix, int action)
5986{
5987 if (action != HDA_FIXUP_ACT_PRE_PROBE)
5988 return;
5989
5990 codec->power_save_node = 1;
5991}
5992
92266651
KY
5993/* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
5994static void alc274_fixup_bind_dacs(struct hda_codec *codec,
5995 const struct hda_fixup *fix, int action)
5996{
5997 struct alc_spec *spec = codec->spec;
caf3c043 5998 static const hda_nid_t preferred_pairs[] = {
92266651
KY
5999 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
6000 0
6001 };
6002
6003 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6004 return;
6005
6006 spec->gen.preferred_dacs = preferred_pairs;
0700d3d1
KY
6007 spec->gen.auto_mute_via_amp = 1;
6008 codec->power_save_node = 0;
92266651
KY
6009}
6010
c4cfcf6f
HW
6011/* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */
6012static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6013 const struct hda_fixup *fix, int action)
6014{
6015 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6016 return;
6017
6018 snd_hda_override_wcaps(codec, 0x03, 0);
6019}
6020
8a8de09c
KY
6021static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6022{
6023 switch (codec->core.vendor_id) {
6024 case 0x10ec0274:
6025 case 0x10ec0294:
6026 case 0x10ec0225:
6027 case 0x10ec0295:
6028 case 0x10ec0299:
6029 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6030 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6031 break;
6032 case 0x10ec0235:
6033 case 0x10ec0236:
6034 case 0x10ec0255:
6035 case 0x10ec0256:
6036 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6037 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6038 break;
6039 }
6040}
6041
8983eb60
KY
6042static void alc295_fixup_chromebook(struct hda_codec *codec,
6043 const struct hda_fixup *fix, int action)
6044{
d3ba58bb
KY
6045 struct alc_spec *spec = codec->spec;
6046
8983eb60 6047 switch (action) {
d3ba58bb
KY
6048 case HDA_FIXUP_ACT_PRE_PROBE:
6049 spec->ultra_low_power = true;
6050 break;
8983eb60 6051 case HDA_FIXUP_ACT_INIT:
8a8de09c 6052 alc_combo_jack_hp_jd_restart(codec);
8983eb60
KY
6053 break;
6054 }
6055}
6056
d1dd4211
KY
6057static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6058 const struct hda_fixup *fix, int action)
6059{
6060 if (action == HDA_FIXUP_ACT_PRE_PROBE)
6061 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6062}
6063
c3cdf189
LJ
6064
6065static void alc294_gx502_toggle_output(struct hda_codec *codec,
6066 struct hda_jack_callback *cb)
6067{
6068 /* The Windows driver sets the codec up in a very different way where
6069 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6070 */
6071 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6072 alc_write_coef_idx(codec, 0x10, 0x8a20);
6073 else
6074 alc_write_coef_idx(codec, 0x10, 0x0a20);
6075}
6076
6077static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6078 const struct hda_fixup *fix, int action)
6079{
6080 /* Pin 0x21: headphones/headset mic */
6081 if (!is_jack_detectable(codec, 0x21))
6082 return;
6083
6084 switch (action) {
6085 case HDA_FIXUP_ACT_PRE_PROBE:
6086 snd_hda_jack_detect_enable_callback(codec, 0x21,
6087 alc294_gx502_toggle_output);
6088 break;
6089 case HDA_FIXUP_ACT_INIT:
6090 /* Make sure to start in a correct state, i.e. if
6091 * headphones have been plugged in before powering up the system
6092 */
6093 alc294_gx502_toggle_output(codec, NULL);
6094 break;
6095 }
6096}
6097
56496253
KY
6098static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6099 const struct hda_fixup *fix, int action)
6100{
6101 if (action != HDA_FIXUP_ACT_INIT)
6102 return;
6103
6104 msleep(100);
6105 alc_write_coef_idx(codec, 0x65, 0x0);
6106}
6107
8a8de09c
KY
6108static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6109 const struct hda_fixup *fix, int action)
6110{
6111 switch (action) {
6112 case HDA_FIXUP_ACT_INIT:
6113 alc_combo_jack_hp_jd_restart(codec);
6114 break;
6115 }
6116}
6117
b317b032
TI
6118/* for hda_fixup_thinkpad_acpi() */
6119#include "thinkpad_helper.c"
b67ae3f1 6120
d5a6cabf
TI
6121static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
6122 const struct hda_fixup *fix, int action)
6123{
6124 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
6125 hda_fixup_thinkpad_acpi(codec, fix, action);
6126}
6127
bbf8ff6b
TB
6128/* for alc295_fixup_hp_top_speakers */
6129#include "hp_x360_helper.c"
6130
1d045db9 6131enum {
f73bbf63 6132 ALC269_FIXUP_GPIO2,
1d045db9
TI
6133 ALC269_FIXUP_SONY_VAIO,
6134 ALC275_FIXUP_SONY_VAIO_GPIO2,
6135 ALC269_FIXUP_DELL_M101Z,
6136 ALC269_FIXUP_SKU_IGNORE,
6137 ALC269_FIXUP_ASUS_G73JW,
6138 ALC269_FIXUP_LENOVO_EAPD,
6139 ALC275_FIXUP_SONY_HWEQ,
e9bd7d5c 6140 ALC275_FIXUP_SONY_DISABLE_AAMIX,
1d045db9 6141 ALC271_FIXUP_DMIC,
017f2a10 6142 ALC269_FIXUP_PCM_44K,
adabb3ec 6143 ALC269_FIXUP_STEREO_DMIC,
7c478f03 6144 ALC269_FIXUP_HEADSET_MIC,
24519911
TI
6145 ALC269_FIXUP_QUANTA_MUTE,
6146 ALC269_FIXUP_LIFEBOOK,
2041d564 6147 ALC269_FIXUP_LIFEBOOK_EXTMIC,
cc7016ab 6148 ALC269_FIXUP_LIFEBOOK_HP_PIN,
4df3fd17 6149 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
fdcc968a 6150 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
a4297b5d
TI
6151 ALC269_FIXUP_AMIC,
6152 ALC269_FIXUP_DMIC,
6153 ALC269VB_FIXUP_AMIC,
6154 ALC269VB_FIXUP_DMIC,
08fb0d0e 6155 ALC269_FIXUP_HP_MUTE_LED,
d06ac143 6156 ALC269_FIXUP_HP_MUTE_LED_MIC1,
08fb0d0e 6157 ALC269_FIXUP_HP_MUTE_LED_MIC2,
7f783bd5 6158 ALC269_FIXUP_HP_MUTE_LED_MIC3,
9f5c6faf 6159 ALC269_FIXUP_HP_GPIO_LED,
9c5dc3bf
KY
6160 ALC269_FIXUP_HP_GPIO_MIC1_LED,
6161 ALC269_FIXUP_HP_LINE1_MIC1_LED,
693b613d 6162 ALC269_FIXUP_INV_DMIC,
108cc108 6163 ALC269_FIXUP_LENOVO_DOCK,
b590b38c 6164 ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
9b745ab8 6165 ALC269_FIXUP_NO_SHUTUP,
88cfcf86 6166 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
108cc108 6167 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
73bdd597
DH
6168 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6169 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
338cae56 6170 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
fcc6c877 6171 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
73bdd597
DH
6172 ALC269_FIXUP_HEADSET_MODE,
6173 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
7819717b 6174 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
d240d1dc
DH
6175 ALC269_FIXUP_ASUS_X101_FUNC,
6176 ALC269_FIXUP_ASUS_X101_VERB,
6177 ALC269_FIXUP_ASUS_X101,
08a978db
DR
6178 ALC271_FIXUP_AMIC_MIC2,
6179 ALC271_FIXUP_HP_GATE_MIC_JACK,
b1e8972e 6180 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
42397004 6181 ALC269_FIXUP_ACER_AC700,
3e0d611b 6182 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
2cede303 6183 ALC269VB_FIXUP_ASUS_ZENBOOK,
23870831 6184 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
8e35cd4a 6185 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
02b504d9 6186 ALC269VB_FIXUP_ORDISSIMO_EVE2,
cd217a63 6187 ALC283_FIXUP_CHROME_BOOK,
0202e99c 6188 ALC283_FIXUP_SENSE_COMBO_JACK,
7bba2157 6189 ALC282_FIXUP_ASUS_TX300,
1bb3e062 6190 ALC283_FIXUP_INT_MIC,
338cae56 6191 ALC290_FIXUP_MONO_SPEAKERS,
0f4881dc
DH
6192 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6193 ALC290_FIXUP_SUBWOOFER,
6194 ALC290_FIXUP_SUBWOOFER_HSJACK,
b67ae3f1 6195 ALC269_FIXUP_THINKPAD_ACPI,
56f27013 6196 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
5824ce8d 6197 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
615966ad 6198 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9a22a8f5 6199 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
31278997 6200 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
9a22a8f5 6201 ALC255_FIXUP_HEADSET_MODE,
31278997 6202 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
a22aa26f 6203 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
1c37c223 6204 ALC292_FIXUP_TPT440_DOCK,
9a811230 6205 ALC292_FIXUP_TPT440,
abaa2274 6206 ALC283_FIXUP_HEADSET_MIC,
b3802783 6207 ALC255_FIXUP_MIC_MUTE_LED,
1a22e775 6208 ALC282_FIXUP_ASPIRE_V5_PINS,
7a5255f1 6209 ALC280_FIXUP_HP_GPIO4,
eaa8e5ef 6210 ALC286_FIXUP_HP_GPIO_LED,
33f4acd3 6211 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
b4b33f9d 6212 ALC280_FIXUP_HP_DOCK_PINS,
04d5466a 6213 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
98973f2f 6214 ALC280_FIXUP_HP_9480M,
e1e62b98
KY
6215 ALC288_FIXUP_DELL_HEADSET_MODE,
6216 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
831bfdf9
HW
6217 ALC288_FIXUP_DELL_XPS_13,
6218 ALC288_FIXUP_DISABLE_AAMIX,
5fab5829 6219 ALC292_FIXUP_DELL_E7X_AAMIX,
8b99aba7
TI
6220 ALC292_FIXUP_DELL_E7X,
6221 ALC292_FIXUP_DISABLE_AAMIX,
c04017ea 6222 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
54324221 6223 ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
977e6276 6224 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
2f726aec 6225 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
6ed1131f 6226 ALC275_FIXUP_DELL_XPS,
23adc192 6227 ALC293_FIXUP_LENOVO_SPK_NOISE,
3694cb29 6228 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
3b43b71f 6229 ALC255_FIXUP_DELL_SPK_NOISE,
d1dd4211 6230 ALC225_FIXUP_DISABLE_MIC_VREF,
2ae95577 6231 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
e312a869 6232 ALC295_FIXUP_DISABLE_DAC3,
d2cd795c 6233 ALC285_FIXUP_SPEAKER2_TO_DAC1,
f883982d 6234 ALC280_FIXUP_HP_HEADSET_MIC,
e549d190 6235 ALC221_FIXUP_HP_FRONT_MIC,
c636b95e 6236 ALC292_FIXUP_TPT460,
dd9aa335 6237 ALC298_FIXUP_SPK_VOLUME,
fd06c77e 6238 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
823ff161 6239 ALC269_FIXUP_ATIV_BOOK_8,
9eb5d0e6 6240 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
c1732ede
CC
6241 ALC256_FIXUP_ASUS_HEADSET_MODE,
6242 ALC256_FIXUP_ASUS_MIC,
eeed4cd1 6243 ALC256_FIXUP_ASUS_AIO_GPIO2,
216d7aeb
CC
6244 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
6245 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
ca169cc2 6246 ALC233_FIXUP_LENOVO_MULTI_CODECS,
ea5c7eba 6247 ALC233_FIXUP_ACER_HEADSET_MIC,
f33f79f3 6248 ALC294_FIXUP_LENOVO_MIC_LOCATION,
5f364135 6249 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
52e4e368 6250 ALC225_FIXUP_S3_POP_NOISE,
b84e8436 6251 ALC700_FIXUP_INTEL_REFERENCE,
92266651
KY
6252 ALC274_FIXUP_DELL_BIND_DACS,
6253 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
399c01aa 6254 ALC298_FIXUP_TPT470_DOCK_FIX,
61fcf8ec 6255 ALC298_FIXUP_TPT470_DOCK,
ae104a21 6256 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
f0ba9d69 6257 ALC255_FIXUP_DELL_HEADSET_MIC,
0fbf21c3 6258 ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
a2ef03fe 6259 ALC298_FIXUP_HUAWEI_MBX_STEREO,
bbf8ff6b 6260 ALC295_FIXUP_HP_X360,
8a328ac1 6261 ALC221_FIXUP_HP_HEADSET_MIC,
c4cfcf6f 6262 ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
e8ed64b0 6263 ALC295_FIXUP_HP_AUTO_MUTE,
33aaebd4 6264 ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
d8ae458e 6265 ALC294_FIXUP_ASUS_MIC,
4e051106
JHP
6266 ALC294_FIXUP_ASUS_HEADSET_MIC,
6267 ALC294_FIXUP_ASUS_SPK,
89e3a568 6268 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
c8c6ee61 6269 ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
cbc05fd6 6270 ALC255_FIXUP_ACER_HEADSET_MIC,
10f5b1b8 6271 ALC295_FIXUP_CHROME_BOOK,
8983eb60 6272 ALC225_FIXUP_HEADSET_JACK,
136824ef
KY
6273 ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
6274 ALC225_FIXUP_WYSE_AUTO_MUTE,
6275 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
667a8f73 6276 ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
8c8967a7 6277 ALC256_FIXUP_ASUS_HEADSET_MIC,
e1037354 6278 ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
e2a829b3 6279 ALC299_FIXUP_PREDATOR_SPK,
bd9c10bc 6280 ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
e79c2269
KY
6281 ALC289_FIXUP_DELL_SPK2,
6282 ALC289_FIXUP_DUAL_SPK,
48e01504
CC
6283 ALC294_FIXUP_SPK2_TO_DAC1,
6284 ALC294_FIXUP_ASUS_DUAL_SPK,
6a6660d0 6285 ALC285_FIXUP_THINKPAD_X1_GEN7,
76f7dec0 6286 ALC285_FIXUP_THINKPAD_HEADSET_JACK,
8b33a134 6287 ALC294_FIXUP_ASUS_HPE,
1b94e59d 6288 ALC294_FIXUP_ASUS_COEF_1B,
c3cdf189
LJ
6289 ALC294_FIXUP_ASUS_GX502_HP,
6290 ALC294_FIXUP_ASUS_GX502_PINS,
6291 ALC294_FIXUP_ASUS_GX502_VERBS,
f5a88b0a 6292 ALC285_FIXUP_HP_GPIO_LED,
431e76c3 6293 ALC285_FIXUP_HP_MUTE_LED,
24164f43 6294 ALC236_FIXUP_HP_MUTE_LED,
14425f1f 6295 ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
9e43342b 6296 ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
8eae7e9b 6297 ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
6e15d126 6298 ALC269VC_FIXUP_ACER_HEADSET_MIC,
781c90c0 6299 ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
293a92c1 6300 ALC289_FIXUP_ASUS_GA401,
4b43d05a 6301 ALC289_FIXUP_ASUS_GA502,
f50a121d 6302 ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
56496253 6303 ALC285_FIXUP_HP_GPIO_AMP_INIT,
f1ec5be1
HC
6304 ALC269_FIXUP_CZC_B20,
6305 ALC269_FIXUP_CZC_TMI,
6306 ALC269_FIXUP_CZC_L101,
6307 ALC269_FIXUP_LEMOTE_A1802,
6308 ALC269_FIXUP_LEMOTE_A190X,
e2d2fded 6309 ALC256_FIXUP_INTEL_NUC8_RUGGED,
fc19d559 6310 ALC255_FIXUP_XIAOMI_HEADSET_MIC,
13468bfa 6311 ALC274_FIXUP_HP_MIC,
8a8de09c 6312 ALC274_FIXUP_HP_HEADSET_MIC,
ef9ce66f 6313 ALC256_FIXUP_ASUS_HPE,
446b8185 6314 ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
f1d4e28b
KY
6315};
6316
1727a771 6317static const struct hda_fixup alc269_fixups[] = {
f73bbf63
KHF
6318 [ALC269_FIXUP_GPIO2] = {
6319 .type = HDA_FIXUP_FUNC,
6320 .v.func = alc_fixup_gpio2,
6321 },
1d045db9 6322 [ALC269_FIXUP_SONY_VAIO] = {
fd108215
TI
6323 .type = HDA_FIXUP_PINCTLS,
6324 .v.pins = (const struct hda_pintbl[]) {
6325 {0x19, PIN_VREFGRD},
1d045db9
TI
6326 {}
6327 }
f1d4e28b 6328 },
1d045db9 6329 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
ae065f1c
TI
6330 .type = HDA_FIXUP_FUNC,
6331 .v.func = alc275_fixup_gpio4_off,
1d045db9
TI
6332 .chained = true,
6333 .chain_id = ALC269_FIXUP_SONY_VAIO
6334 },
6335 [ALC269_FIXUP_DELL_M101Z] = {
1727a771 6336 .type = HDA_FIXUP_VERBS,
1d045db9
TI
6337 .v.verbs = (const struct hda_verb[]) {
6338 /* Enables internal speaker */
6339 {0x20, AC_VERB_SET_COEF_INDEX, 13},
6340 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
6341 {}
6342 }
6343 },
6344 [ALC269_FIXUP_SKU_IGNORE] = {
1727a771 6345 .type = HDA_FIXUP_FUNC,
23d30f28 6346 .v.func = alc_fixup_sku_ignore,
1d045db9
TI
6347 },
6348 [ALC269_FIXUP_ASUS_G73JW] = {
1727a771
TI
6349 .type = HDA_FIXUP_PINS,
6350 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
6351 { 0x17, 0x99130111 }, /* subwoofer */
6352 { }
6353 }
6354 },
6355 [ALC269_FIXUP_LENOVO_EAPD] = {
1727a771 6356 .type = HDA_FIXUP_VERBS,
1d045db9
TI
6357 .v.verbs = (const struct hda_verb[]) {
6358 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
6359 {}
6360 }
6361 },
6362 [ALC275_FIXUP_SONY_HWEQ] = {
1727a771 6363 .type = HDA_FIXUP_FUNC,
1d045db9
TI
6364 .v.func = alc269_fixup_hweq,
6365 .chained = true,
6366 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
6367 },
e9bd7d5c
TI
6368 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
6369 .type = HDA_FIXUP_FUNC,
6370 .v.func = alc_fixup_disable_aamix,
6371 .chained = true,
6372 .chain_id = ALC269_FIXUP_SONY_VAIO
6373 },
1d045db9 6374 [ALC271_FIXUP_DMIC] = {
1727a771 6375 .type = HDA_FIXUP_FUNC,
1d045db9 6376 .v.func = alc271_fixup_dmic,
f1d4e28b 6377 },
017f2a10 6378 [ALC269_FIXUP_PCM_44K] = {
1727a771 6379 .type = HDA_FIXUP_FUNC,
017f2a10 6380 .v.func = alc269_fixup_pcm_44k,
012e7eb1
DH
6381 .chained = true,
6382 .chain_id = ALC269_FIXUP_QUANTA_MUTE
017f2a10 6383 },
adabb3ec 6384 [ALC269_FIXUP_STEREO_DMIC] = {
1727a771 6385 .type = HDA_FIXUP_FUNC,
adabb3ec
TI
6386 .v.func = alc269_fixup_stereo_dmic,
6387 },
7c478f03
DH
6388 [ALC269_FIXUP_HEADSET_MIC] = {
6389 .type = HDA_FIXUP_FUNC,
6390 .v.func = alc269_fixup_headset_mic,
6391 },
24519911 6392 [ALC269_FIXUP_QUANTA_MUTE] = {
1727a771 6393 .type = HDA_FIXUP_FUNC,
24519911
TI
6394 .v.func = alc269_fixup_quanta_mute,
6395 },
6396 [ALC269_FIXUP_LIFEBOOK] = {
1727a771
TI
6397 .type = HDA_FIXUP_PINS,
6398 .v.pins = (const struct hda_pintbl[]) {
24519911
TI
6399 { 0x1a, 0x2101103f }, /* dock line-out */
6400 { 0x1b, 0x23a11040 }, /* dock mic-in */
6401 { }
6402 },
6403 .chained = true,
6404 .chain_id = ALC269_FIXUP_QUANTA_MUTE
6405 },
2041d564
DH
6406 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
6407 .type = HDA_FIXUP_PINS,
6408 .v.pins = (const struct hda_pintbl[]) {
6409 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
6410 { }
6411 },
6412 },
cc7016ab
TI
6413 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
6414 .type = HDA_FIXUP_PINS,
6415 .v.pins = (const struct hda_pintbl[]) {
6416 { 0x21, 0x0221102f }, /* HP out */
6417 { }
6418 },
6419 },
4df3fd17
TI
6420 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
6421 .type = HDA_FIXUP_FUNC,
6422 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
6423 },
fdcc968a
JMG
6424 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
6425 .type = HDA_FIXUP_FUNC,
6426 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
6427 },
a4297b5d 6428 [ALC269_FIXUP_AMIC] = {
1727a771
TI
6429 .type = HDA_FIXUP_PINS,
6430 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
6431 { 0x14, 0x99130110 }, /* speaker */
6432 { 0x15, 0x0121401f }, /* HP out */
6433 { 0x18, 0x01a19c20 }, /* mic */
6434 { 0x19, 0x99a3092f }, /* int-mic */
6435 { }
6436 },
6437 },
6438 [ALC269_FIXUP_DMIC] = {
1727a771
TI
6439 .type = HDA_FIXUP_PINS,
6440 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
6441 { 0x12, 0x99a3092f }, /* int-mic */
6442 { 0x14, 0x99130110 }, /* speaker */
6443 { 0x15, 0x0121401f }, /* HP out */
6444 { 0x18, 0x01a19c20 }, /* mic */
6445 { }
6446 },
6447 },
6448 [ALC269VB_FIXUP_AMIC] = {
1727a771
TI
6449 .type = HDA_FIXUP_PINS,
6450 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
6451 { 0x14, 0x99130110 }, /* speaker */
6452 { 0x18, 0x01a19c20 }, /* mic */
6453 { 0x19, 0x99a3092f }, /* int-mic */
6454 { 0x21, 0x0121401f }, /* HP out */
6455 { }
6456 },
6457 },
2267ea97 6458 [ALC269VB_FIXUP_DMIC] = {
1727a771
TI
6459 .type = HDA_FIXUP_PINS,
6460 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
6461 { 0x12, 0x99a3092f }, /* int-mic */
6462 { 0x14, 0x99130110 }, /* speaker */
6463 { 0x18, 0x01a19c20 }, /* mic */
6464 { 0x21, 0x0121401f }, /* HP out */
6465 { }
6466 },
6467 },
08fb0d0e 6468 [ALC269_FIXUP_HP_MUTE_LED] = {
1727a771 6469 .type = HDA_FIXUP_FUNC,
08fb0d0e 6470 .v.func = alc269_fixup_hp_mute_led,
6d3cd5d4 6471 },
d06ac143
DH
6472 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
6473 .type = HDA_FIXUP_FUNC,
6474 .v.func = alc269_fixup_hp_mute_led_mic1,
6475 },
08fb0d0e 6476 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
1727a771 6477 .type = HDA_FIXUP_FUNC,
08fb0d0e 6478 .v.func = alc269_fixup_hp_mute_led_mic2,
420b0feb 6479 },
7f783bd5
TB
6480 [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
6481 .type = HDA_FIXUP_FUNC,
6482 .v.func = alc269_fixup_hp_mute_led_mic3,
e8ed64b0
GKK
6483 .chained = true,
6484 .chain_id = ALC295_FIXUP_HP_AUTO_MUTE
7f783bd5 6485 },
9f5c6faf
TI
6486 [ALC269_FIXUP_HP_GPIO_LED] = {
6487 .type = HDA_FIXUP_FUNC,
6488 .v.func = alc269_fixup_hp_gpio_led,
6489 },
9c5dc3bf
KY
6490 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
6491 .type = HDA_FIXUP_FUNC,
6492 .v.func = alc269_fixup_hp_gpio_mic1_led,
6493 },
6494 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
6495 .type = HDA_FIXUP_FUNC,
6496 .v.func = alc269_fixup_hp_line1_mic1_led,
6497 },
693b613d 6498 [ALC269_FIXUP_INV_DMIC] = {
1727a771 6499 .type = HDA_FIXUP_FUNC,
9d36a7dc 6500 .v.func = alc_fixup_inv_dmic,
693b613d 6501 },
9b745ab8
TI
6502 [ALC269_FIXUP_NO_SHUTUP] = {
6503 .type = HDA_FIXUP_FUNC,
6504 .v.func = alc_fixup_no_shutup,
6505 },
108cc108 6506 [ALC269_FIXUP_LENOVO_DOCK] = {
1727a771
TI
6507 .type = HDA_FIXUP_PINS,
6508 .v.pins = (const struct hda_pintbl[]) {
108cc108
DH
6509 { 0x19, 0x23a11040 }, /* dock mic */
6510 { 0x1b, 0x2121103f }, /* dock headphone */
6511 { }
6512 },
6513 .chained = true,
6514 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
6515 },
b590b38c
TI
6516 [ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
6517 .type = HDA_FIXUP_FUNC,
6518 .v.func = alc269_fixup_limit_int_mic_boost,
6519 .chained = true,
6520 .chain_id = ALC269_FIXUP_LENOVO_DOCK,
6521 },
108cc108 6522 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
1727a771 6523 .type = HDA_FIXUP_FUNC,
108cc108 6524 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
52129000
DH
6525 .chained = true,
6526 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
108cc108 6527 },
73bdd597
DH
6528 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6529 .type = HDA_FIXUP_PINS,
6530 .v.pins = (const struct hda_pintbl[]) {
6531 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6532 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6533 { }
6534 },
6535 .chained = true,
6536 .chain_id = ALC269_FIXUP_HEADSET_MODE
6537 },
6538 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
6539 .type = HDA_FIXUP_PINS,
6540 .v.pins = (const struct hda_pintbl[]) {
6541 { 0x16, 0x21014020 }, /* dock line out */
6542 { 0x19, 0x21a19030 }, /* dock mic */
6543 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6544 { }
6545 },
6546 .chained = true,
6547 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6548 },
338cae56
DH
6549 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
6550 .type = HDA_FIXUP_PINS,
6551 .v.pins = (const struct hda_pintbl[]) {
6552 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6553 { }
6554 },
6555 .chained = true,
6556 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6557 },
fcc6c877
KY
6558 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
6559 .type = HDA_FIXUP_PINS,
6560 .v.pins = (const struct hda_pintbl[]) {
6561 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6562 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6563 { }
6564 },
6565 .chained = true,
6566 .chain_id = ALC269_FIXUP_HEADSET_MODE
6567 },
73bdd597
DH
6568 [ALC269_FIXUP_HEADSET_MODE] = {
6569 .type = HDA_FIXUP_FUNC,
6570 .v.func = alc_fixup_headset_mode,
6676f308 6571 .chained = true,
b3802783 6572 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
73bdd597
DH
6573 },
6574 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
6575 .type = HDA_FIXUP_FUNC,
6576 .v.func = alc_fixup_headset_mode_no_hp_mic,
6577 },
7819717b
TI
6578 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
6579 .type = HDA_FIXUP_PINS,
6580 .v.pins = (const struct hda_pintbl[]) {
6581 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
6582 { }
6583 },
6584 .chained = true,
6585 .chain_id = ALC269_FIXUP_HEADSET_MODE,
6586 },
88cfcf86
DH
6587 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
6588 .type = HDA_FIXUP_PINS,
6589 .v.pins = (const struct hda_pintbl[]) {
6590 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6591 { }
6592 },
fbc78ad6
DH
6593 .chained = true,
6594 .chain_id = ALC269_FIXUP_HEADSET_MIC
88cfcf86 6595 },
0fbf21c3 6596 [ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
8ac51bbc
AB
6597 .type = HDA_FIXUP_PINS,
6598 .v.pins = (const struct hda_pintbl[]) {
6599 {0x12, 0x90a60130},
6600 {0x13, 0x40000000},
6601 {0x14, 0x90170110},
6602 {0x18, 0x411111f0},
6603 {0x19, 0x04a11040},
6604 {0x1a, 0x411111f0},
6605 {0x1b, 0x90170112},
6606 {0x1d, 0x40759a05},
6607 {0x1e, 0x411111f0},
6608 {0x21, 0x04211020},
6609 { }
6610 },
e2744fd7
AB
6611 .chained = true,
6612 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
8ac51bbc 6613 },
a2ef03fe
TE
6614 [ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
6615 .type = HDA_FIXUP_FUNC,
6616 .v.func = alc298_fixup_huawei_mbx_stereo,
6617 .chained = true,
6618 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
6619 },
d240d1dc
DH
6620 [ALC269_FIXUP_ASUS_X101_FUNC] = {
6621 .type = HDA_FIXUP_FUNC,
6622 .v.func = alc269_fixup_x101_headset_mic,
6623 },
6624 [ALC269_FIXUP_ASUS_X101_VERB] = {
6625 .type = HDA_FIXUP_VERBS,
6626 .v.verbs = (const struct hda_verb[]) {
6627 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6628 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
6629 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
6630 { }
6631 },
6632 .chained = true,
6633 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
6634 },
6635 [ALC269_FIXUP_ASUS_X101] = {
6636 .type = HDA_FIXUP_PINS,
6637 .v.pins = (const struct hda_pintbl[]) {
6638 { 0x18, 0x04a1182c }, /* Headset mic */
6639 { }
6640 },
6641 .chained = true,
6642 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
6643 },
08a978db 6644 [ALC271_FIXUP_AMIC_MIC2] = {
1727a771
TI
6645 .type = HDA_FIXUP_PINS,
6646 .v.pins = (const struct hda_pintbl[]) {
08a978db
DR
6647 { 0x14, 0x99130110 }, /* speaker */
6648 { 0x19, 0x01a19c20 }, /* mic */
6649 { 0x1b, 0x99a7012f }, /* int-mic */
6650 { 0x21, 0x0121401f }, /* HP out */
6651 { }
6652 },
6653 },
6654 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
1727a771 6655 .type = HDA_FIXUP_FUNC,
08a978db
DR
6656 .v.func = alc271_hp_gate_mic_jack,
6657 .chained = true,
6658 .chain_id = ALC271_FIXUP_AMIC_MIC2,
6659 },
b1e8972e
OR
6660 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
6661 .type = HDA_FIXUP_FUNC,
6662 .v.func = alc269_fixup_limit_int_mic_boost,
6663 .chained = true,
6664 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
6665 },
42397004
DR
6666 [ALC269_FIXUP_ACER_AC700] = {
6667 .type = HDA_FIXUP_PINS,
6668 .v.pins = (const struct hda_pintbl[]) {
6669 { 0x12, 0x99a3092f }, /* int-mic */
6670 { 0x14, 0x99130110 }, /* speaker */
6671 { 0x18, 0x03a11c20 }, /* mic */
6672 { 0x1e, 0x0346101e }, /* SPDIF1 */
6673 { 0x21, 0x0321101f }, /* HP out */
6674 { }
6675 },
6676 .chained = true,
6677 .chain_id = ALC271_FIXUP_DMIC,
6678 },
3e0d611b
DH
6679 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
6680 .type = HDA_FIXUP_FUNC,
6681 .v.func = alc269_fixup_limit_int_mic_boost,
2793769f
DH
6682 .chained = true,
6683 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
3e0d611b 6684 },
2cede303
OR
6685 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
6686 .type = HDA_FIXUP_FUNC,
6687 .v.func = alc269_fixup_limit_int_mic_boost,
6688 .chained = true,
6689 .chain_id = ALC269VB_FIXUP_DMIC,
6690 },
23870831
TI
6691 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
6692 .type = HDA_FIXUP_VERBS,
6693 .v.verbs = (const struct hda_verb[]) {
6694 /* class-D output amp +5dB */
6695 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
6696 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
6697 {}
6698 },
6699 .chained = true,
6700 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
6701 },
8e35cd4a
DH
6702 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
6703 .type = HDA_FIXUP_FUNC,
6704 .v.func = alc269_fixup_limit_int_mic_boost,
6705 .chained = true,
6706 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
6707 },
02b504d9
AA
6708 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
6709 .type = HDA_FIXUP_PINS,
6710 .v.pins = (const struct hda_pintbl[]) {
6711 { 0x12, 0x99a3092f }, /* int-mic */
6712 { 0x18, 0x03a11d20 }, /* mic */
6713 { 0x19, 0x411111f0 }, /* Unused bogus pin */
6714 { }
6715 },
6716 },
cd217a63
KY
6717 [ALC283_FIXUP_CHROME_BOOK] = {
6718 .type = HDA_FIXUP_FUNC,
6719 .v.func = alc283_fixup_chromebook,
6720 },
0202e99c
KY
6721 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
6722 .type = HDA_FIXUP_FUNC,
6723 .v.func = alc283_fixup_sense_combo_jack,
6724 .chained = true,
6725 .chain_id = ALC283_FIXUP_CHROME_BOOK,
6726 },
7bba2157
TI
6727 [ALC282_FIXUP_ASUS_TX300] = {
6728 .type = HDA_FIXUP_FUNC,
6729 .v.func = alc282_fixup_asus_tx300,
6730 },
1bb3e062
KY
6731 [ALC283_FIXUP_INT_MIC] = {
6732 .type = HDA_FIXUP_VERBS,
6733 .v.verbs = (const struct hda_verb[]) {
6734 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
6735 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
6736 { }
6737 },
6738 .chained = true,
6739 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
6740 },
0f4881dc
DH
6741 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
6742 .type = HDA_FIXUP_PINS,
6743 .v.pins = (const struct hda_pintbl[]) {
6744 { 0x17, 0x90170112 }, /* subwoofer */
6745 { }
6746 },
6747 .chained = true,
6748 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6749 },
6750 [ALC290_FIXUP_SUBWOOFER] = {
6751 .type = HDA_FIXUP_PINS,
6752 .v.pins = (const struct hda_pintbl[]) {
6753 { 0x17, 0x90170112 }, /* subwoofer */
6754 { }
6755 },
6756 .chained = true,
6757 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
6758 },
338cae56
DH
6759 [ALC290_FIXUP_MONO_SPEAKERS] = {
6760 .type = HDA_FIXUP_FUNC,
6761 .v.func = alc290_fixup_mono_speakers,
0f4881dc
DH
6762 },
6763 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
6764 .type = HDA_FIXUP_FUNC,
6765 .v.func = alc290_fixup_mono_speakers,
338cae56
DH
6766 .chained = true,
6767 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
6768 },
b67ae3f1
DH
6769 [ALC269_FIXUP_THINKPAD_ACPI] = {
6770 .type = HDA_FIXUP_FUNC,
d5a6cabf 6771 .v.func = alc_fixup_thinkpad_acpi,
09da111a
TI
6772 .chained = true,
6773 .chain_id = ALC269_FIXUP_SKU_IGNORE,
b67ae3f1 6774 },
56f27013
DH
6775 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
6776 .type = HDA_FIXUP_FUNC,
6777 .v.func = alc_fixup_inv_dmic,
6778 .chained = true,
6779 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
6780 },
5824ce8d 6781 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
17d30460
HW
6782 .type = HDA_FIXUP_PINS,
6783 .v.pins = (const struct hda_pintbl[]) {
6784 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6785 { }
5824ce8d
CC
6786 },
6787 .chained = true,
17d30460 6788 .chain_id = ALC255_FIXUP_HEADSET_MODE
5824ce8d 6789 },
615966ad
CC
6790 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
6791 .type = HDA_FIXUP_PINS,
6792 .v.pins = (const struct hda_pintbl[]) {
6793 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6794 { }
6795 },
6796 .chained = true,
6797 .chain_id = ALC255_FIXUP_HEADSET_MODE
6798 },
9a22a8f5
KY
6799 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6800 .type = HDA_FIXUP_PINS,
6801 .v.pins = (const struct hda_pintbl[]) {
6802 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6803 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6804 { }
6805 },
6806 .chained = true,
6807 .chain_id = ALC255_FIXUP_HEADSET_MODE
6808 },
31278997
KY
6809 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
6810 .type = HDA_FIXUP_PINS,
6811 .v.pins = (const struct hda_pintbl[]) {
6812 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6813 { }
6814 },
6815 .chained = true,
6816 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
6817 },
9a22a8f5
KY
6818 [ALC255_FIXUP_HEADSET_MODE] = {
6819 .type = HDA_FIXUP_FUNC,
6820 .v.func = alc_fixup_headset_mode_alc255,
4a83d42a 6821 .chained = true,
b3802783 6822 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
9a22a8f5 6823 },
31278997
KY
6824 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
6825 .type = HDA_FIXUP_FUNC,
6826 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
6827 },
a22aa26f
KY
6828 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6829 .type = HDA_FIXUP_PINS,
6830 .v.pins = (const struct hda_pintbl[]) {
6831 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6832 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6833 { }
6834 },
6835 .chained = true,
6836 .chain_id = ALC269_FIXUP_HEADSET_MODE
6837 },
1c37c223 6838 [ALC292_FIXUP_TPT440_DOCK] = {
ec56af67 6839 .type = HDA_FIXUP_FUNC,
7f57d803 6840 .v.func = alc_fixup_tpt440_dock,
1c37c223
TI
6841 .chained = true,
6842 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
6843 },
9a811230
TI
6844 [ALC292_FIXUP_TPT440] = {
6845 .type = HDA_FIXUP_FUNC,
157f0b7f 6846 .v.func = alc_fixup_disable_aamix,
9a811230
TI
6847 .chained = true,
6848 .chain_id = ALC292_FIXUP_TPT440_DOCK,
6849 },
abaa2274 6850 [ALC283_FIXUP_HEADSET_MIC] = {
9dc12862
DD
6851 .type = HDA_FIXUP_PINS,
6852 .v.pins = (const struct hda_pintbl[]) {
6853 { 0x19, 0x04a110f0 },
6854 { },
6855 },
6856 },
b3802783 6857 [ALC255_FIXUP_MIC_MUTE_LED] = {
00ef9940 6858 .type = HDA_FIXUP_FUNC,
8a503555 6859 .v.func = alc_fixup_micmute_led,
00ef9940 6860 },
1a22e775
TI
6861 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
6862 .type = HDA_FIXUP_PINS,
6863 .v.pins = (const struct hda_pintbl[]) {
6864 { 0x12, 0x90a60130 },
6865 { 0x14, 0x90170110 },
6866 { 0x17, 0x40000008 },
6867 { 0x18, 0x411111f0 },
0420694d 6868 { 0x19, 0x01a1913c },
1a22e775
TI
6869 { 0x1a, 0x411111f0 },
6870 { 0x1b, 0x411111f0 },
6871 { 0x1d, 0x40f89b2d },
6872 { 0x1e, 0x411111f0 },
6873 { 0x21, 0x0321101f },
6874 { },
6875 },
6876 },
7a5255f1
DH
6877 [ALC280_FIXUP_HP_GPIO4] = {
6878 .type = HDA_FIXUP_FUNC,
6879 .v.func = alc280_fixup_hp_gpio4,
6880 },
eaa8e5ef
KY
6881 [ALC286_FIXUP_HP_GPIO_LED] = {
6882 .type = HDA_FIXUP_FUNC,
6883 .v.func = alc286_fixup_hp_gpio_led,
6884 },
33f4acd3
DH
6885 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
6886 .type = HDA_FIXUP_FUNC,
6887 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
6888 },
b4b33f9d
TC
6889 [ALC280_FIXUP_HP_DOCK_PINS] = {
6890 .type = HDA_FIXUP_PINS,
6891 .v.pins = (const struct hda_pintbl[]) {
6892 { 0x1b, 0x21011020 }, /* line-out */
6893 { 0x1a, 0x01a1903c }, /* headset mic */
6894 { 0x18, 0x2181103f }, /* line-in */
6895 { },
6896 },
6897 .chained = true,
6898 .chain_id = ALC280_FIXUP_HP_GPIO4
6899 },
04d5466a
JK
6900 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
6901 .type = HDA_FIXUP_PINS,
6902 .v.pins = (const struct hda_pintbl[]) {
6903 { 0x1b, 0x21011020 }, /* line-out */
6904 { 0x18, 0x2181103f }, /* line-in */
6905 { },
6906 },
6907 .chained = true,
6908 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
6909 },
98973f2f
KP
6910 [ALC280_FIXUP_HP_9480M] = {
6911 .type = HDA_FIXUP_FUNC,
6912 .v.func = alc280_fixup_hp_9480m,
6913 },
e1e62b98
KY
6914 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
6915 .type = HDA_FIXUP_FUNC,
6916 .v.func = alc_fixup_headset_mode_dell_alc288,
6917 .chained = true,
b3802783 6918 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
e1e62b98
KY
6919 },
6920 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6921 .type = HDA_FIXUP_PINS,
6922 .v.pins = (const struct hda_pintbl[]) {
6923 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6924 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6925 { }
6926 },
6927 .chained = true,
6928 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
6929 },
831bfdf9
HW
6930 [ALC288_FIXUP_DISABLE_AAMIX] = {
6931 .type = HDA_FIXUP_FUNC,
6932 .v.func = alc_fixup_disable_aamix,
6933 .chained = true,
d44a6864 6934 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
831bfdf9
HW
6935 },
6936 [ALC288_FIXUP_DELL_XPS_13] = {
6937 .type = HDA_FIXUP_FUNC,
6938 .v.func = alc_fixup_dell_xps13,
6939 .chained = true,
6940 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
6941 },
8b99aba7
TI
6942 [ALC292_FIXUP_DISABLE_AAMIX] = {
6943 .type = HDA_FIXUP_FUNC,
6944 .v.func = alc_fixup_disable_aamix,
831bfdf9
HW
6945 .chained = true,
6946 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
8b99aba7 6947 },
c04017ea
DH
6948 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
6949 .type = HDA_FIXUP_FUNC,
6950 .v.func = alc_fixup_disable_aamix,
6951 .chained = true,
6952 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
6953 },
5fab5829 6954 [ALC292_FIXUP_DELL_E7X_AAMIX] = {
8b99aba7
TI
6955 .type = HDA_FIXUP_FUNC,
6956 .v.func = alc_fixup_dell_xps13,
6957 .chained = true,
6958 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
6959 },
5fab5829
TI
6960 [ALC292_FIXUP_DELL_E7X] = {
6961 .type = HDA_FIXUP_FUNC,
8a503555 6962 .v.func = alc_fixup_micmute_led,
5fab5829
TI
6963 /* micmute fixup must be applied at last */
6964 .chained_before = true,
6965 .chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
6966 },
54324221
JM
6967 [ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
6968 .type = HDA_FIXUP_PINS,
6969 .v.pins = (const struct hda_pintbl[]) {
6970 { 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
6971 { }
6972 },
6973 .chained_before = true,
6974 .chain_id = ALC269_FIXUP_HEADSET_MODE,
6975 },
977e6276
KY
6976 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6977 .type = HDA_FIXUP_PINS,
6978 .v.pins = (const struct hda_pintbl[]) {
6979 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6980 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6981 { }
6982 },
6983 .chained = true,
6984 .chain_id = ALC269_FIXUP_HEADSET_MODE
6985 },
2f726aec
HW
6986 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
6987 .type = HDA_FIXUP_PINS,
6988 .v.pins = (const struct hda_pintbl[]) {
6989 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6990 { }
6991 },
6992 .chained = true,
6993 .chain_id = ALC269_FIXUP_HEADSET_MODE
6994 },
6ed1131f
KY
6995 [ALC275_FIXUP_DELL_XPS] = {
6996 .type = HDA_FIXUP_VERBS,
6997 .v.verbs = (const struct hda_verb[]) {
6998 /* Enables internal speaker */
6999 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
7000 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
7001 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
7002 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
7003 {}
7004 }
7005 },
23adc192
HW
7006 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
7007 .type = HDA_FIXUP_FUNC,
7008 .v.func = alc_fixup_disable_aamix,
7009 .chained = true,
7010 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7011 },
3694cb29
K
7012 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
7013 .type = HDA_FIXUP_FUNC,
7014 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
7015 },
3b43b71f
KHF
7016 [ALC255_FIXUP_DELL_SPK_NOISE] = {
7017 .type = HDA_FIXUP_FUNC,
7018 .v.func = alc_fixup_disable_aamix,
7019 .chained = true,
7020 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7021 },
d1dd4211
KY
7022 [ALC225_FIXUP_DISABLE_MIC_VREF] = {
7023 .type = HDA_FIXUP_FUNC,
7024 .v.func = alc_fixup_disable_mic_vref,
7025 .chained = true,
7026 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7027 },
2ae95577
DH
7028 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7029 .type = HDA_FIXUP_VERBS,
7030 .v.verbs = (const struct hda_verb[]) {
7031 /* Disable pass-through path for FRONT 14h */
7032 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7033 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7034 {}
7035 },
7036 .chained = true,
d1dd4211 7037 .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
2ae95577 7038 },
f883982d
TI
7039 [ALC280_FIXUP_HP_HEADSET_MIC] = {
7040 .type = HDA_FIXUP_FUNC,
7041 .v.func = alc_fixup_disable_aamix,
7042 .chained = true,
7043 .chain_id = ALC269_FIXUP_HEADSET_MIC,
7044 },
e549d190
HW
7045 [ALC221_FIXUP_HP_FRONT_MIC] = {
7046 .type = HDA_FIXUP_PINS,
7047 .v.pins = (const struct hda_pintbl[]) {
7048 { 0x19, 0x02a19020 }, /* Front Mic */
7049 { }
7050 },
7051 },
c636b95e
SE
7052 [ALC292_FIXUP_TPT460] = {
7053 .type = HDA_FIXUP_FUNC,
7054 .v.func = alc_fixup_tpt440_dock,
7055 .chained = true,
7056 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
7057 },
dd9aa335
HW
7058 [ALC298_FIXUP_SPK_VOLUME] = {
7059 .type = HDA_FIXUP_FUNC,
7060 .v.func = alc298_fixup_speaker_volume,
59ec4b57 7061 .chained = true,
2f726aec 7062 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
dd9aa335 7063 },
e312a869
TI
7064 [ALC295_FIXUP_DISABLE_DAC3] = {
7065 .type = HDA_FIXUP_FUNC,
7066 .v.func = alc295_fixup_disable_dac3,
7067 },
d2cd795c
JK
7068 [ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
7069 .type = HDA_FIXUP_FUNC,
7070 .v.func = alc285_fixup_speaker2_to_dac1,
c37c0ab0
HW
7071 .chained = true,
7072 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
d2cd795c 7073 },
fd06c77e
KHF
7074 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
7075 .type = HDA_FIXUP_PINS,
7076 .v.pins = (const struct hda_pintbl[]) {
7077 { 0x1b, 0x90170151 },
7078 { }
7079 },
7080 .chained = true,
7081 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7082 },
823ff161
GM
7083 [ALC269_FIXUP_ATIV_BOOK_8] = {
7084 .type = HDA_FIXUP_FUNC,
7085 .v.func = alc_fixup_auto_mute_via_amp,
7086 .chained = true,
7087 .chain_id = ALC269_FIXUP_NO_SHUTUP
7088 },
9eb5d0e6
KY
7089 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
7090 .type = HDA_FIXUP_PINS,
7091 .v.pins = (const struct hda_pintbl[]) {
7092 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7093 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7094 { }
7095 },
7096 .chained = true,
7097 .chain_id = ALC269_FIXUP_HEADSET_MODE
7098 },
c1732ede
CC
7099 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
7100 .type = HDA_FIXUP_FUNC,
7101 .v.func = alc_fixup_headset_mode,
7102 },
7103 [ALC256_FIXUP_ASUS_MIC] = {
7104 .type = HDA_FIXUP_PINS,
7105 .v.pins = (const struct hda_pintbl[]) {
7106 { 0x13, 0x90a60160 }, /* use as internal mic */
7107 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7108 { }
7109 },
7110 .chained = true,
7111 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7112 },
eeed4cd1 7113 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
ae065f1c
TI
7114 .type = HDA_FIXUP_FUNC,
7115 /* Set up GPIO2 for the speaker amp */
7116 .v.func = alc_fixup_gpio4,
eeed4cd1 7117 },
216d7aeb
CC
7118 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7119 .type = HDA_FIXUP_PINS,
7120 .v.pins = (const struct hda_pintbl[]) {
7121 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7122 { }
7123 },
7124 .chained = true,
7125 .chain_id = ALC269_FIXUP_HEADSET_MIC
7126 },
7127 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
7128 .type = HDA_FIXUP_VERBS,
7129 .v.verbs = (const struct hda_verb[]) {
7130 /* Enables internal speaker */
7131 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
7132 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
7133 {}
7134 },
7135 .chained = true,
7136 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7137 },
ca169cc2
KY
7138 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
7139 .type = HDA_FIXUP_FUNC,
7140 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
f73bbf63
KHF
7141 .chained = true,
7142 .chain_id = ALC269_FIXUP_GPIO2
ca169cc2 7143 },
ea5c7eba
JHP
7144 [ALC233_FIXUP_ACER_HEADSET_MIC] = {
7145 .type = HDA_FIXUP_VERBS,
7146 .v.verbs = (const struct hda_verb[]) {
7147 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
7148 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
7149 { }
7150 },
7151 .chained = true,
7152 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7153 },
f33f79f3
HW
7154 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
7155 .type = HDA_FIXUP_PINS,
7156 .v.pins = (const struct hda_pintbl[]) {
7157 /* Change the mic location from front to right, otherwise there are
7158 two front mics with the same name, pulseaudio can't handle them.
7159 This is just a temporary workaround, after applying this fixup,
7160 there will be one "Front Mic" and one "Mic" in this machine.
7161 */
7162 { 0x1a, 0x04a19040 },
7163 { }
7164 },
7165 },
5f364135
KY
7166 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
7167 .type = HDA_FIXUP_PINS,
7168 .v.pins = (const struct hda_pintbl[]) {
7169 { 0x16, 0x0101102f }, /* Rear Headset HP */
7170 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
7171 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
7172 { 0x1b, 0x02011020 },
7173 { }
7174 },
7175 .chained = true,
52e4e368
KHF
7176 .chain_id = ALC225_FIXUP_S3_POP_NOISE
7177 },
7178 [ALC225_FIXUP_S3_POP_NOISE] = {
7179 .type = HDA_FIXUP_FUNC,
7180 .v.func = alc225_fixup_s3_pop_noise,
7181 .chained = true,
5f364135
KY
7182 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7183 },
b84e8436
PH
7184 [ALC700_FIXUP_INTEL_REFERENCE] = {
7185 .type = HDA_FIXUP_VERBS,
7186 .v.verbs = (const struct hda_verb[]) {
7187 /* Enables internal speaker */
7188 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
7189 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
7190 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
7191 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
7192 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
7193 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
7194 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
7195 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
7196 {}
7197 }
7198 },
92266651
KY
7199 [ALC274_FIXUP_DELL_BIND_DACS] = {
7200 .type = HDA_FIXUP_FUNC,
7201 .v.func = alc274_fixup_bind_dacs,
7202 .chained = true,
7203 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7204 },
7205 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
7206 .type = HDA_FIXUP_PINS,
7207 .v.pins = (const struct hda_pintbl[]) {
7208 { 0x1b, 0x0401102f },
7209 { }
7210 },
7211 .chained = true,
7212 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
7213 },
399c01aa 7214 [ALC298_FIXUP_TPT470_DOCK_FIX] = {
61fcf8ec
KY
7215 .type = HDA_FIXUP_FUNC,
7216 .v.func = alc_fixup_tpt470_dock,
7217 .chained = true,
7218 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
7219 },
399c01aa
TI
7220 [ALC298_FIXUP_TPT470_DOCK] = {
7221 .type = HDA_FIXUP_FUNC,
7222 .v.func = alc_fixup_tpt470_dacs,
7223 .chained = true,
7224 .chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
7225 },
ae104a21
KY
7226 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
7227 .type = HDA_FIXUP_PINS,
7228 .v.pins = (const struct hda_pintbl[]) {
7229 { 0x14, 0x0201101f },
7230 { }
7231 },
7232 .chained = true,
7233 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7234 },
f0ba9d69
KY
7235 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
7236 .type = HDA_FIXUP_PINS,
7237 .v.pins = (const struct hda_pintbl[]) {
7238 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7239 { }
7240 },
3ce0d5aa
HW
7241 .chained = true,
7242 .chain_id = ALC269_FIXUP_HEADSET_MIC
f0ba9d69 7243 },
bbf8ff6b
TB
7244 [ALC295_FIXUP_HP_X360] = {
7245 .type = HDA_FIXUP_FUNC,
7246 .v.func = alc295_fixup_hp_top_speakers,
7247 .chained = true,
7248 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
8a328ac1
KY
7249 },
7250 [ALC221_FIXUP_HP_HEADSET_MIC] = {
7251 .type = HDA_FIXUP_PINS,
7252 .v.pins = (const struct hda_pintbl[]) {
7253 { 0x19, 0x0181313f},
7254 { }
7255 },
7256 .chained = true,
7257 .chain_id = ALC269_FIXUP_HEADSET_MIC
7258 },
c4cfcf6f
HW
7259 [ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
7260 .type = HDA_FIXUP_FUNC,
7261 .v.func = alc285_fixup_invalidate_dacs,
6ba189c5
HW
7262 .chained = true,
7263 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
c4cfcf6f 7264 },
e8ed64b0
GKK
7265 [ALC295_FIXUP_HP_AUTO_MUTE] = {
7266 .type = HDA_FIXUP_FUNC,
7267 .v.func = alc_fixup_auto_mute_via_amp,
7268 },
33aaebd4
CC
7269 [ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
7270 .type = HDA_FIXUP_PINS,
7271 .v.pins = (const struct hda_pintbl[]) {
7272 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7273 { }
7274 },
7275 .chained = true,
7276 .chain_id = ALC269_FIXUP_HEADSET_MIC
7277 },
d8ae458e
CC
7278 [ALC294_FIXUP_ASUS_MIC] = {
7279 .type = HDA_FIXUP_PINS,
7280 .v.pins = (const struct hda_pintbl[]) {
7281 { 0x13, 0x90a60160 }, /* use as internal mic */
7282 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7283 { }
7284 },
7285 .chained = true,
ef9ddb9d 7286 .chain_id = ALC269_FIXUP_HEADSET_MIC
d8ae458e 7287 },
4e051106
JHP
7288 [ALC294_FIXUP_ASUS_HEADSET_MIC] = {
7289 .type = HDA_FIXUP_PINS,
7290 .v.pins = (const struct hda_pintbl[]) {
82b01149 7291 { 0x19, 0x01a1103c }, /* use as headset mic */
4e051106
JHP
7292 { }
7293 },
7294 .chained = true,
ef9ddb9d 7295 .chain_id = ALC269_FIXUP_HEADSET_MIC
4e051106
JHP
7296 },
7297 [ALC294_FIXUP_ASUS_SPK] = {
7298 .type = HDA_FIXUP_VERBS,
7299 .v.verbs = (const struct hda_verb[]) {
7300 /* Set EAPD high */
7301 { 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
7302 { 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
473fbe13
KY
7303 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7304 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
4e051106
JHP
7305 { }
7306 },
7307 .chained = true,
7308 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7309 },
c8a9afa6 7310 [ALC295_FIXUP_CHROME_BOOK] = {
e854747d 7311 .type = HDA_FIXUP_FUNC,
c8a9afa6 7312 .v.func = alc295_fixup_chromebook,
8983eb60
KY
7313 .chained = true,
7314 .chain_id = ALC225_FIXUP_HEADSET_JACK
7315 },
7316 [ALC225_FIXUP_HEADSET_JACK] = {
7317 .type = HDA_FIXUP_FUNC,
7318 .v.func = alc_fixup_headset_jack,
e854747d 7319 },
89e3a568
JS
7320 [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
7321 .type = HDA_FIXUP_PINS,
7322 .v.pins = (const struct hda_pintbl[]) {
7323 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7324 { }
7325 },
7326 .chained = true,
7327 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7328 },
c8c6ee61
HW
7329 [ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
7330 .type = HDA_FIXUP_VERBS,
7331 .v.verbs = (const struct hda_verb[]) {
7332 /* Disable PCBEEP-IN passthrough */
7333 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7334 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7335 { }
7336 },
7337 .chained = true,
7338 .chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
7339 },
cbc05fd6
JHP
7340 [ALC255_FIXUP_ACER_HEADSET_MIC] = {
7341 .type = HDA_FIXUP_PINS,
7342 .v.pins = (const struct hda_pintbl[]) {
7343 { 0x19, 0x03a11130 },
7344 { 0x1a, 0x90a60140 }, /* use as internal mic */
7345 { }
7346 },
7347 .chained = true,
7348 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
7349 },
136824ef
KY
7350 [ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
7351 .type = HDA_FIXUP_PINS,
7352 .v.pins = (const struct hda_pintbl[]) {
7353 { 0x16, 0x01011020 }, /* Rear Line out */
7354 { 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
7355 { }
7356 },
7357 .chained = true,
7358 .chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
7359 },
7360 [ALC225_FIXUP_WYSE_AUTO_MUTE] = {
7361 .type = HDA_FIXUP_FUNC,
7362 .v.func = alc_fixup_auto_mute_via_amp,
7363 .chained = true,
7364 .chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
7365 },
7366 [ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
7367 .type = HDA_FIXUP_FUNC,
7368 .v.func = alc_fixup_disable_mic_vref,
7369 .chained = true,
7370 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7371 },
667a8f73
JHP
7372 [ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
7373 .type = HDA_FIXUP_VERBS,
7374 .v.verbs = (const struct hda_verb[]) {
7375 { 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
7376 { 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
7377 { }
7378 },
7379 .chained = true,
7380 .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
7381 },
8c8967a7
DD
7382 [ALC256_FIXUP_ASUS_HEADSET_MIC] = {
7383 .type = HDA_FIXUP_PINS,
7384 .v.pins = (const struct hda_pintbl[]) {
7385 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
7386 { }
7387 },
7388 .chained = true,
7389 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7390 },
e1037354
JHP
7391 [ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7392 .type = HDA_FIXUP_PINS,
7393 .v.pins = (const struct hda_pintbl[]) {
7394 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7395 { }
7396 },
7397 .chained = true,
7398 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7399 },
e2a829b3
BR
7400 [ALC299_FIXUP_PREDATOR_SPK] = {
7401 .type = HDA_FIXUP_PINS,
7402 .v.pins = (const struct hda_pintbl[]) {
7403 { 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
7404 { }
7405 }
7406 },
bd9c10bc 7407 [ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
60083f9e
JHP
7408 .type = HDA_FIXUP_PINS,
7409 .v.pins = (const struct hda_pintbl[]) {
bd9c10bc
JMG
7410 { 0x19, 0x04a11040 },
7411 { 0x21, 0x04211020 },
60083f9e
JHP
7412 { }
7413 },
7414 .chained = true,
bd9c10bc 7415 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
60083f9e 7416 },
e79c2269 7417 [ALC289_FIXUP_DELL_SPK2] = {
bd9c10bc
JMG
7418 .type = HDA_FIXUP_PINS,
7419 .v.pins = (const struct hda_pintbl[]) {
e79c2269 7420 { 0x17, 0x90170130 }, /* bass spk */
bd9c10bc
JMG
7421 { }
7422 },
7423 .chained = true,
e79c2269 7424 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
bd9c10bc 7425 },
e79c2269
KY
7426 [ALC289_FIXUP_DUAL_SPK] = {
7427 .type = HDA_FIXUP_FUNC,
7428 .v.func = alc285_fixup_speaker2_to_dac1,
7429 .chained = true,
7430 .chain_id = ALC289_FIXUP_DELL_SPK2
7431 },
48e01504
CC
7432 [ALC294_FIXUP_SPK2_TO_DAC1] = {
7433 .type = HDA_FIXUP_FUNC,
7434 .v.func = alc285_fixup_speaker2_to_dac1,
7435 .chained = true,
7436 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7437 },
7438 [ALC294_FIXUP_ASUS_DUAL_SPK] = {
436e2550
JHP
7439 .type = HDA_FIXUP_FUNC,
7440 /* The GPIO must be pulled to initialize the AMP */
7441 .v.func = alc_fixup_gpio4,
7442 .chained = true,
48e01504 7443 .chain_id = ALC294_FIXUP_SPK2_TO_DAC1
436e2550 7444 },
6a6660d0
TI
7445 [ALC285_FIXUP_THINKPAD_X1_GEN7] = {
7446 .type = HDA_FIXUP_FUNC,
7447 .v.func = alc285_fixup_thinkpad_x1_gen7,
7448 .chained = true,
7449 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7450 },
76f7dec0
KY
7451 [ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
7452 .type = HDA_FIXUP_FUNC,
7453 .v.func = alc_fixup_headset_jack,
7454 .chained = true,
6a6660d0 7455 .chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
76f7dec0 7456 },
8b33a134
JHP
7457 [ALC294_FIXUP_ASUS_HPE] = {
7458 .type = HDA_FIXUP_VERBS,
7459 .v.verbs = (const struct hda_verb[]) {
7460 /* Set EAPD high */
7461 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7462 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
7463 { }
7464 },
7465 .chained = true,
7466 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7467 },
c3cdf189
LJ
7468 [ALC294_FIXUP_ASUS_GX502_PINS] = {
7469 .type = HDA_FIXUP_PINS,
7470 .v.pins = (const struct hda_pintbl[]) {
7471 { 0x19, 0x03a11050 }, /* front HP mic */
7472 { 0x1a, 0x01a11830 }, /* rear external mic */
7473 { 0x21, 0x03211020 }, /* front HP out */
7474 { }
7475 },
7476 .chained = true,
7477 .chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
7478 },
7479 [ALC294_FIXUP_ASUS_GX502_VERBS] = {
7480 .type = HDA_FIXUP_VERBS,
7481 .v.verbs = (const struct hda_verb[]) {
7482 /* set 0x15 to HP-OUT ctrl */
7483 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
7484 /* unmute the 0x15 amp */
7485 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
7486 { }
7487 },
7488 .chained = true,
7489 .chain_id = ALC294_FIXUP_ASUS_GX502_HP
7490 },
7491 [ALC294_FIXUP_ASUS_GX502_HP] = {
7492 .type = HDA_FIXUP_FUNC,
7493 .v.func = alc294_fixup_gx502_hp,
7494 },
1b94e59d
TI
7495 [ALC294_FIXUP_ASUS_COEF_1B] = {
7496 .type = HDA_FIXUP_VERBS,
7497 .v.verbs = (const struct hda_verb[]) {
7498 /* Set bit 10 to correct noisy output after reboot from
7499 * Windows 10 (due to pop noise reduction?)
7500 */
7501 { 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
7502 { 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
7503 { }
7504 },
7505 },
f5a88b0a
KHF
7506 [ALC285_FIXUP_HP_GPIO_LED] = {
7507 .type = HDA_FIXUP_FUNC,
7508 .v.func = alc285_fixup_hp_gpio_led,
7509 },
431e76c3
KY
7510 [ALC285_FIXUP_HP_MUTE_LED] = {
7511 .type = HDA_FIXUP_FUNC,
7512 .v.func = alc285_fixup_hp_mute_led,
7513 },
24164f43
KY
7514 [ALC236_FIXUP_HP_MUTE_LED] = {
7515 .type = HDA_FIXUP_FUNC,
7516 .v.func = alc236_fixup_hp_mute_led,
7517 },
14425f1f
MP
7518 [ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
7519 .type = HDA_FIXUP_VERBS,
7520 .v.verbs = (const struct hda_verb[]) {
7521 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
7522 { }
7523 },
7524 },
9e43342b
CC
7525 [ALC295_FIXUP_ASUS_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 { }
7530 },
7531 .chained = true,
7532 .chain_id = ALC269_FIXUP_HEADSET_MODE
7533 },
8eae7e9b
JHP
7534 [ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
7535 .type = HDA_FIXUP_PINS,
7536 .v.pins = (const struct hda_pintbl[]) {
7537 { 0x14, 0x90100120 }, /* use as internal speaker */
7538 { 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
7539 { 0x1a, 0x01011020 }, /* use as line out */
7540 { },
7541 },
7542 .chained = true,
7543 .chain_id = ALC269_FIXUP_HEADSET_MIC
7544 },
6e15d126
JHP
7545 [ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
7546 .type = HDA_FIXUP_PINS,
7547 .v.pins = (const struct hda_pintbl[]) {
7548 { 0x18, 0x02a11030 }, /* use as headset mic */
7549 { }
7550 },
7551 .chained = true,
7552 .chain_id = ALC269_FIXUP_HEADSET_MIC
7553 },
781c90c0
JHP
7554 [ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
7555 .type = HDA_FIXUP_PINS,
7556 .v.pins = (const struct hda_pintbl[]) {
7557 { 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
7558 { }
7559 },
7560 .chained = true,
7561 .chain_id = ALC269_FIXUP_HEADSET_MIC
7562 },
293a92c1 7563 [ALC289_FIXUP_ASUS_GA401] = {
ff53664d
AS
7564 .type = HDA_FIXUP_PINS,
7565 .v.pins = (const struct hda_pintbl[]) {
7566 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
7567 { }
7568 },
7569 },
4b43d05a
AS
7570 [ALC289_FIXUP_ASUS_GA502] = {
7571 .type = HDA_FIXUP_PINS,
7572 .v.pins = (const struct hda_pintbl[]) {
7573 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
7574 { }
7575 },
7576 },
f50a121d
JHP
7577 [ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
7578 .type = HDA_FIXUP_PINS,
7579 .v.pins = (const struct hda_pintbl[]) {
7580 { 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
7581 { }
7582 },
7583 .chained = true,
7584 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7585 },
56496253
KY
7586 [ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
7587 .type = HDA_FIXUP_FUNC,
7588 .v.func = alc285_fixup_hp_gpio_amp_init,
7589 .chained = true,
7590 .chain_id = ALC285_FIXUP_HP_GPIO_LED
7591 },
f1ec5be1
HC
7592 [ALC269_FIXUP_CZC_B20] = {
7593 .type = HDA_FIXUP_PINS,
7594 .v.pins = (const struct hda_pintbl[]) {
7595 { 0x12, 0x411111f0 },
7596 { 0x14, 0x90170110 }, /* speaker */
7597 { 0x15, 0x032f1020 }, /* HP out */
7598 { 0x17, 0x411111f0 },
7599 { 0x18, 0x03ab1040 }, /* mic */
7600 { 0x19, 0xb7a7013f },
7601 { 0x1a, 0x0181305f },
7602 { 0x1b, 0x411111f0 },
7603 { 0x1d, 0x411111f0 },
7604 { 0x1e, 0x411111f0 },
7605 { }
7606 },
7607 .chain_id = ALC269_FIXUP_DMIC,
7608 },
7609 [ALC269_FIXUP_CZC_TMI] = {
7610 .type = HDA_FIXUP_PINS,
7611 .v.pins = (const struct hda_pintbl[]) {
7612 { 0x12, 0x4000c000 },
7613 { 0x14, 0x90170110 }, /* speaker */
7614 { 0x15, 0x0421401f }, /* HP out */
7615 { 0x17, 0x411111f0 },
7616 { 0x18, 0x04a19020 }, /* mic */
7617 { 0x19, 0x411111f0 },
7618 { 0x1a, 0x411111f0 },
7619 { 0x1b, 0x411111f0 },
7620 { 0x1d, 0x40448505 },
7621 { 0x1e, 0x411111f0 },
7622 { 0x20, 0x8000ffff },
7623 { }
7624 },
7625 .chain_id = ALC269_FIXUP_DMIC,
7626 },
7627 [ALC269_FIXUP_CZC_L101] = {
7628 .type = HDA_FIXUP_PINS,
7629 .v.pins = (const struct hda_pintbl[]) {
7630 { 0x12, 0x40000000 },
7631 { 0x14, 0x01014010 }, /* speaker */
7632 { 0x15, 0x411111f0 }, /* HP out */
7633 { 0x16, 0x411111f0 },
7634 { 0x18, 0x01a19020 }, /* mic */
7635 { 0x19, 0x02a19021 },
7636 { 0x1a, 0x0181302f },
7637 { 0x1b, 0x0221401f },
7638 { 0x1c, 0x411111f0 },
7639 { 0x1d, 0x4044c601 },
7640 { 0x1e, 0x411111f0 },
7641 { }
7642 },
7643 .chain_id = ALC269_FIXUP_DMIC,
7644 },
7645 [ALC269_FIXUP_LEMOTE_A1802] = {
7646 .type = HDA_FIXUP_PINS,
7647 .v.pins = (const struct hda_pintbl[]) {
7648 { 0x12, 0x40000000 },
7649 { 0x14, 0x90170110 }, /* speaker */
7650 { 0x17, 0x411111f0 },
7651 { 0x18, 0x03a19040 }, /* mic1 */
7652 { 0x19, 0x90a70130 }, /* mic2 */
7653 { 0x1a, 0x411111f0 },
7654 { 0x1b, 0x411111f0 },
7655 { 0x1d, 0x40489d2d },
7656 { 0x1e, 0x411111f0 },
7657 { 0x20, 0x0003ffff },
7658 { 0x21, 0x03214020 },
7659 { }
7660 },
7661 .chain_id = ALC269_FIXUP_DMIC,
7662 },
7663 [ALC269_FIXUP_LEMOTE_A190X] = {
7664 .type = HDA_FIXUP_PINS,
7665 .v.pins = (const struct hda_pintbl[]) {
7666 { 0x14, 0x99130110 }, /* speaker */
7667 { 0x15, 0x0121401f }, /* HP out */
7668 { 0x18, 0x01a19c20 }, /* rear mic */
7669 { 0x19, 0x99a3092f }, /* front mic */
7670 { 0x1b, 0x0201401f }, /* front lineout */
7671 { }
7672 },
7673 .chain_id = ALC269_FIXUP_DMIC,
7674 },
e2d2fded
KHF
7675 [ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
7676 .type = HDA_FIXUP_PINS,
7677 .v.pins = (const struct hda_pintbl[]) {
7678 { 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7679 { }
7680 },
7681 .chained = true,
7682 .chain_id = ALC269_FIXUP_HEADSET_MODE
7683 },
fc19d559
HW
7684 [ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
7685 .type = HDA_FIXUP_VERBS,
7686 .v.verbs = (const struct hda_verb[]) {
7687 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
7688 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
7689 { }
7690 },
7691 .chained = true,
7692 .chain_id = ALC289_FIXUP_ASUS_GA401
7693 },
13468bfa
HW
7694 [ALC274_FIXUP_HP_MIC] = {
7695 .type = HDA_FIXUP_VERBS,
7696 .v.verbs = (const struct hda_verb[]) {
7697 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
7698 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
7699 { }
7700 },
7701 },
8a8de09c
KY
7702 [ALC274_FIXUP_HP_HEADSET_MIC] = {
7703 .type = HDA_FIXUP_FUNC,
7704 .v.func = alc274_fixup_hp_headset_mic,
7705 .chained = true,
7706 .chain_id = ALC274_FIXUP_HP_MIC
7707 },
ef9ce66f
KY
7708 [ALC256_FIXUP_ASUS_HPE] = {
7709 .type = HDA_FIXUP_VERBS,
7710 .v.verbs = (const struct hda_verb[]) {
7711 /* Set EAPD high */
7712 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7713 { 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
7714 { }
7715 },
7716 .chained = true,
7717 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7718 },
446b8185
KY
7719 [ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
7720 .type = HDA_FIXUP_FUNC,
7721 .v.func = alc_fixup_headset_jack,
7722 .chained = true,
7723 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7724 },
f1d4e28b
KY
7725};
7726
1d045db9 7727static const struct snd_pci_quirk alc269_fixup_tbl[] = {
a6b92b66 7728 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
693b613d
DH
7729 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
7730 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
aaedfb47 7731 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
7819717b
TI
7732 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
7733 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
aaedfb47
DH
7734 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
7735 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
02322ac9 7736 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
b1e8972e 7737 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
1a22e775 7738 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
705b65f1 7739 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
6e15d126 7740 SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
b9c2fa52 7741 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
c7531e31
CC
7742 SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
7743 SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
e2a829b3 7744 SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
8eae7e9b 7745 SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
781c90c0 7746 SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
667a8f73
JHP
7747 SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
7748 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
7749 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
2733cceb 7750 SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
ea5c7eba 7751 SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
cbc05fd6 7752 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
f50a121d 7753 SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
aaedfb47 7754 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
6ed1131f 7755 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
86f799b8 7756 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
cf52103a 7757 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
8b99aba7
TI
7758 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
7759 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
0f4881dc 7760 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
73bdd597
DH
7761 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
7762 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
7763 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
0f4881dc
DH
7764 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
7765 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
98070576 7766 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
4275554d 7767 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
0f4881dc 7768 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
a22aa26f
KY
7769 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
7770 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
831bfdf9 7771 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
afecb146 7772 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
3a05d12f 7773 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
8b72415d 7774 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
b734304f
KY
7775 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
7776 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
c04017ea
DH
7777 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
7778 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
7779 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
7780 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
7781 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
fd06c77e 7782 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
3b43b71f 7783 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
c0ca5ece 7784 SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
709ae62e 7785 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
dd9aa335 7786 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
e312a869 7787 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
493de342 7788 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
5f364135 7789 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
40e2c4e5
KY
7790 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
7791 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
f0ba9d69
KY
7792 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
7793 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
ae104a21 7794 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
136824ef 7795 SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
da484d00 7796 SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
c2a7c55a 7797 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
e79c2269
KY
7798 SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
7799 SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
78def224
KY
7800 SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
7801 SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
a22aa26f
KY
7802 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
7803 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
08fb0d0e 7804 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
9f5c6faf 7805 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
8e35cd4a 7806 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
33f4acd3 7807 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
c60666bd 7808 /* ALC282 */
7976eb49 7809 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8a02b164 7810 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8a02b164 7811 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9c5dc3bf
KY
7812 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
7813 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
7814 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
7815 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9c5dc3bf 7816 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
c60666bd 7817 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd
KY
7818 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7819 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8a02b164 7820 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
eaa8e5ef 7821 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
b4b33f9d 7822 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
3271cb22 7823 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
c60666bd 7824 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd
KY
7825 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7826 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7827 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 7828 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
98973f2f 7829 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
9c5dc3bf
KY
7830 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7831 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
c60666bd 7832 /* ALC290 */
9c5dc3bf 7833 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9c5dc3bf 7834 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9c5dc3bf 7835 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9c5dc3bf
KY
7836 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7837 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7838 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7839 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7840 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9c5dc3bf 7841 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
04d5466a 7842 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
c60666bd 7843 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd
KY
7844 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7845 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7846 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9c5dc3bf
KY
7847 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7848 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9c5dc3bf 7849 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
c60666bd 7850 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 7851 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 7852 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd
KY
7853 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7854 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd
KY
7855 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7856 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 7857 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8a02b164
KY
7858 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7859 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7860 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7861 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
f883982d 7862 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
167897f4
JK
7863 SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
7864 SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
563785ed 7865 SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
e549d190 7866 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
bbf8ff6b 7867 SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
167897f4
JK
7868 SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
7869 SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
56e40eb6 7870 SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
190d0381 7871 SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
d33cd42d 7872 SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
b2c22910
KHF
7873 SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
7874 SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
56496253 7875 SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
08befca4 7876 SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
431e76c3 7877 SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
24164f43 7878 SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
c1732ede 7879 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
7bba2157 7880 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
3e0d611b 7881 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9cf6533e 7882 SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
c1732ede 7883 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
4eab0ea1 7884 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
3e0d611b 7885 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4eab0ea1
TI
7886 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
7887 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
7888 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
c1732ede
CC
7889 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
7890 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
7891 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
2cede303 7892 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
23870831 7893 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
3e0d611b 7894 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
48e01504 7895 SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
8c8967a7 7896 SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
4963d66b 7897 SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
158ae2f5 7898 SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
8b33a134 7899 SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
7900e817 7900 SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
017f2a10 7901 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
28e8af8a 7902 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
1b94e59d 7903 SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
693b613d 7904 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
615966ad 7905 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
4eab0ea1 7906 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
c1732ede 7907 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
ef9ce66f 7908 SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
4b43d05a 7909 SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
293a92c1 7910 SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
c3cdf189 7911 SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
eeed4cd1 7912 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
adabb3ec
TI
7913 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
7914 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
7915 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
7916 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
d240d1dc 7917 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
f88abaa0 7918 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
88cfcf86 7919 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
1d045db9
TI
7920 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
7921 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
7922 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
e9bd7d5c 7923 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
24519911 7924 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
4df3fd17 7925 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
cc7016ab 7926 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
88776f36 7927 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
fdcc968a 7928 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
2041d564 7929 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
b84e8436 7930 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
6fa38ef1 7931 SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
0fca97a2 7932 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
a33cc48d 7933 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
14425f1f
MP
7934 SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
7935 SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
f70fff83 7936 SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
8bcea6cb
AC
7937 SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
7938 SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
823ff161 7939 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
568e4e82 7940 SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
abaa2274
AA
7941 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
7942 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
8cd65271 7943 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
b5acfe15 7944 SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
89e3a568 7945 SND_PCI_QUIRK(0x1558, 0x1325, "System76 Darter Pro (darp5)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15
PH
7946 SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7947 SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7948 SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7949 SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7950 SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7951 SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7952 SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7953 SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7954 SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7955 SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7956 SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7957 SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7958 SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7959 SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7960 SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7961 SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7962 SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7963 SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7964 SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7965 SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7966 SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7967 SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7968 SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7969 SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7970 SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7971 SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7972 SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
80a5052d 7973 SND_PCI_QUIRK(0x1558, 0x8550, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
891afcf2
JS
7974 SND_PCI_QUIRK(0x1558, 0x8551, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7975 SND_PCI_QUIRK(0x1558, 0x8560, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
7976 SND_PCI_QUIRK(0x1558, 0x8561, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
b5acfe15
PH
7977 SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7978 SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7979 SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7980 SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7981 SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7982 SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7983 SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7984 SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7985 SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7986 SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL53RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
ca169cc2 7987 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
ef0b3203 7988 SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
1d045db9
TI
7989 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
7990 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
7991 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
7992 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
7993 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
b590b38c 7994 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
c8415a48 7995 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
84f98fdf 7996 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
4407be6b 7997 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
108cc108 7998 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
aaedfb47 7999 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
9a811230 8000 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
1c37c223 8001 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
a12137e7 8002 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
59a51a6b 8003 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
6d16941a 8004 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
7c21539c 8005 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
a4a9e082 8006 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
b6903c0e 8007 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
d05ea7da 8008 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
c0278669 8009 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
61fcf8ec
KY
8010 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8011 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
dab38e43 8012 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
c636b95e 8013 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
61fcf8ec
KY
8014 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
8015 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8016 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
e4c07b3b 8017 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
61fcf8ec
KY
8018 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8019 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8020 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
85981dfd 8021 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9774dc21 8022 SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
ca707b3f 8023 SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
446b8185
KY
8024 SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
8025 SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
3694cb29 8026 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
6ef2f68f 8027 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
f33f79f3 8028 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
bef33e19 8029 SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
e41fc8c5 8030 SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
65811834 8031 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
8da5bbfc 8032 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
2a36c16e 8033 SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
8a6c55d0
AM
8034 SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
8035 SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
56f27013 8036 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
fedb2245 8037 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
56df90b6 8038 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
a4a9e082 8039 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
1bb3e062 8040 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
c497d9f9 8041 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
cd5302c0 8042 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
f2aa1110 8043 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
80b311d3 8044 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
09ea9976 8045 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
037e1197 8046 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
23adc192 8047 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
0f087ee3 8048 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
9cd25743 8049 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
0f087ee3 8050 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
61fcf8ec
KY
8051 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8052 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8053 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
cd5302c0 8054 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
61fcf8ec
KY
8055 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8056 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
012e7eb1 8057 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
1d045db9 8058 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
0fbf21c3 8059 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
f1ec5be1
HC
8060 SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
8061 SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
8062 SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
02b504d9 8063 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
fc19d559 8064 SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
695d1ec3 8065 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
bd9c10bc 8066 SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
f1ec5be1
HC
8067 SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
8068 SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
e2d2fded 8069 SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
a4297b5d 8070
a7f3eedc 8071#if 0
a4297b5d
TI
8072 /* Below is a quirk table taken from the old code.
8073 * Basically the device should work as is without the fixup table.
8074 * If BIOS doesn't give a proper info, enable the corresponding
8075 * fixup entry.
7d7eb9ea 8076 */
a4297b5d
TI
8077 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
8078 ALC269_FIXUP_AMIC),
8079 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
a4297b5d
TI
8080 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
8081 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
8082 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
8083 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
8084 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
8085 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
8086 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
8087 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
8088 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
8089 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
8090 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
8091 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
8092 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
8093 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
8094 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
8095 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
8096 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
8097 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
8098 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
8099 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
8100 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
8101 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
8102 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
8103 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
8104 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
8105 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
8106 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
8107 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
8108 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
8109 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
8110 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
8111 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
8112 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
8113 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
8114 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
8115 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
8116 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
8117 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
8118#endif
8119 {}
8120};
8121
214eef76
DH
8122static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
8123 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
8124 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
8125 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
8126 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
0fbf21c3 8127 SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
214eef76
DH
8128 {}
8129};
8130
1727a771 8131static const struct hda_model_fixup alc269_fixup_models[] = {
a4297b5d
TI
8132 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
8133 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
6e72aa5f
TI
8134 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
8135 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
8136 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
7c478f03 8137 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
b016951e
TI
8138 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
8139 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
108cc108 8140 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
b590b38c 8141 {.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
9f5c6faf 8142 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
04d5466a 8143 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
e32aa85a
DH
8144 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
8145 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
a26d96c7
TI
8146 {.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
8147 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
be8ef16a 8148 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
0202e99c 8149 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
1c37c223 8150 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
9a811230 8151 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
c636b95e 8152 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
399c01aa 8153 {.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
a26d96c7 8154 {.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
ba90d6a6 8155 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
28d1d6d2 8156 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
a26d96c7
TI
8157 {.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
8158 {.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
8159 {.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
8160 {.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
8161 {.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
8162 {.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
8163 {.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
8164 {.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
8165 {.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
8166 {.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
8167 {.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
8168 {.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
8169 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
8170 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
8171 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
8172 {.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
8173 {.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
8174 {.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
8175 {.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
8176 {.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
8177 {.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
8178 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
8179 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
8180 {.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
8181 {.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
8182 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
8183 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
8184 {.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
8185 {.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
8186 {.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
8187 {.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
8188 {.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
8189 {.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
8190 {.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
8191 {.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
8192 {.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
8193 {.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
8194 {.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
8195 {.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
8196 {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
b3802783 8197 {.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
a26d96c7
TI
8198 {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
8199 {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
8200 {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
8201 {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
8202 {.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
8203 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
8204 {.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
8205 {.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
8206 {.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
8207 {.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
8208 {.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
8209 {.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
8210 {.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
8211 {.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
8212 {.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
a26d96c7
TI
8213 {.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
8214 {.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
8215 {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
82aa0d7e 8216 {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
a26d96c7 8217 {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
d2cd795c 8218 {.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
a26d96c7
TI
8219 {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
8220 {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
8221 {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
8222 {.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
8223 {.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
8224 {.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
8225 {.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
8226 {.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
8227 {.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
8228 {.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
8229 {.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
8230 {.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
8231 {.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
8232 {.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
8233 {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
8234 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
8235 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
8983eb60
KY
8236 {.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
8237 {.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
e2a829b3 8238 {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
a2ef03fe 8239 {.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
bd9c10bc 8240 {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
23dc9586 8241 {.id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc298-samsung-headphone"},
fc19d559 8242 {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
13468bfa 8243 {.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
1d045db9 8244 {}
6dda9f4a 8245};
cfc5a845 8246#define ALC225_STANDARD_PINS \
cfc5a845 8247 {0x21, 0x04211020}
6dda9f4a 8248
e8191a8e
HW
8249#define ALC256_STANDARD_PINS \
8250 {0x12, 0x90a60140}, \
8251 {0x14, 0x90170110}, \
e8191a8e
HW
8252 {0x21, 0x02211020}
8253
fea185e2 8254#define ALC282_STANDARD_PINS \
11580297 8255 {0x14, 0x90170110}
e1e62b98 8256
fea185e2 8257#define ALC290_STANDARD_PINS \
11580297 8258 {0x12, 0x99a30130}
fea185e2
DH
8259
8260#define ALC292_STANDARD_PINS \
8261 {0x14, 0x90170110}, \
11580297 8262 {0x15, 0x0221401f}
977e6276 8263
3f640970
HW
8264#define ALC295_STANDARD_PINS \
8265 {0x12, 0xb7a60130}, \
8266 {0x14, 0x90170110}, \
3f640970
HW
8267 {0x21, 0x04211020}
8268
703867e2
WS
8269#define ALC298_STANDARD_PINS \
8270 {0x12, 0x90a60130}, \
8271 {0x21, 0x03211020}
8272
e1918938 8273static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
8a328ac1
KY
8274 SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
8275 {0x14, 0x01014020},
8276 {0x17, 0x90170110},
8277 {0x18, 0x02a11030},
8278 {0x19, 0x0181303F},
8279 {0x21, 0x0221102f}),
5824ce8d
CC
8280 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
8281 {0x12, 0x90a601c0},
8282 {0x14, 0x90171120},
8283 {0x21, 0x02211030}),
615966ad
CC
8284 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
8285 {0x14, 0x90170110},
8286 {0x1b, 0x90a70130},
8287 {0x21, 0x03211020}),
8288 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
8289 {0x1a, 0x90a70130},
8290 {0x1b, 0x90170110},
8291 {0x21, 0x03211020}),
2ae95577 8292 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
cfc5a845 8293 ALC225_STANDARD_PINS,
8a132099 8294 {0x12, 0xb7a60130},
cfc5a845 8295 {0x14, 0x901701a0}),
2ae95577 8296 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
cfc5a845 8297 ALC225_STANDARD_PINS,
8a132099 8298 {0x12, 0xb7a60130},
cfc5a845 8299 {0x14, 0x901701b0}),
8a132099
HW
8300 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
8301 ALC225_STANDARD_PINS,
8302 {0x12, 0xb7a60150},
8303 {0x14, 0x901701a0}),
8304 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
8305 ALC225_STANDARD_PINS,
8306 {0x12, 0xb7a60150},
8307 {0x14, 0x901701b0}),
8308 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
8309 ALC225_STANDARD_PINS,
8310 {0x12, 0xb7a60130},
8311 {0x1b, 0x90170110}),
0ce48e17
KHF
8312 SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
8313 {0x1b, 0x01111010},
8314 {0x1e, 0x01451130},
8315 {0x21, 0x02211020}),
986376b6
HW
8316 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
8317 {0x12, 0x90a60140},
8318 {0x14, 0x90170110},
8319 {0x19, 0x02a11030},
8320 {0x21, 0x02211020}),
e41fc8c5
HW
8321 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
8322 {0x14, 0x90170110},
8323 {0x19, 0x02a11030},
8324 {0x1a, 0x02a11040},
8325 {0x1b, 0x01014020},
8326 {0x21, 0x0221101f}),
d06fb562
HW
8327 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
8328 {0x14, 0x90170110},
8329 {0x19, 0x02a11030},
8330 {0x1a, 0x02a11040},
8331 {0x1b, 0x01011020},
8332 {0x21, 0x0221101f}),
c6b17f10
HW
8333 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
8334 {0x14, 0x90170110},
8335 {0x19, 0x02a11020},
8336 {0x1a, 0x02a11030},
8337 {0x21, 0x0221101f}),
c77900e6 8338 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
c77900e6 8339 {0x14, 0x90170110},
c77900e6 8340 {0x21, 0x02211020}),
86c72d1c
HW
8341 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8342 {0x14, 0x90170130},
8343 {0x21, 0x02211040}),
76c2132e
DH
8344 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8345 {0x12, 0x90a60140},
8346 {0x14, 0x90170110},
76c2132e
DH
8347 {0x21, 0x02211020}),
8348 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8349 {0x12, 0x90a60160},
8350 {0x14, 0x90170120},
76c2132e 8351 {0x21, 0x02211030}),
392c9da2
HW
8352 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8353 {0x14, 0x90170110},
8354 {0x1b, 0x02011020},
8355 {0x21, 0x0221101f}),
6aecd871
HW
8356 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8357 {0x14, 0x90170110},
8358 {0x1b, 0x01011020},
8359 {0x21, 0x0221101f}),
cba59972 8360 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
cba59972 8361 {0x14, 0x90170130},
cba59972 8362 {0x1b, 0x01014020},
cba59972 8363 {0x21, 0x0221103f}),
6aecd871
HW
8364 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8365 {0x14, 0x90170130},
8366 {0x1b, 0x01011020},
8367 {0x21, 0x0221103f}),
59ec4b57
HW
8368 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8369 {0x14, 0x90170130},
8370 {0x1b, 0x02011020},
8371 {0x21, 0x0221103f}),
e9c28e16 8372 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
e9c28e16 8373 {0x14, 0x90170150},
e9c28e16 8374 {0x1b, 0x02011020},
e9c28e16
WS
8375 {0x21, 0x0221105f}),
8376 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
e9c28e16 8377 {0x14, 0x90170110},
e9c28e16 8378 {0x1b, 0x01014020},
e9c28e16 8379 {0x21, 0x0221101f}),
76c2132e
DH
8380 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8381 {0x12, 0x90a60160},
8382 {0x14, 0x90170120},
8383 {0x17, 0x90170140},
76c2132e
DH
8384 {0x21, 0x0321102f}),
8385 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8386 {0x12, 0x90a60160},
8387 {0x14, 0x90170130},
76c2132e
DH
8388 {0x21, 0x02211040}),
8389 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8390 {0x12, 0x90a60160},
8391 {0x14, 0x90170140},
76c2132e
DH
8392 {0x21, 0x02211050}),
8393 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8394 {0x12, 0x90a60170},
8395 {0x14, 0x90170120},
76c2132e
DH
8396 {0x21, 0x02211030}),
8397 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8398 {0x12, 0x90a60170},
8399 {0x14, 0x90170130},
76c2132e 8400 {0x21, 0x02211040}),
0a1f90a9
HW
8401 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8402 {0x12, 0x90a60170},
8403 {0x14, 0x90171130},
8404 {0x21, 0x02211040}),
70658b99 8405 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
70658b99
HW
8406 {0x12, 0x90a60170},
8407 {0x14, 0x90170140},
70658b99 8408 {0x21, 0x02211050}),
9b5a4e39 8409 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9b5a4e39
DH
8410 {0x12, 0x90a60180},
8411 {0x14, 0x90170130},
9b5a4e39 8412 {0x21, 0x02211040}),
f90d83b3
AK
8413 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8414 {0x12, 0x90a60180},
8415 {0x14, 0x90170120},
8416 {0x21, 0x02211030}),
989dbe4a
HW
8417 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8418 {0x1b, 0x01011020},
8419 {0x21, 0x02211010}),
c1732ede
CC
8420 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
8421 {0x14, 0x90170110},
8422 {0x1b, 0x90a70130},
8423 {0x21, 0x04211020}),
8424 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
8425 {0x14, 0x90170110},
8426 {0x1b, 0x90a70130},
8427 {0x21, 0x03211020}),
a806ef1c
CC
8428 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
8429 {0x12, 0x90a60130},
8430 {0x14, 0x90170110},
8431 {0x21, 0x03211020}),
6ac371aa
JHP
8432 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
8433 {0x12, 0x90a60130},
8434 {0x14, 0x90170110},
8435 {0x21, 0x04211020}),
e1037354
JHP
8436 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
8437 {0x1a, 0x90a70130},
8438 {0x1b, 0x90170110},
8439 {0x21, 0x03211020}),
8a8de09c
KY
8440 SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
8441 {0x17, 0x90170110},
8442 {0x19, 0x03a11030},
8443 {0x21, 0x03211020}),
cf51eb9d
DH
8444 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
8445 {0x12, 0x90a60130},
cf51eb9d
DH
8446 {0x14, 0x90170110},
8447 {0x15, 0x0421101f},
11580297 8448 {0x1a, 0x04a11020}),
0279661b
HW
8449 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
8450 {0x12, 0x90a60140},
0279661b
HW
8451 {0x14, 0x90170110},
8452 {0x15, 0x0421101f},
0279661b 8453 {0x18, 0x02811030},
0279661b 8454 {0x1a, 0x04a1103f},
11580297 8455 {0x1b, 0x02011020}),
42304474 8456 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 8457 ALC282_STANDARD_PINS,
42304474 8458 {0x12, 0x99a30130},
42304474 8459 {0x19, 0x03a11020},
42304474 8460 {0x21, 0x0321101f}),
2c609999 8461 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 8462 ALC282_STANDARD_PINS,
2c609999 8463 {0x12, 0x99a30130},
2c609999 8464 {0x19, 0x03a11020},
2c609999
HW
8465 {0x21, 0x03211040}),
8466 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 8467 ALC282_STANDARD_PINS,
2c609999 8468 {0x12, 0x99a30130},
2c609999 8469 {0x19, 0x03a11030},
2c609999
HW
8470 {0x21, 0x03211020}),
8471 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 8472 ALC282_STANDARD_PINS,
2c609999 8473 {0x12, 0x99a30130},
2c609999 8474 {0x19, 0x04a11020},
2c609999 8475 {0x21, 0x0421101f}),
200afc09 8476 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
aec856d0 8477 ALC282_STANDARD_PINS,
200afc09 8478 {0x12, 0x90a60140},
200afc09 8479 {0x19, 0x04a11030},
200afc09 8480 {0x21, 0x04211020}),
76c2132e 8481 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 8482 ALC282_STANDARD_PINS,
76c2132e 8483 {0x12, 0x90a60130},
76c2132e
DH
8484 {0x21, 0x0321101f}),
8485 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
8486 {0x12, 0x90a60160},
8487 {0x14, 0x90170120},
76c2132e 8488 {0x21, 0x02211030}),
bc262179 8489 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 8490 ALC282_STANDARD_PINS,
bc262179 8491 {0x12, 0x90a60130},
bc262179 8492 {0x19, 0x03a11020},
bc262179 8493 {0x21, 0x0321101f}),
c8c6ee61 8494 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
c4cfcf6f
HW
8495 {0x12, 0x90a60130},
8496 {0x14, 0x90170110},
8497 {0x19, 0x04a11040},
8498 {0x21, 0x04211020}),
33aaebd4
CC
8499 SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
8500 {0x12, 0x90a60130},
8501 {0x17, 0x90170110},
8502 {0x21, 0x02211020}),
d44a6864 8503 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
e1e62b98 8504 {0x12, 0x90a60120},
e1e62b98 8505 {0x14, 0x90170110},
e1e62b98 8506 {0x21, 0x0321101f}),
e4442bcf 8507 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 8508 ALC290_STANDARD_PINS,
e4442bcf 8509 {0x15, 0x04211040},
e4442bcf 8510 {0x18, 0x90170112},
11580297 8511 {0x1a, 0x04a11020}),
e4442bcf 8512 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 8513 ALC290_STANDARD_PINS,
e4442bcf 8514 {0x15, 0x04211040},
e4442bcf 8515 {0x18, 0x90170110},
11580297 8516 {0x1a, 0x04a11020}),
e4442bcf 8517 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 8518 ALC290_STANDARD_PINS,
e4442bcf 8519 {0x15, 0x0421101f},
11580297 8520 {0x1a, 0x04a11020}),
e4442bcf 8521 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 8522 ALC290_STANDARD_PINS,
e4442bcf 8523 {0x15, 0x04211020},
11580297 8524 {0x1a, 0x04a11040}),
e4442bcf 8525 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 8526 ALC290_STANDARD_PINS,
e4442bcf
HW
8527 {0x14, 0x90170110},
8528 {0x15, 0x04211020},
11580297 8529 {0x1a, 0x04a11040}),
e4442bcf 8530 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 8531 ALC290_STANDARD_PINS,
e4442bcf
HW
8532 {0x14, 0x90170110},
8533 {0x15, 0x04211020},
11580297 8534 {0x1a, 0x04a11020}),
e4442bcf 8535 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 8536 ALC290_STANDARD_PINS,
e4442bcf
HW
8537 {0x14, 0x90170110},
8538 {0x15, 0x0421101f},
11580297 8539 {0x1a, 0x04a11020}),
e8818fa8 8540 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
aec856d0 8541 ALC292_STANDARD_PINS,
e8818fa8 8542 {0x12, 0x90a60140},
e8818fa8 8543 {0x16, 0x01014020},
11580297 8544 {0x19, 0x01a19030}),
e8818fa8 8545 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
aec856d0 8546 ALC292_STANDARD_PINS,
e8818fa8 8547 {0x12, 0x90a60140},
e8818fa8
HW
8548 {0x16, 0x01014020},
8549 {0x18, 0x02a19031},
11580297 8550 {0x19, 0x01a1903e}),
76c2132e 8551 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
aec856d0 8552 ALC292_STANDARD_PINS,
11580297 8553 {0x12, 0x90a60140}),
76c2132e 8554 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 8555 ALC292_STANDARD_PINS,
76c2132e 8556 {0x13, 0x90a60140},
76c2132e 8557 {0x16, 0x21014020},
11580297 8558 {0x19, 0x21a19030}),
e03fdbde 8559 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 8560 ALC292_STANDARD_PINS,
11580297 8561 {0x13, 0x90a60140}),
d8ae458e
CC
8562 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
8563 {0x14, 0x90170110},
8564 {0x1b, 0x90a70130},
8565 {0x21, 0x04211020}),
8bb37a2a
JHP
8566 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
8567 {0x12, 0x90a60130},
8568 {0x17, 0x90170110},
8569 {0x21, 0x03211020}),
0bea4cc8
JHP
8570 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
8571 {0x12, 0x90a60130},
8572 {0x17, 0x90170110},
8573 {0x21, 0x04211020}),
3887c26c
TI
8574 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
8575 {0x12, 0x90a60130},
8576 {0x17, 0x90170110},
8577 {0x21, 0x03211020}),
9e43342b 8578 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
ad97d667
JHP
8579 {0x12, 0x90a60120},
8580 {0x17, 0x90170110},
8581 {0x21, 0x04211030}),
8582 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
9e43342b
CC
8583 {0x12, 0x90a60130},
8584 {0x17, 0x90170110},
8585 {0x21, 0x03211020}),
8586 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
8587 {0x12, 0x90a60130},
8588 {0x17, 0x90170110},
8589 {0x21, 0x03211020}),
fbc57129 8590 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
0a29c57b
KY
8591 {0x14, 0x90170110},
8592 {0x21, 0x04211020}),
fbc57129
KY
8593 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
8594 {0x14, 0x90170110},
8595 {0x21, 0x04211030}),
3f640970 8596 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
f771d5bb
HW
8597 ALC295_STANDARD_PINS,
8598 {0x17, 0x21014020},
8599 {0x18, 0x21a19030}),
8600 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
8601 ALC295_STANDARD_PINS,
8602 {0x17, 0x21014040},
8603 {0x18, 0x21a19050}),
3f307834
HW
8604 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
8605 ALC295_STANDARD_PINS),
9f502ff5
TI
8606 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
8607 ALC298_STANDARD_PINS,
8608 {0x17, 0x90170110}),
977e6276 8609 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
703867e2
WS
8610 ALC298_STANDARD_PINS,
8611 {0x17, 0x90170140}),
8612 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
8613 ALC298_STANDARD_PINS,
9f502ff5 8614 {0x17, 0x90170150}),
9f1bc2c4
KHF
8615 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
8616 {0x12, 0xb7a60140},
8617 {0x13, 0xb7a60150},
8618 {0x17, 0x90170110},
8619 {0x1a, 0x03011020},
8620 {0x21, 0x03211030}),
54324221
JM
8621 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
8622 {0x12, 0xb7a60140},
8623 {0x17, 0x90170110},
8624 {0x1a, 0x03a11030},
8625 {0x21, 0x03211020}),
fcc6c877
KY
8626 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
8627 ALC225_STANDARD_PINS,
8628 {0x12, 0xb7a60130},
fcc6c877 8629 {0x17, 0x90170110}),
573fcbfd
HW
8630 SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
8631 {0x14, 0x01014010},
8632 {0x17, 0x90170120},
8633 {0x18, 0x02a11030},
8634 {0x19, 0x02a1103f},
8635 {0x21, 0x0221101f}),
e1918938
HW
8636 {}
8637};
6dda9f4a 8638
7c0a6939
HW
8639/* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
8640 * more machines, don't need to match all valid pins, just need to match
8641 * all the pins defined in the tbl. Just because of this reason, it is possible
8642 * that a single machine matches multiple tbls, so there is one limitation:
8643 * at most one tbl is allowed to define for the same vendor and same codec
8644 */
8645static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
8646 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
8647 {0x19, 0x40000000},
8648 {0x1b, 0x40000000}),
aed8c7f4
HW
8649 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8650 {0x19, 0x40000000},
8651 {0x1a, 0x40000000}),
d64ebdbf
HW
8652 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8653 {0x19, 0x40000000},
8654 {0x1a, 0x40000000}),
5815bdfd
HW
8655 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
8656 {0x19, 0x40000000},
8657 {0x1a, 0x40000000}),
7c0a6939
HW
8658 {}
8659};
8660
546bb678 8661static void alc269_fill_coef(struct hda_codec *codec)
1d045db9 8662{
526af6eb 8663 struct alc_spec *spec = codec->spec;
1d045db9 8664 int val;
ebb83eeb 8665
526af6eb 8666 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
546bb678 8667 return;
526af6eb 8668
1bb7e43e 8669 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
1d045db9
TI
8670 alc_write_coef_idx(codec, 0xf, 0x960b);
8671 alc_write_coef_idx(codec, 0xe, 0x8817);
8672 }
ebb83eeb 8673
1bb7e43e 8674 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
1d045db9
TI
8675 alc_write_coef_idx(codec, 0xf, 0x960b);
8676 alc_write_coef_idx(codec, 0xe, 0x8814);
8677 }
ebb83eeb 8678
1bb7e43e 8679 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
1d045db9 8680 /* Power up output pin */
98b24883 8681 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
1d045db9 8682 }
ebb83eeb 8683
1bb7e43e 8684 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
1d045db9 8685 val = alc_read_coef_idx(codec, 0xd);
f3ee07d8 8686 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
1d045db9
TI
8687 /* Capless ramp up clock control */
8688 alc_write_coef_idx(codec, 0xd, val | (1<<10));
8689 }
8690 val = alc_read_coef_idx(codec, 0x17);
f3ee07d8 8691 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
1d045db9
TI
8692 /* Class D power on reset */
8693 alc_write_coef_idx(codec, 0x17, val | (1<<7));
8694 }
8695 }
ebb83eeb 8696
98b24883
TI
8697 /* HP */
8698 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
1d045db9 8699}
a7f2371f 8700
1d045db9
TI
8701/*
8702 */
1d045db9
TI
8703static int patch_alc269(struct hda_codec *codec)
8704{
8705 struct alc_spec *spec;
3de95173 8706 int err;
f1d4e28b 8707
3de95173 8708 err = alc_alloc_spec(codec, 0x0b);
e16fb6d1 8709 if (err < 0)
3de95173
TI
8710 return err;
8711
8712 spec = codec->spec;
08c189f2 8713 spec->gen.shared_mic_vref_pin = 0x18;
317d9313 8714 codec->power_save_node = 0;
e16fb6d1 8715
225068ab
TI
8716#ifdef CONFIG_PM
8717 codec->patch_ops.suspend = alc269_suspend;
8718 codec->patch_ops.resume = alc269_resume;
8719#endif
c2d6af53
KY
8720 spec->shutup = alc_default_shutup;
8721 spec->init_hook = alc_default_init;
225068ab 8722
7639a06c 8723 switch (codec->core.vendor_id) {
065380f0 8724 case 0x10ec0269:
1d045db9 8725 spec->codec_variant = ALC269_TYPE_ALC269VA;
1bb7e43e
TI
8726 switch (alc_get_coef0(codec) & 0x00f0) {
8727 case 0x0010:
5100cd07
TI
8728 if (codec->bus->pci &&
8729 codec->bus->pci->subsystem_vendor == 0x1025 &&
e16fb6d1 8730 spec->cdefine.platform_type == 1)
20ca0c35 8731 err = alc_codec_rename(codec, "ALC271X");
1d045db9 8732 spec->codec_variant = ALC269_TYPE_ALC269VB;
1bb7e43e
TI
8733 break;
8734 case 0x0020:
5100cd07
TI
8735 if (codec->bus->pci &&
8736 codec->bus->pci->subsystem_vendor == 0x17aa &&
e16fb6d1 8737 codec->bus->pci->subsystem_device == 0x21f3)
20ca0c35 8738 err = alc_codec_rename(codec, "ALC3202");
1d045db9 8739 spec->codec_variant = ALC269_TYPE_ALC269VC;
1bb7e43e 8740 break;
adcc70b2
KY
8741 case 0x0030:
8742 spec->codec_variant = ALC269_TYPE_ALC269VD;
8743 break;
1bb7e43e 8744 default:
1d045db9 8745 alc_fix_pll_init(codec, 0x20, 0x04, 15);
1bb7e43e 8746 }
e16fb6d1
TI
8747 if (err < 0)
8748 goto error;
c2d6af53 8749 spec->shutup = alc269_shutup;
546bb678 8750 spec->init_hook = alc269_fill_coef;
1d045db9 8751 alc269_fill_coef(codec);
065380f0
KY
8752 break;
8753
8754 case 0x10ec0280:
8755 case 0x10ec0290:
8756 spec->codec_variant = ALC269_TYPE_ALC280;
8757 break;
8758 case 0x10ec0282:
065380f0 8759 spec->codec_variant = ALC269_TYPE_ALC282;
7b5c7a02
KY
8760 spec->shutup = alc282_shutup;
8761 spec->init_hook = alc282_init;
065380f0 8762 break;
2af02be7
KY
8763 case 0x10ec0233:
8764 case 0x10ec0283:
8765 spec->codec_variant = ALC269_TYPE_ALC283;
8766 spec->shutup = alc283_shutup;
8767 spec->init_hook = alc283_init;
8768 break;
065380f0
KY
8769 case 0x10ec0284:
8770 case 0x10ec0292:
8771 spec->codec_variant = ALC269_TYPE_ALC284;
8772 break;
161ebf29 8773 case 0x10ec0293:
4731d5de 8774 spec->codec_variant = ALC269_TYPE_ALC293;
161ebf29 8775 break;
7fc7d047 8776 case 0x10ec0286:
7c665932 8777 case 0x10ec0288:
7fc7d047
KY
8778 spec->codec_variant = ALC269_TYPE_ALC286;
8779 break;
506b62c3
KY
8780 case 0x10ec0298:
8781 spec->codec_variant = ALC269_TYPE_ALC298;
8782 break;
ea04a1db 8783 case 0x10ec0235:
1d04c9de
KY
8784 case 0x10ec0255:
8785 spec->codec_variant = ALC269_TYPE_ALC255;
ab3b8e51
KY
8786 spec->shutup = alc256_shutup;
8787 spec->init_hook = alc256_init;
1d04c9de 8788 break;
736f20a7 8789 case 0x10ec0236:
4344aec8
KY
8790 case 0x10ec0256:
8791 spec->codec_variant = ALC269_TYPE_ALC256;
4a219ef8
KY
8792 spec->shutup = alc256_shutup;
8793 spec->init_hook = alc256_init;
7d1b6e29 8794 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
4344aec8 8795 break;
f429e7e4
KY
8796 case 0x10ec0257:
8797 spec->codec_variant = ALC269_TYPE_ALC257;
88d42b2b
KY
8798 spec->shutup = alc256_shutup;
8799 spec->init_hook = alc256_init;
f429e7e4
KY
8800 spec->gen.mixer_nid = 0;
8801 break;
0a6f0600 8802 case 0x10ec0215:
7fbdcd83 8803 case 0x10ec0245:
0a6f0600 8804 case 0x10ec0285:
630e3612 8805 case 0x10ec0287:
0a6f0600
KY
8806 case 0x10ec0289:
8807 spec->codec_variant = ALC269_TYPE_ALC215;
1b6832be
KY
8808 spec->shutup = alc225_shutup;
8809 spec->init_hook = alc225_init;
0a6f0600
KY
8810 spec->gen.mixer_nid = 0;
8811 break;
4231430d 8812 case 0x10ec0225:
7d727869 8813 case 0x10ec0295:
28f1f9b2 8814 case 0x10ec0299:
4231430d 8815 spec->codec_variant = ALC269_TYPE_ALC225;
da911b1f
KY
8816 spec->shutup = alc225_shutup;
8817 spec->init_hook = alc225_init;
c1350bff 8818 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
4231430d 8819 break;
dcd4f0db
KY
8820 case 0x10ec0234:
8821 case 0x10ec0274:
8822 case 0x10ec0294:
8823 spec->codec_variant = ALC269_TYPE_ALC294;
532a7784 8824 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
71683c32 8825 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
693abe11 8826 spec->init_hook = alc294_init;
dcd4f0db 8827 break;
1078bef0
KY
8828 case 0x10ec0300:
8829 spec->codec_variant = ALC269_TYPE_ALC300;
8830 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
dcd4f0db 8831 break;
f0778871
KY
8832 case 0x10ec0623:
8833 spec->codec_variant = ALC269_TYPE_ALC623;
8834 break;
6fbae35a
KY
8835 case 0x10ec0700:
8836 case 0x10ec0701:
8837 case 0x10ec0703:
83629532 8838 case 0x10ec0711:
6fbae35a
KY
8839 spec->codec_variant = ALC269_TYPE_ALC700;
8840 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
2d7fe618 8841 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
693abe11 8842 spec->init_hook = alc294_init;
6fbae35a
KY
8843 break;
8844
1d045db9 8845 }
6dda9f4a 8846
ad60d502 8847 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
97a26570 8848 spec->has_alc5505_dsp = 1;
ad60d502
KY
8849 spec->init_hook = alc5505_dsp_init;
8850 }
8851
c9af753f
TI
8852 alc_pre_init(codec);
8853
efe55732
TI
8854 snd_hda_pick_fixup(codec, alc269_fixup_models,
8855 alc269_fixup_tbl, alc269_fixups);
0fc1e447 8856 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
7c0a6939 8857 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
efe55732
TI
8858 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
8859 alc269_fixups);
8860 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
8861
8862 alc_auto_parse_customize_define(codec);
8863
8864 if (has_cdefine_beep(codec))
8865 spec->gen.beep_nid = 0x01;
8866
a4297b5d
TI
8867 /* automatic parse from the BIOS config */
8868 err = alc269_parse_auto_config(codec);
e16fb6d1
TI
8869 if (err < 0)
8870 goto error;
6dda9f4a 8871
fea80fae
TI
8872 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
8873 err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
8874 if (err < 0)
8875 goto error;
8876 }
f1d4e28b 8877
1727a771 8878 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 8879
1d045db9 8880 return 0;
e16fb6d1
TI
8881
8882 error:
8883 alc_free(codec);
8884 return err;
1d045db9 8885}
f1d4e28b 8886
1d045db9
TI
8887/*
8888 * ALC861
8889 */
622e84cd 8890
1d045db9 8891static int alc861_parse_auto_config(struct hda_codec *codec)
6dda9f4a 8892{
1d045db9 8893 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
3e6179b8
TI
8894 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
8895 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
604401a9
TI
8896}
8897
1d045db9
TI
8898/* Pin config fixes */
8899enum {
e652f4c8
TI
8900 ALC861_FIXUP_FSC_AMILO_PI1505,
8901 ALC861_FIXUP_AMP_VREF_0F,
8902 ALC861_FIXUP_NO_JACK_DETECT,
8903 ALC861_FIXUP_ASUS_A6RP,
6ddf0fd1 8904 ALC660_FIXUP_ASUS_W7J,
1d045db9 8905};
7085ec12 8906
31150f23
TI
8907/* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
8908static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
1727a771 8909 const struct hda_fixup *fix, int action)
31150f23
TI
8910{
8911 struct alc_spec *spec = codec->spec;
8912 unsigned int val;
8913
1727a771 8914 if (action != HDA_FIXUP_ACT_INIT)
31150f23 8915 return;
d3f02d60 8916 val = snd_hda_codec_get_pin_target(codec, 0x0f);
31150f23
TI
8917 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
8918 val |= AC_PINCTL_IN_EN;
8919 val |= AC_PINCTL_VREF_50;
cdd03ced 8920 snd_hda_set_pin_ctl(codec, 0x0f, val);
08c189f2 8921 spec->gen.keep_vref_in_automute = 1;
31150f23
TI
8922}
8923
e652f4c8
TI
8924/* suppress the jack-detection */
8925static void alc_fixup_no_jack_detect(struct hda_codec *codec,
1727a771 8926 const struct hda_fixup *fix, int action)
e652f4c8 8927{
1727a771 8928 if (action == HDA_FIXUP_ACT_PRE_PROBE)
e652f4c8 8929 codec->no_jack_detect = 1;
7d7eb9ea 8930}
e652f4c8 8931
1727a771 8932static const struct hda_fixup alc861_fixups[] = {
e652f4c8 8933 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
1727a771
TI
8934 .type = HDA_FIXUP_PINS,
8935 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
8936 { 0x0b, 0x0221101f }, /* HP */
8937 { 0x0f, 0x90170310 }, /* speaker */
8938 { }
8939 }
8940 },
e652f4c8 8941 [ALC861_FIXUP_AMP_VREF_0F] = {
1727a771 8942 .type = HDA_FIXUP_FUNC,
31150f23 8943 .v.func = alc861_fixup_asus_amp_vref_0f,
3b25eb69 8944 },
e652f4c8 8945 [ALC861_FIXUP_NO_JACK_DETECT] = {
1727a771 8946 .type = HDA_FIXUP_FUNC,
e652f4c8
TI
8947 .v.func = alc_fixup_no_jack_detect,
8948 },
8949 [ALC861_FIXUP_ASUS_A6RP] = {
1727a771 8950 .type = HDA_FIXUP_FUNC,
e652f4c8
TI
8951 .v.func = alc861_fixup_asus_amp_vref_0f,
8952 .chained = true,
8953 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
6ddf0fd1
TI
8954 },
8955 [ALC660_FIXUP_ASUS_W7J] = {
8956 .type = HDA_FIXUP_VERBS,
8957 .v.verbs = (const struct hda_verb[]) {
8958 /* ASUS W7J needs a magic pin setup on unused NID 0x10
8959 * for enabling outputs
8960 */
8961 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8962 { }
8963 },
e652f4c8 8964 }
1d045db9 8965};
7085ec12 8966
1d045db9 8967static const struct snd_pci_quirk alc861_fixup_tbl[] = {
6ddf0fd1 8968 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
e7ca237b 8969 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
e652f4c8
TI
8970 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
8971 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
8972 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
8973 SND_PCI_QUIRK(0x1584, 0x2b01, "Haier W18", ALC861_FIXUP_AMP_VREF_0F),
8974 SND_PCI_QUIRK(0x1584, 0x0000, "Uniwill ECS M31EI", ALC861_FIXUP_AMP_VREF_0F),
8975 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
1d045db9
TI
8976 {}
8977};
3af9ee6b 8978
1d045db9
TI
8979/*
8980 */
1d045db9 8981static int patch_alc861(struct hda_codec *codec)
7085ec12 8982{
1d045db9 8983 struct alc_spec *spec;
1d045db9 8984 int err;
7085ec12 8985
3de95173
TI
8986 err = alc_alloc_spec(codec, 0x15);
8987 if (err < 0)
8988 return err;
1d045db9 8989
3de95173 8990 spec = codec->spec;
2722b535
TI
8991 if (has_cdefine_beep(codec))
8992 spec->gen.beep_nid = 0x23;
1d045db9 8993
225068ab
TI
8994#ifdef CONFIG_PM
8995 spec->power_hook = alc_power_eapd;
8996#endif
8997
c9af753f
TI
8998 alc_pre_init(codec);
8999
1727a771
TI
9000 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
9001 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
3af9ee6b 9002
cb4e4824
TI
9003 /* automatic parse from the BIOS config */
9004 err = alc861_parse_auto_config(codec);
e16fb6d1
TI
9005 if (err < 0)
9006 goto error;
3af9ee6b 9007
fea80fae
TI
9008 if (!spec->gen.no_analog) {
9009 err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
9010 if (err < 0)
9011 goto error;
9012 }
7085ec12 9013
1727a771 9014 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 9015
1d045db9 9016 return 0;
e16fb6d1
TI
9017
9018 error:
9019 alc_free(codec);
9020 return err;
7085ec12
TI
9021}
9022
1d045db9
TI
9023/*
9024 * ALC861-VD support
9025 *
9026 * Based on ALC882
9027 *
9028 * In addition, an independent DAC
9029 */
1d045db9 9030static int alc861vd_parse_auto_config(struct hda_codec *codec)
bc9f98a9 9031{
1d045db9 9032 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
3e6179b8
TI
9033 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
9034 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
ce764ab2
TI
9035}
9036
1d045db9 9037enum {
8fdcb6fe
TI
9038 ALC660VD_FIX_ASUS_GPIO1,
9039 ALC861VD_FIX_DALLAS,
1d045db9 9040};
ce764ab2 9041
8fdcb6fe
TI
9042/* exclude VREF80 */
9043static void alc861vd_fixup_dallas(struct hda_codec *codec,
1727a771 9044 const struct hda_fixup *fix, int action)
8fdcb6fe 9045{
1727a771 9046 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
b78562b1
TI
9047 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
9048 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
8fdcb6fe
TI
9049 }
9050}
9051
df73d83f
TI
9052/* reset GPIO1 */
9053static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
9054 const struct hda_fixup *fix, int action)
9055{
9056 struct alc_spec *spec = codec->spec;
9057
9058 if (action == HDA_FIXUP_ACT_PRE_PROBE)
9059 spec->gpio_mask |= 0x02;
9060 alc_fixup_gpio(codec, action, 0x01);
9061}
9062
1727a771 9063static const struct hda_fixup alc861vd_fixups[] = {
1d045db9 9064 [ALC660VD_FIX_ASUS_GPIO1] = {
df73d83f
TI
9065 .type = HDA_FIXUP_FUNC,
9066 .v.func = alc660vd_fixup_asus_gpio1,
1d045db9 9067 },
8fdcb6fe 9068 [ALC861VD_FIX_DALLAS] = {
1727a771 9069 .type = HDA_FIXUP_FUNC,
8fdcb6fe
TI
9070 .v.func = alc861vd_fixup_dallas,
9071 },
1d045db9 9072};
ce764ab2 9073
1d045db9 9074static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
8fdcb6fe 9075 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
1d045db9 9076 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
8fdcb6fe 9077 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
1d045db9
TI
9078 {}
9079};
ce764ab2 9080
1d045db9
TI
9081/*
9082 */
1d045db9 9083static int patch_alc861vd(struct hda_codec *codec)
ce764ab2 9084{
1d045db9 9085 struct alc_spec *spec;
cb4e4824 9086 int err;
ce764ab2 9087
3de95173
TI
9088 err = alc_alloc_spec(codec, 0x0b);
9089 if (err < 0)
9090 return err;
1d045db9 9091
3de95173 9092 spec = codec->spec;
2722b535
TI
9093 if (has_cdefine_beep(codec))
9094 spec->gen.beep_nid = 0x23;
1d045db9 9095
225068ab
TI
9096 spec->shutup = alc_eapd_shutup;
9097
c9af753f
TI
9098 alc_pre_init(codec);
9099
1727a771
TI
9100 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
9101 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1d045db9 9102
cb4e4824
TI
9103 /* automatic parse from the BIOS config */
9104 err = alc861vd_parse_auto_config(codec);
e16fb6d1
TI
9105 if (err < 0)
9106 goto error;
ce764ab2 9107
fea80fae
TI
9108 if (!spec->gen.no_analog) {
9109 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9110 if (err < 0)
9111 goto error;
9112 }
1d045db9 9113
1727a771 9114 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 9115
ce764ab2 9116 return 0;
e16fb6d1
TI
9117
9118 error:
9119 alc_free(codec);
9120 return err;
ce764ab2
TI
9121}
9122
1d045db9
TI
9123/*
9124 * ALC662 support
9125 *
9126 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
9127 * configuration. Each pin widget can choose any input DACs and a mixer.
9128 * Each ADC is connected from a mixer of all inputs. This makes possible
9129 * 6-channel independent captures.
9130 *
9131 * In addition, an independent DAC for the multi-playback (not used in this
9132 * driver yet).
9133 */
1d045db9
TI
9134
9135/*
9136 * BIOS auto configuration
9137 */
9138
bc9f98a9
KY
9139static int alc662_parse_auto_config(struct hda_codec *codec)
9140{
4c6d72d1 9141 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
3e6179b8
TI
9142 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
9143 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
9144 const hda_nid_t *ssids;
ee979a14 9145
7639a06c
TI
9146 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
9147 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
9148 codec->core.vendor_id == 0x10ec0671)
3e6179b8 9149 ssids = alc663_ssids;
6227cdce 9150 else
3e6179b8
TI
9151 ssids = alc662_ssids;
9152 return alc_parse_auto_config(codec, alc662_ignore, ssids);
bc9f98a9
KY
9153}
9154
6be7948f 9155static void alc272_fixup_mario(struct hda_codec *codec,
1727a771 9156 const struct hda_fixup *fix, int action)
6fc398cb 9157{
9bb1f06f 9158 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6fc398cb 9159 return;
6be7948f
TB
9160 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
9161 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
9162 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
9163 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
9164 (0 << AC_AMPCAP_MUTE_SHIFT)))
4e76a883 9165 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
6be7948f
TB
9166}
9167
8e383953
TI
9168static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
9169 { .channels = 2,
9170 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
9171 { .channels = 4,
9172 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
9173 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
9174 { }
9175};
9176
9177/* override the 2.1 chmap */
eb9ca3ab 9178static void alc_fixup_bass_chmap(struct hda_codec *codec,
8e383953
TI
9179 const struct hda_fixup *fix, int action)
9180{
9181 if (action == HDA_FIXUP_ACT_BUILD) {
9182 struct alc_spec *spec = codec->spec;
bbbc7e85 9183 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
8e383953
TI
9184 }
9185}
9186
bf68665d
TI
9187/* avoid D3 for keeping GPIO up */
9188static unsigned int gpio_led_power_filter(struct hda_codec *codec,
9189 hda_nid_t nid,
9190 unsigned int power_state)
9191{
9192 struct alc_spec *spec = codec->spec;
d261eec8 9193 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
bf68665d
TI
9194 return AC_PWRST_D0;
9195 return power_state;
9196}
9197
3e887f37
TI
9198static void alc662_fixup_led_gpio1(struct hda_codec *codec,
9199 const struct hda_fixup *fix, int action)
9200{
9201 struct alc_spec *spec = codec->spec;
3e887f37 9202
01e4a275 9203 alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
3e887f37 9204 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
0f32fd19 9205 spec->mute_led_polarity = 1;
bf68665d 9206 codec->power_filter = gpio_led_power_filter;
3e887f37
TI
9207 }
9208}
9209
c6790c8e
KY
9210static void alc662_usi_automute_hook(struct hda_codec *codec,
9211 struct hda_jack_callback *jack)
9212{
9213 struct alc_spec *spec = codec->spec;
9214 int vref;
9215 msleep(200);
9216 snd_hda_gen_hp_automute(codec, jack);
9217
9218 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
9219 msleep(100);
9220 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
9221 vref);
9222}
9223
9224static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
9225 const struct hda_fixup *fix, int action)
9226{
9227 struct alc_spec *spec = codec->spec;
9228 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
9229 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
9230 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
9231 }
9232}
9233
00066e97
SB
9234static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
9235 struct hda_jack_callback *cb)
9236{
9237 /* surround speakers at 0x1b already get muted automatically when
9238 * headphones are plugged in, but we have to mute/unmute the remaining
9239 * channels manually:
9240 * 0x15 - front left/front right
9241 * 0x18 - front center/ LFE
9242 */
9243 if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
9244 snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
9245 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
9246 } else {
9247 snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
9248 snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
9249 }
9250}
9251
9252static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
9253 const struct hda_fixup *fix, int action)
9254{
9255 /* Pin 0x1b: shared headphones jack and surround speakers */
9256 if (!is_jack_detectable(codec, 0x1b))
9257 return;
9258
9259 switch (action) {
9260 case HDA_FIXUP_ACT_PRE_PROBE:
9261 snd_hda_jack_detect_enable_callback(codec, 0x1b,
9262 alc662_aspire_ethos_mute_speakers);
336820c4
TI
9263 /* subwoofer needs an extra GPIO setting to become audible */
9264 alc_setup_gpio(codec, 0x02);
00066e97
SB
9265 break;
9266 case HDA_FIXUP_ACT_INIT:
9267 /* Make sure to start in a correct state, i.e. if
9268 * headphones have been plugged in before powering up the system
9269 */
9270 alc662_aspire_ethos_mute_speakers(codec, NULL);
9271 break;
9272 }
9273}
9274
5af29028
KY
9275static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
9276 const struct hda_fixup *fix, int action)
9277{
9278 struct alc_spec *spec = codec->spec;
9279
9280 static const struct hda_pintbl pincfgs[] = {
9281 { 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
9282 { 0x1b, 0x0181304f },
9283 { }
9284 };
9285
9286 switch (action) {
9287 case HDA_FIXUP_ACT_PRE_PROBE:
9288 spec->gen.mixer_nid = 0;
9289 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
9290 snd_hda_apply_pincfgs(codec, pincfgs);
9291 break;
9292 case HDA_FIXUP_ACT_INIT:
9293 alc_write_coef_idx(codec, 0x19, 0xa054);
9294 break;
9295 }
9296}
9297
6b0f95c4 9298static const struct coef_fw alc668_coefs[] = {
f3f9185f
KY
9299 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
9300 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
9301 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
9302 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
9303 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
9304 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
9305 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
9306 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
9307 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
9308 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
9309 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
9310 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
9311 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
9312 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
9313 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
9314 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
9315 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
9316 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
9317 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
9318 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
9319 {}
9320};
9321
9322static void alc668_restore_default_value(struct hda_codec *codec)
9323{
9324 alc_process_coef_fw(codec, alc668_coefs);
9325}
9326
6cb3b707 9327enum {
2df03514 9328 ALC662_FIXUP_ASPIRE,
3e887f37 9329 ALC662_FIXUP_LED_GPIO1,
6cb3b707 9330 ALC662_FIXUP_IDEAPAD,
6be7948f 9331 ALC272_FIXUP_MARIO,
f1ec5be1 9332 ALC662_FIXUP_CZC_ET26,
d2ebd479 9333 ALC662_FIXUP_CZC_P10T,
94024cd1 9334 ALC662_FIXUP_SKU_IGNORE,
e59ea3ed 9335 ALC662_FIXUP_HP_RP5800,
53c334ad
TI
9336 ALC662_FIXUP_ASUS_MODE1,
9337 ALC662_FIXUP_ASUS_MODE2,
9338 ALC662_FIXUP_ASUS_MODE3,
9339 ALC662_FIXUP_ASUS_MODE4,
9340 ALC662_FIXUP_ASUS_MODE5,
9341 ALC662_FIXUP_ASUS_MODE6,
9342 ALC662_FIXUP_ASUS_MODE7,
9343 ALC662_FIXUP_ASUS_MODE8,
1565cc35 9344 ALC662_FIXUP_NO_JACK_DETECT,
edfe3bfc 9345 ALC662_FIXUP_ZOTAC_Z68,
125821ae 9346 ALC662_FIXUP_INV_DMIC,
1f8b46cd 9347 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
73bdd597 9348 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
1f8b46cd 9349 ALC662_FIXUP_HEADSET_MODE,
73bdd597 9350 ALC668_FIXUP_HEADSET_MODE,
8e54b4ac 9351 ALC662_FIXUP_BASS_MODE4_CHMAP,
61a75f13 9352 ALC662_FIXUP_BASS_16,
a30c9aaa 9353 ALC662_FIXUP_BASS_1A,
8e54b4ac 9354 ALC662_FIXUP_BASS_CHMAP,
493a52a9 9355 ALC668_FIXUP_AUTO_MUTE,
5e6db669 9356 ALC668_FIXUP_DELL_DISABLE_AAMIX,
033b0a7c 9357 ALC668_FIXUP_DELL_XPS13,
9d4dc584 9358 ALC662_FIXUP_ASUS_Nx50,
fc7438b1 9359 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
3231e205 9360 ALC668_FIXUP_ASUS_Nx51,
5b7c5e1f 9361 ALC668_FIXUP_MIC_COEF,
11ba6111 9362 ALC668_FIXUP_ASUS_G751,
78f4f7c2
KY
9363 ALC891_FIXUP_HEADSET_MODE,
9364 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
9b51fe3e 9365 ALC662_FIXUP_ACER_VERITON,
1a3f0991 9366 ALC892_FIXUP_ASROCK_MOBO,
c6790c8e
KY
9367 ALC662_FIXUP_USI_FUNC,
9368 ALC662_FIXUP_USI_HEADSET_MODE,
ca169cc2 9369 ALC662_FIXUP_LENOVO_MULTI_CODECS,
00066e97 9370 ALC669_FIXUP_ACER_ASPIRE_ETHOS,
00066e97 9371 ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
5af29028 9372 ALC671_FIXUP_HP_HEADSET_MIC2,
d858c706 9373 ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
a124458a 9374 ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
6cb3b707
DH
9375};
9376
1727a771 9377static const struct hda_fixup alc662_fixups[] = {
2df03514 9378 [ALC662_FIXUP_ASPIRE] = {
1727a771
TI
9379 .type = HDA_FIXUP_PINS,
9380 .v.pins = (const struct hda_pintbl[]) {
2df03514
DC
9381 { 0x15, 0x99130112 }, /* subwoofer */
9382 { }
9383 }
9384 },
3e887f37
TI
9385 [ALC662_FIXUP_LED_GPIO1] = {
9386 .type = HDA_FIXUP_FUNC,
9387 .v.func = alc662_fixup_led_gpio1,
9388 },
6cb3b707 9389 [ALC662_FIXUP_IDEAPAD] = {
1727a771
TI
9390 .type = HDA_FIXUP_PINS,
9391 .v.pins = (const struct hda_pintbl[]) {
6cb3b707
DH
9392 { 0x17, 0x99130112 }, /* subwoofer */
9393 { }
3e887f37
TI
9394 },
9395 .chained = true,
9396 .chain_id = ALC662_FIXUP_LED_GPIO1,
6cb3b707 9397 },
6be7948f 9398 [ALC272_FIXUP_MARIO] = {
1727a771 9399 .type = HDA_FIXUP_FUNC,
b5bfbc67 9400 .v.func = alc272_fixup_mario,
d2ebd479 9401 },
f1ec5be1
HC
9402 [ALC662_FIXUP_CZC_ET26] = {
9403 .type = HDA_FIXUP_PINS,
9404 .v.pins = (const struct hda_pintbl[]) {
9405 {0x12, 0x403cc000},
9406 {0x14, 0x90170110}, /* speaker */
9407 {0x15, 0x411111f0},
9408 {0x16, 0x411111f0},
9409 {0x18, 0x01a19030}, /* mic */
9410 {0x19, 0x90a7013f}, /* int-mic */
9411 {0x1a, 0x01014020},
9412 {0x1b, 0x0121401f},
9413 {0x1c, 0x411111f0},
9414 {0x1d, 0x411111f0},
9415 {0x1e, 0x40478e35},
9416 {}
9417 },
9418 .chained = true,
9419 .chain_id = ALC662_FIXUP_SKU_IGNORE
9420 },
d2ebd479 9421 [ALC662_FIXUP_CZC_P10T] = {
1727a771 9422 .type = HDA_FIXUP_VERBS,
d2ebd479
AA
9423 .v.verbs = (const struct hda_verb[]) {
9424 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
9425 {}
9426 }
9427 },
94024cd1 9428 [ALC662_FIXUP_SKU_IGNORE] = {
1727a771 9429 .type = HDA_FIXUP_FUNC,
23d30f28 9430 .v.func = alc_fixup_sku_ignore,
c6b35874 9431 },
e59ea3ed 9432 [ALC662_FIXUP_HP_RP5800] = {
1727a771
TI
9433 .type = HDA_FIXUP_PINS,
9434 .v.pins = (const struct hda_pintbl[]) {
e59ea3ed
TI
9435 { 0x14, 0x0221201f }, /* HP out */
9436 { }
9437 },
9438 .chained = true,
9439 .chain_id = ALC662_FIXUP_SKU_IGNORE
9440 },
53c334ad 9441 [ALC662_FIXUP_ASUS_MODE1] = {
1727a771
TI
9442 .type = HDA_FIXUP_PINS,
9443 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
9444 { 0x14, 0x99130110 }, /* speaker */
9445 { 0x18, 0x01a19c20 }, /* mic */
9446 { 0x19, 0x99a3092f }, /* int-mic */
9447 { 0x21, 0x0121401f }, /* HP out */
9448 { }
9449 },
9450 .chained = true,
9451 .chain_id = ALC662_FIXUP_SKU_IGNORE
9452 },
9453 [ALC662_FIXUP_ASUS_MODE2] = {
1727a771
TI
9454 .type = HDA_FIXUP_PINS,
9455 .v.pins = (const struct hda_pintbl[]) {
2996bdba
TI
9456 { 0x14, 0x99130110 }, /* speaker */
9457 { 0x18, 0x01a19820 }, /* mic */
9458 { 0x19, 0x99a3092f }, /* int-mic */
9459 { 0x1b, 0x0121401f }, /* HP out */
9460 { }
9461 },
53c334ad
TI
9462 .chained = true,
9463 .chain_id = ALC662_FIXUP_SKU_IGNORE
9464 },
9465 [ALC662_FIXUP_ASUS_MODE3] = {
1727a771
TI
9466 .type = HDA_FIXUP_PINS,
9467 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
9468 { 0x14, 0x99130110 }, /* speaker */
9469 { 0x15, 0x0121441f }, /* HP */
9470 { 0x18, 0x01a19840 }, /* mic */
9471 { 0x19, 0x99a3094f }, /* int-mic */
9472 { 0x21, 0x01211420 }, /* HP2 */
9473 { }
9474 },
9475 .chained = true,
9476 .chain_id = ALC662_FIXUP_SKU_IGNORE
9477 },
9478 [ALC662_FIXUP_ASUS_MODE4] = {
1727a771
TI
9479 .type = HDA_FIXUP_PINS,
9480 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
9481 { 0x14, 0x99130110 }, /* speaker */
9482 { 0x16, 0x99130111 }, /* speaker */
9483 { 0x18, 0x01a19840 }, /* mic */
9484 { 0x19, 0x99a3094f }, /* int-mic */
9485 { 0x21, 0x0121441f }, /* HP */
9486 { }
9487 },
9488 .chained = true,
9489 .chain_id = ALC662_FIXUP_SKU_IGNORE
9490 },
9491 [ALC662_FIXUP_ASUS_MODE5] = {
1727a771
TI
9492 .type = HDA_FIXUP_PINS,
9493 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
9494 { 0x14, 0x99130110 }, /* speaker */
9495 { 0x15, 0x0121441f }, /* HP */
9496 { 0x16, 0x99130111 }, /* speaker */
9497 { 0x18, 0x01a19840 }, /* mic */
9498 { 0x19, 0x99a3094f }, /* int-mic */
9499 { }
9500 },
9501 .chained = true,
9502 .chain_id = ALC662_FIXUP_SKU_IGNORE
9503 },
9504 [ALC662_FIXUP_ASUS_MODE6] = {
1727a771
TI
9505 .type = HDA_FIXUP_PINS,
9506 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
9507 { 0x14, 0x99130110 }, /* speaker */
9508 { 0x15, 0x01211420 }, /* HP2 */
9509 { 0x18, 0x01a19840 }, /* mic */
9510 { 0x19, 0x99a3094f }, /* int-mic */
9511 { 0x1b, 0x0121441f }, /* HP */
9512 { }
9513 },
9514 .chained = true,
9515 .chain_id = ALC662_FIXUP_SKU_IGNORE
9516 },
9517 [ALC662_FIXUP_ASUS_MODE7] = {
1727a771
TI
9518 .type = HDA_FIXUP_PINS,
9519 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
9520 { 0x14, 0x99130110 }, /* speaker */
9521 { 0x17, 0x99130111 }, /* speaker */
9522 { 0x18, 0x01a19840 }, /* mic */
9523 { 0x19, 0x99a3094f }, /* int-mic */
9524 { 0x1b, 0x01214020 }, /* HP */
9525 { 0x21, 0x0121401f }, /* HP */
9526 { }
9527 },
9528 .chained = true,
9529 .chain_id = ALC662_FIXUP_SKU_IGNORE
9530 },
9531 [ALC662_FIXUP_ASUS_MODE8] = {
1727a771
TI
9532 .type = HDA_FIXUP_PINS,
9533 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
9534 { 0x14, 0x99130110 }, /* speaker */
9535 { 0x12, 0x99a30970 }, /* int-mic */
9536 { 0x15, 0x01214020 }, /* HP */
9537 { 0x17, 0x99130111 }, /* speaker */
9538 { 0x18, 0x01a19840 }, /* mic */
9539 { 0x21, 0x0121401f }, /* HP */
9540 { }
9541 },
9542 .chained = true,
9543 .chain_id = ALC662_FIXUP_SKU_IGNORE
2996bdba 9544 },
1565cc35 9545 [ALC662_FIXUP_NO_JACK_DETECT] = {
1727a771 9546 .type = HDA_FIXUP_FUNC,
1565cc35
TI
9547 .v.func = alc_fixup_no_jack_detect,
9548 },
edfe3bfc 9549 [ALC662_FIXUP_ZOTAC_Z68] = {
1727a771
TI
9550 .type = HDA_FIXUP_PINS,
9551 .v.pins = (const struct hda_pintbl[]) {
edfe3bfc
DH
9552 { 0x1b, 0x02214020 }, /* Front HP */
9553 { }
9554 }
9555 },
125821ae 9556 [ALC662_FIXUP_INV_DMIC] = {
1727a771 9557 .type = HDA_FIXUP_FUNC,
9d36a7dc 9558 .v.func = alc_fixup_inv_dmic,
125821ae 9559 },
033b0a7c
GM
9560 [ALC668_FIXUP_DELL_XPS13] = {
9561 .type = HDA_FIXUP_FUNC,
9562 .v.func = alc_fixup_dell_xps13,
9563 .chained = true,
9564 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
9565 },
5e6db669
GM
9566 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
9567 .type = HDA_FIXUP_FUNC,
9568 .v.func = alc_fixup_disable_aamix,
9569 .chained = true,
9570 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
9571 },
493a52a9
HW
9572 [ALC668_FIXUP_AUTO_MUTE] = {
9573 .type = HDA_FIXUP_FUNC,
9574 .v.func = alc_fixup_auto_mute_via_amp,
9575 .chained = true,
9576 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
9577 },
1f8b46cd
DH
9578 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
9579 .type = HDA_FIXUP_PINS,
9580 .v.pins = (const struct hda_pintbl[]) {
9581 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
9582 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
9583 { }
9584 },
9585 .chained = true,
9586 .chain_id = ALC662_FIXUP_HEADSET_MODE
9587 },
9588 [ALC662_FIXUP_HEADSET_MODE] = {
9589 .type = HDA_FIXUP_FUNC,
9590 .v.func = alc_fixup_headset_mode_alc662,
9591 },
73bdd597
DH
9592 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
9593 .type = HDA_FIXUP_PINS,
9594 .v.pins = (const struct hda_pintbl[]) {
9595 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
9596 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
9597 { }
9598 },
9599 .chained = true,
9600 .chain_id = ALC668_FIXUP_HEADSET_MODE
9601 },
9602 [ALC668_FIXUP_HEADSET_MODE] = {
9603 .type = HDA_FIXUP_FUNC,
9604 .v.func = alc_fixup_headset_mode_alc668,
9605 },
8e54b4ac 9606 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
8e383953 9607 .type = HDA_FIXUP_FUNC,
eb9ca3ab 9608 .v.func = alc_fixup_bass_chmap,
8e383953
TI
9609 .chained = true,
9610 .chain_id = ALC662_FIXUP_ASUS_MODE4
9611 },
61a75f13
DH
9612 [ALC662_FIXUP_BASS_16] = {
9613 .type = HDA_FIXUP_PINS,
9614 .v.pins = (const struct hda_pintbl[]) {
9615 {0x16, 0x80106111}, /* bass speaker */
9616 {}
9617 },
9618 .chained = true,
9619 .chain_id = ALC662_FIXUP_BASS_CHMAP,
9620 },
a30c9aaa
TI
9621 [ALC662_FIXUP_BASS_1A] = {
9622 .type = HDA_FIXUP_PINS,
9623 .v.pins = (const struct hda_pintbl[]) {
9624 {0x1a, 0x80106111}, /* bass speaker */
9625 {}
9626 },
8e54b4ac
DH
9627 .chained = true,
9628 .chain_id = ALC662_FIXUP_BASS_CHMAP,
a30c9aaa 9629 },
8e54b4ac 9630 [ALC662_FIXUP_BASS_CHMAP] = {
a30c9aaa 9631 .type = HDA_FIXUP_FUNC,
eb9ca3ab 9632 .v.func = alc_fixup_bass_chmap,
a30c9aaa 9633 },
9d4dc584
BM
9634 [ALC662_FIXUP_ASUS_Nx50] = {
9635 .type = HDA_FIXUP_FUNC,
9636 .v.func = alc_fixup_auto_mute_via_amp,
9637 .chained = true,
9638 .chain_id = ALC662_FIXUP_BASS_1A
9639 },
fc7438b1
MP
9640 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
9641 .type = HDA_FIXUP_FUNC,
9642 .v.func = alc_fixup_headset_mode_alc668,
9643 .chain_id = ALC662_FIXUP_BASS_CHMAP
9644 },
3231e205
YP
9645 [ALC668_FIXUP_ASUS_Nx51] = {
9646 .type = HDA_FIXUP_PINS,
9647 .v.pins = (const struct hda_pintbl[]) {
fc7438b1
MP
9648 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
9649 { 0x1a, 0x90170151 }, /* bass speaker */
9650 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
3231e205
YP
9651 {}
9652 },
9653 .chained = true,
fc7438b1 9654 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
3231e205 9655 },
5b7c5e1f 9656 [ALC668_FIXUP_MIC_COEF] = {
11ba6111
TI
9657 .type = HDA_FIXUP_VERBS,
9658 .v.verbs = (const struct hda_verb[]) {
9659 { 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
9660 { 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
9661 {}
9662 },
9663 },
5b7c5e1f
TI
9664 [ALC668_FIXUP_ASUS_G751] = {
9665 .type = HDA_FIXUP_PINS,
9666 .v.pins = (const struct hda_pintbl[]) {
9667 { 0x16, 0x0421101f }, /* HP */
9668 {}
9669 },
9670 .chained = true,
9671 .chain_id = ALC668_FIXUP_MIC_COEF
9672 },
78f4f7c2
KY
9673 [ALC891_FIXUP_HEADSET_MODE] = {
9674 .type = HDA_FIXUP_FUNC,
9675 .v.func = alc_fixup_headset_mode,
9676 },
9677 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
9678 .type = HDA_FIXUP_PINS,
9679 .v.pins = (const struct hda_pintbl[]) {
9680 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
9681 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
9682 { }
9683 },
9684 .chained = true,
9685 .chain_id = ALC891_FIXUP_HEADSET_MODE
9686 },
9b51fe3e
SB
9687 [ALC662_FIXUP_ACER_VERITON] = {
9688 .type = HDA_FIXUP_PINS,
9689 .v.pins = (const struct hda_pintbl[]) {
9690 { 0x15, 0x50170120 }, /* no internal speaker */
9691 { }
9692 }
9693 },
1a3f0991
TI
9694 [ALC892_FIXUP_ASROCK_MOBO] = {
9695 .type = HDA_FIXUP_PINS,
9696 .v.pins = (const struct hda_pintbl[]) {
9697 { 0x15, 0x40f000f0 }, /* disabled */
9698 { 0x16, 0x40f000f0 }, /* disabled */
1a3f0991
TI
9699 { }
9700 }
9701 },
c6790c8e
KY
9702 [ALC662_FIXUP_USI_FUNC] = {
9703 .type = HDA_FIXUP_FUNC,
9704 .v.func = alc662_fixup_usi_headset_mic,
9705 },
9706 [ALC662_FIXUP_USI_HEADSET_MODE] = {
9707 .type = HDA_FIXUP_PINS,
9708 .v.pins = (const struct hda_pintbl[]) {
9709 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
9710 { 0x18, 0x01a1903d },
9711 { }
9712 },
9713 .chained = true,
9714 .chain_id = ALC662_FIXUP_USI_FUNC
9715 },
ca169cc2
KY
9716 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
9717 .type = HDA_FIXUP_FUNC,
9718 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
9719 },
00066e97
SB
9720 [ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
9721 .type = HDA_FIXUP_FUNC,
9722 .v.func = alc662_fixup_aspire_ethos_hp,
9723 },
00066e97
SB
9724 [ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
9725 .type = HDA_FIXUP_PINS,
9726 .v.pins = (const struct hda_pintbl[]) {
9727 { 0x15, 0x92130110 }, /* front speakers */
9728 { 0x18, 0x99130111 }, /* center/subwoofer */
9729 { 0x1b, 0x11130012 }, /* surround plus jack for HP */
9730 { }
9731 },
9732 .chained = true,
336820c4 9733 .chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
00066e97 9734 },
5af29028
KY
9735 [ALC671_FIXUP_HP_HEADSET_MIC2] = {
9736 .type = HDA_FIXUP_FUNC,
9737 .v.func = alc671_fixup_hp_headset_mic2,
9738 },
d858c706
JHP
9739 [ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
9740 .type = HDA_FIXUP_PINS,
9741 .v.pins = (const struct hda_pintbl[]) {
9742 { 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
9743 { }
9744 },
9745 .chained = true,
9746 .chain_id = ALC662_FIXUP_USI_FUNC
9747 },
a124458a
JHP
9748 [ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
9749 .type = HDA_FIXUP_PINS,
9750 .v.pins = (const struct hda_pintbl[]) {
9751 { 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
9752 { 0x1b, 0x0221144f },
9753 { }
9754 },
9755 .chained = true,
9756 .chain_id = ALC662_FIXUP_USI_FUNC
9757 },
6cb3b707
DH
9758};
9759
a9111321 9760static const struct snd_pci_quirk alc662_fixup_tbl[] = {
53c334ad 9761 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
d3d3835c 9762 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
02f6ff90 9763 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
a6c47a85 9764 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
94024cd1 9765 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
125821ae 9766 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
1801928e 9767 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
2df03514 9768 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
a124458a 9769 SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
d858c706 9770 SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
73bdd597
DH
9771 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
9772 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
c5d019c3 9773 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
033b0a7c 9774 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
467e1436 9775 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
09d2014f 9776 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
ad8ff99e 9777 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8dc9abb9
KY
9778 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
9779 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
6a98e34b 9780 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
e59ea3ed 9781 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
148ebf54 9782 SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
2da2dc9e 9783 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
83a9efb5 9784 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
db8948e6 9785 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
9d4dc584 9786 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
11ba6111 9787 SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
8e54b4ac 9788 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
61a75f13 9789 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
3231e205
YP
9790 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
9791 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
c7efff92 9792 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
61a75f13 9793 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
8e54b4ac 9794 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
1565cc35 9795 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
53c334ad 9796 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
a0e90acc 9797 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
c6790c8e 9798 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
ca169cc2 9799 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
d4118588 9800 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
6cb3b707 9801 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
1a3f0991 9802 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
edfe3bfc 9803 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
9b51fe3e 9804 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
f1ec5be1 9805 SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
d2ebd479 9806 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
00066e97 9807 SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
53c334ad
TI
9808
9809#if 0
9810 /* Below is a quirk table taken from the old code.
9811 * Basically the device should work as is without the fixup table.
9812 * If BIOS doesn't give a proper info, enable the corresponding
9813 * fixup entry.
7d7eb9ea 9814 */
53c334ad
TI
9815 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
9816 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
9817 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
9818 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
9819 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
9820 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9821 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
9822 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
9823 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
9824 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9825 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
9826 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
9827 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
9828 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
9829 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
9830 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9831 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
9832 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
9833 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9834 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
9835 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
9836 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9837 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
9838 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
9839 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
9840 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9841 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
9842 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
9843 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9844 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
9845 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9846 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9847 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
9848 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
9849 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
9850 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
9851 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
9852 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
9853 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
9854 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9855 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
9856 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
9857 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
9858 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
9859 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
9860 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
9861 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
9862 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
9863 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
9864 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
9865#endif
6cb3b707
DH
9866 {}
9867};
9868
1727a771 9869static const struct hda_model_fixup alc662_fixup_models[] = {
aa3841b5
TI
9870 {.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
9871 {.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
6be7948f 9872 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
aa3841b5 9873 {.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
53c334ad
TI
9874 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
9875 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
9876 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
9877 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
9878 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
9879 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
9880 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
9881 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
aa3841b5 9882 {.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
6e72aa5f 9883 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
aa3841b5 9884 {.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
e32aa85a 9885 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
aa3841b5
TI
9886 {.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
9887 {.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
9888 {.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
9889 {.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
9890 {.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
9891 {.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
9892 {.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
9893 {.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
40c51675 9894 {.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
aa3841b5
TI
9895 {.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
9896 {.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
9897 {.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
9898 {.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
9899 {.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
ba90d6a6 9900 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
00066e97 9901 {.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
6be7948f
TB
9902 {}
9903};
6cb3b707 9904
532895c5 9905static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
78f4f7c2
KY
9906 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
9907 {0x17, 0x02211010},
9908 {0x18, 0x01a19030},
9909 {0x1a, 0x01813040},
9910 {0x21, 0x01014020}),
4b4e0e32
HW
9911 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
9912 {0x16, 0x01813030},
9913 {0x17, 0x02211010},
9914 {0x18, 0x01a19040},
9915 {0x21, 0x01014020}),
1f8b46cd 9916 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
1f8b46cd 9917 {0x14, 0x01014010},
1f8b46cd 9918 {0x18, 0x01a19020},
1f8b46cd 9919 {0x1a, 0x0181302f},
11580297 9920 {0x1b, 0x0221401f}),
76c2132e
DH
9921 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
9922 {0x12, 0x99a30130},
9923 {0x14, 0x90170110},
9924 {0x15, 0x0321101f},
11580297 9925 {0x16, 0x03011020}),
76c2132e
DH
9926 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
9927 {0x12, 0x99a30140},
9928 {0x14, 0x90170110},
9929 {0x15, 0x0321101f},
11580297 9930 {0x16, 0x03011020}),
76c2132e
DH
9931 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
9932 {0x12, 0x99a30150},
9933 {0x14, 0x90170110},
9934 {0x15, 0x0321101f},
11580297 9935 {0x16, 0x03011020}),
76c2132e 9936 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
76c2132e
DH
9937 {0x14, 0x90170110},
9938 {0x15, 0x0321101f},
11580297 9939 {0x16, 0x03011020}),
76c2132e
DH
9940 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
9941 {0x12, 0x90a60130},
9942 {0x14, 0x90170110},
11580297 9943 {0x15, 0x0321101f}),
5af29028
KY
9944 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
9945 {0x14, 0x01014010},
9946 {0x17, 0x90170150},
f2adbae0 9947 {0x19, 0x02a11060},
5af29028
KY
9948 {0x1b, 0x01813030},
9949 {0x21, 0x02211020}),
9950 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
9951 {0x14, 0x01014010},
9952 {0x18, 0x01a19040},
9953 {0x1b, 0x01813030},
9954 {0x21, 0x02211020}),
9955 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
9956 {0x14, 0x01014020},
9957 {0x17, 0x90170110},
9958 {0x18, 0x01a19050},
9959 {0x1b, 0x01813040},
9960 {0x21, 0x02211030}),
532895c5
HW
9961 {}
9962};
9963
1d045db9
TI
9964/*
9965 */
bc9f98a9
KY
9966static int patch_alc662(struct hda_codec *codec)
9967{
9968 struct alc_spec *spec;
3de95173 9969 int err;
bc9f98a9 9970
3de95173
TI
9971 err = alc_alloc_spec(codec, 0x0b);
9972 if (err < 0)
9973 return err;
bc9f98a9 9974
3de95173 9975 spec = codec->spec;
1f0f4b80 9976
225068ab
TI
9977 spec->shutup = alc_eapd_shutup;
9978
53c334ad
TI
9979 /* handle multiple HPs as is */
9980 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
9981
2c3bf9ab
TI
9982 alc_fix_pll_init(codec, 0x20, 0x04, 15);
9983
7639a06c 9984 switch (codec->core.vendor_id) {
f3f9185f
KY
9985 case 0x10ec0668:
9986 spec->init_hook = alc668_restore_default_value;
9987 break;
f3f9185f 9988 }
8663ff75 9989
c9af753f
TI
9990 alc_pre_init(codec);
9991
1727a771 9992 snd_hda_pick_fixup(codec, alc662_fixup_models,
8e5a0509 9993 alc662_fixup_tbl, alc662_fixups);
0fc1e447 9994 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
1727a771 9995 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
8e5a0509
TI
9996
9997 alc_auto_parse_customize_define(codec);
9998
7504b6cd
TI
9999 if (has_cdefine_beep(codec))
10000 spec->gen.beep_nid = 0x01;
10001
1bb7e43e 10002 if ((alc_get_coef0(codec) & (1 << 14)) &&
5100cd07 10003 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
e16fb6d1 10004 spec->cdefine.platform_type == 1) {
6134b1a2
WY
10005 err = alc_codec_rename(codec, "ALC272X");
10006 if (err < 0)
e16fb6d1 10007 goto error;
20ca0c35 10008 }
274693f3 10009
b9c5106c
TI
10010 /* automatic parse from the BIOS config */
10011 err = alc662_parse_auto_config(codec);
e16fb6d1
TI
10012 if (err < 0)
10013 goto error;
bc9f98a9 10014
7504b6cd 10015 if (!spec->gen.no_analog && spec->gen.beep_nid) {
7639a06c 10016 switch (codec->core.vendor_id) {
da00c244 10017 case 0x10ec0662:
fea80fae 10018 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
da00c244
KY
10019 break;
10020 case 0x10ec0272:
10021 case 0x10ec0663:
10022 case 0x10ec0665:
9ad54547 10023 case 0x10ec0668:
fea80fae 10024 err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
da00c244
KY
10025 break;
10026 case 0x10ec0273:
fea80fae 10027 err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
da00c244
KY
10028 break;
10029 }
fea80fae
TI
10030 if (err < 0)
10031 goto error;
cec27c89 10032 }
2134ea4f 10033
1727a771 10034 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 10035
bc9f98a9 10036 return 0;
801f49d3 10037
e16fb6d1
TI
10038 error:
10039 alc_free(codec);
10040 return err;
b478b998
KY
10041}
10042
d1eb57f4
KY
10043/*
10044 * ALC680 support
10045 */
d1eb57f4 10046
d1eb57f4
KY
10047static int alc680_parse_auto_config(struct hda_codec *codec)
10048{
3e6179b8 10049 return alc_parse_auto_config(codec, NULL, NULL);
d1eb57f4
KY
10050}
10051
d1eb57f4 10052/*
d1eb57f4 10053 */
d1eb57f4
KY
10054static int patch_alc680(struct hda_codec *codec)
10055{
d1eb57f4
KY
10056 int err;
10057
1f0f4b80 10058 /* ALC680 has no aa-loopback mixer */
3de95173
TI
10059 err = alc_alloc_spec(codec, 0);
10060 if (err < 0)
10061 return err;
1f0f4b80 10062
1ebec5f2
TI
10063 /* automatic parse from the BIOS config */
10064 err = alc680_parse_auto_config(codec);
10065 if (err < 0) {
10066 alc_free(codec);
10067 return err;
d1eb57f4
KY
10068 }
10069
d1eb57f4
KY
10070 return 0;
10071}
10072
1da177e4
LT
10073/*
10074 * patch entries
10075 */
b9a94a9c 10076static const struct hda_device_id snd_hda_id_realtek[] = {
0a6f0600 10077 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
b9a94a9c 10078 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
2a36c16e 10079 HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
4231430d 10080 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
b9a94a9c
TI
10081 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
10082 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
dcd4f0db 10083 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
b9a94a9c 10084 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
736f20a7 10085 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
7fbdcd83 10086 HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
b9a94a9c
TI
10087 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
10088 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
f429e7e4 10089 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
b9a94a9c
TI
10090 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
10091 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
10092 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
10093 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
10094 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
10095 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
10096 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
dcd4f0db 10097 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
b9a94a9c
TI
10098 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
10099 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
10100 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
10101 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
10102 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
10103 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
0a6f0600 10104 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
b9a94a9c 10105 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
630e3612 10106 HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
b9a94a9c 10107 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
0a6f0600 10108 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
b9a94a9c
TI
10109 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
10110 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
10111 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
dcd4f0db 10112 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
7d727869 10113 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
b9a94a9c 10114 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
28f1f9b2 10115 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
1078bef0 10116 HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
f0778871 10117 HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
b9a94a9c
TI
10118 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
10119 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
10120 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
10121 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
10122 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
10123 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
10124 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
10125 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
10126 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
10127 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
10128 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
10129 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
10130 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
10131 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
6fbae35a
KY
10132 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
10133 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
10134 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
83629532 10135 HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
78f4f7c2 10136 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
b9a94a9c
TI
10137 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
10138 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
10139 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
10140 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
10141 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
10142 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
10143 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
10144 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
10145 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
10146 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
10147 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
10148 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
10149 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
6d9ffcff 10150 HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
65553b12 10151 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
a535ad57 10152 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
1da177e4
LT
10153 {} /* terminator */
10154};
b9a94a9c 10155MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
1289e9e8
TI
10156
10157MODULE_LICENSE("GPL");
10158MODULE_DESCRIPTION("Realtek HD-audio codec");
10159
d8a766a1 10160static struct hda_codec_driver realtek_driver = {
b9a94a9c 10161 .id = snd_hda_id_realtek,
1289e9e8
TI
10162};
10163
d8a766a1 10164module_hda_codec_driver(realtek_driver);