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