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