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