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