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