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