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