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