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