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