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