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