]> git.ipfire.org Git - thirdparty/linux.git/blame - sound/pci/hda/patch_realtek.c
Merge tag 'asoc-fix-v5.19-rc0' of https://git.kernel.org/pub/scm/linux/kernel/git...
[thirdparty/linux.git] / sound / pci / hda / patch_realtek.c
CommitLineData
d0fa1179 1// SPDX-License-Identifier: GPL-2.0-or-later
1da177e4
LT
2/*
3 * Universal Interface for Intel High Definition Audio Codec
4 *
1d045db9 5 * HD audio interface patch for Realtek ALC codecs
1da177e4 6 *
df694daa
KY
7 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
8 * PeiSen Hou <pshou@realtek.com.tw>
1da177e4 9 * Takashi Iwai <tiwai@suse.de>
409a3e98 10 * Jonathan Woithe <jwoithe@just42.net>
1da177e4
LT
11 */
12
1da177e4
LT
13#include <linux/init.h>
14#include <linux/delay.h>
15#include <linux/slab.h>
16#include <linux/pci.h>
08fb0d0e 17#include <linux/dmi.h>
da155d5b 18#include <linux/module.h>
33f4acd3 19#include <linux/input.h>
87dc3648 20#include <linux/leds.h>
1da177e4 21#include <sound/core.h>
9ad0e496 22#include <sound/jack.h>
be57bfff 23#include <sound/hda_codec.h>
1da177e4 24#include "hda_local.h"
23d30f28 25#include "hda_auto_parser.h"
1835a0f9 26#include "hda_jack.h"
08c189f2 27#include "hda_generic.h"
d3dca026 28#include "hda_component.h"
1da177e4 29
cd63a5ff
TI
30/* keep halting ALC5505 DSP, for power saving */
31#define HALT_REALTEK_ALC5505
32
4a79ba34
TI
33/* extra amp-initialization sequence types */
34enum {
1c76aa5f 35 ALC_INIT_UNDEFINED,
4a79ba34
TI
36 ALC_INIT_NONE,
37 ALC_INIT_DEFAULT,
4a79ba34
TI
38};
39
73bdd597
DH
40enum {
41 ALC_HEADSET_MODE_UNKNOWN,
42 ALC_HEADSET_MODE_UNPLUGGED,
43 ALC_HEADSET_MODE_HEADSET,
44 ALC_HEADSET_MODE_MIC,
45 ALC_HEADSET_MODE_HEADPHONE,
46};
47
48enum {
49 ALC_HEADSET_TYPE_UNKNOWN,
50 ALC_HEADSET_TYPE_CTIA,
51 ALC_HEADSET_TYPE_OMTP,
52};
53
c7b60a89
HW
54enum {
55 ALC_KEY_MICMUTE_INDEX,
56};
57
da00c244
KY
58struct alc_customize_define {
59 unsigned int sku_cfg;
60 unsigned char port_connectivity;
61 unsigned char check_sum;
62 unsigned char customization;
63 unsigned char external_amp;
64 unsigned int enable_pcbeep:1;
65 unsigned int platform_type:1;
66 unsigned int swap:1;
67 unsigned int override:1;
90622917 68 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
da00c244
KY
69};
70
766538ac
TI
71struct alc_coef_led {
72 unsigned int idx;
73 unsigned int mask;
74 unsigned int on;
75 unsigned int off;
76};
77
1da177e4 78struct alc_spec {
08c189f2 79 struct hda_gen_spec gen; /* must be at head */
23d30f28 80
1da177e4 81 /* codec parameterization */
da00c244 82 struct alc_customize_define cdefine;
08c189f2 83 unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
834be88d 84
5579cd6f
TI
85 /* GPIO bits */
86 unsigned int gpio_mask;
87 unsigned int gpio_dir;
88 unsigned int gpio_data;
215c850c 89 bool gpio_write_delay; /* add a delay before writing gpio_data */
5579cd6f 90
8d3d1ece 91 /* mute LED for HP laptops, see vref_mute_led_set() */
08fb0d0e 92 int mute_led_polarity;
dbd13179 93 int micmute_led_polarity;
08fb0d0e 94 hda_nid_t mute_led_nid;
9c5dc3bf 95 hda_nid_t cap_mute_led_nid;
08fb0d0e 96
0f32fd19
TI
97 unsigned int gpio_mute_led_mask;
98 unsigned int gpio_mic_led_mask;
766538ac
TI
99 struct alc_coef_led mute_led_coef;
100 struct alc_coef_led mic_led_coef;
b837a9f5 101 struct mutex coef_mutex;
9f5c6faf 102
73bdd597
DH
103 hda_nid_t headset_mic_pin;
104 hda_nid_t headphone_mic_pin;
105 int current_headset_mode;
106 int current_headset_type;
107
ae6b813a
TI
108 /* hooks */
109 void (*init_hook)(struct hda_codec *codec);
83012a7c 110#ifdef CONFIG_PM
c97259df 111 void (*power_hook)(struct hda_codec *codec);
f5de24b0 112#endif
1c716153 113 void (*shutup)(struct hda_codec *codec);
d922b51d 114
4a79ba34 115 int init_amp;
d433a678 116 int codec_variant; /* flag for other variants */
97a26570
KY
117 unsigned int has_alc5505_dsp:1;
118 unsigned int no_depop_delay:1;
693abe11 119 unsigned int done_hp_init:1;
c0ca5ece 120 unsigned int no_shutup_pins:1;
d3ba58bb 121 unsigned int ultra_low_power:1;
476c02e0 122 unsigned int has_hs_key:1;
92666d45 123 unsigned int no_internal_mic_pin:1;
e64f14f4 124
2c3bf9ab
TI
125 /* for PLL fix */
126 hda_nid_t pll_nid;
127 unsigned int pll_coef_idx, pll_coef_bit;
1bb7e43e 128 unsigned int coef0;
33f4acd3 129 struct input_dev *kb_dev;
c7b60a89 130 u8 alc_mute_keycode_map[1];
d3dca026
LT
131
132 /* component binding */
133 struct component_match *match;
134 struct hda_component comps[HDA_MAX_COMPONENTS];
df694daa
KY
135};
136
f2a227cd
TI
137/*
138 * COEF access helper functions
139 */
140
2a845837
TI
141static void coef_mutex_lock(struct hda_codec *codec)
142{
143 struct alc_spec *spec = codec->spec;
144
145 snd_hda_power_up_pm(codec);
146 mutex_lock(&spec->coef_mutex);
147}
148
149static void coef_mutex_unlock(struct hda_codec *codec)
150{
151 struct alc_spec *spec = codec->spec;
152
153 mutex_unlock(&spec->coef_mutex);
154 snd_hda_power_down_pm(codec);
155}
156
b837a9f5
TI
157static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
158 unsigned int coef_idx)
f2a227cd
TI
159{
160 unsigned int val;
161
162 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
163 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
164 return val;
165}
166
b837a9f5
TI
167static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
168 unsigned int coef_idx)
169{
b837a9f5
TI
170 unsigned int val;
171
2a845837 172 coef_mutex_lock(codec);
b837a9f5 173 val = __alc_read_coefex_idx(codec, nid, coef_idx);
2a845837 174 coef_mutex_unlock(codec);
b837a9f5
TI
175 return val;
176}
177
f2a227cd
TI
178#define alc_read_coef_idx(codec, coef_idx) \
179 alc_read_coefex_idx(codec, 0x20, coef_idx)
180
b837a9f5
TI
181static void __alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
182 unsigned int coef_idx, unsigned int coef_val)
f2a227cd
TI
183{
184 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
185 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
186}
187
b837a9f5
TI
188static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
189 unsigned int coef_idx, unsigned int coef_val)
190{
2a845837 191 coef_mutex_lock(codec);
b837a9f5 192 __alc_write_coefex_idx(codec, nid, coef_idx, coef_val);
2a845837 193 coef_mutex_unlock(codec);
b837a9f5
TI
194}
195
f2a227cd
TI
196#define alc_write_coef_idx(codec, coef_idx, coef_val) \
197 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
198
b837a9f5
TI
199static void __alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
200 unsigned int coef_idx, unsigned int mask,
201 unsigned int bits_set)
202{
203 unsigned int val = __alc_read_coefex_idx(codec, nid, coef_idx);
204
205 if (val != -1)
206 __alc_write_coefex_idx(codec, nid, coef_idx,
207 (val & ~mask) | bits_set);
208}
209
98b24883
TI
210static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
211 unsigned int coef_idx, unsigned int mask,
212 unsigned int bits_set)
213{
2a845837 214 coef_mutex_lock(codec);
b837a9f5 215 __alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set);
2a845837 216 coef_mutex_unlock(codec);
98b24883
TI
217}
218
219#define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
220 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
221
f2a227cd
TI
222/* a special bypass for COEF 0; read the cached value at the second time */
223static unsigned int alc_get_coef0(struct hda_codec *codec)
224{
225 struct alc_spec *spec = codec->spec;
226
227 if (!spec->coef0)
228 spec->coef0 = alc_read_coef_idx(codec, 0);
229 return spec->coef0;
230}
231
54db6c39
TI
232/* coef writes/updates batch */
233struct coef_fw {
234 unsigned char nid;
235 unsigned char idx;
236 unsigned short mask;
237 unsigned short val;
238};
239
240#define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
241 { .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
242#define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
243#define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
244#define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
245
246static void alc_process_coef_fw(struct hda_codec *codec,
247 const struct coef_fw *fw)
248{
2a845837 249 coef_mutex_lock(codec);
54db6c39
TI
250 for (; fw->nid; fw++) {
251 if (fw->mask == (unsigned short)-1)
b837a9f5 252 __alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
54db6c39 253 else
b837a9f5
TI
254 __alc_update_coefex_idx(codec, fw->nid, fw->idx,
255 fw->mask, fw->val);
54db6c39 256 }
2a845837 257 coef_mutex_unlock(codec);
54db6c39
TI
258}
259
df694daa 260/*
1d045db9 261 * GPIO setup tables, used in initialization
df694daa 262 */
5579cd6f 263
bc9f98a9 264/* Enable GPIO mask and set output */
5579cd6f
TI
265static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
266{
267 struct alc_spec *spec = codec->spec;
bc9f98a9 268
5579cd6f
TI
269 spec->gpio_mask |= mask;
270 spec->gpio_dir |= mask;
271 spec->gpio_data |= mask;
272}
bc9f98a9 273
5579cd6f
TI
274static void alc_write_gpio_data(struct hda_codec *codec)
275{
276 struct alc_spec *spec = codec->spec;
277
278 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
279 spec->gpio_data);
280}
281
aaf312de
TI
282static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
283 bool on)
284{
285 struct alc_spec *spec = codec->spec;
286 unsigned int oldval = spec->gpio_data;
287
288 if (on)
289 spec->gpio_data |= mask;
290 else
291 spec->gpio_data &= ~mask;
292 if (oldval != spec->gpio_data)
293 alc_write_gpio_data(codec);
294}
295
5579cd6f
TI
296static void alc_write_gpio(struct hda_codec *codec)
297{
298 struct alc_spec *spec = codec->spec;
299
300 if (!spec->gpio_mask)
301 return;
302
303 snd_hda_codec_write(codec, codec->core.afg, 0,
304 AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
305 snd_hda_codec_write(codec, codec->core.afg, 0,
306 AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir);
215c850c
TI
307 if (spec->gpio_write_delay)
308 msleep(1);
5579cd6f
TI
309 alc_write_gpio_data(codec);
310}
311
312static void alc_fixup_gpio(struct hda_codec *codec, int action,
313 unsigned int mask)
314{
315 if (action == HDA_FIXUP_ACT_PRE_PROBE)
316 alc_setup_gpio(codec, mask);
317}
318
319static void alc_fixup_gpio1(struct hda_codec *codec,
320 const struct hda_fixup *fix, int action)
321{
322 alc_fixup_gpio(codec, action, 0x01);
323}
324
325static void alc_fixup_gpio2(struct hda_codec *codec,
326 const struct hda_fixup *fix, int action)
327{
328 alc_fixup_gpio(codec, action, 0x02);
329}
330
331static void alc_fixup_gpio3(struct hda_codec *codec,
332 const struct hda_fixup *fix, int action)
333{
334 alc_fixup_gpio(codec, action, 0x03);
335}
bdd148a3 336
ae065f1c
TI
337static void alc_fixup_gpio4(struct hda_codec *codec,
338 const struct hda_fixup *fix, int action)
339{
340 alc_fixup_gpio(codec, action, 0x04);
341}
342
8a503555
TI
343static void alc_fixup_micmute_led(struct hda_codec *codec,
344 const struct hda_fixup *fix, int action)
345{
e65bf997 346 if (action == HDA_FIXUP_ACT_PRE_PROBE)
8a503555
TI
347 snd_hda_gen_add_micmute_led_cdev(codec, NULL);
348}
349
2c3bf9ab
TI
350/*
351 * Fix hardware PLL issue
352 * On some codecs, the analog PLL gating control must be off while
353 * the default value is 1.
354 */
355static void alc_fix_pll(struct hda_codec *codec)
356{
357 struct alc_spec *spec = codec->spec;
2c3bf9ab 358
98b24883
TI
359 if (spec->pll_nid)
360 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
361 1 << spec->pll_coef_bit, 0);
2c3bf9ab
TI
362}
363
364static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
365 unsigned int coef_idx, unsigned int coef_bit)
366{
367 struct alc_spec *spec = codec->spec;
368 spec->pll_nid = nid;
369 spec->pll_coef_idx = coef_idx;
370 spec->pll_coef_bit = coef_bit;
371 alc_fix_pll(codec);
372}
373
cf5a2279 374/* update the master volume per volume-knob's unsol event */
1a4f69d5
TI
375static void alc_update_knob_master(struct hda_codec *codec,
376 struct hda_jack_callback *jack)
cf5a2279
TI
377{
378 unsigned int val;
379 struct snd_kcontrol *kctl;
380 struct snd_ctl_elem_value *uctl;
381
382 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
383 if (!kctl)
384 return;
385 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
386 if (!uctl)
387 return;
2ebab40e 388 val = snd_hda_codec_read(codec, jack->nid, 0,
cf5a2279
TI
389 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
390 val &= HDA_AMP_VOLMASK;
391 uctl->value.integer.value[0] = val;
392 uctl->value.integer.value[1] = val;
393 kctl->put(kctl, uctl);
394 kfree(uctl);
395}
396
29adc4b9 397static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
f21d78e2 398{
29adc4b9
DH
399 /* For some reason, the res given from ALC880 is broken.
400 Here we adjust it properly. */
401 snd_hda_jack_unsol_event(codec, res >> 2);
f21d78e2
TI
402}
403
394c97f8
KY
404/* Change EAPD to verb control */
405static void alc_fill_eapd_coef(struct hda_codec *codec)
406{
407 int coef;
408
409 coef = alc_get_coef0(codec);
410
7639a06c 411 switch (codec->core.vendor_id) {
394c97f8
KY
412 case 0x10ec0262:
413 alc_update_coef_idx(codec, 0x7, 0, 1<<5);
414 break;
415 case 0x10ec0267:
416 case 0x10ec0268:
417 alc_update_coef_idx(codec, 0x7, 0, 1<<13);
418 break;
419 case 0x10ec0269:
420 if ((coef & 0x00f0) == 0x0010)
421 alc_update_coef_idx(codec, 0xd, 0, 1<<14);
422 if ((coef & 0x00f0) == 0x0020)
423 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
424 if ((coef & 0x00f0) == 0x0030)
425 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
426 break;
427 case 0x10ec0280:
428 case 0x10ec0284:
429 case 0x10ec0290:
430 case 0x10ec0292:
431 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
432 break;
4231430d 433 case 0x10ec0225:
44be77c5
TI
434 case 0x10ec0295:
435 case 0x10ec0299:
436 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
c0dbbdad 437 fallthrough;
44be77c5 438 case 0x10ec0215:
1948fc06 439 case 0x10ec0230:
394c97f8 440 case 0x10ec0233:
ea04a1db 441 case 0x10ec0235:
c4473744 442 case 0x10ec0236:
7fbdcd83 443 case 0x10ec0245:
394c97f8 444 case 0x10ec0255:
c4473744 445 case 0x10ec0256:
f429e7e4 446 case 0x10ec0257:
394c97f8
KY
447 case 0x10ec0282:
448 case 0x10ec0283:
449 case 0x10ec0286:
450 case 0x10ec0288:
0a6f0600 451 case 0x10ec0285:
506b62c3 452 case 0x10ec0298:
0a6f0600 453 case 0x10ec0289:
1078bef0 454 case 0x10ec0300:
394c97f8
KY
455 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
456 break;
3aabf94c
KY
457 case 0x10ec0275:
458 alc_update_coef_idx(codec, 0xe, 0, 1<<0);
459 break;
8822702f
HW
460 case 0x10ec0287:
461 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
462 alc_write_coef_idx(codec, 0x8, 0x4ab7);
463 break;
394c97f8
KY
464 case 0x10ec0293:
465 alc_update_coef_idx(codec, 0xa, 1<<13, 0);
466 break;
dcd4f0db
KY
467 case 0x10ec0234:
468 case 0x10ec0274:
469 case 0x10ec0294:
6fbae35a
KY
470 case 0x10ec0700:
471 case 0x10ec0701:
472 case 0x10ec0703:
83629532 473 case 0x10ec0711:
dcd4f0db
KY
474 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
475 break;
394c97f8
KY
476 case 0x10ec0662:
477 if ((coef & 0x00f0) == 0x0030)
478 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
479 break;
480 case 0x10ec0272:
481 case 0x10ec0273:
482 case 0x10ec0663:
483 case 0x10ec0665:
484 case 0x10ec0670:
485 case 0x10ec0671:
486 case 0x10ec0672:
487 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
488 break;
9194a1eb 489 case 0x10ec0222:
f0778871
KY
490 case 0x10ec0623:
491 alc_update_coef_idx(codec, 0x19, 1<<13, 0);
492 break;
394c97f8
KY
493 case 0x10ec0668:
494 alc_update_coef_idx(codec, 0x7, 3<<13, 0);
495 break;
496 case 0x10ec0867:
497 alc_update_coef_idx(codec, 0x4, 1<<10, 0);
498 break;
499 case 0x10ec0888:
500 if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
501 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
502 break;
503 case 0x10ec0892:
e5782a5d 504 case 0x10ec0897:
394c97f8
KY
505 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
506 break;
507 case 0x10ec0899:
508 case 0x10ec0900:
6d9ffcff 509 case 0x10ec0b00:
65553b12 510 case 0x10ec1168:
a535ad57 511 case 0x10ec1220:
394c97f8
KY
512 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
513 break;
514 }
515}
516
f9423e7a
KY
517/* additional initialization for ALC888 variants */
518static void alc888_coef_init(struct hda_codec *codec)
519{
1df8874b
KY
520 switch (alc_get_coef0(codec) & 0x00f0) {
521 /* alc888-VA */
522 case 0x00:
523 /* alc888-VB */
524 case 0x10:
525 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
526 break;
527 }
87a8c370
JK
528}
529
3fb4a508
TI
530/* turn on/off EAPD control (only if available) */
531static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
532{
533 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
534 return;
535 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
536 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
537 on ? 2 : 0);
538}
539
691f1fcc
TI
540/* turn on/off EAPD controls of the codec */
541static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
542{
543 /* We currently only handle front, HP */
caf3c043 544 static const hda_nid_t pins[] = {
af95b414 545 0x0f, 0x10, 0x14, 0x15, 0x17, 0
39fa84e9 546 };
caf3c043 547 const hda_nid_t *p;
39fa84e9
TI
548 for (p = pins; *p; p++)
549 set_eapd(codec, *p, on);
691f1fcc
TI
550}
551
dad3197d
KY
552static int find_ext_mic_pin(struct hda_codec *codec);
553
554static void alc_headset_mic_no_shutup(struct hda_codec *codec)
555{
556 const struct hda_pincfg *pin;
557 int mic_pin = find_ext_mic_pin(codec);
558 int i;
559
560 /* don't shut up pins when unloading the driver; otherwise it breaks
561 * the default pin setup at the next load of the driver
562 */
563 if (codec->bus->shutdown)
564 return;
565
566 snd_array_for_each(&codec->init_pins, i, pin) {
567 /* use read here for syncing after issuing each verb */
568 if (pin->nid != mic_pin)
569 snd_hda_codec_read(codec, pin->nid, 0,
570 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
571 }
572
573 codec->pins_shutup = 1;
574}
575
c0ca5ece
TI
576static void alc_shutup_pins(struct hda_codec *codec)
577{
578 struct alc_spec *spec = codec->spec;
579
dad3197d 580 switch (codec->core.vendor_id) {
5aec9891
KY
581 case 0x10ec0236:
582 case 0x10ec0256:
66c5d718 583 case 0x10ec0283:
dad3197d
KY
584 case 0x10ec0286:
585 case 0x10ec0288:
586 case 0x10ec0298:
587 alc_headset_mic_no_shutup(codec);
588 break;
589 default:
590 if (!spec->no_shutup_pins)
591 snd_hda_shutup_pins(codec);
592 break;
593 }
c0ca5ece
TI
594}
595
1c716153 596/* generic shutup callback;
4ce8e6a5 597 * just turning off EAPD and a little pause for avoiding pop-noise
1c716153
TI
598 */
599static void alc_eapd_shutup(struct hda_codec *codec)
600{
97a26570
KY
601 struct alc_spec *spec = codec->spec;
602
1c716153 603 alc_auto_setup_eapd(codec, false);
97a26570
KY
604 if (!spec->no_depop_delay)
605 msleep(200);
c0ca5ece 606 alc_shutup_pins(codec);
1c716153
TI
607}
608
1d045db9 609/* generic EAPD initialization */
4a79ba34 610static void alc_auto_init_amp(struct hda_codec *codec, int type)
bc9f98a9 611{
39fa84e9 612 alc_auto_setup_eapd(codec, true);
5579cd6f 613 alc_write_gpio(codec);
4a79ba34 614 switch (type) {
4a79ba34 615 case ALC_INIT_DEFAULT:
7639a06c 616 switch (codec->core.vendor_id) {
c9b58006 617 case 0x10ec0260:
98b24883 618 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
c9b58006 619 break;
c9b58006
KY
620 case 0x10ec0880:
621 case 0x10ec0882:
622 case 0x10ec0883:
623 case 0x10ec0885:
1df8874b 624 alc_update_coef_idx(codec, 7, 0, 0x2030);
c9b58006 625 break;
f9423e7a 626 case 0x10ec0888:
4a79ba34 627 alc888_coef_init(codec);
f9423e7a 628 break;
bc9f98a9 629 }
4a79ba34
TI
630 break;
631 }
632}
633
35a39f98
TI
634/* get a primary headphone pin if available */
635static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
636{
637 if (spec->gen.autocfg.hp_pins[0])
638 return spec->gen.autocfg.hp_pins[0];
639 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
640 return spec->gen.autocfg.line_out_pins[0];
641 return 0;
642}
08c189f2 643
1d045db9 644/*
08c189f2 645 * Realtek SSID verification
1d045db9 646 */
42cf0d01 647
08c189f2
TI
648/* Could be any non-zero and even value. When used as fixup, tells
649 * the driver to ignore any present sku defines.
650 */
651#define ALC_FIXUP_SKU_IGNORE (2)
1a1455de 652
08c189f2
TI
653static void alc_fixup_sku_ignore(struct hda_codec *codec,
654 const struct hda_fixup *fix, int action)
1a1455de 655{
1a1455de 656 struct alc_spec *spec = codec->spec;
08c189f2
TI
657 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
658 spec->cdefine.fixup = 1;
659 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
1a1455de 660 }
1a1455de
TI
661}
662
b5c6611f
ML
663static void alc_fixup_no_depop_delay(struct hda_codec *codec,
664 const struct hda_fixup *fix, int action)
665{
666 struct alc_spec *spec = codec->spec;
667
84d2dc3e 668 if (action == HDA_FIXUP_ACT_PROBE) {
b5c6611f 669 spec->no_depop_delay = 1;
84d2dc3e
ML
670 codec->depop_delay = 0;
671 }
b5c6611f
ML
672}
673
08c189f2 674static int alc_auto_parse_customize_define(struct hda_codec *codec)
4a79ba34 675{
08c189f2
TI
676 unsigned int ass, tmp, i;
677 unsigned nid = 0;
4a79ba34
TI
678 struct alc_spec *spec = codec->spec;
679
08c189f2 680 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
4a79ba34 681
08c189f2
TI
682 if (spec->cdefine.fixup) {
683 ass = spec->cdefine.sku_cfg;
684 if (ass == ALC_FIXUP_SKU_IGNORE)
685 return -1;
686 goto do_sku;
bb35febd
TI
687 }
688
5100cd07
TI
689 if (!codec->bus->pci)
690 return -1;
7639a06c 691 ass = codec->core.subsystem_id & 0xffff;
08c189f2
TI
692 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
693 goto do_sku;
4a79ba34 694
08c189f2 695 nid = 0x1d;
7639a06c 696 if (codec->core.vendor_id == 0x10ec0260)
08c189f2
TI
697 nid = 0x17;
698 ass = snd_hda_codec_get_pincfg(codec, nid);
42cf0d01 699
08c189f2 700 if (!(ass & 1)) {
4e76a883 701 codec_info(codec, "%s: SKU not ready 0x%08x\n",
7639a06c 702 codec->core.chip_name, ass);
08c189f2 703 return -1;
42cf0d01
DH
704 }
705
08c189f2
TI
706 /* check sum */
707 tmp = 0;
708 for (i = 1; i < 16; i++) {
709 if ((ass >> i) & 1)
710 tmp++;
ae8a60a5 711 }
08c189f2
TI
712 if (((ass >> 16) & 0xf) != tmp)
713 return -1;
ae8a60a5 714
da00c244
KY
715 spec->cdefine.port_connectivity = ass >> 30;
716 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
717 spec->cdefine.check_sum = (ass >> 16) & 0xf;
718 spec->cdefine.customization = ass >> 8;
719do_sku:
720 spec->cdefine.sku_cfg = ass;
721 spec->cdefine.external_amp = (ass & 0x38) >> 3;
722 spec->cdefine.platform_type = (ass & 0x4) >> 2;
723 spec->cdefine.swap = (ass & 0x2) >> 1;
724 spec->cdefine.override = ass & 0x1;
725
4e76a883 726 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
da00c244 727 nid, spec->cdefine.sku_cfg);
4e76a883 728 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
da00c244 729 spec->cdefine.port_connectivity);
4e76a883
TI
730 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
731 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
732 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
733 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
734 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
735 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
736 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
da00c244
KY
737
738 return 0;
739}
740
08c189f2
TI
741/* return the position of NID in the list, or -1 if not found */
742static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
743{
744 int i;
745 for (i = 0; i < nums; i++)
746 if (list[i] == nid)
747 return i;
748 return -1;
749}
1d045db9 750/* return true if the given NID is found in the list */
3af9ee6b
TI
751static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
752{
21268961 753 return find_idx_in_nid_list(nid, list, nums) >= 0;
3af9ee6b
TI
754}
755
4a79ba34
TI
756/* check subsystem ID and set up device-specific initialization;
757 * return 1 if initialized, 0 if invalid SSID
758 */
759/* 32-bit subsystem ID for BIOS loading in HD Audio codec.
760 * 31 ~ 16 : Manufacture ID
761 * 15 ~ 8 : SKU ID
762 * 7 ~ 0 : Assembly ID
763 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
764 */
58c57cfa 765static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
4a79ba34
TI
766{
767 unsigned int ass, tmp, i;
768 unsigned nid;
769 struct alc_spec *spec = codec->spec;
770
90622917
DH
771 if (spec->cdefine.fixup) {
772 ass = spec->cdefine.sku_cfg;
773 if (ass == ALC_FIXUP_SKU_IGNORE)
774 return 0;
775 goto do_sku;
776 }
777
7639a06c 778 ass = codec->core.subsystem_id & 0xffff;
5100cd07
TI
779 if (codec->bus->pci &&
780 ass != codec->bus->pci->subsystem_device && (ass & 1))
4a79ba34
TI
781 goto do_sku;
782
783 /* invalid SSID, check the special NID pin defcfg instead */
784 /*
def319f9 785 * 31~30 : port connectivity
4a79ba34
TI
786 * 29~21 : reserve
787 * 20 : PCBEEP input
788 * 19~16 : Check sum (15:1)
789 * 15~1 : Custom
790 * 0 : override
791 */
792 nid = 0x1d;
7639a06c 793 if (codec->core.vendor_id == 0x10ec0260)
4a79ba34
TI
794 nid = 0x17;
795 ass = snd_hda_codec_get_pincfg(codec, nid);
4e76a883
TI
796 codec_dbg(codec,
797 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
cb6605c1 798 ass, nid);
6227cdce 799 if (!(ass & 1))
4a79ba34
TI
800 return 0;
801 if ((ass >> 30) != 1) /* no physical connection */
802 return 0;
803
804 /* check sum */
805 tmp = 0;
806 for (i = 1; i < 16; i++) {
807 if ((ass >> i) & 1)
808 tmp++;
809 }
810 if (((ass >> 16) & 0xf) != tmp)
811 return 0;
812do_sku:
4e76a883 813 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
7639a06c 814 ass & 0xffff, codec->core.vendor_id);
4a79ba34
TI
815 /*
816 * 0 : override
817 * 1 : Swap Jack
818 * 2 : 0 --> Desktop, 1 --> Laptop
819 * 3~5 : External Amplifier control
820 * 7~6 : Reserved
821 */
822 tmp = (ass & 0x38) >> 3; /* external Amp control */
1c76aa5f
TI
823 if (spec->init_amp == ALC_INIT_UNDEFINED) {
824 switch (tmp) {
825 case 1:
5579cd6f 826 alc_setup_gpio(codec, 0x01);
1c76aa5f
TI
827 break;
828 case 3:
5579cd6f 829 alc_setup_gpio(codec, 0x02);
1c76aa5f
TI
830 break;
831 case 7:
5579cd6f 832 alc_setup_gpio(codec, 0x03);
1c76aa5f
TI
833 break;
834 case 5:
835 default:
836 spec->init_amp = ALC_INIT_DEFAULT;
837 break;
838 }
bc9f98a9 839 }
ea1fb29a 840
8c427226 841 /* is laptop or Desktop and enable the function "Mute internal speaker
c9b58006
KY
842 * when the external headphone out jack is plugged"
843 */
8c427226 844 if (!(ass & 0x8000))
4a79ba34 845 return 1;
c9b58006
KY
846 /*
847 * 10~8 : Jack location
848 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
849 * 14~13: Resvered
850 * 15 : 1 --> enable the function "Mute internal speaker
851 * when the external headphone out jack is plugged"
852 */
35a39f98 853 if (!alc_get_hp_pin(spec)) {
01d4825d 854 hda_nid_t nid;
c9b58006 855 tmp = (ass >> 11) & 0x3; /* HP to chassis */
58c57cfa 856 nid = ports[tmp];
08c189f2
TI
857 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
858 spec->gen.autocfg.line_outs))
3af9ee6b 859 return 1;
08c189f2 860 spec->gen.autocfg.hp_pins[0] = nid;
c9b58006 861 }
4a79ba34
TI
862 return 1;
863}
ea1fb29a 864
3e6179b8
TI
865/* Check the validity of ALC subsystem-id
866 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
867static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
4a79ba34 868{
58c57cfa 869 if (!alc_subsystem_id(codec, ports)) {
4a79ba34 870 struct alc_spec *spec = codec->spec;
67791202
TI
871 if (spec->init_amp == ALC_INIT_UNDEFINED) {
872 codec_dbg(codec,
873 "realtek: Enable default setup for auto mode as fallback\n");
874 spec->init_amp = ALC_INIT_DEFAULT;
875 }
4a79ba34 876 }
21268961 877}
1a1455de 878
1d045db9 879/*
ef8ef5fb 880 */
f9e336f6 881
9d36a7dc
DH
882static void alc_fixup_inv_dmic(struct hda_codec *codec,
883 const struct hda_fixup *fix, int action)
125821ae
TI
884{
885 struct alc_spec *spec = codec->spec;
668d1e96 886
9d36a7dc 887 spec->gen.inv_dmic_split = 1;
6e72aa5f
TI
888}
889
e9edcee0 890
08c189f2 891static int alc_build_controls(struct hda_codec *codec)
1d045db9 892{
a5cb463a 893 int err;
e9427969 894
08c189f2
TI
895 err = snd_hda_gen_build_controls(codec);
896 if (err < 0)
897 return err;
1da177e4 898
1727a771 899 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
1c4a54b4 900 return 0;
a361d84b
KY
901}
902
a361d84b 903
df694daa 904/*
08c189f2 905 * Common callbacks
df694daa 906 */
a361d84b 907
c9af753f
TI
908static void alc_pre_init(struct hda_codec *codec)
909{
910 alc_fill_eapd_coef(codec);
911}
912
aeac1a0d
KY
913#define is_s3_resume(codec) \
914 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
c9af753f
TI
915#define is_s4_resume(codec) \
916 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
917
08c189f2 918static int alc_init(struct hda_codec *codec)
1d045db9
TI
919{
920 struct alc_spec *spec = codec->spec;
a361d84b 921
c9af753f
TI
922 /* hibernation resume needs the full chip initialization */
923 if (is_s4_resume(codec))
924 alc_pre_init(codec);
925
08c189f2
TI
926 if (spec->init_hook)
927 spec->init_hook(codec);
a361d84b 928
89781d08 929 spec->gen.skip_verbs = 1; /* applied in below */
607ca3bd 930 snd_hda_gen_init(codec);
08c189f2
TI
931 alc_fix_pll(codec);
932 alc_auto_init_amp(codec, spec->init_amp);
89781d08 933 snd_hda_apply_verbs(codec); /* apply verbs here after own init */
3abf2f36 934
1727a771 935 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
a361d84b 936
1d045db9
TI
937 return 0;
938}
a361d84b 939
c3d9ca93
RD
940#define alc_free snd_hda_gen_free
941
942#ifdef CONFIG_PM
08c189f2 943static inline void alc_shutup(struct hda_codec *codec)
1d045db9
TI
944{
945 struct alc_spec *spec = codec->spec;
a361d84b 946
c7273bd6
TI
947 if (!snd_hda_get_bool_hint(codec, "shutup"))
948 return; /* disabled explicitly by hints */
949
08c189f2
TI
950 if (spec && spec->shutup)
951 spec->shutup(codec);
9bfb2844 952 else
c0ca5ece 953 alc_shutup_pins(codec);
1d045db9
TI
954}
955
08c189f2 956static void alc_power_eapd(struct hda_codec *codec)
1d045db9 957{
08c189f2 958 alc_auto_setup_eapd(codec, false);
1d045db9 959}
2134ea4f 960
08c189f2 961static int alc_suspend(struct hda_codec *codec)
1d045db9
TI
962{
963 struct alc_spec *spec = codec->spec;
08c189f2
TI
964 alc_shutup(codec);
965 if (spec && spec->power_hook)
966 spec->power_hook(codec);
a361d84b
KY
967 return 0;
968}
969
08c189f2 970static int alc_resume(struct hda_codec *codec)
1d045db9 971{
97a26570
KY
972 struct alc_spec *spec = codec->spec;
973
974 if (!spec->no_depop_delay)
975 msleep(150); /* to avoid pop noise */
08c189f2 976 codec->patch_ops.init(codec);
1a462be5 977 snd_hda_regmap_sync(codec);
08c189f2
TI
978 hda_call_check_power_status(codec, 0x01);
979 return 0;
1d045db9 980}
08c189f2 981#endif
f6a92248 982
1d045db9 983/*
1d045db9 984 */
08c189f2
TI
985static const struct hda_codec_ops alc_patch_ops = {
986 .build_controls = alc_build_controls,
987 .build_pcms = snd_hda_gen_build_pcms,
988 .init = alc_init,
989 .free = alc_free,
990 .unsol_event = snd_hda_jack_unsol_event,
991#ifdef CONFIG_PM
992 .resume = alc_resume,
08c189f2 993 .suspend = alc_suspend,
fce52a3b 994 .check_power_status = snd_hda_gen_check_power_status,
08c189f2 995#endif
08c189f2 996};
f6a92248 997
f53281e6 998
ded255be 999#define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
e01bf509 1000
e4770629 1001/*
4b016931 1002 * Rename codecs appropriately from COEF value or subvendor id
e4770629 1003 */
08c189f2
TI
1004struct alc_codec_rename_table {
1005 unsigned int vendor_id;
1006 unsigned short coef_mask;
1007 unsigned short coef_bits;
1008 const char *name;
1009};
84898e87 1010
4b016931
KY
1011struct alc_codec_rename_pci_table {
1012 unsigned int codec_vendor_id;
1013 unsigned short pci_subvendor;
1014 unsigned short pci_subdevice;
1015 const char *name;
1016};
1017
6b0f95c4 1018static const struct alc_codec_rename_table rename_tbl[] = {
e6e5f7ad 1019 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
08c189f2
TI
1020 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
1021 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
1022 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
1023 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
1024 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
1025 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
1026 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
1027 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
e6e5f7ad 1028 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
08c189f2
TI
1029 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
1030 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
1031 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
1032 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
1033 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
1034 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
1035 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
1036 { } /* terminator */
1037};
84898e87 1038
6b0f95c4 1039static const struct alc_codec_rename_pci_table rename_pci_tbl[] = {
4b016931
KY
1040 { 0x10ec0280, 0x1028, 0, "ALC3220" },
1041 { 0x10ec0282, 0x1028, 0, "ALC3221" },
1042 { 0x10ec0283, 0x1028, 0, "ALC3223" },
193177de 1043 { 0x10ec0288, 0x1028, 0, "ALC3263" },
4b016931 1044 { 0x10ec0292, 0x1028, 0, "ALC3226" },
193177de 1045 { 0x10ec0293, 0x1028, 0, "ALC3235" },
4b016931
KY
1046 { 0x10ec0255, 0x1028, 0, "ALC3234" },
1047 { 0x10ec0668, 0x1028, 0, "ALC3661" },
e6e5f7ad
KY
1048 { 0x10ec0275, 0x1028, 0, "ALC3260" },
1049 { 0x10ec0899, 0x1028, 0, "ALC3861" },
2c674fac 1050 { 0x10ec0298, 0x1028, 0, "ALC3266" },
736f20a7 1051 { 0x10ec0236, 0x1028, 0, "ALC3204" },
82324502 1052 { 0x10ec0256, 0x1028, 0, "ALC3246" },
4231430d 1053 { 0x10ec0225, 0x1028, 0, "ALC3253" },
7d727869 1054 { 0x10ec0295, 0x1028, 0, "ALC3254" },
28f1f9b2 1055 { 0x10ec0299, 0x1028, 0, "ALC3271" },
e6e5f7ad
KY
1056 { 0x10ec0670, 0x1025, 0, "ALC669X" },
1057 { 0x10ec0676, 0x1025, 0, "ALC679X" },
1058 { 0x10ec0282, 0x1043, 0, "ALC3229" },
1059 { 0x10ec0233, 0x1043, 0, "ALC3236" },
1060 { 0x10ec0280, 0x103c, 0, "ALC3228" },
1061 { 0x10ec0282, 0x103c, 0, "ALC3227" },
1062 { 0x10ec0286, 0x103c, 0, "ALC3242" },
1063 { 0x10ec0290, 0x103c, 0, "ALC3241" },
1064 { 0x10ec0668, 0x103c, 0, "ALC3662" },
1065 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
1066 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
4b016931
KY
1067 { } /* terminator */
1068};
1069
08c189f2 1070static int alc_codec_rename_from_preset(struct hda_codec *codec)
1d045db9 1071{
08c189f2 1072 const struct alc_codec_rename_table *p;
4b016931 1073 const struct alc_codec_rename_pci_table *q;
60db6b53 1074
08c189f2 1075 for (p = rename_tbl; p->vendor_id; p++) {
7639a06c 1076 if (p->vendor_id != codec->core.vendor_id)
08c189f2
TI
1077 continue;
1078 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
1079 return alc_codec_rename(codec, p->name);
1d045db9 1080 }
4b016931 1081
5100cd07
TI
1082 if (!codec->bus->pci)
1083 return 0;
4b016931 1084 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
7639a06c 1085 if (q->codec_vendor_id != codec->core.vendor_id)
4b016931
KY
1086 continue;
1087 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1088 continue;
1089 if (!q->pci_subdevice ||
1090 q->pci_subdevice == codec->bus->pci->subsystem_device)
1091 return alc_codec_rename(codec, q->name);
1092 }
1093
08c189f2 1094 return 0;
1d045db9 1095}
f53281e6 1096
e4770629 1097
1d045db9
TI
1098/*
1099 * Digital-beep handlers
1100 */
1101#ifdef CONFIG_SND_HDA_INPUT_BEEP
fea80fae
TI
1102
1103/* additional beep mixers; private_value will be overwritten */
1104static const struct snd_kcontrol_new alc_beep_mixer[] = {
1105 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1106 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1107};
1108
1109/* set up and create beep controls */
1110static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1111 int idx, int dir)
1112{
1113 struct snd_kcontrol_new *knew;
1114 unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1115 int i;
1116
1117 for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1118 knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1119 &alc_beep_mixer[i]);
1120 if (!knew)
1121 return -ENOMEM;
1122 knew->private_value = beep_amp;
1123 }
1124 return 0;
1125}
84898e87 1126
6317e5eb 1127static const struct snd_pci_quirk beep_allow_list[] = {
7110005e 1128 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
a4b7f21d 1129 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
1d045db9 1130 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
8554ee40 1131 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
1d045db9
TI
1132 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1133 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1134 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
78f8baf1 1135 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
1d045db9 1136 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
6317e5eb 1137 /* denylist -- no beep available */
051c78af
TI
1138 SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
1139 SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
1d045db9 1140 {}
fe3eb0a7
KY
1141};
1142
1d045db9
TI
1143static inline int has_cdefine_beep(struct hda_codec *codec)
1144{
1145 struct alc_spec *spec = codec->spec;
1146 const struct snd_pci_quirk *q;
6317e5eb 1147 q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list);
1d045db9
TI
1148 if (q)
1149 return q->value;
1150 return spec->cdefine.enable_pcbeep;
1151}
1152#else
fea80fae 1153#define set_beep_amp(spec, nid, idx, dir) 0
1d045db9
TI
1154#define has_cdefine_beep(codec) 0
1155#endif
84898e87 1156
1d045db9
TI
1157/* parse the BIOS configuration and set up the alc_spec */
1158/* return 1 if successful, 0 if the proper config is not found,
1159 * or a negative error code
1160 */
3e6179b8
TI
1161static int alc_parse_auto_config(struct hda_codec *codec,
1162 const hda_nid_t *ignore_nids,
1163 const hda_nid_t *ssid_nids)
1d045db9
TI
1164{
1165 struct alc_spec *spec = codec->spec;
08c189f2 1166 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
1d045db9 1167 int err;
26f5df26 1168
53c334ad
TI
1169 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1170 spec->parse_flags);
1d045db9
TI
1171 if (err < 0)
1172 return err;
3e6179b8
TI
1173
1174 if (ssid_nids)
1175 alc_ssid_check(codec, ssid_nids);
64154835 1176
08c189f2
TI
1177 err = snd_hda_gen_parse_auto_config(codec, cfg);
1178 if (err < 0)
1179 return err;
070cff4c 1180
1d045db9 1181 return 1;
60db6b53 1182}
f6a92248 1183
3de95173
TI
1184/* common preparation job for alc_spec */
1185static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1186{
1187 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1188 int err;
1189
1190 if (!spec)
1191 return -ENOMEM;
1192 codec->spec = spec;
08c189f2
TI
1193 snd_hda_gen_spec_init(&spec->gen);
1194 spec->gen.mixer_nid = mixer_nid;
1195 spec->gen.own_eapd_ctl = 1;
1098b7c2 1196 codec->single_adc_amp = 1;
08c189f2
TI
1197 /* FIXME: do we need this for all Realtek codec models? */
1198 codec->spdif_status_reset = 1;
a6e7d0a4 1199 codec->forced_resume = 1;
225068ab 1200 codec->patch_ops = alc_patch_ops;
b837a9f5 1201 mutex_init(&spec->coef_mutex);
3de95173
TI
1202
1203 err = alc_codec_rename_from_preset(codec);
1204 if (err < 0) {
1205 kfree(spec);
1206 return err;
1207 }
1208 return 0;
1209}
1210
3e6179b8
TI
1211static int alc880_parse_auto_config(struct hda_codec *codec)
1212{
1213 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
7d7eb9ea 1214 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3e6179b8
TI
1215 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1216}
1217
ee3b2969
TI
1218/*
1219 * ALC880 fix-ups
1220 */
1221enum {
411225a0 1222 ALC880_FIXUP_GPIO1,
ee3b2969
TI
1223 ALC880_FIXUP_GPIO2,
1224 ALC880_FIXUP_MEDION_RIM,
dc6af52d 1225 ALC880_FIXUP_LG,
db8a38e5 1226 ALC880_FIXUP_LG_LW25,
f02aab5d 1227 ALC880_FIXUP_W810,
27e917f8 1228 ALC880_FIXUP_EAPD_COEF,
b9368f5c 1229 ALC880_FIXUP_TCL_S700,
cf5a2279
TI
1230 ALC880_FIXUP_VOL_KNOB,
1231 ALC880_FIXUP_FUJITSU,
ba533818 1232 ALC880_FIXUP_F1734,
817de92f 1233 ALC880_FIXUP_UNIWILL,
967b88c4 1234 ALC880_FIXUP_UNIWILL_DIG,
96e225f6 1235 ALC880_FIXUP_Z71V,
487a588d 1236 ALC880_FIXUP_ASUS_W5A,
67b6ec31
TI
1237 ALC880_FIXUP_3ST_BASE,
1238 ALC880_FIXUP_3ST,
1239 ALC880_FIXUP_3ST_DIG,
1240 ALC880_FIXUP_5ST_BASE,
1241 ALC880_FIXUP_5ST,
1242 ALC880_FIXUP_5ST_DIG,
1243 ALC880_FIXUP_6ST_BASE,
1244 ALC880_FIXUP_6ST,
1245 ALC880_FIXUP_6ST_DIG,
5397145f 1246 ALC880_FIXUP_6ST_AUTOMUTE,
ee3b2969
TI
1247};
1248
cf5a2279
TI
1249/* enable the volume-knob widget support on NID 0x21 */
1250static void alc880_fixup_vol_knob(struct hda_codec *codec,
1727a771 1251 const struct hda_fixup *fix, int action)
cf5a2279 1252{
1727a771 1253 if (action == HDA_FIXUP_ACT_PROBE)
62f949bf
TI
1254 snd_hda_jack_detect_enable_callback(codec, 0x21,
1255 alc_update_knob_master);
cf5a2279
TI
1256}
1257
1727a771 1258static const struct hda_fixup alc880_fixups[] = {
411225a0 1259 [ALC880_FIXUP_GPIO1] = {
5579cd6f
TI
1260 .type = HDA_FIXUP_FUNC,
1261 .v.func = alc_fixup_gpio1,
411225a0 1262 },
ee3b2969 1263 [ALC880_FIXUP_GPIO2] = {
5579cd6f
TI
1264 .type = HDA_FIXUP_FUNC,
1265 .v.func = alc_fixup_gpio2,
ee3b2969
TI
1266 },
1267 [ALC880_FIXUP_MEDION_RIM] = {
1727a771 1268 .type = HDA_FIXUP_VERBS,
ee3b2969
TI
1269 .v.verbs = (const struct hda_verb[]) {
1270 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1271 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1272 { }
1273 },
1274 .chained = true,
1275 .chain_id = ALC880_FIXUP_GPIO2,
1276 },
dc6af52d 1277 [ALC880_FIXUP_LG] = {
1727a771
TI
1278 .type = HDA_FIXUP_PINS,
1279 .v.pins = (const struct hda_pintbl[]) {
dc6af52d
TI
1280 /* disable bogus unused pins */
1281 { 0x16, 0x411111f0 },
1282 { 0x18, 0x411111f0 },
1283 { 0x1a, 0x411111f0 },
1284 { }
1285 }
1286 },
db8a38e5
TI
1287 [ALC880_FIXUP_LG_LW25] = {
1288 .type = HDA_FIXUP_PINS,
1289 .v.pins = (const struct hda_pintbl[]) {
1290 { 0x1a, 0x0181344f }, /* line-in */
1291 { 0x1b, 0x0321403f }, /* headphone */
1292 { }
1293 }
1294 },
f02aab5d 1295 [ALC880_FIXUP_W810] = {
1727a771
TI
1296 .type = HDA_FIXUP_PINS,
1297 .v.pins = (const struct hda_pintbl[]) {
f02aab5d
TI
1298 /* disable bogus unused pins */
1299 { 0x17, 0x411111f0 },
1300 { }
1301 },
1302 .chained = true,
1303 .chain_id = ALC880_FIXUP_GPIO2,
1304 },
27e917f8 1305 [ALC880_FIXUP_EAPD_COEF] = {
1727a771 1306 .type = HDA_FIXUP_VERBS,
27e917f8
TI
1307 .v.verbs = (const struct hda_verb[]) {
1308 /* change to EAPD mode */
1309 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1310 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1311 {}
1312 },
1313 },
b9368f5c 1314 [ALC880_FIXUP_TCL_S700] = {
1727a771 1315 .type = HDA_FIXUP_VERBS,
b9368f5c
TI
1316 .v.verbs = (const struct hda_verb[]) {
1317 /* change to EAPD mode */
1318 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1319 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1320 {}
1321 },
1322 .chained = true,
1323 .chain_id = ALC880_FIXUP_GPIO2,
1324 },
cf5a2279 1325 [ALC880_FIXUP_VOL_KNOB] = {
1727a771 1326 .type = HDA_FIXUP_FUNC,
cf5a2279
TI
1327 .v.func = alc880_fixup_vol_knob,
1328 },
1329 [ALC880_FIXUP_FUJITSU] = {
1330 /* override all pins as BIOS on old Amilo is broken */
1727a771
TI
1331 .type = HDA_FIXUP_PINS,
1332 .v.pins = (const struct hda_pintbl[]) {
bb148bde 1333 { 0x14, 0x0121401f }, /* HP */
cf5a2279
TI
1334 { 0x15, 0x99030120 }, /* speaker */
1335 { 0x16, 0x99030130 }, /* bass speaker */
1336 { 0x17, 0x411111f0 }, /* N/A */
1337 { 0x18, 0x411111f0 }, /* N/A */
1338 { 0x19, 0x01a19950 }, /* mic-in */
1339 { 0x1a, 0x411111f0 }, /* N/A */
1340 { 0x1b, 0x411111f0 }, /* N/A */
1341 { 0x1c, 0x411111f0 }, /* N/A */
1342 { 0x1d, 0x411111f0 }, /* N/A */
1343 { 0x1e, 0x01454140 }, /* SPDIF out */
1344 { }
1345 },
1346 .chained = true,
1347 .chain_id = ALC880_FIXUP_VOL_KNOB,
1348 },
ba533818
TI
1349 [ALC880_FIXUP_F1734] = {
1350 /* almost compatible with FUJITSU, but no bass and SPDIF */
1727a771
TI
1351 .type = HDA_FIXUP_PINS,
1352 .v.pins = (const struct hda_pintbl[]) {
bb148bde 1353 { 0x14, 0x0121401f }, /* HP */
ba533818
TI
1354 { 0x15, 0x99030120 }, /* speaker */
1355 { 0x16, 0x411111f0 }, /* N/A */
1356 { 0x17, 0x411111f0 }, /* N/A */
1357 { 0x18, 0x411111f0 }, /* N/A */
1358 { 0x19, 0x01a19950 }, /* mic-in */
1359 { 0x1a, 0x411111f0 }, /* N/A */
1360 { 0x1b, 0x411111f0 }, /* N/A */
1361 { 0x1c, 0x411111f0 }, /* N/A */
1362 { 0x1d, 0x411111f0 }, /* N/A */
1363 { 0x1e, 0x411111f0 }, /* N/A */
1364 { }
1365 },
1366 .chained = true,
1367 .chain_id = ALC880_FIXUP_VOL_KNOB,
1368 },
817de92f
TI
1369 [ALC880_FIXUP_UNIWILL] = {
1370 /* need to fix HP and speaker pins to be parsed correctly */
1727a771
TI
1371 .type = HDA_FIXUP_PINS,
1372 .v.pins = (const struct hda_pintbl[]) {
817de92f
TI
1373 { 0x14, 0x0121411f }, /* HP */
1374 { 0x15, 0x99030120 }, /* speaker */
1375 { 0x16, 0x99030130 }, /* bass speaker */
1376 { }
1377 },
1378 },
967b88c4 1379 [ALC880_FIXUP_UNIWILL_DIG] = {
1727a771
TI
1380 .type = HDA_FIXUP_PINS,
1381 .v.pins = (const struct hda_pintbl[]) {
967b88c4
TI
1382 /* disable bogus unused pins */
1383 { 0x17, 0x411111f0 },
1384 { 0x19, 0x411111f0 },
1385 { 0x1b, 0x411111f0 },
1386 { 0x1f, 0x411111f0 },
1387 { }
1388 }
1389 },
96e225f6 1390 [ALC880_FIXUP_Z71V] = {
1727a771
TI
1391 .type = HDA_FIXUP_PINS,
1392 .v.pins = (const struct hda_pintbl[]) {
96e225f6
TI
1393 /* set up the whole pins as BIOS is utterly broken */
1394 { 0x14, 0x99030120 }, /* speaker */
1395 { 0x15, 0x0121411f }, /* HP */
1396 { 0x16, 0x411111f0 }, /* N/A */
1397 { 0x17, 0x411111f0 }, /* N/A */
1398 { 0x18, 0x01a19950 }, /* mic-in */
1399 { 0x19, 0x411111f0 }, /* N/A */
1400 { 0x1a, 0x01813031 }, /* line-in */
1401 { 0x1b, 0x411111f0 }, /* N/A */
1402 { 0x1c, 0x411111f0 }, /* N/A */
1403 { 0x1d, 0x411111f0 }, /* N/A */
1404 { 0x1e, 0x0144111e }, /* SPDIF */
1405 { }
1406 }
1407 },
487a588d
TI
1408 [ALC880_FIXUP_ASUS_W5A] = {
1409 .type = HDA_FIXUP_PINS,
1410 .v.pins = (const struct hda_pintbl[]) {
1411 /* set up the whole pins as BIOS is utterly broken */
1412 { 0x14, 0x0121411f }, /* HP */
1413 { 0x15, 0x411111f0 }, /* N/A */
1414 { 0x16, 0x411111f0 }, /* N/A */
1415 { 0x17, 0x411111f0 }, /* N/A */
1416 { 0x18, 0x90a60160 }, /* mic */
1417 { 0x19, 0x411111f0 }, /* N/A */
1418 { 0x1a, 0x411111f0 }, /* N/A */
1419 { 0x1b, 0x411111f0 }, /* N/A */
1420 { 0x1c, 0x411111f0 }, /* N/A */
1421 { 0x1d, 0x411111f0 }, /* N/A */
1422 { 0x1e, 0xb743111e }, /* SPDIF out */
1423 { }
1424 },
1425 .chained = true,
1426 .chain_id = ALC880_FIXUP_GPIO1,
1427 },
67b6ec31 1428 [ALC880_FIXUP_3ST_BASE] = {
1727a771
TI
1429 .type = HDA_FIXUP_PINS,
1430 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1431 { 0x14, 0x01014010 }, /* line-out */
1432 { 0x15, 0x411111f0 }, /* N/A */
1433 { 0x16, 0x411111f0 }, /* N/A */
1434 { 0x17, 0x411111f0 }, /* N/A */
1435 { 0x18, 0x01a19c30 }, /* mic-in */
1436 { 0x19, 0x0121411f }, /* HP */
1437 { 0x1a, 0x01813031 }, /* line-in */
1438 { 0x1b, 0x02a19c40 }, /* front-mic */
1439 { 0x1c, 0x411111f0 }, /* N/A */
1440 { 0x1d, 0x411111f0 }, /* N/A */
1441 /* 0x1e is filled in below */
1442 { 0x1f, 0x411111f0 }, /* N/A */
1443 { }
1444 }
1445 },
1446 [ALC880_FIXUP_3ST] = {
1727a771
TI
1447 .type = HDA_FIXUP_PINS,
1448 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1449 { 0x1e, 0x411111f0 }, /* N/A */
1450 { }
1451 },
1452 .chained = true,
1453 .chain_id = ALC880_FIXUP_3ST_BASE,
1454 },
1455 [ALC880_FIXUP_3ST_DIG] = {
1727a771
TI
1456 .type = HDA_FIXUP_PINS,
1457 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1458 { 0x1e, 0x0144111e }, /* SPDIF */
1459 { }
1460 },
1461 .chained = true,
1462 .chain_id = ALC880_FIXUP_3ST_BASE,
1463 },
1464 [ALC880_FIXUP_5ST_BASE] = {
1727a771
TI
1465 .type = HDA_FIXUP_PINS,
1466 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1467 { 0x14, 0x01014010 }, /* front */
1468 { 0x15, 0x411111f0 }, /* N/A */
1469 { 0x16, 0x01011411 }, /* CLFE */
1470 { 0x17, 0x01016412 }, /* surr */
1471 { 0x18, 0x01a19c30 }, /* mic-in */
1472 { 0x19, 0x0121411f }, /* HP */
1473 { 0x1a, 0x01813031 }, /* line-in */
1474 { 0x1b, 0x02a19c40 }, /* front-mic */
1475 { 0x1c, 0x411111f0 }, /* N/A */
1476 { 0x1d, 0x411111f0 }, /* N/A */
1477 /* 0x1e is filled in below */
1478 { 0x1f, 0x411111f0 }, /* N/A */
1479 { }
1480 }
1481 },
1482 [ALC880_FIXUP_5ST] = {
1727a771
TI
1483 .type = HDA_FIXUP_PINS,
1484 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1485 { 0x1e, 0x411111f0 }, /* N/A */
1486 { }
1487 },
1488 .chained = true,
1489 .chain_id = ALC880_FIXUP_5ST_BASE,
1490 },
1491 [ALC880_FIXUP_5ST_DIG] = {
1727a771
TI
1492 .type = HDA_FIXUP_PINS,
1493 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1494 { 0x1e, 0x0144111e }, /* SPDIF */
1495 { }
1496 },
1497 .chained = true,
1498 .chain_id = ALC880_FIXUP_5ST_BASE,
1499 },
1500 [ALC880_FIXUP_6ST_BASE] = {
1727a771
TI
1501 .type = HDA_FIXUP_PINS,
1502 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1503 { 0x14, 0x01014010 }, /* front */
1504 { 0x15, 0x01016412 }, /* surr */
1505 { 0x16, 0x01011411 }, /* CLFE */
1506 { 0x17, 0x01012414 }, /* side */
1507 { 0x18, 0x01a19c30 }, /* mic-in */
1508 { 0x19, 0x02a19c40 }, /* front-mic */
1509 { 0x1a, 0x01813031 }, /* line-in */
1510 { 0x1b, 0x0121411f }, /* HP */
1511 { 0x1c, 0x411111f0 }, /* N/A */
1512 { 0x1d, 0x411111f0 }, /* N/A */
1513 /* 0x1e is filled in below */
1514 { 0x1f, 0x411111f0 }, /* N/A */
1515 { }
1516 }
1517 },
1518 [ALC880_FIXUP_6ST] = {
1727a771
TI
1519 .type = HDA_FIXUP_PINS,
1520 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1521 { 0x1e, 0x411111f0 }, /* N/A */
1522 { }
1523 },
1524 .chained = true,
1525 .chain_id = ALC880_FIXUP_6ST_BASE,
1526 },
1527 [ALC880_FIXUP_6ST_DIG] = {
1727a771
TI
1528 .type = HDA_FIXUP_PINS,
1529 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1530 { 0x1e, 0x0144111e }, /* SPDIF */
1531 { }
1532 },
1533 .chained = true,
1534 .chain_id = ALC880_FIXUP_6ST_BASE,
1535 },
5397145f
TI
1536 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1537 .type = HDA_FIXUP_PINS,
1538 .v.pins = (const struct hda_pintbl[]) {
1539 { 0x1b, 0x0121401f }, /* HP with jack detect */
1540 { }
1541 },
1542 .chained_before = true,
1543 .chain_id = ALC880_FIXUP_6ST_BASE,
1544 },
ee3b2969
TI
1545};
1546
1547static const struct snd_pci_quirk alc880_fixup_tbl[] = {
f02aab5d 1548 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
487a588d 1549 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
96e225f6 1550 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
29e3fdcc 1551 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
6538de03 1552 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
29e3fdcc 1553 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
27e917f8 1554 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
967b88c4 1555 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
ba533818 1556 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
817de92f 1557 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
7833c7e8 1558 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
f02aab5d 1559 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
ee3b2969 1560 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
5397145f 1561 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
a161574e 1562 SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
cf5a2279 1563 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
ba533818 1564 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
cf5a2279 1565 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
dc6af52d
TI
1566 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1567 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1568 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
db8a38e5 1569 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
b9368f5c 1570 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
67b6ec31
TI
1571
1572 /* Below is the copied entries from alc880_quirks.c.
1573 * It's not quite sure whether BIOS sets the correct pin-config table
1574 * on these machines, thus they are kept to be compatible with
1575 * the old static quirks. Once when it's confirmed to work without
1576 * these overrides, it'd be better to remove.
1577 */
1578 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1579 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1580 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1581 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1582 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1583 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1584 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1585 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1586 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1587 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1588 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1589 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1590 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1591 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1592 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1593 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1594 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1595 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1596 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1597 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1598 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1599 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1600 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1601 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1602 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1603 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1604 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1605 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1606 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1607 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1608 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1609 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1610 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1611 /* default Intel */
1612 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1613 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1614 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1615 {}
1616};
1617
1727a771 1618static const struct hda_model_fixup alc880_fixup_models[] = {
67b6ec31
TI
1619 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1620 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1621 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1622 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1623 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1624 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
5397145f 1625 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
ee3b2969
TI
1626 {}
1627};
1628
1629
1d045db9
TI
1630/*
1631 * OK, here we have finally the patch for ALC880
1632 */
1d045db9 1633static int patch_alc880(struct hda_codec *codec)
60db6b53 1634{
1d045db9 1635 struct alc_spec *spec;
1d045db9 1636 int err;
f6a92248 1637
3de95173
TI
1638 err = alc_alloc_spec(codec, 0x0b);
1639 if (err < 0)
1640 return err;
64154835 1641
3de95173 1642 spec = codec->spec;
08c189f2 1643 spec->gen.need_dac_fix = 1;
7504b6cd 1644 spec->gen.beep_nid = 0x01;
f53281e6 1645
225068ab
TI
1646 codec->patch_ops.unsol_event = alc880_unsol_event;
1647
c9af753f
TI
1648 alc_pre_init(codec);
1649
1727a771 1650 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
67b6ec31 1651 alc880_fixups);
1727a771 1652 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
ee3b2969 1653
67b6ec31
TI
1654 /* automatic parse from the BIOS config */
1655 err = alc880_parse_auto_config(codec);
1656 if (err < 0)
1657 goto error;
fe3eb0a7 1658
fea80fae
TI
1659 if (!spec->gen.no_analog) {
1660 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1661 if (err < 0)
1662 goto error;
1663 }
f53281e6 1664
1727a771 1665 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 1666
1d045db9 1667 return 0;
e16fb6d1
TI
1668
1669 error:
1670 alc_free(codec);
1671 return err;
226b1ec8
KY
1672}
1673
1d045db9 1674
60db6b53 1675/*
1d045db9 1676 * ALC260 support
60db6b53 1677 */
1d045db9 1678static int alc260_parse_auto_config(struct hda_codec *codec)
f6a92248 1679{
1d045db9 1680 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
3e6179b8
TI
1681 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1682 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
f6a92248
KY
1683}
1684
1d045db9
TI
1685/*
1686 * Pin config fixes
1687 */
1688enum {
ca8f0424
TI
1689 ALC260_FIXUP_HP_DC5750,
1690 ALC260_FIXUP_HP_PIN_0F,
1691 ALC260_FIXUP_COEF,
15317ab2 1692 ALC260_FIXUP_GPIO1,
20f7d928
TI
1693 ALC260_FIXUP_GPIO1_TOGGLE,
1694 ALC260_FIXUP_REPLACER,
0a1c4fa2 1695 ALC260_FIXUP_HP_B1900,
118cb4a4 1696 ALC260_FIXUP_KN1,
39aedee7 1697 ALC260_FIXUP_FSC_S7020,
5ebd3bbd 1698 ALC260_FIXUP_FSC_S7020_JWSE,
d08c5ef2 1699 ALC260_FIXUP_VAIO_PINS,
1d045db9
TI
1700};
1701
20f7d928
TI
1702static void alc260_gpio1_automute(struct hda_codec *codec)
1703{
1704 struct alc_spec *spec = codec->spec;
aaf312de
TI
1705
1706 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
20f7d928
TI
1707}
1708
1709static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1727a771 1710 const struct hda_fixup *fix, int action)
20f7d928
TI
1711{
1712 struct alc_spec *spec = codec->spec;
1727a771 1713 if (action == HDA_FIXUP_ACT_PROBE) {
20f7d928
TI
1714 /* although the machine has only one output pin, we need to
1715 * toggle GPIO1 according to the jack state
1716 */
08c189f2
TI
1717 spec->gen.automute_hook = alc260_gpio1_automute;
1718 spec->gen.detect_hp = 1;
1719 spec->gen.automute_speaker = 1;
1720 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
62f949bf 1721 snd_hda_jack_detect_enable_callback(codec, 0x0f,
08c189f2 1722 snd_hda_gen_hp_automute);
5579cd6f 1723 alc_setup_gpio(codec, 0x01);
20f7d928
TI
1724 }
1725}
1726
118cb4a4 1727static void alc260_fixup_kn1(struct hda_codec *codec,
1727a771 1728 const struct hda_fixup *fix, int action)
118cb4a4
TI
1729{
1730 struct alc_spec *spec = codec->spec;
1727a771 1731 static const struct hda_pintbl pincfgs[] = {
118cb4a4
TI
1732 { 0x0f, 0x02214000 }, /* HP/speaker */
1733 { 0x12, 0x90a60160 }, /* int mic */
1734 { 0x13, 0x02a19000 }, /* ext mic */
1735 { 0x18, 0x01446000 }, /* SPDIF out */
1736 /* disable bogus I/O pins */
1737 { 0x10, 0x411111f0 },
1738 { 0x11, 0x411111f0 },
1739 { 0x14, 0x411111f0 },
1740 { 0x15, 0x411111f0 },
1741 { 0x16, 0x411111f0 },
1742 { 0x17, 0x411111f0 },
1743 { 0x19, 0x411111f0 },
1744 { }
1745 };
1746
1747 switch (action) {
1727a771
TI
1748 case HDA_FIXUP_ACT_PRE_PROBE:
1749 snd_hda_apply_pincfgs(codec, pincfgs);
118cb4a4
TI
1750 spec->init_amp = ALC_INIT_NONE;
1751 break;
1752 }
1753}
1754
39aedee7
TI
1755static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1756 const struct hda_fixup *fix, int action)
1757{
1758 struct alc_spec *spec = codec->spec;
1c76aa5f 1759 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5ebd3bbd
TI
1760 spec->init_amp = ALC_INIT_NONE;
1761}
39aedee7 1762
5ebd3bbd
TI
1763static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1764 const struct hda_fixup *fix, int action)
1765{
1766 struct alc_spec *spec = codec->spec;
1767 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
f811c3cf 1768 spec->gen.add_jack_modes = 1;
5ebd3bbd 1769 spec->gen.hp_mic = 1;
e6e0ee50 1770 }
39aedee7
TI
1771}
1772
1727a771 1773static const struct hda_fixup alc260_fixups[] = {
ca8f0424 1774 [ALC260_FIXUP_HP_DC5750] = {
1727a771
TI
1775 .type = HDA_FIXUP_PINS,
1776 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
1777 { 0x11, 0x90130110 }, /* speaker */
1778 { }
1779 }
1780 },
ca8f0424 1781 [ALC260_FIXUP_HP_PIN_0F] = {
1727a771
TI
1782 .type = HDA_FIXUP_PINS,
1783 .v.pins = (const struct hda_pintbl[]) {
ca8f0424
TI
1784 { 0x0f, 0x01214000 }, /* HP */
1785 { }
1786 }
1787 },
1788 [ALC260_FIXUP_COEF] = {
1727a771 1789 .type = HDA_FIXUP_VERBS,
ca8f0424 1790 .v.verbs = (const struct hda_verb[]) {
e30cf2d2
RM
1791 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1792 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
ca8f0424
TI
1793 { }
1794 },
ca8f0424 1795 },
15317ab2 1796 [ALC260_FIXUP_GPIO1] = {
5579cd6f
TI
1797 .type = HDA_FIXUP_FUNC,
1798 .v.func = alc_fixup_gpio1,
15317ab2 1799 },
20f7d928 1800 [ALC260_FIXUP_GPIO1_TOGGLE] = {
1727a771 1801 .type = HDA_FIXUP_FUNC,
20f7d928
TI
1802 .v.func = alc260_fixup_gpio1_toggle,
1803 .chained = true,
1804 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1805 },
1806 [ALC260_FIXUP_REPLACER] = {
1727a771 1807 .type = HDA_FIXUP_VERBS,
20f7d928 1808 .v.verbs = (const struct hda_verb[]) {
192a98e2
TI
1809 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1810 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
20f7d928
TI
1811 { }
1812 },
1813 .chained = true,
1814 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1815 },
0a1c4fa2 1816 [ALC260_FIXUP_HP_B1900] = {
1727a771 1817 .type = HDA_FIXUP_FUNC,
0a1c4fa2
TI
1818 .v.func = alc260_fixup_gpio1_toggle,
1819 .chained = true,
1820 .chain_id = ALC260_FIXUP_COEF,
118cb4a4
TI
1821 },
1822 [ALC260_FIXUP_KN1] = {
1727a771 1823 .type = HDA_FIXUP_FUNC,
118cb4a4
TI
1824 .v.func = alc260_fixup_kn1,
1825 },
39aedee7
TI
1826 [ALC260_FIXUP_FSC_S7020] = {
1827 .type = HDA_FIXUP_FUNC,
1828 .v.func = alc260_fixup_fsc_s7020,
1829 },
5ebd3bbd
TI
1830 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1831 .type = HDA_FIXUP_FUNC,
1832 .v.func = alc260_fixup_fsc_s7020_jwse,
1833 .chained = true,
1834 .chain_id = ALC260_FIXUP_FSC_S7020,
1835 },
d08c5ef2
TI
1836 [ALC260_FIXUP_VAIO_PINS] = {
1837 .type = HDA_FIXUP_PINS,
1838 .v.pins = (const struct hda_pintbl[]) {
1839 /* Pin configs are missing completely on some VAIOs */
1840 { 0x0f, 0x01211020 },
1841 { 0x10, 0x0001003f },
1842 { 0x11, 0x411111f0 },
1843 { 0x12, 0x01a15930 },
1844 { 0x13, 0x411111f0 },
1845 { 0x14, 0x411111f0 },
1846 { 0x15, 0x411111f0 },
1847 { 0x16, 0x411111f0 },
1848 { 0x17, 0x411111f0 },
1849 { 0x18, 0x411111f0 },
1850 { 0x19, 0x411111f0 },
1851 { }
1852 }
1853 },
1d045db9
TI
1854};
1855
1856static const struct snd_pci_quirk alc260_fixup_tbl[] = {
15317ab2 1857 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
ca8f0424 1858 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
15317ab2 1859 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
ca8f0424 1860 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
0a1c4fa2 1861 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
d08c5ef2 1862 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
0f5a5b85 1863 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
39aedee7 1864 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
b1f58085 1865 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
118cb4a4 1866 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
20f7d928 1867 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
ca8f0424 1868 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
1d045db9
TI
1869 {}
1870};
1871
5ebd3bbd
TI
1872static const struct hda_model_fixup alc260_fixup_models[] = {
1873 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1874 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1875 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1876 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1877 {}
1878};
1879
1d045db9
TI
1880/*
1881 */
1d045db9 1882static int patch_alc260(struct hda_codec *codec)
977ddd6b 1883{
1d045db9 1884 struct alc_spec *spec;
c3c2c9e7 1885 int err;
1d045db9 1886
3de95173
TI
1887 err = alc_alloc_spec(codec, 0x07);
1888 if (err < 0)
1889 return err;
1d045db9 1890
3de95173 1891 spec = codec->spec;
ea46c3c8
TI
1892 /* as quite a few machines require HP amp for speaker outputs,
1893 * it's easier to enable it unconditionally; even if it's unneeded,
1894 * it's almost harmless.
1895 */
1896 spec->gen.prefer_hp_amp = 1;
7504b6cd 1897 spec->gen.beep_nid = 0x01;
1d045db9 1898
225068ab
TI
1899 spec->shutup = alc_eapd_shutup;
1900
c9af753f
TI
1901 alc_pre_init(codec);
1902
5ebd3bbd
TI
1903 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1904 alc260_fixups);
1727a771 1905 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
977ddd6b 1906
c3c2c9e7
TI
1907 /* automatic parse from the BIOS config */
1908 err = alc260_parse_auto_config(codec);
1909 if (err < 0)
1910 goto error;
977ddd6b 1911
fea80fae
TI
1912 if (!spec->gen.no_analog) {
1913 err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1914 if (err < 0)
1915 goto error;
1916 }
977ddd6b 1917
1727a771 1918 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 1919
1d045db9 1920 return 0;
e16fb6d1
TI
1921
1922 error:
1923 alc_free(codec);
1924 return err;
6981d184
TI
1925}
1926
1d045db9
TI
1927
1928/*
1929 * ALC882/883/885/888/889 support
1930 *
1931 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1932 * configuration. Each pin widget can choose any input DACs and a mixer.
1933 * Each ADC is connected from a mixer of all inputs. This makes possible
1934 * 6-channel independent captures.
1935 *
1936 * In addition, an independent DAC for the multi-playback (not used in this
1937 * driver yet).
1938 */
1d045db9
TI
1939
1940/*
1941 * Pin config fixes
1942 */
ff818c24 1943enum {
5c0ebfbe
TI
1944 ALC882_FIXUP_ABIT_AW9D_MAX,
1945 ALC882_FIXUP_LENOVO_Y530,
1946 ALC882_FIXUP_PB_M5210,
1947 ALC882_FIXUP_ACER_ASPIRE_7736,
1948 ALC882_FIXUP_ASUS_W90V,
8f239214 1949 ALC889_FIXUP_CD,
b2c53e20 1950 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
5c0ebfbe 1951 ALC889_FIXUP_VAIO_TT,
0e7cc2e7 1952 ALC888_FIXUP_EEE1601,
4841b8e6 1953 ALC886_FIXUP_EAPD,
177943a3 1954 ALC882_FIXUP_EAPD,
7a6069bf 1955 ALC883_FIXUP_EAPD,
8812c4f9 1956 ALC883_FIXUP_ACER_EAPD,
1a97b7f2
TI
1957 ALC882_FIXUP_GPIO1,
1958 ALC882_FIXUP_GPIO2,
eb844d51 1959 ALC882_FIXUP_GPIO3,
68ef0561
TI
1960 ALC889_FIXUP_COEF,
1961 ALC882_FIXUP_ASUS_W2JC,
c3e837bb
TI
1962 ALC882_FIXUP_ACER_ASPIRE_4930G,
1963 ALC882_FIXUP_ACER_ASPIRE_8930G,
1964 ALC882_FIXUP_ASPIRE_8930G_VERBS,
5671087f 1965 ALC885_FIXUP_MACPRO_GPIO,
02a237b2 1966 ALC889_FIXUP_DAC_ROUTE,
1a97b7f2
TI
1967 ALC889_FIXUP_MBP_VREF,
1968 ALC889_FIXUP_IMAC91_VREF,
e7729a41 1969 ALC889_FIXUP_MBA11_VREF,
0756f09c 1970 ALC889_FIXUP_MBA21_VREF,
c20f31ec 1971 ALC889_FIXUP_MP11_VREF,
9f660a1c 1972 ALC889_FIXUP_MP41_VREF,
6e72aa5f 1973 ALC882_FIXUP_INV_DMIC,
e427c237 1974 ALC882_FIXUP_NO_PRIMARY_HP,
1f0bbf03 1975 ALC887_FIXUP_ASUS_BASS,
eb9ca3ab 1976 ALC887_FIXUP_BASS_CHMAP,
7beb3a6e 1977 ALC1220_FIXUP_GB_DUAL_CODECS,
c1933008 1978 ALC1220_FIXUP_GB_X570,
0202f5cd 1979 ALC1220_FIXUP_CLEVO_P950,
80690a27
RS
1980 ALC1220_FIXUP_CLEVO_PB51ED,
1981 ALC1220_FIXUP_CLEVO_PB51ED_PINS,
ca184355
JHP
1982 ALC887_FIXUP_ASUS_AUDIO,
1983 ALC887_FIXUP_ASUS_HMIC,
9bfa7b36 1984 ALCS1200A_FIXUP_MIC_VREF,
ff818c24
TI
1985};
1986
68ef0561 1987static void alc889_fixup_coef(struct hda_codec *codec,
1727a771 1988 const struct hda_fixup *fix, int action)
68ef0561 1989{
1727a771 1990 if (action != HDA_FIXUP_ACT_INIT)
68ef0561 1991 return;
1df8874b 1992 alc_update_coef_idx(codec, 7, 0, 0x2030);
68ef0561
TI
1993}
1994
5671087f
TI
1995/* set up GPIO at initialization */
1996static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
1727a771 1997 const struct hda_fixup *fix, int action)
5671087f 1998{
215c850c
TI
1999 struct alc_spec *spec = codec->spec;
2000
2001 spec->gpio_write_delay = true;
2002 alc_fixup_gpio3(codec, fix, action);
5671087f
TI
2003}
2004
02a237b2
TI
2005/* Fix the connection of some pins for ALC889:
2006 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
2007 * work correctly (bko#42740)
2008 */
2009static void alc889_fixup_dac_route(struct hda_codec *codec,
1727a771 2010 const struct hda_fixup *fix, int action)
02a237b2 2011{
1727a771 2012 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
ef8d60fb 2013 /* fake the connections during parsing the tree */
caf3c043
MM
2014 static const hda_nid_t conn1[] = { 0x0c, 0x0d };
2015 static const hda_nid_t conn2[] = { 0x0e, 0x0f };
2016 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2017 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
2018 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
2019 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
1727a771 2020 } else if (action == HDA_FIXUP_ACT_PROBE) {
ef8d60fb 2021 /* restore the connections */
caf3c043
MM
2022 static const hda_nid_t conn[] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
2023 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
2024 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
2025 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
2026 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
02a237b2
TI
2027 }
2028}
2029
1a97b7f2
TI
2030/* Set VREF on HP pin */
2031static void alc889_fixup_mbp_vref(struct hda_codec *codec,
1727a771 2032 const struct hda_fixup *fix, int action)
1a97b7f2 2033{
caf3c043 2034 static const hda_nid_t nids[] = { 0x14, 0x15, 0x19 };
1a97b7f2 2035 struct alc_spec *spec = codec->spec;
1a97b7f2
TI
2036 int i;
2037
1727a771 2038 if (action != HDA_FIXUP_ACT_INIT)
1a97b7f2
TI
2039 return;
2040 for (i = 0; i < ARRAY_SIZE(nids); i++) {
2041 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
2042 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
2043 continue;
d3f02d60 2044 val = snd_hda_codec_get_pin_target(codec, nids[i]);
1a97b7f2 2045 val |= AC_PINCTL_VREF_80;
cdd03ced 2046 snd_hda_set_pin_ctl(codec, nids[i], val);
08c189f2 2047 spec->gen.keep_vref_in_automute = 1;
1a97b7f2
TI
2048 break;
2049 }
2050}
2051
0756f09c
TI
2052static void alc889_fixup_mac_pins(struct hda_codec *codec,
2053 const hda_nid_t *nids, int num_nids)
1a97b7f2
TI
2054{
2055 struct alc_spec *spec = codec->spec;
1a97b7f2
TI
2056 int i;
2057
0756f09c 2058 for (i = 0; i < num_nids; i++) {
1a97b7f2 2059 unsigned int val;
d3f02d60 2060 val = snd_hda_codec_get_pin_target(codec, nids[i]);
1a97b7f2 2061 val |= AC_PINCTL_VREF_50;
cdd03ced 2062 snd_hda_set_pin_ctl(codec, nids[i], val);
1a97b7f2 2063 }
08c189f2 2064 spec->gen.keep_vref_in_automute = 1;
1a97b7f2
TI
2065}
2066
0756f09c
TI
2067/* Set VREF on speaker pins on imac91 */
2068static void alc889_fixup_imac91_vref(struct hda_codec *codec,
2069 const struct hda_fixup *fix, int action)
2070{
caf3c043 2071 static const hda_nid_t nids[] = { 0x18, 0x1a };
0756f09c
TI
2072
2073 if (action == HDA_FIXUP_ACT_INIT)
2074 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2075}
2076
e7729a41
AV
2077/* Set VREF on speaker pins on mba11 */
2078static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2079 const struct hda_fixup *fix, int action)
2080{
caf3c043 2081 static const hda_nid_t nids[] = { 0x18 };
e7729a41
AV
2082
2083 if (action == HDA_FIXUP_ACT_INIT)
2084 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2085}
2086
0756f09c
TI
2087/* Set VREF on speaker pins on mba21 */
2088static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2089 const struct hda_fixup *fix, int action)
2090{
caf3c043 2091 static const hda_nid_t nids[] = { 0x18, 0x19 };
0756f09c
TI
2092
2093 if (action == HDA_FIXUP_ACT_INIT)
2094 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2095}
2096
e427c237 2097/* Don't take HP output as primary
d9111496
FLVC
2098 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2099 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
e427c237
TI
2100 */
2101static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
1727a771 2102 const struct hda_fixup *fix, int action)
e427c237
TI
2103{
2104 struct alc_spec *spec = codec->spec;
da96fb5b 2105 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
08c189f2 2106 spec->gen.no_primary_hp = 1;
da96fb5b
TI
2107 spec->gen.no_multi_io = 1;
2108 }
e427c237
TI
2109}
2110
eb9ca3ab
TI
2111static void alc_fixup_bass_chmap(struct hda_codec *codec,
2112 const struct hda_fixup *fix, int action);
2113
7beb3a6e
TI
2114/* For dual-codec configuration, we need to disable some features to avoid
2115 * conflicts of kctls and PCM streams
2116 */
2117static void alc_fixup_dual_codecs(struct hda_codec *codec,
2118 const struct hda_fixup *fix, int action)
2119{
2120 struct alc_spec *spec = codec->spec;
2121
2122 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2123 return;
2124 /* disable vmaster */
2125 spec->gen.suppress_vmaster = 1;
2126 /* auto-mute and auto-mic switch don't work with multiple codecs */
2127 spec->gen.suppress_auto_mute = 1;
2128 spec->gen.suppress_auto_mic = 1;
2129 /* disable aamix as well */
2130 spec->gen.mixer_nid = 0;
2131 /* add location prefix to avoid conflicts */
2132 codec->force_pin_prefix = 1;
2133}
2134
2135static void rename_ctl(struct hda_codec *codec, const char *oldname,
2136 const char *newname)
2137{
2138 struct snd_kcontrol *kctl;
2139
2140 kctl = snd_hda_find_mixer_ctl(codec, oldname);
2141 if (kctl)
2142 strcpy(kctl->id.name, newname);
2143}
2144
2145static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2146 const struct hda_fixup *fix,
2147 int action)
2148{
2149 alc_fixup_dual_codecs(codec, fix, action);
2150 switch (action) {
2151 case HDA_FIXUP_ACT_PRE_PROBE:
2152 /* override card longname to provide a unique UCM profile */
2153 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2154 break;
2155 case HDA_FIXUP_ACT_BUILD:
2156 /* rename Capture controls depending on the codec */
2157 rename_ctl(codec, "Capture Volume",
2158 codec->addr == 0 ?
2159 "Rear-Panel Capture Volume" :
2160 "Front-Panel Capture Volume");
2161 rename_ctl(codec, "Capture Switch",
2162 codec->addr == 0 ?
2163 "Rear-Panel Capture Switch" :
2164 "Front-Panel Capture Switch");
2165 break;
2166 }
2167}
2168
c1933008
CL
2169static void alc1220_fixup_gb_x570(struct hda_codec *codec,
2170 const struct hda_fixup *fix,
2171 int action)
2172{
2173 static const hda_nid_t conn1[] = { 0x0c };
2174 static const struct coef_fw gb_x570_coefs[] = {
41a86013 2175 WRITE_COEF(0x07, 0x03c0),
c1933008
CL
2176 WRITE_COEF(0x1a, 0x01c1),
2177 WRITE_COEF(0x1b, 0x0202),
2178 WRITE_COEF(0x43, 0x3005),
2179 {}
2180 };
2181
2182 switch (action) {
2183 case HDA_FIXUP_ACT_PRE_PROBE:
2184 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2185 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2186 break;
2187 case HDA_FIXUP_ACT_INIT:
2188 alc_process_coef_fw(codec, gb_x570_coefs);
2189 break;
2190 }
2191}
2192
0202f5cd
P
2193static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2194 const struct hda_fixup *fix,
2195 int action)
2196{
caf3c043 2197 static const hda_nid_t conn1[] = { 0x0c };
0202f5cd
P
2198
2199 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2200 return;
2201
2202 alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2203 /* We therefore want to make sure 0x14 (front headphone) and
2204 * 0x1b (speakers) use the stereo DAC 0x02
2205 */
caf3c043
MM
2206 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2207 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
0202f5cd
P
2208}
2209
7f665b1c
JS
2210static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2211 const struct hda_fixup *fix, int action);
2212
80690a27 2213static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
7f665b1c
JS
2214 const struct hda_fixup *fix,
2215 int action)
2216{
2217 alc1220_fixup_clevo_p950(codec, fix, action);
2218 alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2219}
2220
ca184355
JHP
2221static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
2222 struct hda_jack_callback *jack)
2223{
2224 struct alc_spec *spec = codec->spec;
2225 unsigned int vref;
2226
2227 snd_hda_gen_hp_automute(codec, jack);
2228
2229 if (spec->gen.hp_jack_present)
2230 vref = AC_PINCTL_VREF_80;
2231 else
2232 vref = AC_PINCTL_VREF_HIZ;
2233 snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
2234}
2235
2236static void alc887_fixup_asus_jack(struct hda_codec *codec,
2237 const struct hda_fixup *fix, int action)
2238{
2239 struct alc_spec *spec = codec->spec;
2240 if (action != HDA_FIXUP_ACT_PROBE)
2241 return;
2242 snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
2243 spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook;
2244}
2245
1727a771 2246static const struct hda_fixup alc882_fixups[] = {
5c0ebfbe 2247 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
1727a771
TI
2248 .type = HDA_FIXUP_PINS,
2249 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
2250 { 0x15, 0x01080104 }, /* side */
2251 { 0x16, 0x01011012 }, /* rear */
2252 { 0x17, 0x01016011 }, /* clfe */
2785591a 2253 { }
145a902b
DH
2254 }
2255 },
5c0ebfbe 2256 [ALC882_FIXUP_LENOVO_Y530] = {
1727a771
TI
2257 .type = HDA_FIXUP_PINS,
2258 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
2259 { 0x15, 0x99130112 }, /* rear int speakers */
2260 { 0x16, 0x99130111 }, /* subwoofer */
ac612407
DH
2261 { }
2262 }
2263 },
5c0ebfbe 2264 [ALC882_FIXUP_PB_M5210] = {
fd108215
TI
2265 .type = HDA_FIXUP_PINCTLS,
2266 .v.pins = (const struct hda_pintbl[]) {
2267 { 0x19, PIN_VREF50 },
357f915e
KY
2268 {}
2269 }
2270 },
5c0ebfbe 2271 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
1727a771 2272 .type = HDA_FIXUP_FUNC,
23d30f28 2273 .v.func = alc_fixup_sku_ignore,
6981d184 2274 },
5c0ebfbe 2275 [ALC882_FIXUP_ASUS_W90V] = {
1727a771
TI
2276 .type = HDA_FIXUP_PINS,
2277 .v.pins = (const struct hda_pintbl[]) {
5cdf745e
TI
2278 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
2279 { }
2280 }
2281 },
8f239214 2282 [ALC889_FIXUP_CD] = {
1727a771
TI
2283 .type = HDA_FIXUP_PINS,
2284 .v.pins = (const struct hda_pintbl[]) {
8f239214
MB
2285 { 0x1c, 0x993301f0 }, /* CD */
2286 { }
2287 }
2288 },
b2c53e20
DH
2289 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2290 .type = HDA_FIXUP_PINS,
2291 .v.pins = (const struct hda_pintbl[]) {
2292 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2293 { }
2294 },
2295 .chained = true,
2296 .chain_id = ALC889_FIXUP_CD,
2297 },
5c0ebfbe 2298 [ALC889_FIXUP_VAIO_TT] = {
1727a771
TI
2299 .type = HDA_FIXUP_PINS,
2300 .v.pins = (const struct hda_pintbl[]) {
5c0ebfbe
TI
2301 { 0x17, 0x90170111 }, /* hidden surround speaker */
2302 { }
2303 }
2304 },
0e7cc2e7 2305 [ALC888_FIXUP_EEE1601] = {
1727a771 2306 .type = HDA_FIXUP_VERBS,
0e7cc2e7
TI
2307 .v.verbs = (const struct hda_verb[]) {
2308 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2309 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
2310 { }
2311 }
177943a3 2312 },
4841b8e6
PH
2313 [ALC886_FIXUP_EAPD] = {
2314 .type = HDA_FIXUP_VERBS,
2315 .v.verbs = (const struct hda_verb[]) {
2316 /* change to EAPD mode */
2317 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2318 { 0x20, AC_VERB_SET_PROC_COEF, 0x0068 },
2319 { }
2320 }
2321 },
177943a3 2322 [ALC882_FIXUP_EAPD] = {
1727a771 2323 .type = HDA_FIXUP_VERBS,
177943a3
TI
2324 .v.verbs = (const struct hda_verb[]) {
2325 /* change to EAPD mode */
2326 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2327 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2328 { }
2329 }
2330 },
7a6069bf 2331 [ALC883_FIXUP_EAPD] = {
1727a771 2332 .type = HDA_FIXUP_VERBS,
7a6069bf
TI
2333 .v.verbs = (const struct hda_verb[]) {
2334 /* change to EAPD mode */
2335 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2336 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2337 { }
2338 }
2339 },
8812c4f9 2340 [ALC883_FIXUP_ACER_EAPD] = {
1727a771 2341 .type = HDA_FIXUP_VERBS,
8812c4f9
TI
2342 .v.verbs = (const struct hda_verb[]) {
2343 /* eanable EAPD on Acer laptops */
2344 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2345 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2346 { }
2347 }
2348 },
1a97b7f2 2349 [ALC882_FIXUP_GPIO1] = {
5579cd6f
TI
2350 .type = HDA_FIXUP_FUNC,
2351 .v.func = alc_fixup_gpio1,
1a97b7f2
TI
2352 },
2353 [ALC882_FIXUP_GPIO2] = {
5579cd6f
TI
2354 .type = HDA_FIXUP_FUNC,
2355 .v.func = alc_fixup_gpio2,
1a97b7f2 2356 },
eb844d51 2357 [ALC882_FIXUP_GPIO3] = {
5579cd6f
TI
2358 .type = HDA_FIXUP_FUNC,
2359 .v.func = alc_fixup_gpio3,
eb844d51 2360 },
68ef0561 2361 [ALC882_FIXUP_ASUS_W2JC] = {
5579cd6f
TI
2362 .type = HDA_FIXUP_FUNC,
2363 .v.func = alc_fixup_gpio1,
68ef0561
TI
2364 .chained = true,
2365 .chain_id = ALC882_FIXUP_EAPD,
2366 },
2367 [ALC889_FIXUP_COEF] = {
1727a771 2368 .type = HDA_FIXUP_FUNC,
68ef0561
TI
2369 .v.func = alc889_fixup_coef,
2370 },
c3e837bb 2371 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
1727a771
TI
2372 .type = HDA_FIXUP_PINS,
2373 .v.pins = (const struct hda_pintbl[]) {
c3e837bb
TI
2374 { 0x16, 0x99130111 }, /* CLFE speaker */
2375 { 0x17, 0x99130112 }, /* surround speaker */
2376 { }
038d4fef
TI
2377 },
2378 .chained = true,
2379 .chain_id = ALC882_FIXUP_GPIO1,
c3e837bb
TI
2380 },
2381 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
1727a771
TI
2382 .type = HDA_FIXUP_PINS,
2383 .v.pins = (const struct hda_pintbl[]) {
c3e837bb
TI
2384 { 0x16, 0x99130111 }, /* CLFE speaker */
2385 { 0x1b, 0x99130112 }, /* surround speaker */
2386 { }
2387 },
2388 .chained = true,
2389 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2390 },
2391 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2392 /* additional init verbs for Acer Aspire 8930G */
1727a771 2393 .type = HDA_FIXUP_VERBS,
c3e837bb
TI
2394 .v.verbs = (const struct hda_verb[]) {
2395 /* Enable all DACs */
2396 /* DAC DISABLE/MUTE 1? */
2397 /* setting bits 1-5 disables DAC nids 0x02-0x06
2398 * apparently. Init=0x38 */
2399 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2400 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2401 /* DAC DISABLE/MUTE 2? */
2402 /* some bit here disables the other DACs.
2403 * Init=0x4900 */
2404 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2405 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2406 /* DMIC fix
2407 * This laptop has a stereo digital microphone.
2408 * The mics are only 1cm apart which makes the stereo
2409 * useless. However, either the mic or the ALC889
2410 * makes the signal become a difference/sum signal
2411 * instead of standard stereo, which is annoying.
2412 * So instead we flip this bit which makes the
2413 * codec replicate the sum signal to both channels,
2414 * turning it into a normal mono mic.
2415 */
2416 /* DMIC_CONTROL? Init value = 0x0001 */
2417 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2418 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2419 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2420 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2421 { }
038d4fef
TI
2422 },
2423 .chained = true,
2424 .chain_id = ALC882_FIXUP_GPIO1,
c3e837bb 2425 },
5671087f 2426 [ALC885_FIXUP_MACPRO_GPIO] = {
1727a771 2427 .type = HDA_FIXUP_FUNC,
5671087f
TI
2428 .v.func = alc885_fixup_macpro_gpio,
2429 },
02a237b2 2430 [ALC889_FIXUP_DAC_ROUTE] = {
1727a771 2431 .type = HDA_FIXUP_FUNC,
02a237b2
TI
2432 .v.func = alc889_fixup_dac_route,
2433 },
1a97b7f2 2434 [ALC889_FIXUP_MBP_VREF] = {
1727a771 2435 .type = HDA_FIXUP_FUNC,
1a97b7f2
TI
2436 .v.func = alc889_fixup_mbp_vref,
2437 .chained = true,
2438 .chain_id = ALC882_FIXUP_GPIO1,
2439 },
2440 [ALC889_FIXUP_IMAC91_VREF] = {
1727a771 2441 .type = HDA_FIXUP_FUNC,
1a97b7f2
TI
2442 .v.func = alc889_fixup_imac91_vref,
2443 .chained = true,
2444 .chain_id = ALC882_FIXUP_GPIO1,
2445 },
e7729a41
AV
2446 [ALC889_FIXUP_MBA11_VREF] = {
2447 .type = HDA_FIXUP_FUNC,
2448 .v.func = alc889_fixup_mba11_vref,
2449 .chained = true,
2450 .chain_id = ALC889_FIXUP_MBP_VREF,
2451 },
0756f09c
TI
2452 [ALC889_FIXUP_MBA21_VREF] = {
2453 .type = HDA_FIXUP_FUNC,
2454 .v.func = alc889_fixup_mba21_vref,
2455 .chained = true,
2456 .chain_id = ALC889_FIXUP_MBP_VREF,
2457 },
c20f31ec
TI
2458 [ALC889_FIXUP_MP11_VREF] = {
2459 .type = HDA_FIXUP_FUNC,
2460 .v.func = alc889_fixup_mba11_vref,
2461 .chained = true,
2462 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2463 },
9f660a1c
MK
2464 [ALC889_FIXUP_MP41_VREF] = {
2465 .type = HDA_FIXUP_FUNC,
2466 .v.func = alc889_fixup_mbp_vref,
2467 .chained = true,
2468 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2469 },
6e72aa5f 2470 [ALC882_FIXUP_INV_DMIC] = {
1727a771 2471 .type = HDA_FIXUP_FUNC,
9d36a7dc 2472 .v.func = alc_fixup_inv_dmic,
6e72aa5f 2473 },
e427c237 2474 [ALC882_FIXUP_NO_PRIMARY_HP] = {
1727a771 2475 .type = HDA_FIXUP_FUNC,
e427c237
TI
2476 .v.func = alc882_fixup_no_primary_hp,
2477 },
1f0bbf03
TI
2478 [ALC887_FIXUP_ASUS_BASS] = {
2479 .type = HDA_FIXUP_PINS,
2480 .v.pins = (const struct hda_pintbl[]) {
2481 {0x16, 0x99130130}, /* bass speaker */
2482 {}
2483 },
eb9ca3ab
TI
2484 .chained = true,
2485 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2486 },
2487 [ALC887_FIXUP_BASS_CHMAP] = {
2488 .type = HDA_FIXUP_FUNC,
2489 .v.func = alc_fixup_bass_chmap,
1f0bbf03 2490 },
7beb3a6e
TI
2491 [ALC1220_FIXUP_GB_DUAL_CODECS] = {
2492 .type = HDA_FIXUP_FUNC,
2493 .v.func = alc1220_fixup_gb_dual_codecs,
2494 },
c1933008
CL
2495 [ALC1220_FIXUP_GB_X570] = {
2496 .type = HDA_FIXUP_FUNC,
2497 .v.func = alc1220_fixup_gb_x570,
2498 },
0202f5cd
P
2499 [ALC1220_FIXUP_CLEVO_P950] = {
2500 .type = HDA_FIXUP_FUNC,
2501 .v.func = alc1220_fixup_clevo_p950,
2502 },
80690a27 2503 [ALC1220_FIXUP_CLEVO_PB51ED] = {
7f665b1c 2504 .type = HDA_FIXUP_FUNC,
80690a27 2505 .v.func = alc1220_fixup_clevo_pb51ed,
7f665b1c 2506 },
80690a27 2507 [ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
7f665b1c
JS
2508 .type = HDA_FIXUP_PINS,
2509 .v.pins = (const struct hda_pintbl[]) {
2510 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2511 {}
2512 },
2513 .chained = true,
80690a27 2514 .chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
7f665b1c 2515 },
ca184355
JHP
2516 [ALC887_FIXUP_ASUS_AUDIO] = {
2517 .type = HDA_FIXUP_PINS,
2518 .v.pins = (const struct hda_pintbl[]) {
2519 { 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */
2520 { 0x19, 0x22219420 },
2521 {}
2522 },
2523 },
2524 [ALC887_FIXUP_ASUS_HMIC] = {
2525 .type = HDA_FIXUP_FUNC,
2526 .v.func = alc887_fixup_asus_jack,
2527 .chained = true,
2528 .chain_id = ALC887_FIXUP_ASUS_AUDIO,
2529 },
9bfa7b36
ML
2530 [ALCS1200A_FIXUP_MIC_VREF] = {
2531 .type = HDA_FIXUP_PINCTLS,
2532 .v.pins = (const struct hda_pintbl[]) {
2533 { 0x18, PIN_VREF50 }, /* rear mic */
2534 { 0x19, PIN_VREF50 }, /* front mic */
2535 {}
2536 }
2537 },
ff818c24
TI
2538};
2539
1d045db9 2540static const struct snd_pci_quirk alc882_fixup_tbl[] = {
8812c4f9
TI
2541 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2542 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
b5d724b1 2543 SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
8812c4f9
TI
2544 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2545 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2546 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2547 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
c3e837bb
TI
2548 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2549 ALC882_FIXUP_ACER_ASPIRE_4930G),
2550 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2551 ALC882_FIXUP_ACER_ASPIRE_4930G),
2552 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2553 ALC882_FIXUP_ACER_ASPIRE_8930G),
2554 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2555 ALC882_FIXUP_ACER_ASPIRE_8930G),
b265047a
TI
2556 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2557 ALC882_FIXUP_ACER_ASPIRE_4930G),
2558 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
c3e837bb
TI
2559 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2560 ALC882_FIXUP_ACER_ASPIRE_4930G),
2561 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2562 ALC882_FIXUP_ACER_ASPIRE_4930G),
f5c53d89
TI
2563 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2564 ALC882_FIXUP_ACER_ASPIRE_4930G),
02a237b2 2565 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
fe97da1f 2566 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
ac9b1cdd 2567 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
177943a3 2568 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
5c0ebfbe 2569 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
68ef0561 2570 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
ca184355 2571 SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC),
0e7cc2e7 2572 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
1f0bbf03 2573 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
85bcf96c 2574 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
9bfa7b36 2575 SND_PCI_QUIRK(0x1043, 0x8797, "ASUS TUF B550M-PLUS", ALCS1200A_FIXUP_MIC_VREF),
b7529c18
TI
2576 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2577 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
ac9b1cdd 2578 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
e427c237 2579 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
3f3c3714 2580 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
5671087f
TI
2581
2582 /* All Apple entries are in codec SSIDs */
1a97b7f2
TI
2583 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2584 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2585 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
c20f31ec 2586 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
5671087f
TI
2587 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2588 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
1a97b7f2
TI
2589 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2590 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
5671087f 2591 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
e7729a41 2592 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
0756f09c 2593 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
1a97b7f2
TI
2594 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2595 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
5671087f 2596 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
1a97b7f2
TI
2597 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2598 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2599 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
9f660a1c 2600 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
05193639 2601 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
1a97b7f2
TI
2602 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2603 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
649ccd08 2604 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
5671087f 2605
7a6069bf 2606 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
4841b8e6 2607 SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
b2c53e20 2608 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
7beb3a6e 2609 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
c1933008 2610 SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570),
ea354196 2611 SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_GB_X570),
41a86013 2612 SND_PCI_QUIRK(0x1458, 0xa0d5, "Gigabyte X570S Aorus Master", ALC1220_FIXUP_GB_X570),
a0b03952 2613 SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
a655e2b1 2614 SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
09926202 2615 SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
1d3aa4a5 2616 SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
7dafba37 2617 SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
cc5049ae 2618 SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
d2c3b14e 2619 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
26af1772 2620 SND_PCI_QUIRK(0x1462, 0xcc34, "MSI Godlike X570", ALC1220_FIXUP_GB_DUAL_CODECS),
63691587 2621 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
d2c3b14e 2622 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
5c0ebfbe 2623 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
13e1a4cd
TI
2624 SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2625 SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2626 SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2627 SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2628 SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
aef454b4 2629 SND_PCI_QUIRK(0x1558, 0x65f1, "Clevo PC50HS", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
9eb6f5c3 2630 SND_PCI_QUIRK(0x1558, 0x65f5, "Clevo PD50PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
13e1a4cd
TI
2631 SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2632 SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2633 SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
dbfe8350 2634 SND_PCI_QUIRK(0x1558, 0x67f1, "Clevo PC70H[PRS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
13e1a4cd 2635 SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
1f8d398e 2636 SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170SM", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
cc03069a 2637 SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED),
0202f5cd 2638 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
b5acfe15 2639 SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
13e1a4cd 2640 SND_PCI_QUIRK(0x1558, 0x950a, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
f3d737b6 2641 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2f0d520a 2642 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
b5acfe15
PH
2643 SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
2644 SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950),
2645 SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950),
2646 SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950),
503d90b3
RS
2647 SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2648 SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
b5acfe15 2649 SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
7a6069bf
TI
2650 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2651 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
ac9b1cdd 2652 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
68ef0561 2653 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
ff818c24
TI
2654 {}
2655};
2656
1727a771 2657static const struct hda_model_fixup alc882_fixup_models[] = {
772c2917
TI
2658 {.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2659 {.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2660 {.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2661 {.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2662 {.id = ALC889_FIXUP_CD, .name = "cd"},
2663 {.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2664 {.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2665 {.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2666 {.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2667 {.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2668 {.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2669 {.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2670 {.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2671 {.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2672 {.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
912093bc
TI
2673 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2674 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2675 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
772c2917
TI
2676 {.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2677 {.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2678 {.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2679 {.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2680 {.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2681 {.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2682 {.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2683 {.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
6e72aa5f 2684 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
e427c237 2685 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
772c2917 2686 {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
ba90d6a6 2687 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
63394a16 2688 {.id = ALC1220_FIXUP_GB_X570, .name = "gb-x570"},
772c2917 2689 {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
912093bc
TI
2690 {}
2691};
2692
119b75c1
HW
2693static const struct snd_hda_pin_quirk alc882_pin_fixup_tbl[] = {
2694 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1043, "ASUS", ALC1220_FIXUP_CLEVO_P950,
2695 {0x14, 0x01014010},
2696 {0x15, 0x01011012},
2697 {0x16, 0x01016011},
2698 {0x18, 0x01a19040},
2699 {0x19, 0x02a19050},
2700 {0x1a, 0x0181304f},
2701 {0x1b, 0x0221401f},
2702 {0x1e, 0x01456130}),
2703 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1462, "MS-7C35", ALC1220_FIXUP_CLEVO_P950,
2704 {0x14, 0x01015010},
2705 {0x15, 0x01011012},
2706 {0x16, 0x01011011},
2707 {0x18, 0x01a11040},
2708 {0x19, 0x02a19050},
2709 {0x1a, 0x0181104f},
2710 {0x1b, 0x0221401f},
2711 {0x1e, 0x01451130}),
2712 {}
2713};
2714
f6a92248 2715/*
1d045db9 2716 * BIOS auto configuration
f6a92248 2717 */
1d045db9
TI
2718/* almost identical with ALC880 parser... */
2719static int alc882_parse_auto_config(struct hda_codec *codec)
2720{
1d045db9 2721 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
3e6179b8
TI
2722 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2723 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
1d045db9 2724}
b896b4eb 2725
1d045db9
TI
2726/*
2727 */
1d045db9 2728static int patch_alc882(struct hda_codec *codec)
f6a92248
KY
2729{
2730 struct alc_spec *spec;
1a97b7f2 2731 int err;
f6a92248 2732
3de95173
TI
2733 err = alc_alloc_spec(codec, 0x0b);
2734 if (err < 0)
2735 return err;
f6a92248 2736
3de95173 2737 spec = codec->spec;
1f0f4b80 2738
7639a06c 2739 switch (codec->core.vendor_id) {
1d045db9
TI
2740 case 0x10ec0882:
2741 case 0x10ec0885:
acf08081 2742 case 0x10ec0900:
6d9ffcff 2743 case 0x10ec0b00:
a535ad57 2744 case 0x10ec1220:
1d045db9
TI
2745 break;
2746 default:
2747 /* ALC883 and variants */
2748 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2749 break;
c793bec5 2750 }
977ddd6b 2751
c9af753f
TI
2752 alc_pre_init(codec);
2753
1727a771 2754 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
912093bc 2755 alc882_fixups);
119b75c1 2756 snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true);
1727a771 2757 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
ff818c24 2758
1d045db9
TI
2759 alc_auto_parse_customize_define(codec);
2760
7504b6cd
TI
2761 if (has_cdefine_beep(codec))
2762 spec->gen.beep_nid = 0x01;
2763
1a97b7f2
TI
2764 /* automatic parse from the BIOS config */
2765 err = alc882_parse_auto_config(codec);
2766 if (err < 0)
2767 goto error;
f6a92248 2768
fea80fae
TI
2769 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2770 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2771 if (err < 0)
2772 goto error;
2773 }
f6a92248 2774
1727a771 2775 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 2776
f6a92248 2777 return 0;
e16fb6d1
TI
2778
2779 error:
2780 alc_free(codec);
2781 return err;
f6a92248
KY
2782}
2783
df694daa 2784
df694daa 2785/*
1d045db9 2786 * ALC262 support
df694daa 2787 */
1d045db9 2788static int alc262_parse_auto_config(struct hda_codec *codec)
df694daa 2789{
1d045db9 2790 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
3e6179b8
TI
2791 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2792 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
df694daa
KY
2793}
2794
df694daa 2795/*
1d045db9 2796 * Pin config fixes
df694daa 2797 */
cfc9b06f 2798enum {
ea4e7af1 2799 ALC262_FIXUP_FSC_H270,
7513e6da 2800 ALC262_FIXUP_FSC_S7110,
ea4e7af1
TI
2801 ALC262_FIXUP_HP_Z200,
2802 ALC262_FIXUP_TYAN,
c470150c 2803 ALC262_FIXUP_LENOVO_3000,
b42590b8
TI
2804 ALC262_FIXUP_BENQ,
2805 ALC262_FIXUP_BENQ_T31,
6e72aa5f 2806 ALC262_FIXUP_INV_DMIC,
b5c6611f 2807 ALC262_FIXUP_INTEL_BAYLEYBAY,
cfc9b06f
TI
2808};
2809
1727a771 2810static const struct hda_fixup alc262_fixups[] = {
ea4e7af1 2811 [ALC262_FIXUP_FSC_H270] = {
1727a771
TI
2812 .type = HDA_FIXUP_PINS,
2813 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
2814 { 0x14, 0x99130110 }, /* speaker */
2815 { 0x15, 0x0221142f }, /* front HP */
2816 { 0x1b, 0x0121141f }, /* rear HP */
2817 { }
2818 }
2819 },
7513e6da
TI
2820 [ALC262_FIXUP_FSC_S7110] = {
2821 .type = HDA_FIXUP_PINS,
2822 .v.pins = (const struct hda_pintbl[]) {
2823 { 0x15, 0x90170110 }, /* speaker */
2824 { }
2825 },
2826 .chained = true,
2827 .chain_id = ALC262_FIXUP_BENQ,
2828 },
ea4e7af1 2829 [ALC262_FIXUP_HP_Z200] = {
1727a771
TI
2830 .type = HDA_FIXUP_PINS,
2831 .v.pins = (const struct hda_pintbl[]) {
1d045db9 2832 { 0x16, 0x99130120 }, /* internal speaker */
73413b12
TI
2833 { }
2834 }
cfc9b06f 2835 },
ea4e7af1 2836 [ALC262_FIXUP_TYAN] = {
1727a771
TI
2837 .type = HDA_FIXUP_PINS,
2838 .v.pins = (const struct hda_pintbl[]) {
ea4e7af1
TI
2839 { 0x14, 0x1993e1f0 }, /* int AUX */
2840 { }
2841 }
2842 },
c470150c 2843 [ALC262_FIXUP_LENOVO_3000] = {
fd108215
TI
2844 .type = HDA_FIXUP_PINCTLS,
2845 .v.pins = (const struct hda_pintbl[]) {
2846 { 0x19, PIN_VREF50 },
b42590b8
TI
2847 {}
2848 },
2849 .chained = true,
2850 .chain_id = ALC262_FIXUP_BENQ,
2851 },
2852 [ALC262_FIXUP_BENQ] = {
1727a771 2853 .type = HDA_FIXUP_VERBS,
b42590b8 2854 .v.verbs = (const struct hda_verb[]) {
c470150c
TI
2855 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2856 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2857 {}
2858 }
2859 },
b42590b8 2860 [ALC262_FIXUP_BENQ_T31] = {
1727a771 2861 .type = HDA_FIXUP_VERBS,
b42590b8
TI
2862 .v.verbs = (const struct hda_verb[]) {
2863 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2864 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2865 {}
2866 }
2867 },
6e72aa5f 2868 [ALC262_FIXUP_INV_DMIC] = {
1727a771 2869 .type = HDA_FIXUP_FUNC,
9d36a7dc 2870 .v.func = alc_fixup_inv_dmic,
6e72aa5f 2871 },
b5c6611f
ML
2872 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2873 .type = HDA_FIXUP_FUNC,
2874 .v.func = alc_fixup_no_depop_delay,
2875 },
cfc9b06f
TI
2876};
2877
1d045db9 2878static const struct snd_pci_quirk alc262_fixup_tbl[] = {
ea4e7af1 2879 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
7513e6da 2880 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
3dcd3be3 2881 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
ea4e7af1 2882 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
275ec0cb 2883 SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
ea4e7af1 2884 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
c470150c 2885 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
b42590b8
TI
2886 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2887 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
b5c6611f 2888 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
cfc9b06f
TI
2889 {}
2890};
df694daa 2891
1727a771 2892static const struct hda_model_fixup alc262_fixup_models[] = {
6e72aa5f 2893 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
e43c44d6
TI
2894 {.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2895 {.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2896 {.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2897 {.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2898 {.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2899 {.id = ALC262_FIXUP_BENQ, .name = "benq"},
2900 {.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2901 {.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
6e72aa5f
TI
2902 {}
2903};
1d045db9 2904
1d045db9
TI
2905/*
2906 */
1d045db9 2907static int patch_alc262(struct hda_codec *codec)
df694daa
KY
2908{
2909 struct alc_spec *spec;
df694daa
KY
2910 int err;
2911
3de95173
TI
2912 err = alc_alloc_spec(codec, 0x0b);
2913 if (err < 0)
2914 return err;
df694daa 2915
3de95173 2916 spec = codec->spec;
08c189f2 2917 spec->gen.shared_mic_vref_pin = 0x18;
1d045db9 2918
225068ab
TI
2919 spec->shutup = alc_eapd_shutup;
2920
1d045db9
TI
2921#if 0
2922 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2923 * under-run
2924 */
98b24883 2925 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
1d045db9 2926#endif
1d045db9
TI
2927 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2928
c9af753f
TI
2929 alc_pre_init(codec);
2930
1727a771 2931 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
6e72aa5f 2932 alc262_fixups);
1727a771 2933 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
9c7f852e 2934
af741c15
TI
2935 alc_auto_parse_customize_define(codec);
2936
7504b6cd
TI
2937 if (has_cdefine_beep(codec))
2938 spec->gen.beep_nid = 0x01;
2939
42399f7a
TI
2940 /* automatic parse from the BIOS config */
2941 err = alc262_parse_auto_config(codec);
2942 if (err < 0)
2943 goto error;
df694daa 2944
fea80fae
TI
2945 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2946 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2947 if (err < 0)
2948 goto error;
2949 }
2134ea4f 2950
1727a771 2951 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 2952
1da177e4 2953 return 0;
e16fb6d1
TI
2954
2955 error:
2956 alc_free(codec);
2957 return err;
1da177e4
LT
2958}
2959
f32610ed 2960/*
1d045db9 2961 * ALC268
f32610ed 2962 */
1d045db9 2963/* bind Beep switches of both NID 0x0f and 0x10 */
a717777d
TI
2964static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2965 struct snd_ctl_elem_value *ucontrol)
2966{
2967 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2968 unsigned long pval;
2969 int err;
2970
2971 mutex_lock(&codec->control_mutex);
2972 pval = kcontrol->private_value;
2973 kcontrol->private_value = (pval & ~0xff) | 0x0f;
2974 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2975 if (err >= 0) {
2976 kcontrol->private_value = (pval & ~0xff) | 0x10;
2977 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2978 }
2979 kcontrol->private_value = pval;
2980 mutex_unlock(&codec->control_mutex);
2981 return err;
2982}
f32610ed 2983
1d045db9
TI
2984static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2985 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
a717777d
TI
2986 {
2987 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2988 .name = "Beep Playback Switch",
2989 .subdevice = HDA_SUBDEV_AMP_FLAG,
2990 .info = snd_hda_mixer_amp_switch_info,
2991 .get = snd_hda_mixer_amp_switch_get,
2992 .put = alc268_beep_switch_put,
2993 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
2994 },
f32610ed
JS
2995};
2996
1d045db9
TI
2997/* set PCBEEP vol = 0, mute connections */
2998static const struct hda_verb alc268_beep_init_verbs[] = {
2999 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3000 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3001 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3002 { }
f32610ed
JS
3003};
3004
6e72aa5f
TI
3005enum {
3006 ALC268_FIXUP_INV_DMIC,
cb766404 3007 ALC268_FIXUP_HP_EAPD,
24eff328 3008 ALC268_FIXUP_SPDIF,
6e72aa5f
TI
3009};
3010
1727a771 3011static const struct hda_fixup alc268_fixups[] = {
6e72aa5f 3012 [ALC268_FIXUP_INV_DMIC] = {
1727a771 3013 .type = HDA_FIXUP_FUNC,
9d36a7dc 3014 .v.func = alc_fixup_inv_dmic,
6e72aa5f 3015 },
cb766404 3016 [ALC268_FIXUP_HP_EAPD] = {
1727a771 3017 .type = HDA_FIXUP_VERBS,
cb766404
TI
3018 .v.verbs = (const struct hda_verb[]) {
3019 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
3020 {}
3021 }
3022 },
24eff328
TI
3023 [ALC268_FIXUP_SPDIF] = {
3024 .type = HDA_FIXUP_PINS,
3025 .v.pins = (const struct hda_pintbl[]) {
3026 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
3027 {}
3028 }
3029 },
6e72aa5f
TI
3030};
3031
1727a771 3032static const struct hda_model_fixup alc268_fixup_models[] = {
6e72aa5f 3033 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
cb766404 3034 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
03bf11c9 3035 {.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
cb766404
TI
3036 {}
3037};
3038
3039static const struct snd_pci_quirk alc268_fixup_tbl[] = {
24eff328 3040 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
fcd8f3b1 3041 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
cb766404
TI
3042 /* below is codec SSID since multiple Toshiba laptops have the
3043 * same PCI SSID 1179:ff00
3044 */
3045 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
6e72aa5f
TI
3046 {}
3047};
3048
f32610ed
JS
3049/*
3050 * BIOS auto configuration
3051 */
1d045db9 3052static int alc268_parse_auto_config(struct hda_codec *codec)
f32610ed 3053{
3e6179b8 3054 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
7504b6cd 3055 return alc_parse_auto_config(codec, NULL, alc268_ssids);
f32610ed
JS
3056}
3057
1d045db9
TI
3058/*
3059 */
1d045db9 3060static int patch_alc268(struct hda_codec *codec)
f32610ed
JS
3061{
3062 struct alc_spec *spec;
a5cb463a 3063 int i, err;
f32610ed 3064
1d045db9 3065 /* ALC268 has no aa-loopback mixer */
3de95173
TI
3066 err = alc_alloc_spec(codec, 0);
3067 if (err < 0)
3068 return err;
3069
3070 spec = codec->spec;
2722b535
TI
3071 if (has_cdefine_beep(codec))
3072 spec->gen.beep_nid = 0x01;
1f0f4b80 3073
225068ab
TI
3074 spec->shutup = alc_eapd_shutup;
3075
c9af753f
TI
3076 alc_pre_init(codec);
3077
1727a771
TI
3078 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
3079 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
6e72aa5f 3080
6ebb8053
TI
3081 /* automatic parse from the BIOS config */
3082 err = alc268_parse_auto_config(codec);
e16fb6d1
TI
3083 if (err < 0)
3084 goto error;
f32610ed 3085
7504b6cd
TI
3086 if (err > 0 && !spec->gen.no_analog &&
3087 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
a5cb463a
TI
3088 for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
3089 if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
3090 &alc268_beep_mixer[i])) {
3091 err = -ENOMEM;
3092 goto error;
3093 }
3094 }
7504b6cd 3095 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
1d045db9
TI
3096 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
3097 /* override the amp caps for beep generator */
3098 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
3099 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
3100 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
3101 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
3102 (0 << AC_AMPCAP_MUTE_SHIFT));
2f893286
KY
3103 }
3104
1727a771 3105 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
6e72aa5f 3106
f32610ed 3107 return 0;
e16fb6d1
TI
3108
3109 error:
3110 alc_free(codec);
3111 return err;
f32610ed
JS
3112}
3113
bc9f98a9 3114/*
1d045db9 3115 * ALC269
bc9f98a9 3116 */
08c189f2 3117
1d045db9 3118static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
1d045db9 3119 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
bc9f98a9
KY
3120};
3121
1d045db9 3122static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
1d045db9 3123 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
bc9f98a9 3124};
291702f0 3125
1d045db9
TI
3126/* different alc269-variants */
3127enum {
3128 ALC269_TYPE_ALC269VA,
3129 ALC269_TYPE_ALC269VB,
3130 ALC269_TYPE_ALC269VC,
adcc70b2 3131 ALC269_TYPE_ALC269VD,
065380f0
KY
3132 ALC269_TYPE_ALC280,
3133 ALC269_TYPE_ALC282,
2af02be7 3134 ALC269_TYPE_ALC283,
065380f0 3135 ALC269_TYPE_ALC284,
4731d5de 3136 ALC269_TYPE_ALC293,
7fc7d047 3137 ALC269_TYPE_ALC286,
506b62c3 3138 ALC269_TYPE_ALC298,
1d04c9de 3139 ALC269_TYPE_ALC255,
4344aec8 3140 ALC269_TYPE_ALC256,
f429e7e4 3141 ALC269_TYPE_ALC257,
0a6f0600 3142 ALC269_TYPE_ALC215,
4231430d 3143 ALC269_TYPE_ALC225,
60571929 3144 ALC269_TYPE_ALC245,
99cee034 3145 ALC269_TYPE_ALC287,
dcd4f0db 3146 ALC269_TYPE_ALC294,
1078bef0 3147 ALC269_TYPE_ALC300,
f0778871 3148 ALC269_TYPE_ALC623,
6fbae35a 3149 ALC269_TYPE_ALC700,
bc9f98a9
KY
3150};
3151
3152/*
1d045db9 3153 * BIOS auto configuration
bc9f98a9 3154 */
1d045db9
TI
3155static int alc269_parse_auto_config(struct hda_codec *codec)
3156{
1d045db9 3157 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
3e6179b8
TI
3158 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
3159 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3160 struct alc_spec *spec = codec->spec;
adcc70b2
KY
3161 const hda_nid_t *ssids;
3162
3163 switch (spec->codec_variant) {
3164 case ALC269_TYPE_ALC269VA:
3165 case ALC269_TYPE_ALC269VC:
065380f0
KY
3166 case ALC269_TYPE_ALC280:
3167 case ALC269_TYPE_ALC284:
4731d5de 3168 case ALC269_TYPE_ALC293:
adcc70b2
KY
3169 ssids = alc269va_ssids;
3170 break;
3171 case ALC269_TYPE_ALC269VB:
3172 case ALC269_TYPE_ALC269VD:
065380f0 3173 case ALC269_TYPE_ALC282:
2af02be7 3174 case ALC269_TYPE_ALC283:
7fc7d047 3175 case ALC269_TYPE_ALC286:
506b62c3 3176 case ALC269_TYPE_ALC298:
1d04c9de 3177 case ALC269_TYPE_ALC255:
4344aec8 3178 case ALC269_TYPE_ALC256:
f429e7e4 3179 case ALC269_TYPE_ALC257:
0a6f0600 3180 case ALC269_TYPE_ALC215:
4231430d 3181 case ALC269_TYPE_ALC225:
60571929 3182 case ALC269_TYPE_ALC245:
99cee034 3183 case ALC269_TYPE_ALC287:
dcd4f0db 3184 case ALC269_TYPE_ALC294:
1078bef0 3185 case ALC269_TYPE_ALC300:
f0778871 3186 case ALC269_TYPE_ALC623:
6fbae35a 3187 case ALC269_TYPE_ALC700:
adcc70b2
KY
3188 ssids = alc269_ssids;
3189 break;
3190 default:
3191 ssids = alc269_ssids;
3192 break;
3193 }
bc9f98a9 3194
3e6179b8 3195 return alc_parse_auto_config(codec, alc269_ignore, ssids);
1d045db9 3196}
bc9f98a9 3197
476c02e0
HW
3198static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
3199 { SND_JACK_BTN_0, KEY_PLAYPAUSE },
3200 { SND_JACK_BTN_1, KEY_VOICECOMMAND },
3201 { SND_JACK_BTN_2, KEY_VOLUMEUP },
3202 { SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3203 {}
3204};
3205
3206static void alc_headset_btn_callback(struct hda_codec *codec,
3207 struct hda_jack_callback *jack)
3208{
3209 int report = 0;
3210
3211 if (jack->unsol_res & (7 << 13))
3212 report |= SND_JACK_BTN_0;
3213
3214 if (jack->unsol_res & (1 << 16 | 3 << 8))
3215 report |= SND_JACK_BTN_1;
3216
3217 /* Volume up key */
3218 if (jack->unsol_res & (7 << 23))
3219 report |= SND_JACK_BTN_2;
3220
3221 /* Volume down key */
3222 if (jack->unsol_res & (7 << 10))
3223 report |= SND_JACK_BTN_3;
3224
04f7791b 3225 snd_hda_jack_set_button_state(codec, jack->nid, report);
476c02e0
HW
3226}
3227
3228static void alc_disable_headset_jack_key(struct hda_codec *codec)
3229{
3230 struct alc_spec *spec = codec->spec;
3231
3232 if (!spec->has_hs_key)
3233 return;
3234
3235 switch (codec->core.vendor_id) {
3236 case 0x10ec0215:
3237 case 0x10ec0225:
3238 case 0x10ec0285:
c72b9bfe 3239 case 0x10ec0287:
476c02e0
HW
3240 case 0x10ec0295:
3241 case 0x10ec0289:
3242 case 0x10ec0299:
3243 alc_write_coef_idx(codec, 0x48, 0x0);
3244 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3245 alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3246 break;
1948fc06 3247 case 0x10ec0230:
476c02e0
HW
3248 case 0x10ec0236:
3249 case 0x10ec0256:
3250 alc_write_coef_idx(codec, 0x48, 0x0);
3251 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3252 break;
3253 }
3254}
3255
3256static void alc_enable_headset_jack_key(struct hda_codec *codec)
3257{
3258 struct alc_spec *spec = codec->spec;
3259
3260 if (!spec->has_hs_key)
3261 return;
3262
3263 switch (codec->core.vendor_id) {
3264 case 0x10ec0215:
3265 case 0x10ec0225:
3266 case 0x10ec0285:
c72b9bfe 3267 case 0x10ec0287:
476c02e0
HW
3268 case 0x10ec0295:
3269 case 0x10ec0289:
3270 case 0x10ec0299:
3271 alc_write_coef_idx(codec, 0x48, 0xd011);
3272 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3273 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3274 break;
1948fc06 3275 case 0x10ec0230:
476c02e0
HW
3276 case 0x10ec0236:
3277 case 0x10ec0256:
3278 alc_write_coef_idx(codec, 0x48, 0xd011);
3279 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3280 break;
3281 }
3282}
3283
3284static void alc_fixup_headset_jack(struct hda_codec *codec,
3285 const struct hda_fixup *fix, int action)
3286{
3287 struct alc_spec *spec = codec->spec;
04f7791b 3288 hda_nid_t hp_pin;
476c02e0
HW
3289
3290 switch (action) {
3291 case HDA_FIXUP_ACT_PRE_PROBE:
3292 spec->has_hs_key = 1;
3293 snd_hda_jack_detect_enable_callback(codec, 0x55,
3294 alc_headset_btn_callback);
476c02e0 3295 break;
04f7791b
HW
3296 case HDA_FIXUP_ACT_BUILD:
3297 hp_pin = alc_get_hp_pin(spec);
3298 if (!hp_pin || snd_hda_jack_bind_keymap(codec, 0x55,
3299 alc_headset_btn_keymap,
3300 hp_pin))
3301 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack",
3302 false, SND_JACK_HEADSET,
3303 alc_headset_btn_keymap);
3304
476c02e0
HW
3305 alc_enable_headset_jack_key(codec);
3306 break;
3307 }
3308}
3309
1387e2d1 3310static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
1d045db9 3311{
98b24883 3312 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
1d045db9 3313}
291702f0 3314
1d045db9
TI
3315static void alc269_shutup(struct hda_codec *codec)
3316{
adcc70b2
KY
3317 struct alc_spec *spec = codec->spec;
3318
1387e2d1
KY
3319 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3320 alc269vb_toggle_power_output(codec, 0);
3321 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3322 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
1d045db9
TI
3323 msleep(150);
3324 }
c0ca5ece 3325 alc_shutup_pins(codec);
1d045db9 3326}
291702f0 3327
6b0f95c4 3328static const struct coef_fw alc282_coefs[] = {
54db6c39 3329 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
32fa7e49 3330 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
54db6c39
TI
3331 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3332 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3333 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3334 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3335 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3336 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3337 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3338 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3339 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3340 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3341 WRITE_COEF(0x34, 0xa0c0), /* ANC */
3342 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3343 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3344 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3345 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3346 WRITE_COEF(0x63, 0x2902), /* PLL */
3347 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3348 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3349 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3350 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3351 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3352 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3353 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3354 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3355 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3356 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3357 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3358 {}
3359};
3360
cb149cb3
KY
3361static void alc282_restore_default_value(struct hda_codec *codec)
3362{
54db6c39 3363 alc_process_coef_fw(codec, alc282_coefs);
cb149cb3
KY
3364}
3365
7b5c7a02
KY
3366static void alc282_init(struct hda_codec *codec)
3367{
3368 struct alc_spec *spec = codec->spec;
35a39f98 3369 hda_nid_t hp_pin = alc_get_hp_pin(spec);
7b5c7a02
KY
3370 bool hp_pin_sense;
3371 int coef78;
3372
cb149cb3
KY
3373 alc282_restore_default_value(codec);
3374
7b5c7a02
KY
3375 if (!hp_pin)
3376 return;
3377 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3378 coef78 = alc_read_coef_idx(codec, 0x78);
3379
3380 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3381 /* Headphone capless set to high power mode */
3382 alc_write_coef_idx(codec, 0x78, 0x9004);
3383
3384 if (hp_pin_sense)
3385 msleep(2);
3386
3387 snd_hda_codec_write(codec, hp_pin, 0,
3388 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3389
3390 if (hp_pin_sense)
3391 msleep(85);
3392
3393 snd_hda_codec_write(codec, hp_pin, 0,
3394 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3395
3396 if (hp_pin_sense)
3397 msleep(100);
3398
3399 /* Headphone capless set to normal mode */
3400 alc_write_coef_idx(codec, 0x78, coef78);
3401}
3402
3403static void alc282_shutup(struct hda_codec *codec)
3404{
3405 struct alc_spec *spec = codec->spec;
35a39f98 3406 hda_nid_t hp_pin = alc_get_hp_pin(spec);
7b5c7a02
KY
3407 bool hp_pin_sense;
3408 int coef78;
3409
3410 if (!hp_pin) {
3411 alc269_shutup(codec);
3412 return;
3413 }
3414
3415 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3416 coef78 = alc_read_coef_idx(codec, 0x78);
3417 alc_write_coef_idx(codec, 0x78, 0x9004);
3418
3419 if (hp_pin_sense)
3420 msleep(2);
3421
3422 snd_hda_codec_write(codec, hp_pin, 0,
3423 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3424
3425 if (hp_pin_sense)
3426 msleep(85);
3427
c0ca5ece
TI
3428 if (!spec->no_shutup_pins)
3429 snd_hda_codec_write(codec, hp_pin, 0,
3430 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
7b5c7a02
KY
3431
3432 if (hp_pin_sense)
3433 msleep(100);
3434
3435 alc_auto_setup_eapd(codec, false);
c0ca5ece 3436 alc_shutup_pins(codec);
7b5c7a02
KY
3437 alc_write_coef_idx(codec, 0x78, coef78);
3438}
3439
6b0f95c4 3440static const struct coef_fw alc283_coefs[] = {
54db6c39 3441 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
56779864 3442 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
54db6c39
TI
3443 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3444 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3445 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3446 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3447 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3448 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3449 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3450 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3451 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3452 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3453 WRITE_COEF(0x22, 0xa0c0), /* ANC */
3454 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3455 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3456 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3457 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3458 WRITE_COEF(0x2e, 0x2902), /* PLL */
3459 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3460 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3461 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3462 WRITE_COEF(0x36, 0x0), /* capless control 5 */
3463 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3464 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3465 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3466 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3467 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3468 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3469 WRITE_COEF(0x49, 0x0), /* test mode */
3470 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3471 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3472 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
56779864 3473 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
54db6c39
TI
3474 {}
3475};
3476
6bd55b04
KY
3477static void alc283_restore_default_value(struct hda_codec *codec)
3478{
54db6c39 3479 alc_process_coef_fw(codec, alc283_coefs);
6bd55b04
KY
3480}
3481
2af02be7
KY
3482static void alc283_init(struct hda_codec *codec)
3483{
3484 struct alc_spec *spec = codec->spec;
35a39f98 3485 hda_nid_t hp_pin = alc_get_hp_pin(spec);
2af02be7 3486 bool hp_pin_sense;
2af02be7 3487
6bd55b04
KY
3488 alc283_restore_default_value(codec);
3489
2af02be7
KY
3490 if (!hp_pin)
3491 return;
a59d7199
KY
3492
3493 msleep(30);
2af02be7
KY
3494 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3495
3496 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3497 /* Headphone capless set to high power mode */
3498 alc_write_coef_idx(codec, 0x43, 0x9004);
3499
3500 snd_hda_codec_write(codec, hp_pin, 0,
3501 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3502
3503 if (hp_pin_sense)
3504 msleep(85);
3505
3506 snd_hda_codec_write(codec, hp_pin, 0,
3507 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3508
3509 if (hp_pin_sense)
3510 msleep(85);
3511 /* Index 0x46 Combo jack auto switch control 2 */
3512 /* 3k pull low control for Headset jack. */
98b24883 3513 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
2af02be7
KY
3514 /* Headphone capless set to normal mode */
3515 alc_write_coef_idx(codec, 0x43, 0x9614);
3516}
3517
3518static void alc283_shutup(struct hda_codec *codec)
3519{
3520 struct alc_spec *spec = codec->spec;
35a39f98 3521 hda_nid_t hp_pin = alc_get_hp_pin(spec);
2af02be7 3522 bool hp_pin_sense;
2af02be7
KY
3523
3524 if (!hp_pin) {
3525 alc269_shutup(codec);
3526 return;
3527 }
3528
3529 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3530
3531 alc_write_coef_idx(codec, 0x43, 0x9004);
3532
b450b17c
HP
3533 /*depop hp during suspend*/
3534 alc_write_coef_idx(codec, 0x06, 0x2100);
3535
2af02be7
KY
3536 snd_hda_codec_write(codec, hp_pin, 0,
3537 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3538
3539 if (hp_pin_sense)
88011c09 3540 msleep(100);
2af02be7 3541
c0ca5ece
TI
3542 if (!spec->no_shutup_pins)
3543 snd_hda_codec_write(codec, hp_pin, 0,
3544 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
2af02be7 3545
98b24883 3546 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
2af02be7
KY
3547
3548 if (hp_pin_sense)
88011c09 3549 msleep(100);
0435b3ff 3550 alc_auto_setup_eapd(codec, false);
c0ca5ece 3551 alc_shutup_pins(codec);
2af02be7
KY
3552 alc_write_coef_idx(codec, 0x43, 0x9614);
3553}
3554
4a219ef8
KY
3555static void alc256_init(struct hda_codec *codec)
3556{
3557 struct alc_spec *spec = codec->spec;
35a39f98 3558 hda_nid_t hp_pin = alc_get_hp_pin(spec);
4a219ef8
KY
3559 bool hp_pin_sense;
3560
3561 if (!hp_pin)
6447c962 3562 hp_pin = 0x21;
4a219ef8
KY
3563
3564 msleep(30);
3565
3566 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3567
3568 if (hp_pin_sense)
3569 msleep(2);
3570
3571 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
6447c962
KY
3572 if (spec->ultra_low_power) {
3573 alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3574 alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3575 alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3576 alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3577 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3578 msleep(30);
3579 }
4a219ef8
KY
3580
3581 snd_hda_codec_write(codec, hp_pin, 0,
3582 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3583
6447c962 3584 if (hp_pin_sense || spec->ultra_low_power)
4a219ef8
KY
3585 msleep(85);
3586
3587 snd_hda_codec_write(codec, hp_pin, 0,
3588 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3589
6447c962 3590 if (hp_pin_sense || spec->ultra_low_power)
4a219ef8
KY
3591 msleep(100);
3592
3593 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3594 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
88d42b2b
KY
3595 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3596 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
c4473744
TH
3597 /*
3598 * Expose headphone mic (or possibly Line In on some machines) instead
3599 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3600 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3601 * this register.
3602 */
3603 alc_write_coef_idx(codec, 0x36, 0x5757);
4a219ef8
KY
3604}
3605
3606static void alc256_shutup(struct hda_codec *codec)
3607{
3608 struct alc_spec *spec = codec->spec;
35a39f98 3609 hda_nid_t hp_pin = alc_get_hp_pin(spec);
4a219ef8
KY
3610 bool hp_pin_sense;
3611
6447c962
KY
3612 if (!hp_pin)
3613 hp_pin = 0x21;
4a219ef8
KY
3614
3615 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3616
3617 if (hp_pin_sense)
3618 msleep(2);
3619
3620 snd_hda_codec_write(codec, hp_pin, 0,
3621 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3622
6447c962 3623 if (hp_pin_sense || spec->ultra_low_power)
4a219ef8
KY
3624 msleep(85);
3625
1c9609e3
TI
3626 /* 3k pull low control for Headset jack. */
3627 /* NOTE: call this before clearing the pin, otherwise codec stalls */
3f742490
HW
3628 /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
3629 * when booting with headset plugged. So skip setting it for the codec alc257
3630 */
f30741cd
KHF
3631 if (codec->core.vendor_id != 0x10ec0236 &&
3632 codec->core.vendor_id != 0x10ec0257)
3f742490 3633 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
1c9609e3 3634
c0ca5ece
TI
3635 if (!spec->no_shutup_pins)
3636 snd_hda_codec_write(codec, hp_pin, 0,
3637 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4a219ef8 3638
6447c962 3639 if (hp_pin_sense || spec->ultra_low_power)
4a219ef8
KY
3640 msleep(100);
3641
3642 alc_auto_setup_eapd(codec, false);
c0ca5ece 3643 alc_shutup_pins(codec);
6447c962
KY
3644 if (spec->ultra_low_power) {
3645 msleep(50);
3646 alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3647 alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3648 alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3649 alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3650 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3651 msleep(30);
3652 }
4a219ef8
KY
3653}
3654
3c24e483
KY
3655static void alc285_hp_init(struct hda_codec *codec)
3656{
3657 struct alc_spec *spec = codec->spec;
3658 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3659 int i, val;
3660 int coef38, coef0d, coef36;
3661
3662 alc_update_coef_idx(codec, 0x4a, 1<<15, 1<<15); /* Reset HP JD */
3663 coef38 = alc_read_coef_idx(codec, 0x38); /* Amp control */
3664 coef0d = alc_read_coef_idx(codec, 0x0d); /* Digital Misc control */
3665 coef36 = alc_read_coef_idx(codec, 0x36); /* Passthrough Control */
3666 alc_update_coef_idx(codec, 0x38, 1<<4, 0x0);
3667 alc_update_coef_idx(codec, 0x0d, 0x110, 0x0);
3668
3669 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
3670
3671 if (hp_pin)
3672 snd_hda_codec_write(codec, hp_pin, 0,
3673 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3674
3675 msleep(130);
3676 alc_update_coef_idx(codec, 0x36, 1<<14, 1<<14);
3677 alc_update_coef_idx(codec, 0x36, 1<<13, 0x0);
3678
3679 if (hp_pin)
3680 snd_hda_codec_write(codec, hp_pin, 0,
3681 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3682 msleep(10);
3683 alc_write_coef_idx(codec, 0x67, 0x0); /* Set HP depop to manual mode */
3684 alc_write_coefex_idx(codec, 0x58, 0x00, 0x7880);
3685 alc_write_coefex_idx(codec, 0x58, 0x0f, 0xf049);
3686 alc_update_coefex_idx(codec, 0x58, 0x03, 0x00f0, 0x00c0);
3687
3688 alc_write_coefex_idx(codec, 0x58, 0x00, 0xf888); /* HP depop procedure start */
3689 val = alc_read_coefex_idx(codec, 0x58, 0x00);
3690 for (i = 0; i < 20 && val & 0x8000; i++) {
3691 msleep(50);
3692 val = alc_read_coefex_idx(codec, 0x58, 0x00);
3693 } /* Wait for depop procedure finish */
3694
3695 alc_write_coefex_idx(codec, 0x58, 0x00, val); /* write back the result */
3696 alc_update_coef_idx(codec, 0x38, 1<<4, coef38);
3697 alc_update_coef_idx(codec, 0x0d, 0x110, coef0d);
3698 alc_update_coef_idx(codec, 0x36, 3<<13, coef36);
3699
3700 msleep(50);
3701 alc_update_coef_idx(codec, 0x4a, 1<<15, 0);
3702}
3703
da911b1f
KY
3704static void alc225_init(struct hda_codec *codec)
3705{
3706 struct alc_spec *spec = codec->spec;
35a39f98 3707 hda_nid_t hp_pin = alc_get_hp_pin(spec);
da911b1f
KY
3708 bool hp1_pin_sense, hp2_pin_sense;
3709
60571929
KY
3710 if (spec->codec_variant != ALC269_TYPE_ALC287 &&
3711 spec->codec_variant != ALC269_TYPE_ALC245)
3c24e483
KY
3712 /* required only at boot or S3 and S4 resume time */
3713 if (!spec->done_hp_init ||
3714 is_s3_resume(codec) ||
3715 is_s4_resume(codec)) {
3716 alc285_hp_init(codec);
3717 spec->done_hp_init = true;
3718 }
3719
da911b1f 3720 if (!hp_pin)
d3ba58bb 3721 hp_pin = 0x21;
da911b1f
KY
3722 msleep(30);
3723
3724 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3725 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3726
3727 if (hp1_pin_sense || hp2_pin_sense)
3728 msleep(2);
3729
3730 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
d3ba58bb
KY
3731 if (spec->ultra_low_power) {
3732 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3733 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3734 alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3735 msleep(30);
3736 }
da911b1f 3737
d3ba58bb 3738 if (hp1_pin_sense || spec->ultra_low_power)
da911b1f
KY
3739 snd_hda_codec_write(codec, hp_pin, 0,
3740 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3741 if (hp2_pin_sense)
3742 snd_hda_codec_write(codec, 0x16, 0,
3743 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3744
d3ba58bb 3745 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
da911b1f
KY
3746 msleep(85);
3747
d3ba58bb 3748 if (hp1_pin_sense || spec->ultra_low_power)
da911b1f
KY
3749 snd_hda_codec_write(codec, hp_pin, 0,
3750 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3751 if (hp2_pin_sense)
3752 snd_hda_codec_write(codec, 0x16, 0,
3753 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3754
d3ba58bb 3755 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
da911b1f
KY
3756 msleep(100);
3757
3758 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3759 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3760}
3761
3762static void alc225_shutup(struct hda_codec *codec)
3763{
3764 struct alc_spec *spec = codec->spec;
35a39f98 3765 hda_nid_t hp_pin = alc_get_hp_pin(spec);
da911b1f
KY
3766 bool hp1_pin_sense, hp2_pin_sense;
3767
d3ba58bb
KY
3768 if (!hp_pin)
3769 hp_pin = 0x21;
476c02e0
HW
3770
3771 alc_disable_headset_jack_key(codec);
da911b1f
KY
3772 /* 3k pull low control for Headset jack. */
3773 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3774
3775 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3776 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3777
3778 if (hp1_pin_sense || hp2_pin_sense)
3779 msleep(2);
3780
d3ba58bb 3781 if (hp1_pin_sense || spec->ultra_low_power)
da911b1f
KY
3782 snd_hda_codec_write(codec, hp_pin, 0,
3783 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3784 if (hp2_pin_sense)
3785 snd_hda_codec_write(codec, 0x16, 0,
3786 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3787
d3ba58bb 3788 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
da911b1f
KY
3789 msleep(85);
3790
d3ba58bb 3791 if (hp1_pin_sense || spec->ultra_low_power)
da911b1f
KY
3792 snd_hda_codec_write(codec, hp_pin, 0,
3793 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3794 if (hp2_pin_sense)
3795 snd_hda_codec_write(codec, 0x16, 0,
3796 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3797
d3ba58bb 3798 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
da911b1f
KY
3799 msleep(100);
3800
3801 alc_auto_setup_eapd(codec, false);
c0ca5ece 3802 alc_shutup_pins(codec);
d3ba58bb
KY
3803 if (spec->ultra_low_power) {
3804 msleep(50);
3805 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3806 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3807 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3808 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3809 msleep(30);
3810 }
476c02e0
HW
3811
3812 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3813 alc_enable_headset_jack_key(codec);
da911b1f
KY
3814}
3815
c2d6af53
KY
3816static void alc_default_init(struct hda_codec *codec)
3817{
3818 struct alc_spec *spec = codec->spec;
35a39f98 3819 hda_nid_t hp_pin = alc_get_hp_pin(spec);
c2d6af53
KY
3820 bool hp_pin_sense;
3821
3822 if (!hp_pin)
3823 return;
3824
3825 msleep(30);
3826
3827 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3828
3829 if (hp_pin_sense)
3830 msleep(2);
3831
3832 snd_hda_codec_write(codec, hp_pin, 0,
3833 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3834
3835 if (hp_pin_sense)
3836 msleep(85);
3837
3838 snd_hda_codec_write(codec, hp_pin, 0,
3839 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3840
3841 if (hp_pin_sense)
3842 msleep(100);
3843}
3844
3845static void alc_default_shutup(struct hda_codec *codec)
3846{
3847 struct alc_spec *spec = codec->spec;
35a39f98 3848 hda_nid_t hp_pin = alc_get_hp_pin(spec);
c2d6af53
KY
3849 bool hp_pin_sense;
3850
3851 if (!hp_pin) {
3852 alc269_shutup(codec);
3853 return;
3854 }
3855
3856 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3857
3858 if (hp_pin_sense)
3859 msleep(2);
3860
3861 snd_hda_codec_write(codec, hp_pin, 0,
3862 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3863
3864 if (hp_pin_sense)
3865 msleep(85);
3866
c0ca5ece
TI
3867 if (!spec->no_shutup_pins)
3868 snd_hda_codec_write(codec, hp_pin, 0,
3869 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
c2d6af53
KY
3870
3871 if (hp_pin_sense)
3872 msleep(100);
3873
3874 alc_auto_setup_eapd(codec, false);
c0ca5ece 3875 alc_shutup_pins(codec);
c2d6af53
KY
3876}
3877
693abe11
KY
3878static void alc294_hp_init(struct hda_codec *codec)
3879{
3880 struct alc_spec *spec = codec->spec;
35a39f98 3881 hda_nid_t hp_pin = alc_get_hp_pin(spec);
693abe11
KY
3882 int i, val;
3883
3884 if (!hp_pin)
3885 return;
3886
3887 snd_hda_codec_write(codec, hp_pin, 0,
3888 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3889
3890 msleep(100);
3891
c0ca5ece
TI
3892 if (!spec->no_shutup_pins)
3893 snd_hda_codec_write(codec, hp_pin, 0,
3894 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
693abe11
KY
3895
3896 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3897 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3898
3899 /* Wait for depop procedure finish */
3900 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3901 for (i = 0; i < 20 && val & 0x0080; i++) {
3902 msleep(50);
3903 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3904 }
3905 /* Set HP depop to auto mode */
3906 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3907 msleep(50);
3908}
3909
3910static void alc294_init(struct hda_codec *codec)
3911{
3912 struct alc_spec *spec = codec->spec;
3913
f6ef4e0e
TI
3914 /* required only at boot or S4 resume time */
3915 if (!spec->done_hp_init ||
3916 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
693abe11
KY
3917 alc294_hp_init(codec);
3918 spec->done_hp_init = true;
3919 }
3920 alc_default_init(codec);
3921}
3922
ad60d502
KY
3923static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3924 unsigned int val)
3925{
3926 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3927 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3928 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3929}
3930
3931static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3932{
3933 unsigned int val;
3934
3935 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3936 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3937 & 0xffff;
3938 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3939 << 16;
3940 return val;
3941}
3942
3943static void alc5505_dsp_halt(struct hda_codec *codec)
3944{
3945 unsigned int val;
3946
3947 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3948 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3949 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3950 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3951 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3952 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3953 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3954 val = alc5505_coef_get(codec, 0x6220);
3955 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3956}
3957
3958static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3959{
3960 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3961 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3962 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3963 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3964 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3965 alc5505_coef_set(codec, 0x880c, 0x00000004);
3966}
3967
3968static void alc5505_dsp_init(struct hda_codec *codec)
3969{
3970 unsigned int val;
3971
3972 alc5505_dsp_halt(codec);
3973 alc5505_dsp_back_from_halt(codec);
3974 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3975 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3976 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3977 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3978 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3979 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3980 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3981 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3982 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3983 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3984 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3985 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3986 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3987
3988 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3989 if (val <= 3)
3990 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3991 else
3992 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3993
3994 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3995 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3996 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3997 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3998 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3999 alc5505_coef_set(codec, 0x880c, 0x00000003);
4000 alc5505_coef_set(codec, 0x880c, 0x00000010);
cd63a5ff
TI
4001
4002#ifdef HALT_REALTEK_ALC5505
4003 alc5505_dsp_halt(codec);
4004#endif
ad60d502
KY
4005}
4006
cd63a5ff 4007#ifdef HALT_REALTEK_ALC5505
8a71821f
PLB
4008#define alc5505_dsp_suspend(codec) do { } while (0) /* NOP */
4009#define alc5505_dsp_resume(codec) do { } while (0) /* NOP */
cd63a5ff
TI
4010#else
4011#define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
4012#define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
4013#endif
4014
2a43952a 4015#ifdef CONFIG_PM
ad60d502
KY
4016static int alc269_suspend(struct hda_codec *codec)
4017{
4018 struct alc_spec *spec = codec->spec;
4019
4020 if (spec->has_alc5505_dsp)
cd63a5ff 4021 alc5505_dsp_suspend(codec);
ad60d502
KY
4022 return alc_suspend(codec);
4023}
4024
1d045db9
TI
4025static int alc269_resume(struct hda_codec *codec)
4026{
adcc70b2
KY
4027 struct alc_spec *spec = codec->spec;
4028
1387e2d1
KY
4029 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4030 alc269vb_toggle_power_output(codec, 0);
4031 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
adcc70b2 4032 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
1d045db9
TI
4033 msleep(150);
4034 }
8c427226 4035
1d045db9 4036 codec->patch_ops.init(codec);
f1d4e28b 4037
1387e2d1
KY
4038 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4039 alc269vb_toggle_power_output(codec, 1);
4040 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
adcc70b2 4041 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
1d045db9
TI
4042 msleep(200);
4043 }
f1d4e28b 4044
1a462be5 4045 snd_hda_regmap_sync(codec);
1d045db9 4046 hda_call_check_power_status(codec, 0x01);
f475371a
HW
4047
4048 /* on some machine, the BIOS will clear the codec gpio data when enter
4049 * suspend, and won't restore the data after resume, so we restore it
4050 * in the driver.
4051 */
d261eec8
TI
4052 if (spec->gpio_data)
4053 alc_write_gpio_data(codec);
f475371a 4054
ad60d502 4055 if (spec->has_alc5505_dsp)
cd63a5ff 4056 alc5505_dsp_resume(codec);
c5177c86 4057
1d045db9
TI
4058 return 0;
4059}
2a43952a 4060#endif /* CONFIG_PM */
f1d4e28b 4061
108cc108 4062static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
1727a771 4063 const struct hda_fixup *fix, int action)
108cc108
DH
4064{
4065 struct alc_spec *spec = codec->spec;
4066
1727a771 4067 if (action == HDA_FIXUP_ACT_PRE_PROBE)
108cc108
DH
4068 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
4069}
4070
fdcc968a
JMG
4071static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
4072 const struct hda_fixup *fix,
4073 int action)
4074{
4075 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
4076 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
4077
4078 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
4079 snd_hda_codec_set_pincfg(codec, 0x19,
4080 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
4081 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
4082}
4083
1d045db9 4084static void alc269_fixup_hweq(struct hda_codec *codec,
1727a771 4085 const struct hda_fixup *fix, int action)
1d045db9 4086{
98b24883
TI
4087 if (action == HDA_FIXUP_ACT_INIT)
4088 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
1d045db9 4089}
f1d4e28b 4090
7c478f03
DH
4091static void alc269_fixup_headset_mic(struct hda_codec *codec,
4092 const struct hda_fixup *fix, int action)
4093{
4094 struct alc_spec *spec = codec->spec;
4095
4096 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4097 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4098}
4099
1d045db9 4100static void alc271_fixup_dmic(struct hda_codec *codec,
1727a771 4101 const struct hda_fixup *fix, int action)
1d045db9
TI
4102{
4103 static const struct hda_verb verbs[] = {
4104 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
4105 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
4106 {}
4107 };
4108 unsigned int cfg;
f1d4e28b 4109
7639a06c
TI
4110 if (strcmp(codec->core.chip_name, "ALC271X") &&
4111 strcmp(codec->core.chip_name, "ALC269VB"))
1d045db9
TI
4112 return;
4113 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
4114 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
4115 snd_hda_sequence_write(codec, verbs);
4116}
f1d4e28b 4117
c8426b27
TI
4118/* Fix the speaker amp after resume, etc */
4119static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec,
4120 const struct hda_fixup *fix,
4121 int action)
4122{
4123 if (action == HDA_FIXUP_ACT_INIT)
4124 alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000);
4125}
4126
017f2a10 4127static void alc269_fixup_pcm_44k(struct hda_codec *codec,
1727a771 4128 const struct hda_fixup *fix, int action)
017f2a10
TI
4129{
4130 struct alc_spec *spec = codec->spec;
4131
1727a771 4132 if (action != HDA_FIXUP_ACT_PROBE)
017f2a10
TI
4133 return;
4134
4135 /* Due to a hardware problem on Lenovo Ideadpad, we need to
4136 * fix the sample rate of analog I/O to 44.1kHz
4137 */
08c189f2
TI
4138 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
4139 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
017f2a10
TI
4140}
4141
adabb3ec 4142static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
1727a771 4143 const struct hda_fixup *fix, int action)
adabb3ec 4144{
adabb3ec
TI
4145 /* The digital-mic unit sends PDM (differential signal) instead of
4146 * the standard PCM, thus you can't record a valid mono stream as is.
4147 * Below is a workaround specific to ALC269 to control the dmic
4148 * signal source as mono.
4149 */
98b24883
TI
4150 if (action == HDA_FIXUP_ACT_INIT)
4151 alc_update_coef_idx(codec, 0x07, 0, 0x80);
adabb3ec
TI
4152}
4153
24519911
TI
4154static void alc269_quanta_automute(struct hda_codec *codec)
4155{
08c189f2 4156 snd_hda_gen_update_outputs(codec);
24519911 4157
1687ccc8
TI
4158 alc_write_coef_idx(codec, 0x0c, 0x680);
4159 alc_write_coef_idx(codec, 0x0c, 0x480);
24519911
TI
4160}
4161
4162static void alc269_fixup_quanta_mute(struct hda_codec *codec,
1727a771 4163 const struct hda_fixup *fix, int action)
24519911
TI
4164{
4165 struct alc_spec *spec = codec->spec;
1727a771 4166 if (action != HDA_FIXUP_ACT_PROBE)
24519911 4167 return;
08c189f2 4168 spec->gen.automute_hook = alc269_quanta_automute;
24519911
TI
4169}
4170
d240d1dc 4171static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
1a4f69d5 4172 struct hda_jack_callback *jack)
d240d1dc
DH
4173{
4174 struct alc_spec *spec = codec->spec;
4175 int vref;
4176 msleep(200);
4177 snd_hda_gen_hp_automute(codec, jack);
4178
4179 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4180 msleep(100);
4181 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4182 vref);
4183 msleep(500);
4184 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4185 vref);
4186}
4187
a2ef03fe
TE
4188/*
4189 * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
4190 */
4191struct hda_alc298_mbxinit {
4192 unsigned char value_0x23;
4193 unsigned char value_0x25;
4194};
4195
4196static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
4197 const struct hda_alc298_mbxinit *initval,
4198 bool first)
4199{
4200 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
4201 alc_write_coef_idx(codec, 0x26, 0xb000);
4202
4203 if (first)
4204 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
4205
4206 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4207 alc_write_coef_idx(codec, 0x26, 0xf000);
4208 alc_write_coef_idx(codec, 0x23, initval->value_0x23);
4209
4210 if (initval->value_0x23 != 0x1e)
4211 alc_write_coef_idx(codec, 0x25, initval->value_0x25);
4212
4213 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4214 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4215}
4216
4217static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
4218 const struct hda_fixup *fix,
4219 int action)
4220{
4221 /* Initialization magic */
4222 static const struct hda_alc298_mbxinit dac_init[] = {
4223 {0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
4224 {0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
4225 {0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
4226 {0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
4227 {0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
4228 {0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
4229 {0x2f, 0x00},
4230 {0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
4231 {0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
4232 {0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
4233 {}
4234 };
4235 const struct hda_alc298_mbxinit *seq;
4236
4237 if (action != HDA_FIXUP_ACT_INIT)
4238 return;
4239
4240 /* Start */
4241 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4242 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4243 alc_write_coef_idx(codec, 0x26, 0xf000);
4244 alc_write_coef_idx(codec, 0x22, 0x31);
4245 alc_write_coef_idx(codec, 0x23, 0x0b);
4246 alc_write_coef_idx(codec, 0x25, 0x00);
4247 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4248 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4249
4250 for (seq = dac_init; seq->value_0x23; seq++)
4251 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4252}
4253
d240d1dc
DH
4254static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4255 const struct hda_fixup *fix, int action)
4256{
4257 struct alc_spec *spec = codec->spec;
4258 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4259 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4260 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
4261 }
4262}
4263
766538ac
TI
4264static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4265 bool polarity, bool on)
4266{
4267 unsigned int pinval;
4268
4269 if (!pin)
4270 return;
4271 if (polarity)
4272 on = !on;
4273 pinval = snd_hda_codec_get_pin_target(codec, pin);
4274 pinval &= ~AC_PINCTL_VREFEN;
4275 pinval |= on ? AC_PINCTL_VREF_80 : AC_PINCTL_VREF_HIZ;
4276 /* temporarily power up/down for setting VREF */
4277 snd_hda_power_up_pm(codec);
4278 snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4279 snd_hda_power_down_pm(codec);
4280}
d240d1dc 4281
08fb0d0e 4282/* update mute-LED according to the speaker mute state via mic VREF pin */
8d3d1ece
TI
4283static int vref_mute_led_set(struct led_classdev *led_cdev,
4284 enum led_brightness brightness)
6d3cd5d4 4285{
8d3d1ece 4286 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
08fb0d0e 4287 struct alc_spec *spec = codec->spec;
08fb0d0e 4288
766538ac
TI
4289 alc_update_vref_led(codec, spec->mute_led_nid,
4290 spec->mute_led_polarity, brightness);
8d3d1ece 4291 return 0;
6d3cd5d4
DH
4292}
4293
d5b6b65e
DH
4294/* Make sure the led works even in runtime suspend */
4295static unsigned int led_power_filter(struct hda_codec *codec,
4296 hda_nid_t nid,
4297 unsigned int power_state)
4298{
4299 struct alc_spec *spec = codec->spec;
4300
50dd9050
HW
4301 if (power_state != AC_PWRST_D3 || nid == 0 ||
4302 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
d5b6b65e
DH
4303 return power_state;
4304
4305 /* Set pin ctl again, it might have just been set to 0 */
4306 snd_hda_set_pin_ctl(codec, nid,
4307 snd_hda_codec_get_pin_target(codec, nid));
4308
cffd3966 4309 return snd_hda_gen_path_power_filter(codec, nid, power_state);
d5b6b65e
DH
4310}
4311
08fb0d0e
TI
4312static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4313 const struct hda_fixup *fix, int action)
6d3cd5d4
DH
4314{
4315 struct alc_spec *spec = codec->spec;
08fb0d0e
TI
4316 const struct dmi_device *dev = NULL;
4317
4318 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4319 return;
4320
4321 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4322 int pol, pin;
4323 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4324 continue;
4325 if (pin < 0x0a || pin >= 0x10)
4326 break;
4327 spec->mute_led_polarity = pol;
4328 spec->mute_led_nid = pin - 0x0a + 0x18;
8d3d1ece 4329 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
d5b6b65e 4330 codec->power_filter = led_power_filter;
4e76a883
TI
4331 codec_dbg(codec,
4332 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
08fb0d0e 4333 spec->mute_led_polarity);
6d3cd5d4
DH
4334 break;
4335 }
4336}
4337
85c467dc
TI
4338static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4339 const struct hda_fixup *fix,
4340 int action, hda_nid_t pin)
d06ac143
DH
4341{
4342 struct alc_spec *spec = codec->spec;
85c467dc 4343
d06ac143
DH
4344 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4345 spec->mute_led_polarity = 0;
85c467dc 4346 spec->mute_led_nid = pin;
8d3d1ece 4347 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
d5b6b65e 4348 codec->power_filter = led_power_filter;
d06ac143
DH
4349 }
4350}
4351
85c467dc
TI
4352static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4353 const struct hda_fixup *fix, int action)
4354{
4355 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4356}
4357
08fb0d0e
TI
4358static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4359 const struct hda_fixup *fix, int action)
420b0feb 4360{
85c467dc 4361 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
420b0feb
TI
4362}
4363
7f783bd5
TB
4364static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4365 const struct hda_fixup *fix, int action)
4366{
85c467dc 4367 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
7f783bd5
TB
4368}
4369
0f32fd19
TI
4370/* update LED status via GPIO */
4371static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
dbd13179 4372 int polarity, bool enabled)
9f5c6faf 4373{
dbd13179 4374 if (polarity)
0f32fd19 4375 enabled = !enabled;
d261eec8 4376 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
9f5c6faf
TI
4377}
4378
0f32fd19 4379/* turn on/off mute LED via GPIO per vmaster hook */
8d3d1ece
TI
4380static int gpio_mute_led_set(struct led_classdev *led_cdev,
4381 enum led_brightness brightness)
9f5c6faf 4382{
8d3d1ece 4383 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
9f5c6faf 4384 struct alc_spec *spec = codec->spec;
9f5c6faf 4385
dbd13179 4386 alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
8d3d1ece
TI
4387 spec->mute_led_polarity, !brightness);
4388 return 0;
0f32fd19 4389}
9f5c6faf 4390
0f32fd19 4391/* turn on/off mic-mute LED via GPIO per capture hook */
87dc3648
KHF
4392static int micmute_led_set(struct led_classdev *led_cdev,
4393 enum led_brightness brightness)
4394{
4395 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4396 struct alc_spec *spec = codec->spec;
4397
4398 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
40469064 4399 spec->micmute_led_polarity, !brightness);
87dc3648
KHF
4400 return 0;
4401}
4402
01e4a275
TI
4403/* setup mute and mic-mute GPIO bits, add hooks appropriately */
4404static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4405 int action,
4406 unsigned int mute_mask,
4407 unsigned int micmute_mask)
9f5c6faf
TI
4408{
4409 struct alc_spec *spec = codec->spec;
9f5c6faf 4410
01e4a275
TI
4411 alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4412
4413 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4414 return;
4415 if (mute_mask) {
4416 spec->gpio_mute_led_mask = mute_mask;
8d3d1ece 4417 snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
01e4a275
TI
4418 }
4419 if (micmute_mask) {
4420 spec->gpio_mic_led_mask = micmute_mask;
7cdf8c49 4421 snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
9f5c6faf
TI
4422 }
4423}
4424
e7d66cf7
JS
4425static void alc236_fixup_hp_gpio_led(struct hda_codec *codec,
4426 const struct hda_fixup *fix, int action)
4427{
4428 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01);
4429}
4430
01e4a275 4431static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
eaa8e5ef
KY
4432 const struct hda_fixup *fix, int action)
4433{
01e4a275
TI
4434 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4435}
eaa8e5ef 4436
f5a88b0a
KHF
4437static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4438 const struct hda_fixup *fix, int action)
4439{
3e0650ab 4440 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
f5a88b0a
KHF
4441}
4442
01e4a275
TI
4443static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4444 const struct hda_fixup *fix, int action)
4445{
4446 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
9f5c6faf
TI
4447}
4448
a0ccbc53
KY
4449static void alc287_fixup_hp_gpio_led(struct hda_codec *codec,
4450 const struct hda_fixup *fix, int action)
4451{
4452 alc_fixup_hp_gpio_led(codec, action, 0x10, 0);
4453}
4454
5fc462c3
JC
4455static void alc245_fixup_hp_gpio_led(struct hda_codec *codec,
4456 const struct hda_fixup *fix, int action)
4457{
4458 struct alc_spec *spec = codec->spec;
4459
4460 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4461 spec->micmute_led_polarity = 1;
4462 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4463}
4464
8a503555
TI
4465/* turn on/off mic-mute LED per capture hook via VREF change */
4466static int vref_micmute_led_set(struct led_classdev *led_cdev,
4467 enum led_brightness brightness)
9c5dc3bf 4468{
8a503555 4469 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
9c5dc3bf 4470 struct alc_spec *spec = codec->spec;
9c5dc3bf 4471
766538ac
TI
4472 alc_update_vref_led(codec, spec->cap_mute_led_nid,
4473 spec->micmute_led_polarity, brightness);
8a503555 4474 return 0;
9c5dc3bf
KY
4475}
4476
4477static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4478 const struct hda_fixup *fix, int action)
4479{
4480 struct alc_spec *spec = codec->spec;
9c5dc3bf 4481
01e4a275 4482 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
9c5dc3bf 4483 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
01e4a275
TI
4484 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4485 * enable headphone amp
4486 */
4487 spec->gpio_mask |= 0x10;
4488 spec->gpio_dir |= 0x10;
9c5dc3bf 4489 spec->cap_mute_led_nid = 0x18;
8a503555 4490 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
50dd9050 4491 codec->power_filter = led_power_filter;
9c5dc3bf
KY
4492 }
4493}
4494
7a5255f1
DH
4495static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4496 const struct hda_fixup *fix, int action)
4497{
7a5255f1 4498 struct alc_spec *spec = codec->spec;
7a5255f1 4499
01e4a275 4500 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
7a5255f1 4501 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
7a5255f1 4502 spec->cap_mute_led_nid = 0x18;
8a503555 4503 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
7a5255f1
DH
4504 codec->power_filter = led_power_filter;
4505 }
4506}
4507
c3bb2b52
TI
4508/* HP Spectre x360 14 model needs a unique workaround for enabling the amp;
4509 * it needs to toggle the GPIO0 once on and off at each time (bko#210633)
4510 */
4511static void alc245_fixup_hp_x360_amp(struct hda_codec *codec,
4512 const struct hda_fixup *fix, int action)
4513{
4514 struct alc_spec *spec = codec->spec;
4515
4516 switch (action) {
4517 case HDA_FIXUP_ACT_PRE_PROBE:
4518 spec->gpio_mask |= 0x01;
4519 spec->gpio_dir |= 0x01;
4520 break;
4521 case HDA_FIXUP_ACT_INIT:
4522 /* need to toggle GPIO to enable the amp */
4523 alc_update_gpio_data(codec, 0x01, true);
4524 msleep(100);
4525 alc_update_gpio_data(codec, 0x01, false);
4526 break;
4527 }
4528}
4529
622464c8
TI
4530/* toggle GPIO2 at each time stream is started; we use PREPARE state instead */
4531static void alc274_hp_envy_pcm_hook(struct hda_pcm_stream *hinfo,
4532 struct hda_codec *codec,
4533 struct snd_pcm_substream *substream,
4534 int action)
4535{
4536 switch (action) {
4537 case HDA_GEN_PCM_ACT_PREPARE:
4538 alc_update_gpio_data(codec, 0x04, true);
4539 break;
4540 case HDA_GEN_PCM_ACT_CLEANUP:
4541 alc_update_gpio_data(codec, 0x04, false);
4542 break;
4543 }
4544}
4545
4546static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
4547 const struct hda_fixup *fix,
4548 int action)
4549{
4550 struct alc_spec *spec = codec->spec;
4551
4552 if (action == HDA_FIXUP_ACT_PROBE) {
4553 spec->gpio_mask |= 0x04;
4554 spec->gpio_dir |= 0x04;
4555 spec->gen.pcm_playback_hook = alc274_hp_envy_pcm_hook;
4556 }
4557}
4558
766538ac
TI
4559static void alc_update_coef_led(struct hda_codec *codec,
4560 struct alc_coef_led *led,
4561 bool polarity, bool on)
4562{
4563 if (polarity)
4564 on = !on;
4565 /* temporarily power up/down for setting COEF bit */
4566 alc_update_coef_idx(codec, led->idx, led->mask,
4567 on ? led->on : led->off);
4568}
4569
431e76c3 4570/* update mute-LED according to the speaker mute state via COEF bit */
8d3d1ece
TI
4571static int coef_mute_led_set(struct led_classdev *led_cdev,
4572 enum led_brightness brightness)
431e76c3 4573{
8d3d1ece 4574 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
431e76c3
KY
4575 struct alc_spec *spec = codec->spec;
4576
766538ac
TI
4577 alc_update_coef_led(codec, &spec->mute_led_coef,
4578 spec->mute_led_polarity, brightness);
8d3d1ece 4579 return 0;
431e76c3
KY
4580}
4581
4582static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4583 const struct hda_fixup *fix,
4584 int action)
4585{
4586 struct alc_spec *spec = codec->spec;
4587
4588 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4589 spec->mute_led_polarity = 0;
766538ac
TI
4590 spec->mute_led_coef.idx = 0x0b;
4591 spec->mute_led_coef.mask = 1 << 3;
4592 spec->mute_led_coef.on = 1 << 3;
4593 spec->mute_led_coef.off = 0;
8d3d1ece 4594 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
431e76c3
KY
4595 }
4596}
4597
24164f43
KY
4598static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4599 const struct hda_fixup *fix,
4600 int action)
4601{
4602 struct alc_spec *spec = codec->spec;
4603
4604 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4605 spec->mute_led_polarity = 0;
766538ac
TI
4606 spec->mute_led_coef.idx = 0x34;
4607 spec->mute_led_coef.mask = 1 << 5;
4608 spec->mute_led_coef.on = 0;
4609 spec->mute_led_coef.off = 1 << 5;
8d3d1ece 4610 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
24164f43
KY
4611 }
4612}
4613
431e76c3 4614/* turn on/off mic-mute LED per capture hook by coef bit */
8a503555
TI
4615static int coef_micmute_led_set(struct led_classdev *led_cdev,
4616 enum led_brightness brightness)
431e76c3 4617{
8a503555 4618 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
431e76c3
KY
4619 struct alc_spec *spec = codec->spec;
4620
766538ac
TI
4621 alc_update_coef_led(codec, &spec->mic_led_coef,
4622 spec->micmute_led_polarity, brightness);
8a503555 4623 return 0;
431e76c3
KY
4624}
4625
4626static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4627 const struct hda_fixup *fix, int action)
4628{
4629 struct alc_spec *spec = codec->spec;
4630
4631 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
766538ac
TI
4632 spec->mic_led_coef.idx = 0x19;
4633 spec->mic_led_coef.mask = 1 << 13;
4634 spec->mic_led_coef.on = 1 << 13;
4635 spec->mic_led_coef.off = 0;
8a503555 4636 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
431e76c3
KY
4637 }
4638}
4639
24164f43
KY
4640static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4641 const struct hda_fixup *fix, int action)
4642{
4643 struct alc_spec *spec = codec->spec;
4644
4645 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
766538ac
TI
4646 spec->mic_led_coef.idx = 0x35;
4647 spec->mic_led_coef.mask = 3 << 2;
4648 spec->mic_led_coef.on = 2 << 2;
4649 spec->mic_led_coef.off = 1 << 2;
8a503555 4650 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
24164f43
KY
4651 }
4652}
4653
431e76c3
KY
4654static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4655 const struct hda_fixup *fix, int action)
4656{
4657 alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4658 alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4659}
4660
24164f43
KY
4661static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4662 const struct hda_fixup *fix, int action)
4663{
4664 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4665 alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4666}
4667
75b62ab6
JW
4668static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec,
4669 const struct hda_fixup *fix, int action)
4670{
4671 struct alc_spec *spec = codec->spec;
4672
4673 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4674 spec->cap_mute_led_nid = 0x1a;
4675 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4676 codec->power_filter = led_power_filter;
4677 }
4678}
4679
4680static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec,
4681 const struct hda_fixup *fix, int action)
4682{
4683 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4684 alc236_fixup_hp_micmute_led_vref(codec, fix, action);
4685}
4686
6a30abaa 4687#if IS_REACHABLE(CONFIG_INPUT)
33f4acd3
DH
4688static void gpio2_mic_hotkey_event(struct hda_codec *codec,
4689 struct hda_jack_callback *event)
4690{
4691 struct alc_spec *spec = codec->spec;
4692
4693 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
4694 send both key on and key off event for every interrupt. */
c7b60a89 4695 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
33f4acd3 4696 input_sync(spec->kb_dev);
c7b60a89 4697 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
33f4acd3
DH
4698 input_sync(spec->kb_dev);
4699}
33f4acd3 4700
3694cb29
K
4701static int alc_register_micmute_input_device(struct hda_codec *codec)
4702{
4703 struct alc_spec *spec = codec->spec;
c7b60a89 4704 int i;
3694cb29
K
4705
4706 spec->kb_dev = input_allocate_device();
4707 if (!spec->kb_dev) {
4708 codec_err(codec, "Out of memory (input_allocate_device)\n");
4709 return -ENOMEM;
4710 }
c7b60a89
HW
4711
4712 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
4713
3694cb29
K
4714 spec->kb_dev->name = "Microphone Mute Button";
4715 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
c7b60a89
HW
4716 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
4717 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
4718 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
4719 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
4720 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
3694cb29
K
4721
4722 if (input_register_device(spec->kb_dev)) {
4723 codec_err(codec, "input_register_device failed\n");
4724 input_free_device(spec->kb_dev);
4725 spec->kb_dev = NULL;
4726 return -ENOMEM;
4727 }
4728
4729 return 0;
4730}
4731
01e4a275
TI
4732/* GPIO1 = set according to SKU external amp
4733 * GPIO2 = mic mute hotkey
4734 * GPIO3 = mute LED
4735 * GPIO4 = mic mute LED
4736 */
33f4acd3
DH
4737static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4738 const struct hda_fixup *fix, int action)
4739{
33f4acd3
DH
4740 struct alc_spec *spec = codec->spec;
4741
01e4a275 4742 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
33f4acd3 4743 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1c76aa5f 4744 spec->init_amp = ALC_INIT_DEFAULT;
3694cb29 4745 if (alc_register_micmute_input_device(codec) != 0)
33f4acd3 4746 return;
33f4acd3 4747
01e4a275
TI
4748 spec->gpio_mask |= 0x06;
4749 spec->gpio_dir |= 0x02;
4750 spec->gpio_data |= 0x02;
7639a06c 4751 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
33f4acd3 4752 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
7639a06c 4753 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
33f4acd3 4754 gpio2_mic_hotkey_event);
33f4acd3
DH
4755 return;
4756 }
4757
4758 if (!spec->kb_dev)
4759 return;
4760
4761 switch (action) {
33f4acd3
DH
4762 case HDA_FIXUP_ACT_FREE:
4763 input_unregister_device(spec->kb_dev);
33f4acd3
DH
4764 spec->kb_dev = NULL;
4765 }
33f4acd3
DH
4766}
4767
01e4a275
TI
4768/* Line2 = mic mute hotkey
4769 * GPIO2 = mic mute LED
4770 */
3694cb29
K
4771static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4772 const struct hda_fixup *fix, int action)
4773{
3694cb29
K
4774 struct alc_spec *spec = codec->spec;
4775
01e4a275 4776 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
3694cb29 4777 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1c76aa5f 4778 spec->init_amp = ALC_INIT_DEFAULT;
3694cb29
K
4779 if (alc_register_micmute_input_device(codec) != 0)
4780 return;
4781
3694cb29
K
4782 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4783 gpio2_mic_hotkey_event);
3694cb29
K
4784 return;
4785 }
4786
4787 if (!spec->kb_dev)
4788 return;
4789
4790 switch (action) {
3694cb29
K
4791 case HDA_FIXUP_ACT_FREE:
4792 input_unregister_device(spec->kb_dev);
4793 spec->kb_dev = NULL;
4794 }
4795}
c469652b
TI
4796#else /* INPUT */
4797#define alc280_fixup_hp_gpio2_mic_hotkey NULL
4798#define alc233_fixup_lenovo_line2_mic_hotkey NULL
4799#endif /* INPUT */
3694cb29 4800
9c5dc3bf
KY
4801static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4802 const struct hda_fixup *fix, int action)
4803{
4804 struct alc_spec *spec = codec->spec;
4805
1bce62a6 4806 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
9c5dc3bf 4807 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
9c5dc3bf 4808 spec->cap_mute_led_nid = 0x18;
8a503555 4809 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
9c5dc3bf
KY
4810 }
4811}
4812
6b0f95c4 4813static const struct coef_fw alc225_pre_hsmode[] = {
5a36767a
KY
4814 UPDATE_COEF(0x4a, 1<<8, 0),
4815 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4816 UPDATE_COEF(0x63, 3<<14, 3<<14),
4817 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4818 UPDATE_COEF(0x4a, 3<<10, 3<<10),
4819 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4820 UPDATE_COEF(0x4a, 3<<10, 0),
4821 {}
4822};
4823
73bdd597
DH
4824static void alc_headset_mode_unplugged(struct hda_codec *codec)
4825{
92666d45 4826 struct alc_spec *spec = codec->spec;
6b0f95c4 4827 static const struct coef_fw coef0255[] = {
717f43d8 4828 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
54db6c39
TI
4829 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4830 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4831 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4832 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4833 {}
4834 };
6b0f95c4 4835 static const struct coef_fw coef0256[] = {
e69e7e03 4836 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
717f43d8
KY
4837 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4838 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4839 WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
4840 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
e69e7e03
KY
4841 {}
4842 };
6b0f95c4 4843 static const struct coef_fw coef0233[] = {
54db6c39
TI
4844 WRITE_COEF(0x1b, 0x0c0b),
4845 WRITE_COEF(0x45, 0xc429),
4846 UPDATE_COEF(0x35, 0x4000, 0),
4847 WRITE_COEF(0x06, 0x2104),
4848 WRITE_COEF(0x1a, 0x0001),
4849 WRITE_COEF(0x26, 0x0004),
4850 WRITE_COEF(0x32, 0x42a3),
4851 {}
4852 };
6b0f95c4 4853 static const struct coef_fw coef0288[] = {
f3b70332
KY
4854 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4855 UPDATE_COEF(0x50, 0x2000, 0x2000),
4856 UPDATE_COEF(0x56, 0x0006, 0x0006),
4857 UPDATE_COEF(0x66, 0x0008, 0),
4858 UPDATE_COEF(0x67, 0x2000, 0),
4859 {}
4860 };
6b0f95c4 4861 static const struct coef_fw coef0298[] = {
89542936
KY
4862 UPDATE_COEF(0x19, 0x1300, 0x0300),
4863 {}
4864 };
6b0f95c4 4865 static const struct coef_fw coef0292[] = {
54db6c39
TI
4866 WRITE_COEF(0x76, 0x000e),
4867 WRITE_COEF(0x6c, 0x2400),
4868 WRITE_COEF(0x18, 0x7308),
4869 WRITE_COEF(0x6b, 0xc429),
4870 {}
4871 };
6b0f95c4 4872 static const struct coef_fw coef0293[] = {
54db6c39
TI
4873 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
4874 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
4875 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
4876 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
4877 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
4878 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4879 {}
4880 };
6b0f95c4 4881 static const struct coef_fw coef0668[] = {
54db6c39
TI
4882 WRITE_COEF(0x15, 0x0d40),
4883 WRITE_COEF(0xb7, 0x802b),
4884 {}
4885 };
6b0f95c4 4886 static const struct coef_fw coef0225[] = {
5a36767a 4887 UPDATE_COEF(0x63, 3<<14, 0),
4cc9b9d6
KY
4888 {}
4889 };
6b0f95c4 4890 static const struct coef_fw coef0274[] = {
71683c32
KY
4891 UPDATE_COEF(0x4a, 0x0100, 0),
4892 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
4893 UPDATE_COEF(0x6b, 0xf000, 0x5000),
4894 UPDATE_COEF(0x4a, 0x0010, 0),
4895 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
4896 WRITE_COEF(0x45, 0x5289),
4897 UPDATE_COEF(0x4a, 0x0c00, 0),
4898 {}
4899 };
54db6c39 4900
92666d45
KY
4901 if (spec->no_internal_mic_pin) {
4902 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
4903 return;
4904 }
4905
7639a06c 4906 switch (codec->core.vendor_id) {
9a22a8f5 4907 case 0x10ec0255:
e69e7e03
KY
4908 alc_process_coef_fw(codec, coef0255);
4909 break;
1948fc06 4910 case 0x10ec0230:
736f20a7 4911 case 0x10ec0236:
7081adf3 4912 case 0x10ec0256:
e69e7e03 4913 alc_process_coef_fw(codec, coef0256);
9a22a8f5 4914 break;
71683c32
KY
4915 case 0x10ec0234:
4916 case 0x10ec0274:
4917 case 0x10ec0294:
4918 alc_process_coef_fw(codec, coef0274);
4919 break;
13fd08a3 4920 case 0x10ec0233:
73bdd597 4921 case 0x10ec0283:
54db6c39 4922 alc_process_coef_fw(codec, coef0233);
73bdd597 4923 break;
f3b70332
KY
4924 case 0x10ec0286:
4925 case 0x10ec0288:
89542936
KY
4926 alc_process_coef_fw(codec, coef0288);
4927 break;
1a5bc8d9 4928 case 0x10ec0298:
89542936 4929 alc_process_coef_fw(codec, coef0298);
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, coef0668);
73bdd597 4940 break;
c2b691ee 4941 case 0x10ec0215:
4cc9b9d6 4942 case 0x10ec0225:
c2b691ee 4943 case 0x10ec0285:
7d727869 4944 case 0x10ec0295:
c2b691ee 4945 case 0x10ec0289:
28f1f9b2 4946 case 0x10ec0299:
4d4b0c52 4947 alc_process_coef_fw(codec, alc225_pre_hsmode);
4cc9b9d6
KY
4948 alc_process_coef_fw(codec, coef0225);
4949 break;
78f4f7c2
KY
4950 case 0x10ec0867:
4951 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4952 break;
73bdd597 4953 }
4e76a883 4954 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
73bdd597
DH
4955}
4956
4957
4958static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
4959 hda_nid_t mic_pin)
4960{
6b0f95c4 4961 static const struct coef_fw coef0255[] = {
54db6c39
TI
4962 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
4963 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4964 {}
4965 };
6b0f95c4 4966 static const struct coef_fw coef0256[] = {
717f43d8
KY
4967 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
4968 WRITE_COEFEX(0x57, 0x03, 0x09a3),
4969 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4970 {}
4971 };
6b0f95c4 4972 static const struct coef_fw coef0233[] = {
54db6c39
TI
4973 UPDATE_COEF(0x35, 0, 1<<14),
4974 WRITE_COEF(0x06, 0x2100),
4975 WRITE_COEF(0x1a, 0x0021),
4976 WRITE_COEF(0x26, 0x008c),
4977 {}
4978 };
6b0f95c4 4979 static const struct coef_fw coef0288[] = {
89542936 4980 UPDATE_COEF(0x4f, 0x00c0, 0),
f3b70332
KY
4981 UPDATE_COEF(0x50, 0x2000, 0),
4982 UPDATE_COEF(0x56, 0x0006, 0),
4983 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4984 UPDATE_COEF(0x66, 0x0008, 0x0008),
4985 UPDATE_COEF(0x67, 0x2000, 0x2000),
4986 {}
4987 };
6b0f95c4 4988 static const struct coef_fw coef0292[] = {
54db6c39
TI
4989 WRITE_COEF(0x19, 0xa208),
4990 WRITE_COEF(0x2e, 0xacf0),
4991 {}
4992 };
6b0f95c4 4993 static const struct coef_fw coef0293[] = {
54db6c39
TI
4994 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
4995 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
4996 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4997 {}
4998 };
6b0f95c4 4999 static const struct coef_fw coef0688[] = {
54db6c39
TI
5000 WRITE_COEF(0xb7, 0x802b),
5001 WRITE_COEF(0xb5, 0x1040),
5002 UPDATE_COEF(0xc3, 0, 1<<12),
5003 {}
5004 };
6b0f95c4 5005 static const struct coef_fw coef0225[] = {
4cc9b9d6
KY
5006 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
5007 UPDATE_COEF(0x4a, 3<<4, 2<<4),
5008 UPDATE_COEF(0x63, 3<<14, 0),
5009 {}
5010 };
6b0f95c4 5011 static const struct coef_fw coef0274[] = {
71683c32
KY
5012 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
5013 UPDATE_COEF(0x4a, 0x0010, 0),
5014 UPDATE_COEF(0x6b, 0xf000, 0),
5015 {}
5016 };
54db6c39 5017
7639a06c 5018 switch (codec->core.vendor_id) {
9a22a8f5
KY
5019 case 0x10ec0255:
5020 alc_write_coef_idx(codec, 0x45, 0xc489);
5021 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 5022 alc_process_coef_fw(codec, coef0255);
9a22a8f5
KY
5023 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5024 break;
1948fc06 5025 case 0x10ec0230:
717f43d8
KY
5026 case 0x10ec0236:
5027 case 0x10ec0256:
5028 alc_write_coef_idx(codec, 0x45, 0xc489);
5029 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5030 alc_process_coef_fw(codec, coef0256);
5031 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5032 break;
71683c32
KY
5033 case 0x10ec0234:
5034 case 0x10ec0274:
5035 case 0x10ec0294:
5036 alc_write_coef_idx(codec, 0x45, 0x4689);
5037 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5038 alc_process_coef_fw(codec, coef0274);
5039 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5040 break;
13fd08a3 5041 case 0x10ec0233:
73bdd597
DH
5042 case 0x10ec0283:
5043 alc_write_coef_idx(codec, 0x45, 0xc429);
5044 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 5045 alc_process_coef_fw(codec, coef0233);
73bdd597
DH
5046 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5047 break;
f3b70332
KY
5048 case 0x10ec0286:
5049 case 0x10ec0288:
1a5bc8d9 5050 case 0x10ec0298:
f3b70332
KY
5051 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5052 alc_process_coef_fw(codec, coef0288);
5053 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5054 break;
73bdd597
DH
5055 case 0x10ec0292:
5056 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 5057 alc_process_coef_fw(codec, coef0292);
73bdd597 5058 break;
a22aa26f
KY
5059 case 0x10ec0293:
5060 /* Set to TRS mode */
5061 alc_write_coef_idx(codec, 0x45, 0xc429);
5062 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 5063 alc_process_coef_fw(codec, coef0293);
a22aa26f
KY
5064 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5065 break;
78f4f7c2
KY
5066 case 0x10ec0867:
5067 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
c0dbbdad 5068 fallthrough;
9eb5d0e6 5069 case 0x10ec0221:
1f8b46cd
DH
5070 case 0x10ec0662:
5071 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5072 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5073 break;
73bdd597
DH
5074 case 0x10ec0668:
5075 alc_write_coef_idx(codec, 0x11, 0x0001);
5076 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 5077 alc_process_coef_fw(codec, coef0688);
73bdd597
DH
5078 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5079 break;
c2b691ee 5080 case 0x10ec0215:
4cc9b9d6 5081 case 0x10ec0225:
c2b691ee 5082 case 0x10ec0285:
7d727869 5083 case 0x10ec0295:
c2b691ee 5084 case 0x10ec0289:
28f1f9b2 5085 case 0x10ec0299:
5a36767a 5086 alc_process_coef_fw(codec, alc225_pre_hsmode);
4cc9b9d6
KY
5087 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
5088 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5089 alc_process_coef_fw(codec, coef0225);
5090 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5091 break;
73bdd597 5092 }
4e76a883 5093 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
73bdd597
DH
5094}
5095
5096static void alc_headset_mode_default(struct hda_codec *codec)
5097{
6b0f95c4 5098 static const struct coef_fw coef0225[] = {
5a36767a
KY
5099 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
5100 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
5101 UPDATE_COEF(0x49, 3<<8, 0<<8),
5102 UPDATE_COEF(0x4a, 3<<4, 3<<4),
5103 UPDATE_COEF(0x63, 3<<14, 0),
5104 UPDATE_COEF(0x67, 0xf000, 0x3000),
2ae95577
DH
5105 {}
5106 };
6b0f95c4 5107 static const struct coef_fw coef0255[] = {
54db6c39
TI
5108 WRITE_COEF(0x45, 0xc089),
5109 WRITE_COEF(0x45, 0xc489),
5110 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5111 WRITE_COEF(0x49, 0x0049),
5112 {}
5113 };
6b0f95c4 5114 static const struct coef_fw coef0256[] = {
717f43d8
KY
5115 WRITE_COEF(0x45, 0xc489),
5116 WRITE_COEFEX(0x57, 0x03, 0x0da3),
5117 WRITE_COEF(0x49, 0x0049),
5118 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5119 WRITE_COEF(0x06, 0x6100),
5120 {}
5121 };
6b0f95c4 5122 static const struct coef_fw coef0233[] = {
54db6c39
TI
5123 WRITE_COEF(0x06, 0x2100),
5124 WRITE_COEF(0x32, 0x4ea3),
5125 {}
5126 };
6b0f95c4 5127 static const struct coef_fw coef0288[] = {
f3b70332
KY
5128 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
5129 UPDATE_COEF(0x50, 0x2000, 0x2000),
5130 UPDATE_COEF(0x56, 0x0006, 0x0006),
5131 UPDATE_COEF(0x66, 0x0008, 0),
5132 UPDATE_COEF(0x67, 0x2000, 0),
5133 {}
5134 };
6b0f95c4 5135 static const struct coef_fw coef0292[] = {
54db6c39
TI
5136 WRITE_COEF(0x76, 0x000e),
5137 WRITE_COEF(0x6c, 0x2400),
5138 WRITE_COEF(0x6b, 0xc429),
5139 WRITE_COEF(0x18, 0x7308),
5140 {}
5141 };
6b0f95c4 5142 static const struct coef_fw coef0293[] = {
54db6c39
TI
5143 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5144 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
5145 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5146 {}
5147 };
6b0f95c4 5148 static const struct coef_fw coef0688[] = {
54db6c39
TI
5149 WRITE_COEF(0x11, 0x0041),
5150 WRITE_COEF(0x15, 0x0d40),
5151 WRITE_COEF(0xb7, 0x802b),
5152 {}
5153 };
6b0f95c4 5154 static const struct coef_fw coef0274[] = {
71683c32
KY
5155 WRITE_COEF(0x45, 0x4289),
5156 UPDATE_COEF(0x4a, 0x0010, 0x0010),
5157 UPDATE_COEF(0x6b, 0x0f00, 0),
5158 UPDATE_COEF(0x49, 0x0300, 0x0300),
5159 {}
5160 };
54db6c39 5161
7639a06c 5162 switch (codec->core.vendor_id) {
c2b691ee 5163 case 0x10ec0215:
2ae95577 5164 case 0x10ec0225:
c2b691ee 5165 case 0x10ec0285:
7d727869 5166 case 0x10ec0295:
c2b691ee 5167 case 0x10ec0289:
28f1f9b2 5168 case 0x10ec0299:
5a36767a 5169 alc_process_coef_fw(codec, alc225_pre_hsmode);
2ae95577
DH
5170 alc_process_coef_fw(codec, coef0225);
5171 break;
9a22a8f5 5172 case 0x10ec0255:
54db6c39 5173 alc_process_coef_fw(codec, coef0255);
9a22a8f5 5174 break;
1948fc06 5175 case 0x10ec0230:
717f43d8
KY
5176 case 0x10ec0236:
5177 case 0x10ec0256:
5178 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5179 alc_write_coef_idx(codec, 0x45, 0xc089);
5180 msleep(50);
5181 alc_process_coef_fw(codec, coef0256);
5182 break;
71683c32
KY
5183 case 0x10ec0234:
5184 case 0x10ec0274:
5185 case 0x10ec0294:
5186 alc_process_coef_fw(codec, coef0274);
5187 break;
13fd08a3 5188 case 0x10ec0233:
73bdd597 5189 case 0x10ec0283:
54db6c39 5190 alc_process_coef_fw(codec, coef0233);
73bdd597 5191 break;
f3b70332
KY
5192 case 0x10ec0286:
5193 case 0x10ec0288:
1a5bc8d9 5194 case 0x10ec0298:
f3b70332
KY
5195 alc_process_coef_fw(codec, coef0288);
5196 break;
73bdd597 5197 case 0x10ec0292:
54db6c39 5198 alc_process_coef_fw(codec, coef0292);
73bdd597 5199 break;
a22aa26f 5200 case 0x10ec0293:
54db6c39 5201 alc_process_coef_fw(codec, coef0293);
a22aa26f 5202 break;
73bdd597 5203 case 0x10ec0668:
54db6c39 5204 alc_process_coef_fw(codec, coef0688);
73bdd597 5205 break;
78f4f7c2
KY
5206 case 0x10ec0867:
5207 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5208 break;
73bdd597 5209 }
4e76a883 5210 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
73bdd597
DH
5211}
5212
5213/* Iphone type */
5214static void alc_headset_mode_ctia(struct hda_codec *codec)
5215{
89542936
KY
5216 int val;
5217
6b0f95c4 5218 static const struct coef_fw coef0255[] = {
54db6c39
TI
5219 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5220 WRITE_COEF(0x1b, 0x0c2b),
5221 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5222 {}
5223 };
6b0f95c4 5224 static const struct coef_fw coef0256[] = {
e69e7e03 5225 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
717f43d8 5226 WRITE_COEF(0x1b, 0x0e6b),
e69e7e03
KY
5227 {}
5228 };
6b0f95c4 5229 static const struct coef_fw coef0233[] = {
54db6c39
TI
5230 WRITE_COEF(0x45, 0xd429),
5231 WRITE_COEF(0x1b, 0x0c2b),
5232 WRITE_COEF(0x32, 0x4ea3),
5233 {}
5234 };
6b0f95c4 5235 static const struct coef_fw coef0288[] = {
f3b70332
KY
5236 UPDATE_COEF(0x50, 0x2000, 0x2000),
5237 UPDATE_COEF(0x56, 0x0006, 0x0006),
5238 UPDATE_COEF(0x66, 0x0008, 0),
5239 UPDATE_COEF(0x67, 0x2000, 0),
5240 {}
5241 };
6b0f95c4 5242 static const struct coef_fw coef0292[] = {
54db6c39
TI
5243 WRITE_COEF(0x6b, 0xd429),
5244 WRITE_COEF(0x76, 0x0008),
5245 WRITE_COEF(0x18, 0x7388),
5246 {}
5247 };
6b0f95c4 5248 static const struct coef_fw coef0293[] = {
54db6c39
TI
5249 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
5250 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5251 {}
5252 };
6b0f95c4 5253 static const struct coef_fw coef0688[] = {
54db6c39
TI
5254 WRITE_COEF(0x11, 0x0001),
5255 WRITE_COEF(0x15, 0x0d60),
5256 WRITE_COEF(0xc3, 0x0000),
5257 {}
5258 };
6b0f95c4 5259 static const struct coef_fw coef0225_1[] = {
4cc9b9d6 5260 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5a36767a
KY
5261 UPDATE_COEF(0x63, 3<<14, 2<<14),
5262 {}
5263 };
6b0f95c4 5264 static const struct coef_fw coef0225_2[] = {
5a36767a
KY
5265 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5266 UPDATE_COEF(0x63, 3<<14, 1<<14),
4cc9b9d6
KY
5267 {}
5268 };
54db6c39 5269
7639a06c 5270 switch (codec->core.vendor_id) {
9a22a8f5 5271 case 0x10ec0255:
54db6c39 5272 alc_process_coef_fw(codec, coef0255);
9a22a8f5 5273 break;
1948fc06 5274 case 0x10ec0230:
736f20a7 5275 case 0x10ec0236:
e69e7e03
KY
5276 case 0x10ec0256:
5277 alc_process_coef_fw(codec, coef0256);
5278 break;
71683c32
KY
5279 case 0x10ec0234:
5280 case 0x10ec0274:
5281 case 0x10ec0294:
5282 alc_write_coef_idx(codec, 0x45, 0xd689);
5283 break;
13fd08a3 5284 case 0x10ec0233:
73bdd597 5285 case 0x10ec0283:
54db6c39 5286 alc_process_coef_fw(codec, coef0233);
73bdd597 5287 break;
1a5bc8d9 5288 case 0x10ec0298:
89542936
KY
5289 val = alc_read_coef_idx(codec, 0x50);
5290 if (val & (1 << 12)) {
5291 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5292 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5293 msleep(300);
5294 } else {
5295 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5296 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5297 msleep(300);
5298 }
5299 break;
f3b70332
KY
5300 case 0x10ec0286:
5301 case 0x10ec0288:
5302 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5303 msleep(300);
5304 alc_process_coef_fw(codec, coef0288);
5305 break;
73bdd597 5306 case 0x10ec0292:
54db6c39 5307 alc_process_coef_fw(codec, coef0292);
73bdd597 5308 break;
a22aa26f 5309 case 0x10ec0293:
54db6c39 5310 alc_process_coef_fw(codec, coef0293);
a22aa26f 5311 break;
73bdd597 5312 case 0x10ec0668:
54db6c39 5313 alc_process_coef_fw(codec, coef0688);
73bdd597 5314 break;
c2b691ee 5315 case 0x10ec0215:
4cc9b9d6 5316 case 0x10ec0225:
c2b691ee 5317 case 0x10ec0285:
7d727869 5318 case 0x10ec0295:
c2b691ee 5319 case 0x10ec0289:
28f1f9b2 5320 case 0x10ec0299:
5a36767a
KY
5321 val = alc_read_coef_idx(codec, 0x45);
5322 if (val & (1 << 9))
5323 alc_process_coef_fw(codec, coef0225_2);
5324 else
5325 alc_process_coef_fw(codec, coef0225_1);
4cc9b9d6 5326 break;
78f4f7c2
KY
5327 case 0x10ec0867:
5328 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5329 break;
73bdd597 5330 }
4e76a883 5331 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
73bdd597
DH
5332}
5333
5334/* Nokia type */
5335static void alc_headset_mode_omtp(struct hda_codec *codec)
5336{
6b0f95c4 5337 static const struct coef_fw coef0255[] = {
54db6c39
TI
5338 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5339 WRITE_COEF(0x1b, 0x0c2b),
5340 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5341 {}
5342 };
6b0f95c4 5343 static const struct coef_fw coef0256[] = {
e69e7e03 5344 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
717f43d8 5345 WRITE_COEF(0x1b, 0x0e6b),
e69e7e03
KY
5346 {}
5347 };
6b0f95c4 5348 static const struct coef_fw coef0233[] = {
54db6c39
TI
5349 WRITE_COEF(0x45, 0xe429),
5350 WRITE_COEF(0x1b, 0x0c2b),
5351 WRITE_COEF(0x32, 0x4ea3),
5352 {}
5353 };
6b0f95c4 5354 static const struct coef_fw coef0288[] = {
f3b70332
KY
5355 UPDATE_COEF(0x50, 0x2000, 0x2000),
5356 UPDATE_COEF(0x56, 0x0006, 0x0006),
5357 UPDATE_COEF(0x66, 0x0008, 0),
5358 UPDATE_COEF(0x67, 0x2000, 0),
5359 {}
5360 };
6b0f95c4 5361 static const struct coef_fw coef0292[] = {
54db6c39
TI
5362 WRITE_COEF(0x6b, 0xe429),
5363 WRITE_COEF(0x76, 0x0008),
5364 WRITE_COEF(0x18, 0x7388),
5365 {}
5366 };
6b0f95c4 5367 static const struct coef_fw coef0293[] = {
54db6c39
TI
5368 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5369 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5370 {}
5371 };
6b0f95c4 5372 static const struct coef_fw coef0688[] = {
54db6c39
TI
5373 WRITE_COEF(0x11, 0x0001),
5374 WRITE_COEF(0x15, 0x0d50),
5375 WRITE_COEF(0xc3, 0x0000),
5376 {}
5377 };
6b0f95c4 5378 static const struct coef_fw coef0225[] = {
4cc9b9d6 5379 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
5a36767a 5380 UPDATE_COEF(0x63, 3<<14, 2<<14),
4cc9b9d6
KY
5381 {}
5382 };
54db6c39 5383
7639a06c 5384 switch (codec->core.vendor_id) {
9a22a8f5 5385 case 0x10ec0255:
54db6c39 5386 alc_process_coef_fw(codec, coef0255);
9a22a8f5 5387 break;
1948fc06 5388 case 0x10ec0230:
736f20a7 5389 case 0x10ec0236:
e69e7e03
KY
5390 case 0x10ec0256:
5391 alc_process_coef_fw(codec, coef0256);
5392 break;
71683c32
KY
5393 case 0x10ec0234:
5394 case 0x10ec0274:
5395 case 0x10ec0294:
5396 alc_write_coef_idx(codec, 0x45, 0xe689);
5397 break;
13fd08a3 5398 case 0x10ec0233:
73bdd597 5399 case 0x10ec0283:
54db6c39 5400 alc_process_coef_fw(codec, coef0233);
73bdd597 5401 break;
1a5bc8d9
KY
5402 case 0x10ec0298:
5403 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
89542936
KY
5404 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5405 msleep(300);
5406 break;
f3b70332
KY
5407 case 0x10ec0286:
5408 case 0x10ec0288:
5409 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5410 msleep(300);
5411 alc_process_coef_fw(codec, coef0288);
5412 break;
73bdd597 5413 case 0x10ec0292:
54db6c39 5414 alc_process_coef_fw(codec, coef0292);
73bdd597 5415 break;
a22aa26f 5416 case 0x10ec0293:
54db6c39 5417 alc_process_coef_fw(codec, coef0293);
a22aa26f 5418 break;
73bdd597 5419 case 0x10ec0668:
54db6c39 5420 alc_process_coef_fw(codec, coef0688);
73bdd597 5421 break;
c2b691ee 5422 case 0x10ec0215:
4cc9b9d6 5423 case 0x10ec0225:
c2b691ee 5424 case 0x10ec0285:
7d727869 5425 case 0x10ec0295:
c2b691ee 5426 case 0x10ec0289:
28f1f9b2 5427 case 0x10ec0299:
4cc9b9d6
KY
5428 alc_process_coef_fw(codec, coef0225);
5429 break;
73bdd597 5430 }
4e76a883 5431 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
73bdd597
DH
5432}
5433
5434static void alc_determine_headset_type(struct hda_codec *codec)
5435{
5436 int val;
5437 bool is_ctia = false;
5438 struct alc_spec *spec = codec->spec;
6b0f95c4 5439 static const struct coef_fw coef0255[] = {
54db6c39
TI
5440 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5441 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5442 conteol) */
5443 {}
5444 };
6b0f95c4 5445 static const struct coef_fw coef0288[] = {
f3b70332
KY
5446 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5447 {}
5448 };
6b0f95c4 5449 static const struct coef_fw coef0298[] = {
89542936
KY
5450 UPDATE_COEF(0x50, 0x2000, 0x2000),
5451 UPDATE_COEF(0x56, 0x0006, 0x0006),
5452 UPDATE_COEF(0x66, 0x0008, 0),
5453 UPDATE_COEF(0x67, 0x2000, 0),
5454 UPDATE_COEF(0x19, 0x1300, 0x1300),
5455 {}
5456 };
6b0f95c4 5457 static const struct coef_fw coef0293[] = {
54db6c39
TI
5458 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5459 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5460 {}
5461 };
6b0f95c4 5462 static const struct coef_fw coef0688[] = {
54db6c39
TI
5463 WRITE_COEF(0x11, 0x0001),
5464 WRITE_COEF(0xb7, 0x802b),
5465 WRITE_COEF(0x15, 0x0d60),
5466 WRITE_COEF(0xc3, 0x0c00),
5467 {}
5468 };
6b0f95c4 5469 static const struct coef_fw coef0274[] = {
71683c32
KY
5470 UPDATE_COEF(0x4a, 0x0010, 0),
5471 UPDATE_COEF(0x4a, 0x8000, 0),
5472 WRITE_COEF(0x45, 0xd289),
5473 UPDATE_COEF(0x49, 0x0300, 0x0300),
5474 {}
5475 };
73bdd597 5476
92666d45
KY
5477 if (spec->no_internal_mic_pin) {
5478 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5479 return;
5480 }
5481
7639a06c 5482 switch (codec->core.vendor_id) {
9a22a8f5 5483 case 0x10ec0255:
717f43d8
KY
5484 alc_process_coef_fw(codec, coef0255);
5485 msleep(300);
5486 val = alc_read_coef_idx(codec, 0x46);
5487 is_ctia = (val & 0x0070) == 0x0070;
5488 break;
1948fc06 5489 case 0x10ec0230:
717f43d8 5490 case 0x10ec0236:
7081adf3 5491 case 0x10ec0256:
717f43d8
KY
5492 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5493 alc_write_coef_idx(codec, 0x06, 0x6104);
5494 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5495
5496 snd_hda_codec_write(codec, 0x21, 0,
5497 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5498 msleep(80);
5499 snd_hda_codec_write(codec, 0x21, 0,
5500 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5501
54db6c39 5502 alc_process_coef_fw(codec, coef0255);
9a22a8f5
KY
5503 msleep(300);
5504 val = alc_read_coef_idx(codec, 0x46);
5505 is_ctia = (val & 0x0070) == 0x0070;
717f43d8
KY
5506
5507 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5508 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5509
5510 snd_hda_codec_write(codec, 0x21, 0,
5511 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5512 msleep(80);
5513 snd_hda_codec_write(codec, 0x21, 0,
5514 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
9a22a8f5 5515 break;
71683c32
KY
5516 case 0x10ec0234:
5517 case 0x10ec0274:
5518 case 0x10ec0294:
5519 alc_process_coef_fw(codec, coef0274);
febf2256 5520 msleep(850);
71683c32
KY
5521 val = alc_read_coef_idx(codec, 0x46);
5522 is_ctia = (val & 0x00f0) == 0x00f0;
5523 break;
13fd08a3 5524 case 0x10ec0233:
73bdd597
DH
5525 case 0x10ec0283:
5526 alc_write_coef_idx(codec, 0x45, 0xd029);
5527 msleep(300);
5528 val = alc_read_coef_idx(codec, 0x46);
5529 is_ctia = (val & 0x0070) == 0x0070;
5530 break;
1a5bc8d9 5531 case 0x10ec0298:
89542936
KY
5532 snd_hda_codec_write(codec, 0x21, 0,
5533 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5534 msleep(100);
5535 snd_hda_codec_write(codec, 0x21, 0,
5536 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5537 msleep(200);
5538
5539 val = alc_read_coef_idx(codec, 0x50);
5540 if (val & (1 << 12)) {
5541 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5542 alc_process_coef_fw(codec, coef0288);
5543 msleep(350);
5544 val = alc_read_coef_idx(codec, 0x50);
5545 is_ctia = (val & 0x0070) == 0x0070;
5546 } else {
5547 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5548 alc_process_coef_fw(codec, coef0288);
5549 msleep(350);
5550 val = alc_read_coef_idx(codec, 0x50);
5551 is_ctia = (val & 0x0070) == 0x0070;
5552 }
5553 alc_process_coef_fw(codec, coef0298);
5554 snd_hda_codec_write(codec, 0x21, 0,
5555 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5556 msleep(75);
5557 snd_hda_codec_write(codec, 0x21, 0,
5558 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5559 break;
f3b70332
KY
5560 case 0x10ec0286:
5561 case 0x10ec0288:
5562 alc_process_coef_fw(codec, coef0288);
5563 msleep(350);
5564 val = alc_read_coef_idx(codec, 0x50);
5565 is_ctia = (val & 0x0070) == 0x0070;
5566 break;
73bdd597
DH
5567 case 0x10ec0292:
5568 alc_write_coef_idx(codec, 0x6b, 0xd429);
5569 msleep(300);
5570 val = alc_read_coef_idx(codec, 0x6c);
5571 is_ctia = (val & 0x001c) == 0x001c;
5572 break;
a22aa26f 5573 case 0x10ec0293:
54db6c39 5574 alc_process_coef_fw(codec, coef0293);
a22aa26f
KY
5575 msleep(300);
5576 val = alc_read_coef_idx(codec, 0x46);
5577 is_ctia = (val & 0x0070) == 0x0070;
5578 break;
73bdd597 5579 case 0x10ec0668:
54db6c39 5580 alc_process_coef_fw(codec, coef0688);
73bdd597
DH
5581 msleep(300);
5582 val = alc_read_coef_idx(codec, 0xbe);
5583 is_ctia = (val & 0x1c02) == 0x1c02;
5584 break;
c2b691ee 5585 case 0x10ec0215:
4cc9b9d6 5586 case 0x10ec0225:
c2b691ee 5587 case 0x10ec0285:
7d727869 5588 case 0x10ec0295:
c2b691ee 5589 case 0x10ec0289:
28f1f9b2 5590 case 0x10ec0299:
da911b1f
KY
5591 snd_hda_codec_write(codec, 0x21, 0,
5592 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5593 msleep(80);
5594 snd_hda_codec_write(codec, 0x21, 0,
5595 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5596
5a36767a
KY
5597 alc_process_coef_fw(codec, alc225_pre_hsmode);
5598 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5599 val = alc_read_coef_idx(codec, 0x45);
5600 if (val & (1 << 9)) {
5601 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5602 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5603 msleep(800);
5604 val = alc_read_coef_idx(codec, 0x46);
5605 is_ctia = (val & 0x00f0) == 0x00f0;
5606 } else {
5607 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5608 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5609 msleep(800);
5610 val = alc_read_coef_idx(codec, 0x46);
5611 is_ctia = (val & 0x00f0) == 0x00f0;
5612 }
5613 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
5614 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
5615 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
da911b1f
KY
5616
5617 snd_hda_codec_write(codec, 0x21, 0,
5618 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5619 msleep(80);
5620 snd_hda_codec_write(codec, 0x21, 0,
5621 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
4cc9b9d6 5622 break;
78f4f7c2
KY
5623 case 0x10ec0867:
5624 is_ctia = true;
5625 break;
73bdd597
DH
5626 }
5627
4e76a883 5628 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
73bdd597
DH
5629 is_ctia ? "yes" : "no");
5630 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
5631}
5632
5633static void alc_update_headset_mode(struct hda_codec *codec)
5634{
5635 struct alc_spec *spec = codec->spec;
5636
5637 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
35a39f98 5638 hda_nid_t hp_pin = alc_get_hp_pin(spec);
73bdd597
DH
5639
5640 int new_headset_mode;
5641
5642 if (!snd_hda_jack_detect(codec, hp_pin))
5643 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
5644 else if (mux_pin == spec->headset_mic_pin)
5645 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
5646 else if (mux_pin == spec->headphone_mic_pin)
5647 new_headset_mode = ALC_HEADSET_MODE_MIC;
5648 else
5649 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
5650
5959a6bc
DH
5651 if (new_headset_mode == spec->current_headset_mode) {
5652 snd_hda_gen_update_outputs(codec);
73bdd597 5653 return;
5959a6bc 5654 }
73bdd597
DH
5655
5656 switch (new_headset_mode) {
5657 case ALC_HEADSET_MODE_UNPLUGGED:
5658 alc_headset_mode_unplugged(codec);
aeac1a0d
KY
5659 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5660 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
73bdd597
DH
5661 spec->gen.hp_jack_present = false;
5662 break;
5663 case ALC_HEADSET_MODE_HEADSET:
5664 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
5665 alc_determine_headset_type(codec);
5666 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
5667 alc_headset_mode_ctia(codec);
5668 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
5669 alc_headset_mode_omtp(codec);
5670 spec->gen.hp_jack_present = true;
5671 break;
5672 case ALC_HEADSET_MODE_MIC:
5673 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
5674 spec->gen.hp_jack_present = false;
5675 break;
5676 case ALC_HEADSET_MODE_HEADPHONE:
5677 alc_headset_mode_default(codec);
5678 spec->gen.hp_jack_present = true;
5679 break;
5680 }
5681 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
5682 snd_hda_set_pin_ctl_cache(codec, hp_pin,
5683 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
1f8b46cd 5684 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
73bdd597
DH
5685 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
5686 PIN_VREFHIZ);
5687 }
5688 spec->current_headset_mode = new_headset_mode;
5689
5690 snd_hda_gen_update_outputs(codec);
5691}
5692
5693static void alc_update_headset_mode_hook(struct hda_codec *codec,
7fe30711
TI
5694 struct snd_kcontrol *kcontrol,
5695 struct snd_ctl_elem_value *ucontrol)
73bdd597
DH
5696{
5697 alc_update_headset_mode(codec);
5698}
5699
1a4f69d5
TI
5700static void alc_update_headset_jack_cb(struct hda_codec *codec,
5701 struct hda_jack_callback *jack)
73bdd597 5702{
73bdd597 5703 snd_hda_gen_hp_automute(codec, jack);
e54f30be 5704 alc_update_headset_mode(codec);
73bdd597
DH
5705}
5706
5707static void alc_probe_headset_mode(struct hda_codec *codec)
5708{
5709 int i;
5710 struct alc_spec *spec = codec->spec;
5711 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5712
5713 /* Find mic pins */
5714 for (i = 0; i < cfg->num_inputs; i++) {
5715 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
5716 spec->headset_mic_pin = cfg->inputs[i].pin;
5717 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
5718 spec->headphone_mic_pin = cfg->inputs[i].pin;
5719 }
5720
0bed2aa3 5721 WARN_ON(spec->gen.cap_sync_hook);
73bdd597
DH
5722 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
5723 spec->gen.automute_hook = alc_update_headset_mode;
5724 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
5725}
5726
5727static void alc_fixup_headset_mode(struct hda_codec *codec,
5728 const struct hda_fixup *fix, int action)
5729{
5730 struct alc_spec *spec = codec->spec;
5731
5732 switch (action) {
5733 case HDA_FIXUP_ACT_PRE_PROBE:
5734 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
5735 break;
5736 case HDA_FIXUP_ACT_PROBE:
5737 alc_probe_headset_mode(codec);
5738 break;
5739 case HDA_FIXUP_ACT_INIT:
aeac1a0d
KY
5740 if (is_s3_resume(codec) || is_s4_resume(codec)) {
5741 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5742 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5743 }
73bdd597
DH
5744 alc_update_headset_mode(codec);
5745 break;
5746 }
5747}
5748
5749static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
5750 const struct hda_fixup *fix, int action)
5751{
5752 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5753 struct alc_spec *spec = codec->spec;
5754 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5755 }
5756 else
5757 alc_fixup_headset_mode(codec, fix, action);
5758}
5759
31278997
KY
5760static void alc255_set_default_jack_type(struct hda_codec *codec)
5761{
5762 /* Set to iphone type */
6b0f95c4 5763 static const struct coef_fw alc255fw[] = {
54db6c39
TI
5764 WRITE_COEF(0x1b, 0x880b),
5765 WRITE_COEF(0x45, 0xd089),
5766 WRITE_COEF(0x1b, 0x080b),
5767 WRITE_COEF(0x46, 0x0004),
5768 WRITE_COEF(0x1b, 0x0c0b),
5769 {}
5770 };
6b0f95c4 5771 static const struct coef_fw alc256fw[] = {
e69e7e03
KY
5772 WRITE_COEF(0x1b, 0x884b),
5773 WRITE_COEF(0x45, 0xd089),
5774 WRITE_COEF(0x1b, 0x084b),
5775 WRITE_COEF(0x46, 0x0004),
5776 WRITE_COEF(0x1b, 0x0c4b),
5777 {}
5778 };
5779 switch (codec->core.vendor_id) {
5780 case 0x10ec0255:
5781 alc_process_coef_fw(codec, alc255fw);
5782 break;
1948fc06 5783 case 0x10ec0230:
736f20a7 5784 case 0x10ec0236:
e69e7e03
KY
5785 case 0x10ec0256:
5786 alc_process_coef_fw(codec, alc256fw);
5787 break;
5788 }
31278997
KY
5789 msleep(30);
5790}
5791
9a22a8f5
KY
5792static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
5793 const struct hda_fixup *fix, int action)
5794{
5795 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
31278997 5796 alc255_set_default_jack_type(codec);
9a22a8f5
KY
5797 }
5798 alc_fixup_headset_mode(codec, fix, action);
5799}
5800
31278997
KY
5801static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
5802 const struct hda_fixup *fix, int action)
5803{
5804 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5805 struct alc_spec *spec = codec->spec;
5806 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5807 alc255_set_default_jack_type(codec);
5808 }
5809 else
5810 alc_fixup_headset_mode(codec, fix, action);
5811}
5812
e1e62b98
KY
5813static void alc288_update_headset_jack_cb(struct hda_codec *codec,
5814 struct hda_jack_callback *jack)
5815{
5816 struct alc_spec *spec = codec->spec;
e1e62b98
KY
5817
5818 alc_update_headset_jack_cb(codec, jack);
5819 /* Headset Mic enable or disable, only for Dell Dino */
d44a6864 5820 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
e1e62b98
KY
5821}
5822
5823static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5824 const struct hda_fixup *fix, int action)
5825{
5826 alc_fixup_headset_mode(codec, fix, action);
5827 if (action == HDA_FIXUP_ACT_PROBE) {
5828 struct alc_spec *spec = codec->spec;
d44a6864
TI
5829 /* toggled via hp_automute_hook */
5830 spec->gpio_mask |= 0x40;
5831 spec->gpio_dir |= 0x40;
e1e62b98
KY
5832 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
5833 }
5834}
5835
493a52a9
HW
5836static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5837 const struct hda_fixup *fix, int action)
5838{
5839 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5840 struct alc_spec *spec = codec->spec;
5841 spec->gen.auto_mute_via_amp = 1;
5842 }
5843}
5844
9b745ab8
TI
5845static void alc_fixup_no_shutup(struct hda_codec *codec,
5846 const struct hda_fixup *fix, int action)
5847{
efe55732 5848 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
9b745ab8 5849 struct alc_spec *spec = codec->spec;
c0ca5ece 5850 spec->no_shutup_pins = 1;
9b745ab8
TI
5851 }
5852}
5853
5e6db669
GM
5854static void alc_fixup_disable_aamix(struct hda_codec *codec,
5855 const struct hda_fixup *fix, int action)
5856{
5857 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5858 struct alc_spec *spec = codec->spec;
5859 /* Disable AA-loopback as it causes white noise */
5860 spec->gen.mixer_nid = 0;
5861 }
5862}
5863
7f57d803
TI
5864/* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
5865static void alc_fixup_tpt440_dock(struct hda_codec *codec,
5866 const struct hda_fixup *fix, int action)
5867{
5868 static const struct hda_pintbl pincfgs[] = {
5869 { 0x16, 0x21211010 }, /* dock headphone */
5870 { 0x19, 0x21a11010 }, /* dock mic */
5871 { }
5872 };
5873 struct alc_spec *spec = codec->spec;
5874
5875 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5876 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5877 codec->power_save_node = 0; /* avoid click noises */
5878 snd_hda_apply_pincfgs(codec, pincfgs);
5879 }
5880}
5881
61fcf8ec
KY
5882static void alc_fixup_tpt470_dock(struct hda_codec *codec,
5883 const struct hda_fixup *fix, int action)
5884{
5885 static const struct hda_pintbl pincfgs[] = {
5886 { 0x17, 0x21211010 }, /* dock headphone */
5887 { 0x19, 0x21a11010 }, /* dock mic */
5888 { }
5889 };
5890 struct alc_spec *spec = codec->spec;
5891
5892 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5893 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
71db96dd
TI
5894 snd_hda_apply_pincfgs(codec, pincfgs);
5895 } else if (action == HDA_FIXUP_ACT_INIT) {
61fcf8ec
KY
5896 /* Enable DOCK device */
5897 snd_hda_codec_write(codec, 0x17, 0,
5898 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5899 /* Enable DOCK device */
5900 snd_hda_codec_write(codec, 0x19, 0,
5901 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
61fcf8ec
KY
5902 }
5903}
5904
399c01aa
TI
5905static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
5906 const struct hda_fixup *fix, int action)
5907{
5908 /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
5909 * the speaker output becomes too low by some reason on Thinkpads with
5910 * ALC298 codec
5911 */
5912 static const hda_nid_t preferred_pairs[] = {
5913 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
5914 0
5915 };
5916 struct alc_spec *spec = codec->spec;
5917
5918 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5919 spec->gen.preferred_dacs = preferred_pairs;
5920}
5921
8eedd3a7
TI
5922static void alc295_fixup_asus_dacs(struct hda_codec *codec,
5923 const struct hda_fixup *fix, int action)
5924{
5925 static const hda_nid_t preferred_pairs[] = {
5926 0x17, 0x02, 0x21, 0x03, 0
5927 };
5928 struct alc_spec *spec = codec->spec;
5929
5930 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5931 spec->gen.preferred_dacs = preferred_pairs;
5932}
5933
9476d369 5934static void alc_shutup_dell_xps13(struct hda_codec *codec)
033b0a7c
GM
5935{
5936 struct alc_spec *spec = codec->spec;
35a39f98 5937 int hp_pin = alc_get_hp_pin(spec);
033b0a7c 5938
9476d369
GM
5939 /* Prevent pop noises when headphones are plugged in */
5940 snd_hda_codec_write(codec, hp_pin, 0,
5941 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5942 msleep(20);
033b0a7c
GM
5943}
5944
5945static void alc_fixup_dell_xps13(struct hda_codec *codec,
5946 const struct hda_fixup *fix, int action)
5947{
3e1b0c4a
TI
5948 struct alc_spec *spec = codec->spec;
5949 struct hda_input_mux *imux = &spec->gen.input_mux;
5950 int i;
f38663ab 5951
3e1b0c4a
TI
5952 switch (action) {
5953 case HDA_FIXUP_ACT_PRE_PROBE:
5954 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
5955 * it causes a click noise at start up
5956 */
5957 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
efe55732 5958 spec->shutup = alc_shutup_dell_xps13;
3e1b0c4a
TI
5959 break;
5960 case HDA_FIXUP_ACT_PROBE:
f38663ab
GM
5961 /* Make the internal mic the default input source. */
5962 for (i = 0; i < imux->num_items; i++) {
5963 if (spec->gen.imux_pins[i] == 0x12) {
5964 spec->gen.cur_mux[0] = i;
5965 break;
5966 }
5967 }
3e1b0c4a 5968 break;
033b0a7c
GM
5969 }
5970}
5971
1f8b46cd
DH
5972static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
5973 const struct hda_fixup *fix, int action)
5974{
5975 struct alc_spec *spec = codec->spec;
5976
5977 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5978 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5979 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
b40eda64
DH
5980
5981 /* Disable boost for mic-in permanently. (This code is only called
5982 from quirks that guarantee that the headphone is at NID 0x1b.) */
5983 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
5984 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
1f8b46cd
DH
5985 } else
5986 alc_fixup_headset_mode(codec, fix, action);
5987}
5988
73bdd597
DH
5989static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
5990 const struct hda_fixup *fix, int action)
5991{
5992 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
73bdd597 5993 alc_write_coef_idx(codec, 0xc4, 0x8000);
98b24883 5994 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
73bdd597
DH
5995 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
5996 }
5997 alc_fixup_headset_mode(codec, fix, action);
5998}
5999
bde7bc60
CCC
6000/* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
6001static int find_ext_mic_pin(struct hda_codec *codec)
6002{
6003 struct alc_spec *spec = codec->spec;
6004 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6005 hda_nid_t nid;
6006 unsigned int defcfg;
6007 int i;
6008
6009 for (i = 0; i < cfg->num_inputs; i++) {
6010 if (cfg->inputs[i].type != AUTO_PIN_MIC)
6011 continue;
6012 nid = cfg->inputs[i].pin;
6013 defcfg = snd_hda_codec_get_pincfg(codec, nid);
6014 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
6015 continue;
6016 return nid;
6017 }
6018
6019 return 0;
6020}
6021
08a978db 6022static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
1727a771 6023 const struct hda_fixup *fix,
08a978db
DR
6024 int action)
6025{
6026 struct alc_spec *spec = codec->spec;
6027
0db75790 6028 if (action == HDA_FIXUP_ACT_PROBE) {
bde7bc60 6029 int mic_pin = find_ext_mic_pin(codec);
35a39f98 6030 int hp_pin = alc_get_hp_pin(spec);
bde7bc60
CCC
6031
6032 if (snd_BUG_ON(!mic_pin || !hp_pin))
0db75790 6033 return;
bde7bc60 6034 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
0db75790 6035 }
08a978db 6036}
693b613d 6037
3e0d611b
DH
6038static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
6039 const struct hda_fixup *fix,
6040 int action)
6041{
6042 struct alc_spec *spec = codec->spec;
6043 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6044 int i;
6045
6046 /* The mic boosts on level 2 and 3 are too noisy
6047 on the internal mic input.
6048 Therefore limit the boost to 0 or 1. */
6049
6050 if (action != HDA_FIXUP_ACT_PROBE)
6051 return;
6052
6053 for (i = 0; i < cfg->num_inputs; i++) {
6054 hda_nid_t nid = cfg->inputs[i].pin;
6055 unsigned int defcfg;
6056 if (cfg->inputs[i].type != AUTO_PIN_MIC)
6057 continue;
6058 defcfg = snd_hda_codec_get_pincfg(codec, nid);
6059 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
6060 continue;
6061
6062 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
6063 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
6064 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
6065 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
6066 (0 << AC_AMPCAP_MUTE_SHIFT));
6067 }
6068}
6069
cd217a63 6070static void alc283_hp_automute_hook(struct hda_codec *codec,
1a4f69d5 6071 struct hda_jack_callback *jack)
cd217a63
KY
6072{
6073 struct alc_spec *spec = codec->spec;
6074 int vref;
6075
6076 msleep(200);
6077 snd_hda_gen_hp_automute(codec, jack);
6078
6079 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
6080
6081 msleep(600);
6082 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6083 vref);
6084}
6085
cd217a63
KY
6086static void alc283_fixup_chromebook(struct hda_codec *codec,
6087 const struct hda_fixup *fix, int action)
6088{
6089 struct alc_spec *spec = codec->spec;
cd217a63
KY
6090
6091 switch (action) {
6092 case HDA_FIXUP_ACT_PRE_PROBE:
0202e99c 6093 snd_hda_override_wcaps(codec, 0x03, 0);
d2e92709
TI
6094 /* Disable AA-loopback as it causes white noise */
6095 spec->gen.mixer_nid = 0;
38070219 6096 break;
0202e99c 6097 case HDA_FIXUP_ACT_INIT:
de9481cb
KY
6098 /* MIC2-VREF control */
6099 /* Set to manual mode */
98b24883 6100 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
0202e99c 6101 /* Enable Line1 input control by verb */
98b24883 6102 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
0202e99c
KY
6103 break;
6104 }
6105}
6106
6107static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
6108 const struct hda_fixup *fix, int action)
6109{
6110 struct alc_spec *spec = codec->spec;
0202e99c
KY
6111
6112 switch (action) {
6113 case HDA_FIXUP_ACT_PRE_PROBE:
cd217a63 6114 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
38070219
KY
6115 break;
6116 case HDA_FIXUP_ACT_INIT:
cd217a63
KY
6117 /* MIC2-VREF control */
6118 /* Set to manual mode */
98b24883 6119 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
cd217a63
KY
6120 break;
6121 }
6122}
6123
7bba2157
TI
6124/* mute tablet speaker pin (0x14) via dock plugging in addition */
6125static void asus_tx300_automute(struct hda_codec *codec)
6126{
6127 struct alc_spec *spec = codec->spec;
6128 snd_hda_gen_update_outputs(codec);
6129 if (snd_hda_jack_detect(codec, 0x1b))
6130 spec->gen.mute_bits |= (1ULL << 0x14);
6131}
6132
6133static void alc282_fixup_asus_tx300(struct hda_codec *codec,
6134 const struct hda_fixup *fix, int action)
6135{
6136 struct alc_spec *spec = codec->spec;
7bba2157
TI
6137 static const struct hda_pintbl dock_pins[] = {
6138 { 0x1b, 0x21114000 }, /* dock speaker pin */
6139 {}
6140 };
7bba2157
TI
6141
6142 switch (action) {
6143 case HDA_FIXUP_ACT_PRE_PROBE:
1c76aa5f 6144 spec->init_amp = ALC_INIT_DEFAULT;
ae065f1c
TI
6145 /* TX300 needs to set up GPIO2 for the speaker amp */
6146 alc_setup_gpio(codec, 0x04);
7bba2157
TI
6147 snd_hda_apply_pincfgs(codec, dock_pins);
6148 spec->gen.auto_mute_via_amp = 1;
6149 spec->gen.automute_hook = asus_tx300_automute;
6150 snd_hda_jack_detect_enable_callback(codec, 0x1b,
7bba2157
TI
6151 snd_hda_gen_hp_automute);
6152 break;
5579cd6f
TI
6153 case HDA_FIXUP_ACT_PROBE:
6154 spec->init_amp = ALC_INIT_DEFAULT;
6155 break;
7bba2157
TI
6156 case HDA_FIXUP_ACT_BUILD:
6157 /* this is a bit tricky; give more sane names for the main
6158 * (tablet) speaker and the dock speaker, respectively
6159 */
56798e6b
TI
6160 rename_ctl(codec, "Speaker Playback Switch",
6161 "Dock Speaker Playback Switch");
6162 rename_ctl(codec, "Bass Speaker Playback Switch",
6163 "Speaker Playback Switch");
7bba2157
TI
6164 break;
6165 }
6166}
6167
338cae56
DH
6168static void alc290_fixup_mono_speakers(struct hda_codec *codec,
6169 const struct hda_fixup *fix, int action)
6170{
0f4881dc
DH
6171 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6172 /* DAC node 0x03 is giving mono output. We therefore want to
6173 make sure 0x14 (front speaker) and 0x15 (headphones) use the
6174 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
caf3c043
MM
6175 static const hda_nid_t conn1[] = { 0x0c };
6176 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
6177 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
0f4881dc 6178 }
338cae56
DH
6179}
6180
dd9aa335
HW
6181static void alc298_fixup_speaker_volume(struct hda_codec *codec,
6182 const struct hda_fixup *fix, int action)
6183{
6184 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6185 /* The speaker is routed to the Node 0x06 by a mistake, as a result
6186 we can't adjust the speaker's volume since this node does not has
6187 Amp-out capability. we change the speaker's route to:
6188 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
6189 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
6190 speaker's volume now. */
6191
caf3c043
MM
6192 static const hda_nid_t conn1[] = { 0x0c };
6193 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
dd9aa335
HW
6194 }
6195}
6196
e312a869
TI
6197/* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
6198static void alc295_fixup_disable_dac3(struct hda_codec *codec,
6199 const struct hda_fixup *fix, int action)
6200{
6201 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
caf3c043
MM
6202 static const hda_nid_t conn[] = { 0x02, 0x03 };
6203 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
e312a869
TI
6204 }
6205}
6206
d2cd795c
JK
6207/* force NID 0x17 (Bass Speaker) to DAC1 to share it with the main speaker */
6208static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
6209 const struct hda_fixup *fix, int action)
6210{
6211 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
caf3c043
MM
6212 static const hda_nid_t conn[] = { 0x02 };
6213 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
d2cd795c
JK
6214 }
6215}
6216
98973f2f
KP
6217/* Hook to update amp GPIO4 for automute */
6218static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
6219 struct hda_jack_callback *jack)
6220{
6221 struct alc_spec *spec = codec->spec;
6222
6223 snd_hda_gen_hp_automute(codec, jack);
6224 /* mute_led_polarity is set to 0, so we pass inverted value here */
dbd13179
KHF
6225 alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
6226 !spec->gen.hp_jack_present);
98973f2f
KP
6227}
6228
6229/* Manage GPIOs for HP EliteBook Folio 9480m.
6230 *
6231 * GPIO4 is the headphone amplifier power control
6232 * GPIO3 is the audio output mute indicator LED
6233 */
6234
6235static void alc280_fixup_hp_9480m(struct hda_codec *codec,
6236 const struct hda_fixup *fix,
6237 int action)
6238{
6239 struct alc_spec *spec = codec->spec;
98973f2f 6240
01e4a275 6241 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
98973f2f 6242 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
01e4a275
TI
6243 /* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
6244 spec->gpio_mask |= 0x10;
6245 spec->gpio_dir |= 0x10;
98973f2f 6246 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
98973f2f
KP
6247 }
6248}
6249
ae065f1c
TI
6250static void alc275_fixup_gpio4_off(struct hda_codec *codec,
6251 const struct hda_fixup *fix,
6252 int action)
6253{
6254 struct alc_spec *spec = codec->spec;
6255
6256 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6257 spec->gpio_mask |= 0x04;
6258 spec->gpio_dir |= 0x04;
6259 /* set data bit low */
6260 }
6261}
6262
6a6660d0
TI
6263/* Quirk for Thinkpad X1 7th and 8th Gen
6264 * The following fixed routing needed
6265 * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
6266 * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
6267 * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
6268 */
6269static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
6270 const struct hda_fixup *fix, int action)
6271{
6272 static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
6273 static const hda_nid_t preferred_pairs[] = {
6274 0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
6275 };
6276 struct alc_spec *spec = codec->spec;
6277
6278 switch (action) {
6279 case HDA_FIXUP_ACT_PRE_PROBE:
6280 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6281 spec->gen.preferred_dacs = preferred_pairs;
6282 break;
6283 case HDA_FIXUP_ACT_BUILD:
6284 /* The generic parser creates somewhat unintuitive volume ctls
6285 * with the fixed routing above, and the shared DAC2 may be
6286 * confusing for PA.
6287 * Rename those to unique names so that PA doesn't touch them
6288 * and use only Master volume.
6289 */
6290 rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
6291 rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
6292 break;
6293 }
6294}
6295
ca169cc2
KY
6296static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
6297 const struct hda_fixup *fix,
6298 int action)
6299{
6300 alc_fixup_dual_codecs(codec, fix, action);
6301 switch (action) {
6302 case HDA_FIXUP_ACT_PRE_PROBE:
6303 /* override card longname to provide a unique UCM profile */
6304 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
6305 break;
6306 case HDA_FIXUP_ACT_BUILD:
6307 /* rename Capture controls depending on the codec */
6308 rename_ctl(codec, "Capture Volume",
6309 codec->addr == 0 ?
6310 "Rear-Panel Capture Volume" :
6311 "Front-Panel Capture Volume");
6312 rename_ctl(codec, "Capture Switch",
6313 codec->addr == 0 ?
6314 "Rear-Panel Capture Switch" :
6315 "Front-Panel Capture Switch");
6316 break;
6317 }
6318}
6319
52e4e368
KHF
6320static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
6321 const struct hda_fixup *fix, int action)
6322{
6323 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6324 return;
6325
6326 codec->power_save_node = 1;
6327}
6328
92266651
KY
6329/* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
6330static void alc274_fixup_bind_dacs(struct hda_codec *codec,
6331 const struct hda_fixup *fix, int action)
6332{
6333 struct alc_spec *spec = codec->spec;
caf3c043 6334 static const hda_nid_t preferred_pairs[] = {
92266651
KY
6335 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
6336 0
6337 };
6338
6339 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6340 return;
6341
6342 spec->gen.preferred_dacs = preferred_pairs;
0700d3d1
KY
6343 spec->gen.auto_mute_via_amp = 1;
6344 codec->power_save_node = 0;
92266651
KY
6345}
6346
c84bfedc
TI
6347/* avoid DAC 0x06 for bass speaker 0x17; it has no volume control */
6348static void alc289_fixup_asus_ga401(struct hda_codec *codec,
6349 const struct hda_fixup *fix, int action)
6350{
6351 static const hda_nid_t preferred_pairs[] = {
6352 0x14, 0x02, 0x17, 0x02, 0x21, 0x03, 0
6353 };
6354 struct alc_spec *spec = codec->spec;
6355
6356 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6357 spec->gen.preferred_dacs = preferred_pairs;
6358 spec->gen.obey_preferred_dacs = 1;
6359 }
6360}
6361
c4cfcf6f
HW
6362/* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */
6363static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6364 const struct hda_fixup *fix, int action)
6365{
6366 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6367 return;
6368
6369 snd_hda_override_wcaps(codec, 0x03, 0);
6370}
6371
8a8de09c
KY
6372static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6373{
6374 switch (codec->core.vendor_id) {
6375 case 0x10ec0274:
6376 case 0x10ec0294:
6377 case 0x10ec0225:
6378 case 0x10ec0295:
6379 case 0x10ec0299:
6380 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6381 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6382 break;
1948fc06 6383 case 0x10ec0230:
8a8de09c
KY
6384 case 0x10ec0235:
6385 case 0x10ec0236:
6386 case 0x10ec0255:
6387 case 0x10ec0256:
6388 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6389 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6390 break;
6391 }
6392}
6393
8983eb60
KY
6394static void alc295_fixup_chromebook(struct hda_codec *codec,
6395 const struct hda_fixup *fix, int action)
6396{
d3ba58bb
KY
6397 struct alc_spec *spec = codec->spec;
6398
8983eb60 6399 switch (action) {
d3ba58bb
KY
6400 case HDA_FIXUP_ACT_PRE_PROBE:
6401 spec->ultra_low_power = true;
6402 break;
8983eb60 6403 case HDA_FIXUP_ACT_INIT:
8a8de09c 6404 alc_combo_jack_hp_jd_restart(codec);
8983eb60
KY
6405 break;
6406 }
6407}
6408
d1dd4211
KY
6409static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6410 const struct hda_fixup *fix, int action)
6411{
6412 if (action == HDA_FIXUP_ACT_PRE_PROBE)
6413 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6414}
6415
c3cdf189
LJ
6416
6417static void alc294_gx502_toggle_output(struct hda_codec *codec,
6418 struct hda_jack_callback *cb)
6419{
6420 /* The Windows driver sets the codec up in a very different way where
6421 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6422 */
6423 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6424 alc_write_coef_idx(codec, 0x10, 0x8a20);
6425 else
6426 alc_write_coef_idx(codec, 0x10, 0x0a20);
6427}
6428
6429static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6430 const struct hda_fixup *fix, int action)
6431{
6432 /* Pin 0x21: headphones/headset mic */
6433 if (!is_jack_detectable(codec, 0x21))
6434 return;
6435
6436 switch (action) {
6437 case HDA_FIXUP_ACT_PRE_PROBE:
6438 snd_hda_jack_detect_enable_callback(codec, 0x21,
6439 alc294_gx502_toggle_output);
6440 break;
6441 case HDA_FIXUP_ACT_INIT:
6442 /* Make sure to start in a correct state, i.e. if
6443 * headphones have been plugged in before powering up the system
6444 */
6445 alc294_gx502_toggle_output(codec, NULL);
6446 break;
6447 }
6448}
6449
c1b55029
DC
6450static void alc294_gu502_toggle_output(struct hda_codec *codec,
6451 struct hda_jack_callback *cb)
6452{
6453 /* Windows sets 0x10 to 0x8420 for Node 0x20 which is
6454 * responsible from changes between speakers and headphones
6455 */
6456 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6457 alc_write_coef_idx(codec, 0x10, 0x8420);
6458 else
6459 alc_write_coef_idx(codec, 0x10, 0x0a20);
6460}
6461
6462static void alc294_fixup_gu502_hp(struct hda_codec *codec,
6463 const struct hda_fixup *fix, int action)
6464{
6465 if (!is_jack_detectable(codec, 0x21))
6466 return;
6467
6468 switch (action) {
6469 case HDA_FIXUP_ACT_PRE_PROBE:
6470 snd_hda_jack_detect_enable_callback(codec, 0x21,
6471 alc294_gu502_toggle_output);
6472 break;
6473 case HDA_FIXUP_ACT_INIT:
6474 alc294_gu502_toggle_output(codec, NULL);
6475 break;
6476 }
6477}
6478
56496253
KY
6479static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6480 const struct hda_fixup *fix, int action)
6481{
6482 if (action != HDA_FIXUP_ACT_INIT)
6483 return;
6484
6485 msleep(100);
6486 alc_write_coef_idx(codec, 0x65, 0x0);
6487}
6488
8a8de09c
KY
6489static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6490 const struct hda_fixup *fix, int action)
6491{
6492 switch (action) {
6493 case HDA_FIXUP_ACT_INIT:
6494 alc_combo_jack_hp_jd_restart(codec);
6495 break;
6496 }
6497}
6498
92666d45
KY
6499static void alc_fixup_no_int_mic(struct hda_codec *codec,
6500 const struct hda_fixup *fix, int action)
6501{
6502 struct alc_spec *spec = codec->spec;
6503
6504 switch (action) {
6505 case HDA_FIXUP_ACT_PRE_PROBE:
6506 /* Mic RING SLEEVE swap for combo jack */
6507 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
6508 spec->no_internal_mic_pin = true;
6509 break;
6510 case HDA_FIXUP_ACT_INIT:
6511 alc_combo_jack_hp_jd_restart(codec);
6512 break;
6513 }
6514}
6515
d94befbb
DB
6516/* GPIO1 = amplifier on/off
6517 * GPIO3 = mic mute LED
6518 */
6519static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec,
6520 const struct hda_fixup *fix, int action)
6521{
6522 static const hda_nid_t conn[] = { 0x02 };
6523
6524 struct alc_spec *spec = codec->spec;
6525 static const struct hda_pintbl pincfgs[] = {
6526 { 0x14, 0x90170110 }, /* front/high speakers */
6527 { 0x17, 0x90170130 }, /* back/bass speakers */
6528 { }
6529 };
6530
6531 //enable micmute led
6532 alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04);
6533
6534 switch (action) {
6535 case HDA_FIXUP_ACT_PRE_PROBE:
6536 spec->micmute_led_polarity = 1;
6537 /* needed for amp of back speakers */
6538 spec->gpio_mask |= 0x01;
6539 spec->gpio_dir |= 0x01;
6540 snd_hda_apply_pincfgs(codec, pincfgs);
6541 /* share DAC to have unified volume control */
6542 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
6543 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6544 break;
6545 case HDA_FIXUP_ACT_INIT:
6546 /* need to toggle GPIO to enable the amp of back speakers */
6547 alc_update_gpio_data(codec, 0x01, true);
6548 msleep(100);
6549 alc_update_gpio_data(codec, 0x01, false);
6550 break;
6551 }
6552}
6553
434591b2
ED
6554static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec,
6555 const struct hda_fixup *fix, int action)
6556{
6557 static const hda_nid_t conn[] = { 0x02 };
6558 static const struct hda_pintbl pincfgs[] = {
6559 { 0x14, 0x90170110 }, /* rear speaker */
6560 { }
6561 };
6562
6563 switch (action) {
6564 case HDA_FIXUP_ACT_PRE_PROBE:
6565 snd_hda_apply_pincfgs(codec, pincfgs);
6566 /* force front speaker to DAC1 */
6567 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6568 break;
6569 }
6570}
6571
b317b032
TI
6572/* for hda_fixup_thinkpad_acpi() */
6573#include "thinkpad_helper.c"
b67ae3f1 6574
d5a6cabf
TI
6575static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
6576 const struct hda_fixup *fix, int action)
6577{
6578 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
6579 hda_fixup_thinkpad_acpi(codec, fix, action);
6580}
6581
ad7cc2d4
CB
6582/* Fixup for Lenovo Legion 15IMHg05 speaker output on headset removal. */
6583static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec,
6584 const struct hda_fixup *fix,
6585 int action)
6586{
6587 struct alc_spec *spec = codec->spec;
6588
6589 switch (action) {
6590 case HDA_FIXUP_ACT_PRE_PROBE:
6591 spec->gen.suppress_auto_mute = 1;
6592 break;
6593 }
6594}
6595
d3dca026
LT
6596static int comp_bind(struct device *dev)
6597{
6598 struct hda_codec *cdc = dev_to_hda_codec(dev);
6599 struct alc_spec *spec = cdc->spec;
6600
6601 return component_bind_all(dev, spec->comps);
6602}
6603
6604static void comp_unbind(struct device *dev)
6605{
6606 struct hda_codec *cdc = dev_to_hda_codec(dev);
6607 struct alc_spec *spec = cdc->spec;
6608
6609 component_unbind_all(dev, spec->comps);
6610}
6611
6612static const struct component_master_ops comp_master_ops = {
6613 .bind = comp_bind,
6614 .unbind = comp_unbind,
6615};
6616
6617static void comp_generic_playback_hook(struct hda_pcm_stream *hinfo, struct hda_codec *cdc,
6618 struct snd_pcm_substream *sub, int action)
6619{
6620 struct alc_spec *spec = cdc->spec;
6621 int i;
6622
6623 for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6624 if (spec->comps[i].dev)
6625 spec->comps[i].playback_hook(spec->comps[i].dev, action);
6626 }
6627}
6628
ae7abe36
SB
6629static void cs35l41_generic_fixup(struct hda_codec *cdc, int action, const char *bus,
6630 const char *hid, int count)
6631{
6632 struct device *dev = hda_codec_dev(cdc);
6633 struct alc_spec *spec = cdc->spec;
6634 char *name;
6635 int ret, i;
6636
6637 switch (action) {
6638 case HDA_FIXUP_ACT_PRE_PROBE:
6639 for (i = 0; i < count; i++) {
6640 name = devm_kasprintf(dev, GFP_KERNEL,
6641 "%s-%s:00-cs35l41-hda.%d", bus, hid, i);
6642 if (!name)
6643 return;
ae016b9d 6644 component_match_add(dev, &spec->match, component_compare_dev_name, name);
ae7abe36
SB
6645 }
6646 ret = component_master_add_with_match(dev, &comp_master_ops, spec->match);
6647 if (ret)
6648 codec_err(cdc, "Fail to register component aggregator %d\n", ret);
6649 else
6650 spec->gen.pcm_playback_hook = comp_generic_playback_hook;
6651 break;
6652 }
6653}
6654
6655static void cs35l41_fixup_i2c_two(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
6656{
6657 cs35l41_generic_fixup(cdc, action, "i2c", "CSC3551", 2);
6658}
6659
07bcab93
LT
6660static void cs35l41_fixup_spi_two(struct hda_codec *codec, const struct hda_fixup *fix, int action)
6661{
6662 cs35l41_generic_fixup(codec, action, "spi0", "CSC3551", 2);
6663}
6664
6665static void cs35l41_fixup_spi_four(struct hda_codec *codec, const struct hda_fixup *fix, int action)
6666{
6667 cs35l41_generic_fixup(codec, action, "spi0", "CSC3551", 4);
6668}
6669
d3dca026
LT
6670static void alc287_fixup_legion_16achg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
6671 int action)
6672{
14e42cee 6673 cs35l41_generic_fixup(cdc, action, "i2c", "CLSA0100", 2);
d3dca026
LT
6674}
6675
bbf8ff6b
TB
6676/* for alc295_fixup_hp_top_speakers */
6677#include "hp_x360_helper.c"
6678
26928ca1
TI
6679/* for alc285_fixup_ideapad_s740_coef() */
6680#include "ideapad_s740_helper.c"
6681
619764cc
WS
6682static const struct coef_fw alc256_fixup_set_coef_defaults_coefs[] = {
6683 WRITE_COEF(0x10, 0x0020), WRITE_COEF(0x24, 0x0000),
6684 WRITE_COEF(0x26, 0x0000), WRITE_COEF(0x29, 0x3000),
6685 WRITE_COEF(0x37, 0xfe05), WRITE_COEF(0x45, 0x5089),
6686 {}
6687};
6688
6689static void alc256_fixup_set_coef_defaults(struct hda_codec *codec,
6690 const struct hda_fixup *fix,
6691 int action)
dd6dd6e3
WS
6692{
6693 /*
619764cc
WS
6694 * A certain other OS sets these coeffs to different values. On at least
6695 * one TongFang barebone these settings might survive even a cold
6696 * reboot. So to restore a clean slate the values are explicitly reset
6697 * to default here. Without this, the external microphone is always in a
6698 * plugged-in state, while the internal microphone is always in an
6699 * unplugged state, breaking the ability to use the internal microphone.
6700 */
6701 alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs);
dd6dd6e3
WS
6702}
6703
174a7fb3
WS
6704static const struct coef_fw alc233_fixup_no_audio_jack_coefs[] = {
6705 WRITE_COEF(0x1a, 0x9003), WRITE_COEF(0x1b, 0x0e2b), WRITE_COEF(0x37, 0xfe06),
6706 WRITE_COEF(0x38, 0x4981), WRITE_COEF(0x45, 0xd489), WRITE_COEF(0x46, 0x0074),
6707 WRITE_COEF(0x49, 0x0149),
6708 {}
6709};
6710
6711static void alc233_fixup_no_audio_jack(struct hda_codec *codec,
6712 const struct hda_fixup *fix,
6713 int action)
6714{
6715 /*
6716 * The audio jack input and output is not detected on the ASRock NUC Box
6717 * 1100 series when cold booting without this fix. Warm rebooting from a
6718 * certain other OS makes the audio functional, as COEF settings are
6719 * preserved in this case. This fix sets these altered COEF values as
6720 * the default.
6721 */
6722 alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs);
6723}
6724
edca7cc4
WS
6725static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec,
6726 const struct hda_fixup *fix,
6727 int action)
6728{
6729 /*
6730 * The Clevo NJ51CU comes either with the ALC293 or the ALC256 codec,
6731 * but uses the 0x8686 subproduct id in both cases. The ALC256 codec
6732 * needs an additional quirk for sound working after suspend and resume.
6733 */
6734 if (codec->core.vendor_id == 0x10ec0256) {
6735 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
6736 snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120);
6737 } else {
6738 snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c);
6739 }
6740}
6741
1efcdd9c
GM
6742static void alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec *codec,
6743 const struct hda_fixup *fix,
6744 int action)
6745{
6746 struct alc_spec *spec = codec->spec;
6747 struct hda_input_mux *imux = &spec->gen.input_mux;
6748 int i;
6749
6750 alc269_fixup_limit_int_mic_boost(codec, fix, action);
6751
6752 switch (action) {
6753 case HDA_FIXUP_ACT_PRE_PROBE:
6754 /**
6755 * Set the vref of pin 0x19 (Headset Mic) and pin 0x1b (Headphone Mic)
6756 * to Hi-Z to avoid pop noises at startup and when plugging and
6757 * unplugging headphones.
6758 */
6759 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6760 snd_hda_codec_set_pin_target(codec, 0x1b, PIN_VREFHIZ);
6761 break;
6762 case HDA_FIXUP_ACT_PROBE:
6763 /**
6764 * Make the internal mic (0x12) the default input source to
6765 * prevent pop noises on cold boot.
6766 */
6767 for (i = 0; i < imux->num_items; i++) {
6768 if (spec->gen.imux_pins[i] == 0x12) {
6769 spec->gen.cur_mux[0] = i;
6770 break;
6771 }
6772 }
6773 break;
6774 }
6775}
6776
1d045db9 6777enum {
f73bbf63 6778 ALC269_FIXUP_GPIO2,
1d045db9
TI
6779 ALC269_FIXUP_SONY_VAIO,
6780 ALC275_FIXUP_SONY_VAIO_GPIO2,
6781 ALC269_FIXUP_DELL_M101Z,
6782 ALC269_FIXUP_SKU_IGNORE,
6783 ALC269_FIXUP_ASUS_G73JW,
6784 ALC269_FIXUP_LENOVO_EAPD,
6785 ALC275_FIXUP_SONY_HWEQ,
e9bd7d5c 6786 ALC275_FIXUP_SONY_DISABLE_AAMIX,
1d045db9 6787 ALC271_FIXUP_DMIC,
017f2a10 6788 ALC269_FIXUP_PCM_44K,
adabb3ec 6789 ALC269_FIXUP_STEREO_DMIC,
7c478f03 6790 ALC269_FIXUP_HEADSET_MIC,
24519911
TI
6791 ALC269_FIXUP_QUANTA_MUTE,
6792 ALC269_FIXUP_LIFEBOOK,
2041d564 6793 ALC269_FIXUP_LIFEBOOK_EXTMIC,
cc7016ab 6794 ALC269_FIXUP_LIFEBOOK_HP_PIN,
4df3fd17 6795 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
fdcc968a 6796 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
a4297b5d
TI
6797 ALC269_FIXUP_AMIC,
6798 ALC269_FIXUP_DMIC,
6799 ALC269VB_FIXUP_AMIC,
6800 ALC269VB_FIXUP_DMIC,
08fb0d0e 6801 ALC269_FIXUP_HP_MUTE_LED,
d06ac143 6802 ALC269_FIXUP_HP_MUTE_LED_MIC1,
08fb0d0e 6803 ALC269_FIXUP_HP_MUTE_LED_MIC2,
7f783bd5 6804 ALC269_FIXUP_HP_MUTE_LED_MIC3,
9f5c6faf 6805 ALC269_FIXUP_HP_GPIO_LED,
9c5dc3bf
KY
6806 ALC269_FIXUP_HP_GPIO_MIC1_LED,
6807 ALC269_FIXUP_HP_LINE1_MIC1_LED,
693b613d 6808 ALC269_FIXUP_INV_DMIC,
108cc108 6809 ALC269_FIXUP_LENOVO_DOCK,
b590b38c 6810 ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
9b745ab8 6811 ALC269_FIXUP_NO_SHUTUP,
88cfcf86 6812 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
108cc108 6813 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
73bdd597
DH
6814 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6815 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
338cae56 6816 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
fcc6c877 6817 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
1efcdd9c 6818 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET,
73bdd597
DH
6819 ALC269_FIXUP_HEADSET_MODE,
6820 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
7819717b 6821 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
d240d1dc
DH
6822 ALC269_FIXUP_ASUS_X101_FUNC,
6823 ALC269_FIXUP_ASUS_X101_VERB,
6824 ALC269_FIXUP_ASUS_X101,
08a978db
DR
6825 ALC271_FIXUP_AMIC_MIC2,
6826 ALC271_FIXUP_HP_GATE_MIC_JACK,
b1e8972e 6827 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
42397004 6828 ALC269_FIXUP_ACER_AC700,
3e0d611b 6829 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
2cede303 6830 ALC269VB_FIXUP_ASUS_ZENBOOK,
23870831 6831 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
8e35cd4a 6832 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
02b504d9 6833 ALC269VB_FIXUP_ORDISSIMO_EVE2,
cd217a63 6834 ALC283_FIXUP_CHROME_BOOK,
0202e99c 6835 ALC283_FIXUP_SENSE_COMBO_JACK,
7bba2157 6836 ALC282_FIXUP_ASUS_TX300,
1bb3e062 6837 ALC283_FIXUP_INT_MIC,
338cae56 6838 ALC290_FIXUP_MONO_SPEAKERS,
0f4881dc
DH
6839 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6840 ALC290_FIXUP_SUBWOOFER,
6841 ALC290_FIXUP_SUBWOOFER_HSJACK,
b67ae3f1 6842 ALC269_FIXUP_THINKPAD_ACPI,
56f27013 6843 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
5824ce8d 6844 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
615966ad 6845 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9a22a8f5 6846 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
31278997 6847 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
9a22a8f5 6848 ALC255_FIXUP_HEADSET_MODE,
31278997 6849 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
a22aa26f 6850 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
1c37c223 6851 ALC292_FIXUP_TPT440_DOCK,
9a811230 6852 ALC292_FIXUP_TPT440,
abaa2274 6853 ALC283_FIXUP_HEADSET_MIC,
b3802783 6854 ALC255_FIXUP_MIC_MUTE_LED,
1a22e775 6855 ALC282_FIXUP_ASPIRE_V5_PINS,
c8426b27 6856 ALC269VB_FIXUP_ASPIRE_E1_COEF,
7a5255f1 6857 ALC280_FIXUP_HP_GPIO4,
eaa8e5ef 6858 ALC286_FIXUP_HP_GPIO_LED,
33f4acd3 6859 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
b4b33f9d 6860 ALC280_FIXUP_HP_DOCK_PINS,
04d5466a 6861 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
98973f2f 6862 ALC280_FIXUP_HP_9480M,
c3bb2b52 6863 ALC245_FIXUP_HP_X360_AMP,
d94befbb 6864 ALC285_FIXUP_HP_SPECTRE_X360_EB1,
e1e62b98
KY
6865 ALC288_FIXUP_DELL_HEADSET_MODE,
6866 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
831bfdf9
HW
6867 ALC288_FIXUP_DELL_XPS_13,
6868 ALC288_FIXUP_DISABLE_AAMIX,
5fab5829 6869 ALC292_FIXUP_DELL_E7X_AAMIX,
8b99aba7
TI
6870 ALC292_FIXUP_DELL_E7X,
6871 ALC292_FIXUP_DISABLE_AAMIX,
c04017ea 6872 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
54324221 6873 ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
977e6276 6874 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
2f726aec 6875 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
6ed1131f 6876 ALC275_FIXUP_DELL_XPS,
23adc192 6877 ALC293_FIXUP_LENOVO_SPK_NOISE,
3694cb29 6878 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
3b43b71f 6879 ALC255_FIXUP_DELL_SPK_NOISE,
d1dd4211 6880 ALC225_FIXUP_DISABLE_MIC_VREF,
2ae95577 6881 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
e312a869 6882 ALC295_FIXUP_DISABLE_DAC3,
d2cd795c 6883 ALC285_FIXUP_SPEAKER2_TO_DAC1,
f883982d 6884 ALC280_FIXUP_HP_HEADSET_MIC,
e549d190 6885 ALC221_FIXUP_HP_FRONT_MIC,
c636b95e 6886 ALC292_FIXUP_TPT460,
dd9aa335 6887 ALC298_FIXUP_SPK_VOLUME,
f86de9b1 6888 ALC298_FIXUP_LENOVO_SPK_VOLUME,
fd06c77e 6889 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
823ff161 6890 ALC269_FIXUP_ATIV_BOOK_8,
9eb5d0e6 6891 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
c1732ede
CC
6892 ALC256_FIXUP_ASUS_HEADSET_MODE,
6893 ALC256_FIXUP_ASUS_MIC,
eeed4cd1 6894 ALC256_FIXUP_ASUS_AIO_GPIO2,
216d7aeb
CC
6895 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
6896 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
ca169cc2 6897 ALC233_FIXUP_LENOVO_MULTI_CODECS,
ea5c7eba 6898 ALC233_FIXUP_ACER_HEADSET_MIC,
f33f79f3 6899 ALC294_FIXUP_LENOVO_MIC_LOCATION,
5f364135 6900 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
52e4e368 6901 ALC225_FIXUP_S3_POP_NOISE,
b84e8436 6902 ALC700_FIXUP_INTEL_REFERENCE,
92266651
KY
6903 ALC274_FIXUP_DELL_BIND_DACS,
6904 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
399c01aa 6905 ALC298_FIXUP_TPT470_DOCK_FIX,
61fcf8ec 6906 ALC298_FIXUP_TPT470_DOCK,
ae104a21 6907 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
f0ba9d69 6908 ALC255_FIXUP_DELL_HEADSET_MIC,
0fbf21c3 6909 ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
a2ef03fe 6910 ALC298_FIXUP_HUAWEI_MBX_STEREO,
bbf8ff6b 6911 ALC295_FIXUP_HP_X360,
8a328ac1 6912 ALC221_FIXUP_HP_HEADSET_MIC,
c4cfcf6f 6913 ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
e8ed64b0 6914 ALC295_FIXUP_HP_AUTO_MUTE,
33aaebd4 6915 ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
d8ae458e 6916 ALC294_FIXUP_ASUS_MIC,
4e051106
JHP
6917 ALC294_FIXUP_ASUS_HEADSET_MIC,
6918 ALC294_FIXUP_ASUS_SPK,
89e3a568 6919 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
c8c6ee61 6920 ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
cbc05fd6 6921 ALC255_FIXUP_ACER_HEADSET_MIC,
10f5b1b8 6922 ALC295_FIXUP_CHROME_BOOK,
8983eb60 6923 ALC225_FIXUP_HEADSET_JACK,
136824ef
KY
6924 ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
6925 ALC225_FIXUP_WYSE_AUTO_MUTE,
6926 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
667a8f73 6927 ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
8c8967a7 6928 ALC256_FIXUP_ASUS_HEADSET_MIC,
e1037354 6929 ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
e2a829b3 6930 ALC299_FIXUP_PREDATOR_SPK,
bd9c10bc 6931 ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
e79c2269
KY
6932 ALC289_FIXUP_DELL_SPK2,
6933 ALC289_FIXUP_DUAL_SPK,
48e01504
CC
6934 ALC294_FIXUP_SPK2_TO_DAC1,
6935 ALC294_FIXUP_ASUS_DUAL_SPK,
6a6660d0 6936 ALC285_FIXUP_THINKPAD_X1_GEN7,
76f7dec0 6937 ALC285_FIXUP_THINKPAD_HEADSET_JACK,
8b33a134 6938 ALC294_FIXUP_ASUS_HPE,
1b94e59d 6939 ALC294_FIXUP_ASUS_COEF_1B,
c3cdf189
LJ
6940 ALC294_FIXUP_ASUS_GX502_HP,
6941 ALC294_FIXUP_ASUS_GX502_PINS,
6942 ALC294_FIXUP_ASUS_GX502_VERBS,
c1b55029
DC
6943 ALC294_FIXUP_ASUS_GU502_HP,
6944 ALC294_FIXUP_ASUS_GU502_PINS,
6945 ALC294_FIXUP_ASUS_GU502_VERBS,
f5a88b0a 6946 ALC285_FIXUP_HP_GPIO_LED,
431e76c3 6947 ALC285_FIXUP_HP_MUTE_LED,
e7d66cf7 6948 ALC236_FIXUP_HP_GPIO_LED,
24164f43 6949 ALC236_FIXUP_HP_MUTE_LED,
75b62ab6 6950 ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
14425f1f 6951 ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
ef248d9b 6952 ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
9e43342b 6953 ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
8eae7e9b 6954 ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
6e15d126 6955 ALC269VC_FIXUP_ACER_HEADSET_MIC,
781c90c0 6956 ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
293a92c1 6957 ALC289_FIXUP_ASUS_GA401,
4b43d05a 6958 ALC289_FIXUP_ASUS_GA502,
f50a121d 6959 ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
56496253 6960 ALC285_FIXUP_HP_GPIO_AMP_INIT,
f1ec5be1
HC
6961 ALC269_FIXUP_CZC_B20,
6962 ALC269_FIXUP_CZC_TMI,
6963 ALC269_FIXUP_CZC_L101,
6964 ALC269_FIXUP_LEMOTE_A1802,
6965 ALC269_FIXUP_LEMOTE_A190X,
e2d2fded 6966 ALC256_FIXUP_INTEL_NUC8_RUGGED,
d1ee66c5
PC
6967 ALC233_FIXUP_INTEL_NUC8_DMIC,
6968 ALC233_FIXUP_INTEL_NUC8_BOOST,
73e7161e 6969 ALC256_FIXUP_INTEL_NUC10,
fc19d559 6970 ALC255_FIXUP_XIAOMI_HEADSET_MIC,
13468bfa 6971 ALC274_FIXUP_HP_MIC,
8a8de09c 6972 ALC274_FIXUP_HP_HEADSET_MIC,
622464c8 6973 ALC274_FIXUP_HP_ENVY_GPIO,
ef9ce66f 6974 ALC256_FIXUP_ASUS_HPE,
446b8185 6975 ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
a0ccbc53 6976 ALC287_FIXUP_HP_GPIO_LED,
9e885770 6977 ALC256_FIXUP_HP_HEADSET_MIC,
5fc462c3 6978 ALC245_FIXUP_HP_GPIO_LED,
92666d45 6979 ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
34cdf405 6980 ALC282_FIXUP_ACER_DISABLE_LINEOUT,
495dc763 6981 ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST,
d0e18561 6982 ALC256_FIXUP_ACER_HEADSET_MIC,
26928ca1 6983 ALC285_FIXUP_IDEAPAD_S740_COEF,
bd15b155 6984 ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST,
8eedd3a7 6985 ALC295_FIXUP_ASUS_DACS,
5d84b531 6986 ALC295_FIXUP_HP_OMEN,
f2be77fe 6987 ALC285_FIXUP_HP_SPECTRE_X360,
9ebaef05 6988 ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP,
29c8f40b 6989 ALC623_FIXUP_LENOVO_THINKSTATION_P340,
57c9e21a 6990 ALC255_FIXUP_ACER_HEADPHONE_AND_MIC,
8903376d 6991 ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST,
ad7cc2d4
CB
6992 ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS,
6993 ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
6994 ALC287_FIXUP_YOGA7_14ITL_SPEAKERS,
dd6dd6e3 6995 ALC287_FIXUP_13S_GEN2_SPEAKERS,
619764cc 6996 ALC256_FIXUP_SET_COEF_DEFAULTS,
1278cc5a 6997 ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
174a7fb3 6998 ALC233_FIXUP_NO_AUDIO_JACK,
edca7cc4 6999 ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME,
8f4c9042
BF
7000 ALC285_FIXUP_LEGION_Y9000X_SPEAKERS,
7001 ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
d3dca026 7002 ALC287_FIXUP_LEGION_16ACHG6,
ae7abe36 7003 ALC287_FIXUP_CS35L41_I2C_2,
b3fbe536 7004 ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED,
07bcab93 7005 ALC245_FIXUP_CS35L41_SPI_2,
ce18f905 7006 ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED,
07bcab93
LT
7007 ALC245_FIXUP_CS35L41_SPI_4,
7008 ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED,
91502a9a 7009 ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED,
309d7363 7010 ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE,
f1d4e28b
KY
7011};
7012
1727a771 7013static const struct hda_fixup alc269_fixups[] = {
f73bbf63
KHF
7014 [ALC269_FIXUP_GPIO2] = {
7015 .type = HDA_FIXUP_FUNC,
7016 .v.func = alc_fixup_gpio2,
7017 },
1d045db9 7018 [ALC269_FIXUP_SONY_VAIO] = {
fd108215
TI
7019 .type = HDA_FIXUP_PINCTLS,
7020 .v.pins = (const struct hda_pintbl[]) {
7021 {0x19, PIN_VREFGRD},
1d045db9
TI
7022 {}
7023 }
f1d4e28b 7024 },
1d045db9 7025 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
ae065f1c
TI
7026 .type = HDA_FIXUP_FUNC,
7027 .v.func = alc275_fixup_gpio4_off,
1d045db9
TI
7028 .chained = true,
7029 .chain_id = ALC269_FIXUP_SONY_VAIO
7030 },
7031 [ALC269_FIXUP_DELL_M101Z] = {
1727a771 7032 .type = HDA_FIXUP_VERBS,
1d045db9
TI
7033 .v.verbs = (const struct hda_verb[]) {
7034 /* Enables internal speaker */
7035 {0x20, AC_VERB_SET_COEF_INDEX, 13},
7036 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
7037 {}
7038 }
7039 },
7040 [ALC269_FIXUP_SKU_IGNORE] = {
1727a771 7041 .type = HDA_FIXUP_FUNC,
23d30f28 7042 .v.func = alc_fixup_sku_ignore,
1d045db9
TI
7043 },
7044 [ALC269_FIXUP_ASUS_G73JW] = {
1727a771
TI
7045 .type = HDA_FIXUP_PINS,
7046 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
7047 { 0x17, 0x99130111 }, /* subwoofer */
7048 { }
7049 }
7050 },
7051 [ALC269_FIXUP_LENOVO_EAPD] = {
1727a771 7052 .type = HDA_FIXUP_VERBS,
1d045db9
TI
7053 .v.verbs = (const struct hda_verb[]) {
7054 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
7055 {}
7056 }
7057 },
7058 [ALC275_FIXUP_SONY_HWEQ] = {
1727a771 7059 .type = HDA_FIXUP_FUNC,
1d045db9
TI
7060 .v.func = alc269_fixup_hweq,
7061 .chained = true,
7062 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
7063 },
e9bd7d5c
TI
7064 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
7065 .type = HDA_FIXUP_FUNC,
7066 .v.func = alc_fixup_disable_aamix,
7067 .chained = true,
7068 .chain_id = ALC269_FIXUP_SONY_VAIO
7069 },
1d045db9 7070 [ALC271_FIXUP_DMIC] = {
1727a771 7071 .type = HDA_FIXUP_FUNC,
1d045db9 7072 .v.func = alc271_fixup_dmic,
f1d4e28b 7073 },
017f2a10 7074 [ALC269_FIXUP_PCM_44K] = {
1727a771 7075 .type = HDA_FIXUP_FUNC,
017f2a10 7076 .v.func = alc269_fixup_pcm_44k,
012e7eb1
DH
7077 .chained = true,
7078 .chain_id = ALC269_FIXUP_QUANTA_MUTE
017f2a10 7079 },
adabb3ec 7080 [ALC269_FIXUP_STEREO_DMIC] = {
1727a771 7081 .type = HDA_FIXUP_FUNC,
adabb3ec
TI
7082 .v.func = alc269_fixup_stereo_dmic,
7083 },
7c478f03
DH
7084 [ALC269_FIXUP_HEADSET_MIC] = {
7085 .type = HDA_FIXUP_FUNC,
7086 .v.func = alc269_fixup_headset_mic,
7087 },
24519911 7088 [ALC269_FIXUP_QUANTA_MUTE] = {
1727a771 7089 .type = HDA_FIXUP_FUNC,
24519911
TI
7090 .v.func = alc269_fixup_quanta_mute,
7091 },
7092 [ALC269_FIXUP_LIFEBOOK] = {
1727a771
TI
7093 .type = HDA_FIXUP_PINS,
7094 .v.pins = (const struct hda_pintbl[]) {
24519911
TI
7095 { 0x1a, 0x2101103f }, /* dock line-out */
7096 { 0x1b, 0x23a11040 }, /* dock mic-in */
7097 { }
7098 },
7099 .chained = true,
7100 .chain_id = ALC269_FIXUP_QUANTA_MUTE
7101 },
2041d564
DH
7102 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
7103 .type = HDA_FIXUP_PINS,
7104 .v.pins = (const struct hda_pintbl[]) {
7105 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
7106 { }
7107 },
7108 },
cc7016ab
TI
7109 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
7110 .type = HDA_FIXUP_PINS,
7111 .v.pins = (const struct hda_pintbl[]) {
7112 { 0x21, 0x0221102f }, /* HP out */
7113 { }
7114 },
7115 },
4df3fd17
TI
7116 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
7117 .type = HDA_FIXUP_FUNC,
7118 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
7119 },
fdcc968a
JMG
7120 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
7121 .type = HDA_FIXUP_FUNC,
7122 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
7123 },
a4297b5d 7124 [ALC269_FIXUP_AMIC] = {
1727a771
TI
7125 .type = HDA_FIXUP_PINS,
7126 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
7127 { 0x14, 0x99130110 }, /* speaker */
7128 { 0x15, 0x0121401f }, /* HP out */
7129 { 0x18, 0x01a19c20 }, /* mic */
7130 { 0x19, 0x99a3092f }, /* int-mic */
7131 { }
7132 },
7133 },
7134 [ALC269_FIXUP_DMIC] = {
1727a771
TI
7135 .type = HDA_FIXUP_PINS,
7136 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
7137 { 0x12, 0x99a3092f }, /* int-mic */
7138 { 0x14, 0x99130110 }, /* speaker */
7139 { 0x15, 0x0121401f }, /* HP out */
7140 { 0x18, 0x01a19c20 }, /* mic */
7141 { }
7142 },
7143 },
7144 [ALC269VB_FIXUP_AMIC] = {
1727a771
TI
7145 .type = HDA_FIXUP_PINS,
7146 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
7147 { 0x14, 0x99130110 }, /* speaker */
7148 { 0x18, 0x01a19c20 }, /* mic */
7149 { 0x19, 0x99a3092f }, /* int-mic */
7150 { 0x21, 0x0121401f }, /* HP out */
7151 { }
7152 },
7153 },
2267ea97 7154 [ALC269VB_FIXUP_DMIC] = {
1727a771
TI
7155 .type = HDA_FIXUP_PINS,
7156 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
7157 { 0x12, 0x99a3092f }, /* int-mic */
7158 { 0x14, 0x99130110 }, /* speaker */
7159 { 0x18, 0x01a19c20 }, /* mic */
7160 { 0x21, 0x0121401f }, /* HP out */
7161 { }
7162 },
7163 },
08fb0d0e 7164 [ALC269_FIXUP_HP_MUTE_LED] = {
1727a771 7165 .type = HDA_FIXUP_FUNC,
08fb0d0e 7166 .v.func = alc269_fixup_hp_mute_led,
6d3cd5d4 7167 },
d06ac143
DH
7168 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
7169 .type = HDA_FIXUP_FUNC,
7170 .v.func = alc269_fixup_hp_mute_led_mic1,
7171 },
08fb0d0e 7172 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
1727a771 7173 .type = HDA_FIXUP_FUNC,
08fb0d0e 7174 .v.func = alc269_fixup_hp_mute_led_mic2,
420b0feb 7175 },
7f783bd5
TB
7176 [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
7177 .type = HDA_FIXUP_FUNC,
7178 .v.func = alc269_fixup_hp_mute_led_mic3,
e8ed64b0
GKK
7179 .chained = true,
7180 .chain_id = ALC295_FIXUP_HP_AUTO_MUTE
7f783bd5 7181 },
9f5c6faf
TI
7182 [ALC269_FIXUP_HP_GPIO_LED] = {
7183 .type = HDA_FIXUP_FUNC,
7184 .v.func = alc269_fixup_hp_gpio_led,
7185 },
9c5dc3bf
KY
7186 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
7187 .type = HDA_FIXUP_FUNC,
7188 .v.func = alc269_fixup_hp_gpio_mic1_led,
7189 },
7190 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
7191 .type = HDA_FIXUP_FUNC,
7192 .v.func = alc269_fixup_hp_line1_mic1_led,
7193 },
693b613d 7194 [ALC269_FIXUP_INV_DMIC] = {
1727a771 7195 .type = HDA_FIXUP_FUNC,
9d36a7dc 7196 .v.func = alc_fixup_inv_dmic,
693b613d 7197 },
9b745ab8
TI
7198 [ALC269_FIXUP_NO_SHUTUP] = {
7199 .type = HDA_FIXUP_FUNC,
7200 .v.func = alc_fixup_no_shutup,
7201 },
108cc108 7202 [ALC269_FIXUP_LENOVO_DOCK] = {
1727a771
TI
7203 .type = HDA_FIXUP_PINS,
7204 .v.pins = (const struct hda_pintbl[]) {
108cc108
DH
7205 { 0x19, 0x23a11040 }, /* dock mic */
7206 { 0x1b, 0x2121103f }, /* dock headphone */
7207 { }
7208 },
7209 .chained = true,
7210 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
7211 },
b590b38c
TI
7212 [ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
7213 .type = HDA_FIXUP_FUNC,
7214 .v.func = alc269_fixup_limit_int_mic_boost,
7215 .chained = true,
7216 .chain_id = ALC269_FIXUP_LENOVO_DOCK,
7217 },
108cc108 7218 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
1727a771 7219 .type = HDA_FIXUP_FUNC,
108cc108 7220 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
52129000
DH
7221 .chained = true,
7222 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
108cc108 7223 },
73bdd597
DH
7224 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7225 .type = HDA_FIXUP_PINS,
7226 .v.pins = (const struct hda_pintbl[]) {
7227 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7228 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7229 { }
7230 },
7231 .chained = true,
7232 .chain_id = ALC269_FIXUP_HEADSET_MODE
7233 },
7234 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7235 .type = HDA_FIXUP_PINS,
7236 .v.pins = (const struct hda_pintbl[]) {
7237 { 0x16, 0x21014020 }, /* dock line out */
7238 { 0x19, 0x21a19030 }, /* dock mic */
7239 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7240 { }
7241 },
7242 .chained = true,
7243 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7244 },
338cae56
DH
7245 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
7246 .type = HDA_FIXUP_PINS,
7247 .v.pins = (const struct hda_pintbl[]) {
7248 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7249 { }
7250 },
7251 .chained = true,
7252 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7253 },
fcc6c877
KY
7254 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
7255 .type = HDA_FIXUP_PINS,
7256 .v.pins = (const struct hda_pintbl[]) {
7257 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7258 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7259 { }
7260 },
7261 .chained = true,
7262 .chain_id = ALC269_FIXUP_HEADSET_MODE
7263 },
73bdd597
DH
7264 [ALC269_FIXUP_HEADSET_MODE] = {
7265 .type = HDA_FIXUP_FUNC,
7266 .v.func = alc_fixup_headset_mode,
6676f308 7267 .chained = true,
b3802783 7268 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
73bdd597
DH
7269 },
7270 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7271 .type = HDA_FIXUP_FUNC,
7272 .v.func = alc_fixup_headset_mode_no_hp_mic,
7273 },
7819717b
TI
7274 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
7275 .type = HDA_FIXUP_PINS,
7276 .v.pins = (const struct hda_pintbl[]) {
7277 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
7278 { }
7279 },
7280 .chained = true,
7281 .chain_id = ALC269_FIXUP_HEADSET_MODE,
7282 },
88cfcf86
DH
7283 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
7284 .type = HDA_FIXUP_PINS,
7285 .v.pins = (const struct hda_pintbl[]) {
7286 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7287 { }
7288 },
fbc78ad6
DH
7289 .chained = true,
7290 .chain_id = ALC269_FIXUP_HEADSET_MIC
88cfcf86 7291 },
0fbf21c3 7292 [ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
8ac51bbc
AB
7293 .type = HDA_FIXUP_PINS,
7294 .v.pins = (const struct hda_pintbl[]) {
7295 {0x12, 0x90a60130},
7296 {0x13, 0x40000000},
7297 {0x14, 0x90170110},
7298 {0x18, 0x411111f0},
7299 {0x19, 0x04a11040},
7300 {0x1a, 0x411111f0},
7301 {0x1b, 0x90170112},
7302 {0x1d, 0x40759a05},
7303 {0x1e, 0x411111f0},
7304 {0x21, 0x04211020},
7305 { }
7306 },
e2744fd7
AB
7307 .chained = true,
7308 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
8ac51bbc 7309 },
a2ef03fe
TE
7310 [ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
7311 .type = HDA_FIXUP_FUNC,
7312 .v.func = alc298_fixup_huawei_mbx_stereo,
7313 .chained = true,
7314 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
7315 },
d240d1dc
DH
7316 [ALC269_FIXUP_ASUS_X101_FUNC] = {
7317 .type = HDA_FIXUP_FUNC,
7318 .v.func = alc269_fixup_x101_headset_mic,
7319 },
7320 [ALC269_FIXUP_ASUS_X101_VERB] = {
7321 .type = HDA_FIXUP_VERBS,
7322 .v.verbs = (const struct hda_verb[]) {
7323 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
7324 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
7325 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
7326 { }
7327 },
7328 .chained = true,
7329 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
7330 },
7331 [ALC269_FIXUP_ASUS_X101] = {
7332 .type = HDA_FIXUP_PINS,
7333 .v.pins = (const struct hda_pintbl[]) {
7334 { 0x18, 0x04a1182c }, /* Headset mic */
7335 { }
7336 },
7337 .chained = true,
7338 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
7339 },
08a978db 7340 [ALC271_FIXUP_AMIC_MIC2] = {
1727a771
TI
7341 .type = HDA_FIXUP_PINS,
7342 .v.pins = (const struct hda_pintbl[]) {
08a978db
DR
7343 { 0x14, 0x99130110 }, /* speaker */
7344 { 0x19, 0x01a19c20 }, /* mic */
7345 { 0x1b, 0x99a7012f }, /* int-mic */
7346 { 0x21, 0x0121401f }, /* HP out */
7347 { }
7348 },
7349 },
7350 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
1727a771 7351 .type = HDA_FIXUP_FUNC,
08a978db
DR
7352 .v.func = alc271_hp_gate_mic_jack,
7353 .chained = true,
7354 .chain_id = ALC271_FIXUP_AMIC_MIC2,
7355 },
b1e8972e
OR
7356 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
7357 .type = HDA_FIXUP_FUNC,
7358 .v.func = alc269_fixup_limit_int_mic_boost,
7359 .chained = true,
7360 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
7361 },
42397004
DR
7362 [ALC269_FIXUP_ACER_AC700] = {
7363 .type = HDA_FIXUP_PINS,
7364 .v.pins = (const struct hda_pintbl[]) {
7365 { 0x12, 0x99a3092f }, /* int-mic */
7366 { 0x14, 0x99130110 }, /* speaker */
7367 { 0x18, 0x03a11c20 }, /* mic */
7368 { 0x1e, 0x0346101e }, /* SPDIF1 */
7369 { 0x21, 0x0321101f }, /* HP out */
7370 { }
7371 },
7372 .chained = true,
7373 .chain_id = ALC271_FIXUP_DMIC,
7374 },
3e0d611b
DH
7375 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
7376 .type = HDA_FIXUP_FUNC,
7377 .v.func = alc269_fixup_limit_int_mic_boost,
2793769f
DH
7378 .chained = true,
7379 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
3e0d611b 7380 },
2cede303
OR
7381 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
7382 .type = HDA_FIXUP_FUNC,
7383 .v.func = alc269_fixup_limit_int_mic_boost,
7384 .chained = true,
7385 .chain_id = ALC269VB_FIXUP_DMIC,
7386 },
23870831
TI
7387 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
7388 .type = HDA_FIXUP_VERBS,
7389 .v.verbs = (const struct hda_verb[]) {
7390 /* class-D output amp +5dB */
7391 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
7392 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
7393 {}
7394 },
7395 .chained = true,
7396 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
7397 },
8e35cd4a
DH
7398 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
7399 .type = HDA_FIXUP_FUNC,
7400 .v.func = alc269_fixup_limit_int_mic_boost,
7401 .chained = true,
7402 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
7403 },
02b504d9
AA
7404 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
7405 .type = HDA_FIXUP_PINS,
7406 .v.pins = (const struct hda_pintbl[]) {
7407 { 0x12, 0x99a3092f }, /* int-mic */
7408 { 0x18, 0x03a11d20 }, /* mic */
7409 { 0x19, 0x411111f0 }, /* Unused bogus pin */
7410 { }
7411 },
7412 },
cd217a63
KY
7413 [ALC283_FIXUP_CHROME_BOOK] = {
7414 .type = HDA_FIXUP_FUNC,
7415 .v.func = alc283_fixup_chromebook,
7416 },
0202e99c
KY
7417 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
7418 .type = HDA_FIXUP_FUNC,
7419 .v.func = alc283_fixup_sense_combo_jack,
7420 .chained = true,
7421 .chain_id = ALC283_FIXUP_CHROME_BOOK,
7422 },
7bba2157
TI
7423 [ALC282_FIXUP_ASUS_TX300] = {
7424 .type = HDA_FIXUP_FUNC,
7425 .v.func = alc282_fixup_asus_tx300,
7426 },
1bb3e062
KY
7427 [ALC283_FIXUP_INT_MIC] = {
7428 .type = HDA_FIXUP_VERBS,
7429 .v.verbs = (const struct hda_verb[]) {
7430 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
7431 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
7432 { }
7433 },
7434 .chained = true,
7435 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7436 },
0f4881dc
DH
7437 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
7438 .type = HDA_FIXUP_PINS,
7439 .v.pins = (const struct hda_pintbl[]) {
7440 { 0x17, 0x90170112 }, /* subwoofer */
7441 { }
7442 },
7443 .chained = true,
7444 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7445 },
7446 [ALC290_FIXUP_SUBWOOFER] = {
7447 .type = HDA_FIXUP_PINS,
7448 .v.pins = (const struct hda_pintbl[]) {
7449 { 0x17, 0x90170112 }, /* subwoofer */
7450 { }
7451 },
7452 .chained = true,
7453 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
7454 },
338cae56
DH
7455 [ALC290_FIXUP_MONO_SPEAKERS] = {
7456 .type = HDA_FIXUP_FUNC,
7457 .v.func = alc290_fixup_mono_speakers,
0f4881dc
DH
7458 },
7459 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
7460 .type = HDA_FIXUP_FUNC,
7461 .v.func = alc290_fixup_mono_speakers,
338cae56
DH
7462 .chained = true,
7463 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
7464 },
b67ae3f1
DH
7465 [ALC269_FIXUP_THINKPAD_ACPI] = {
7466 .type = HDA_FIXUP_FUNC,
d5a6cabf 7467 .v.func = alc_fixup_thinkpad_acpi,
09da111a
TI
7468 .chained = true,
7469 .chain_id = ALC269_FIXUP_SKU_IGNORE,
b67ae3f1 7470 },
56f27013
DH
7471 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
7472 .type = HDA_FIXUP_FUNC,
7473 .v.func = alc_fixup_inv_dmic,
7474 .chained = true,
7475 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7476 },
5824ce8d 7477 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
17d30460
HW
7478 .type = HDA_FIXUP_PINS,
7479 .v.pins = (const struct hda_pintbl[]) {
7480 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7481 { }
5824ce8d
CC
7482 },
7483 .chained = true,
17d30460 7484 .chain_id = ALC255_FIXUP_HEADSET_MODE
5824ce8d 7485 },
615966ad
CC
7486 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7487 .type = HDA_FIXUP_PINS,
7488 .v.pins = (const struct hda_pintbl[]) {
7489 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7490 { }
7491 },
7492 .chained = true,
7493 .chain_id = ALC255_FIXUP_HEADSET_MODE
7494 },
9a22a8f5
KY
7495 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7496 .type = HDA_FIXUP_PINS,
7497 .v.pins = (const struct hda_pintbl[]) {
7498 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7499 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7500 { }
7501 },
7502 .chained = true,
7503 .chain_id = ALC255_FIXUP_HEADSET_MODE
7504 },
31278997
KY
7505 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7506 .type = HDA_FIXUP_PINS,
7507 .v.pins = (const struct hda_pintbl[]) {
7508 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7509 { }
7510 },
7511 .chained = true,
7512 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
7513 },
9a22a8f5
KY
7514 [ALC255_FIXUP_HEADSET_MODE] = {
7515 .type = HDA_FIXUP_FUNC,
7516 .v.func = alc_fixup_headset_mode_alc255,
4a83d42a 7517 .chained = true,
b3802783 7518 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
9a22a8f5 7519 },
31278997
KY
7520 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7521 .type = HDA_FIXUP_FUNC,
7522 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
7523 },
a22aa26f
KY
7524 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7525 .type = HDA_FIXUP_PINS,
7526 .v.pins = (const struct hda_pintbl[]) {
7527 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7528 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7529 { }
7530 },
7531 .chained = true,
7532 .chain_id = ALC269_FIXUP_HEADSET_MODE
7533 },
1c37c223 7534 [ALC292_FIXUP_TPT440_DOCK] = {
ec56af67 7535 .type = HDA_FIXUP_FUNC,
7f57d803 7536 .v.func = alc_fixup_tpt440_dock,
1c37c223
TI
7537 .chained = true,
7538 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7539 },
9a811230
TI
7540 [ALC292_FIXUP_TPT440] = {
7541 .type = HDA_FIXUP_FUNC,
157f0b7f 7542 .v.func = alc_fixup_disable_aamix,
9a811230
TI
7543 .chained = true,
7544 .chain_id = ALC292_FIXUP_TPT440_DOCK,
7545 },
abaa2274 7546 [ALC283_FIXUP_HEADSET_MIC] = {
9dc12862
DD
7547 .type = HDA_FIXUP_PINS,
7548 .v.pins = (const struct hda_pintbl[]) {
7549 { 0x19, 0x04a110f0 },
7550 { },
7551 },
7552 },
b3802783 7553 [ALC255_FIXUP_MIC_MUTE_LED] = {
00ef9940 7554 .type = HDA_FIXUP_FUNC,
8a503555 7555 .v.func = alc_fixup_micmute_led,
00ef9940 7556 },
1a22e775
TI
7557 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
7558 .type = HDA_FIXUP_PINS,
7559 .v.pins = (const struct hda_pintbl[]) {
7560 { 0x12, 0x90a60130 },
7561 { 0x14, 0x90170110 },
7562 { 0x17, 0x40000008 },
7563 { 0x18, 0x411111f0 },
0420694d 7564 { 0x19, 0x01a1913c },
1a22e775
TI
7565 { 0x1a, 0x411111f0 },
7566 { 0x1b, 0x411111f0 },
7567 { 0x1d, 0x40f89b2d },
7568 { 0x1e, 0x411111f0 },
7569 { 0x21, 0x0321101f },
7570 { },
7571 },
7572 },
c8426b27
TI
7573 [ALC269VB_FIXUP_ASPIRE_E1_COEF] = {
7574 .type = HDA_FIXUP_FUNC,
7575 .v.func = alc269vb_fixup_aspire_e1_coef,
7576 },
7a5255f1
DH
7577 [ALC280_FIXUP_HP_GPIO4] = {
7578 .type = HDA_FIXUP_FUNC,
7579 .v.func = alc280_fixup_hp_gpio4,
7580 },
eaa8e5ef
KY
7581 [ALC286_FIXUP_HP_GPIO_LED] = {
7582 .type = HDA_FIXUP_FUNC,
7583 .v.func = alc286_fixup_hp_gpio_led,
7584 },
33f4acd3
DH
7585 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
7586 .type = HDA_FIXUP_FUNC,
7587 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
7588 },
b4b33f9d
TC
7589 [ALC280_FIXUP_HP_DOCK_PINS] = {
7590 .type = HDA_FIXUP_PINS,
7591 .v.pins = (const struct hda_pintbl[]) {
7592 { 0x1b, 0x21011020 }, /* line-out */
7593 { 0x1a, 0x01a1903c }, /* headset mic */
7594 { 0x18, 0x2181103f }, /* line-in */
7595 { },
7596 },
7597 .chained = true,
7598 .chain_id = ALC280_FIXUP_HP_GPIO4
7599 },
04d5466a
JK
7600 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
7601 .type = HDA_FIXUP_PINS,
7602 .v.pins = (const struct hda_pintbl[]) {
7603 { 0x1b, 0x21011020 }, /* line-out */
7604 { 0x18, 0x2181103f }, /* line-in */
7605 { },
7606 },
7607 .chained = true,
7608 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
7609 },
98973f2f
KP
7610 [ALC280_FIXUP_HP_9480M] = {
7611 .type = HDA_FIXUP_FUNC,
7612 .v.func = alc280_fixup_hp_9480m,
7613 },
c3bb2b52
TI
7614 [ALC245_FIXUP_HP_X360_AMP] = {
7615 .type = HDA_FIXUP_FUNC,
7616 .v.func = alc245_fixup_hp_x360_amp,
5fc462c3
JC
7617 .chained = true,
7618 .chain_id = ALC245_FIXUP_HP_GPIO_LED
c3bb2b52 7619 },
e1e62b98
KY
7620 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
7621 .type = HDA_FIXUP_FUNC,
7622 .v.func = alc_fixup_headset_mode_dell_alc288,
7623 .chained = true,
b3802783 7624 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
e1e62b98
KY
7625 },
7626 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7627 .type = HDA_FIXUP_PINS,
7628 .v.pins = (const struct hda_pintbl[]) {
7629 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7630 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7631 { }
7632 },
7633 .chained = true,
7634 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
7635 },
831bfdf9
HW
7636 [ALC288_FIXUP_DISABLE_AAMIX] = {
7637 .type = HDA_FIXUP_FUNC,
7638 .v.func = alc_fixup_disable_aamix,
7639 .chained = true,
d44a6864 7640 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
831bfdf9
HW
7641 },
7642 [ALC288_FIXUP_DELL_XPS_13] = {
7643 .type = HDA_FIXUP_FUNC,
7644 .v.func = alc_fixup_dell_xps13,
7645 .chained = true,
7646 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
7647 },
8b99aba7
TI
7648 [ALC292_FIXUP_DISABLE_AAMIX] = {
7649 .type = HDA_FIXUP_FUNC,
7650 .v.func = alc_fixup_disable_aamix,
831bfdf9
HW
7651 .chained = true,
7652 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
8b99aba7 7653 },
c04017ea
DH
7654 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
7655 .type = HDA_FIXUP_FUNC,
7656 .v.func = alc_fixup_disable_aamix,
7657 .chained = true,
7658 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
7659 },
5fab5829 7660 [ALC292_FIXUP_DELL_E7X_AAMIX] = {
8b99aba7
TI
7661 .type = HDA_FIXUP_FUNC,
7662 .v.func = alc_fixup_dell_xps13,
7663 .chained = true,
7664 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
7665 },
5fab5829
TI
7666 [ALC292_FIXUP_DELL_E7X] = {
7667 .type = HDA_FIXUP_FUNC,
8a503555 7668 .v.func = alc_fixup_micmute_led,
5fab5829
TI
7669 /* micmute fixup must be applied at last */
7670 .chained_before = true,
7671 .chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
7672 },
54324221
JM
7673 [ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
7674 .type = HDA_FIXUP_PINS,
7675 .v.pins = (const struct hda_pintbl[]) {
7676 { 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
7677 { }
7678 },
7679 .chained_before = true,
7680 .chain_id = ALC269_FIXUP_HEADSET_MODE,
7681 },
977e6276
KY
7682 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7683 .type = HDA_FIXUP_PINS,
7684 .v.pins = (const struct hda_pintbl[]) {
7685 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7686 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7687 { }
7688 },
7689 .chained = true,
7690 .chain_id = ALC269_FIXUP_HEADSET_MODE
7691 },
2f726aec
HW
7692 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
7693 .type = HDA_FIXUP_PINS,
7694 .v.pins = (const struct hda_pintbl[]) {
7695 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7696 { }
7697 },
7698 .chained = true,
7699 .chain_id = ALC269_FIXUP_HEADSET_MODE
7700 },
6ed1131f
KY
7701 [ALC275_FIXUP_DELL_XPS] = {
7702 .type = HDA_FIXUP_VERBS,
7703 .v.verbs = (const struct hda_verb[]) {
7704 /* Enables internal speaker */
7705 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
7706 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
7707 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
7708 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
7709 {}
7710 }
7711 },
23adc192
HW
7712 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
7713 .type = HDA_FIXUP_FUNC,
7714 .v.func = alc_fixup_disable_aamix,
7715 .chained = true,
7716 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7717 },
3694cb29
K
7718 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
7719 .type = HDA_FIXUP_FUNC,
7720 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
7721 },
d1ee66c5
PC
7722 [ALC233_FIXUP_INTEL_NUC8_DMIC] = {
7723 .type = HDA_FIXUP_FUNC,
7724 .v.func = alc_fixup_inv_dmic,
7725 .chained = true,
7726 .chain_id = ALC233_FIXUP_INTEL_NUC8_BOOST,
7727 },
7728 [ALC233_FIXUP_INTEL_NUC8_BOOST] = {
7729 .type = HDA_FIXUP_FUNC,
7730 .v.func = alc269_fixup_limit_int_mic_boost
7731 },
3b43b71f
KHF
7732 [ALC255_FIXUP_DELL_SPK_NOISE] = {
7733 .type = HDA_FIXUP_FUNC,
7734 .v.func = alc_fixup_disable_aamix,
7735 .chained = true,
7736 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7737 },
d1dd4211
KY
7738 [ALC225_FIXUP_DISABLE_MIC_VREF] = {
7739 .type = HDA_FIXUP_FUNC,
7740 .v.func = alc_fixup_disable_mic_vref,
7741 .chained = true,
7742 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7743 },
2ae95577
DH
7744 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7745 .type = HDA_FIXUP_VERBS,
7746 .v.verbs = (const struct hda_verb[]) {
7747 /* Disable pass-through path for FRONT 14h */
7748 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7749 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7750 {}
7751 },
7752 .chained = true,
d1dd4211 7753 .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
2ae95577 7754 },
f883982d
TI
7755 [ALC280_FIXUP_HP_HEADSET_MIC] = {
7756 .type = HDA_FIXUP_FUNC,
7757 .v.func = alc_fixup_disable_aamix,
7758 .chained = true,
7759 .chain_id = ALC269_FIXUP_HEADSET_MIC,
7760 },
e549d190
HW
7761 [ALC221_FIXUP_HP_FRONT_MIC] = {
7762 .type = HDA_FIXUP_PINS,
7763 .v.pins = (const struct hda_pintbl[]) {
7764 { 0x19, 0x02a19020 }, /* Front Mic */
7765 { }
7766 },
7767 },
c636b95e
SE
7768 [ALC292_FIXUP_TPT460] = {
7769 .type = HDA_FIXUP_FUNC,
7770 .v.func = alc_fixup_tpt440_dock,
7771 .chained = true,
7772 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
7773 },
dd9aa335
HW
7774 [ALC298_FIXUP_SPK_VOLUME] = {
7775 .type = HDA_FIXUP_FUNC,
7776 .v.func = alc298_fixup_speaker_volume,
59ec4b57 7777 .chained = true,
2f726aec 7778 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
dd9aa335 7779 },
f86de9b1
KY
7780 [ALC298_FIXUP_LENOVO_SPK_VOLUME] = {
7781 .type = HDA_FIXUP_FUNC,
7782 .v.func = alc298_fixup_speaker_volume,
7783 },
e312a869
TI
7784 [ALC295_FIXUP_DISABLE_DAC3] = {
7785 .type = HDA_FIXUP_FUNC,
7786 .v.func = alc295_fixup_disable_dac3,
7787 },
d2cd795c
JK
7788 [ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
7789 .type = HDA_FIXUP_FUNC,
7790 .v.func = alc285_fixup_speaker2_to_dac1,
c37c0ab0
HW
7791 .chained = true,
7792 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
d2cd795c 7793 },
fd06c77e
KHF
7794 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
7795 .type = HDA_FIXUP_PINS,
7796 .v.pins = (const struct hda_pintbl[]) {
7797 { 0x1b, 0x90170151 },
7798 { }
7799 },
7800 .chained = true,
7801 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7802 },
823ff161
GM
7803 [ALC269_FIXUP_ATIV_BOOK_8] = {
7804 .type = HDA_FIXUP_FUNC,
7805 .v.func = alc_fixup_auto_mute_via_amp,
7806 .chained = true,
7807 .chain_id = ALC269_FIXUP_NO_SHUTUP
7808 },
9eb5d0e6
KY
7809 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
7810 .type = HDA_FIXUP_PINS,
7811 .v.pins = (const struct hda_pintbl[]) {
7812 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7813 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7814 { }
7815 },
7816 .chained = true,
7817 .chain_id = ALC269_FIXUP_HEADSET_MODE
7818 },
c1732ede
CC
7819 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
7820 .type = HDA_FIXUP_FUNC,
7821 .v.func = alc_fixup_headset_mode,
7822 },
7823 [ALC256_FIXUP_ASUS_MIC] = {
7824 .type = HDA_FIXUP_PINS,
7825 .v.pins = (const struct hda_pintbl[]) {
7826 { 0x13, 0x90a60160 }, /* use as internal mic */
7827 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7828 { }
7829 },
7830 .chained = true,
7831 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7832 },
eeed4cd1 7833 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
ae065f1c
TI
7834 .type = HDA_FIXUP_FUNC,
7835 /* Set up GPIO2 for the speaker amp */
7836 .v.func = alc_fixup_gpio4,
eeed4cd1 7837 },
216d7aeb
CC
7838 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7839 .type = HDA_FIXUP_PINS,
7840 .v.pins = (const struct hda_pintbl[]) {
7841 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7842 { }
7843 },
7844 .chained = true,
7845 .chain_id = ALC269_FIXUP_HEADSET_MIC
7846 },
7847 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
7848 .type = HDA_FIXUP_VERBS,
7849 .v.verbs = (const struct hda_verb[]) {
7850 /* Enables internal speaker */
7851 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
7852 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
7853 {}
7854 },
7855 .chained = true,
7856 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7857 },
ca169cc2
KY
7858 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
7859 .type = HDA_FIXUP_FUNC,
7860 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
f73bbf63
KHF
7861 .chained = true,
7862 .chain_id = ALC269_FIXUP_GPIO2
ca169cc2 7863 },
ea5c7eba
JHP
7864 [ALC233_FIXUP_ACER_HEADSET_MIC] = {
7865 .type = HDA_FIXUP_VERBS,
7866 .v.verbs = (const struct hda_verb[]) {
7867 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
7868 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
7869 { }
7870 },
7871 .chained = true,
7872 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7873 },
f33f79f3
HW
7874 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
7875 .type = HDA_FIXUP_PINS,
7876 .v.pins = (const struct hda_pintbl[]) {
7877 /* Change the mic location from front to right, otherwise there are
7878 two front mics with the same name, pulseaudio can't handle them.
7879 This is just a temporary workaround, after applying this fixup,
7880 there will be one "Front Mic" and one "Mic" in this machine.
7881 */
7882 { 0x1a, 0x04a19040 },
7883 { }
7884 },
7885 },
5f364135
KY
7886 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
7887 .type = HDA_FIXUP_PINS,
7888 .v.pins = (const struct hda_pintbl[]) {
7889 { 0x16, 0x0101102f }, /* Rear Headset HP */
7890 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
7891 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
7892 { 0x1b, 0x02011020 },
7893 { }
7894 },
7895 .chained = true,
52e4e368
KHF
7896 .chain_id = ALC225_FIXUP_S3_POP_NOISE
7897 },
7898 [ALC225_FIXUP_S3_POP_NOISE] = {
7899 .type = HDA_FIXUP_FUNC,
7900 .v.func = alc225_fixup_s3_pop_noise,
7901 .chained = true,
5f364135
KY
7902 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7903 },
b84e8436
PH
7904 [ALC700_FIXUP_INTEL_REFERENCE] = {
7905 .type = HDA_FIXUP_VERBS,
7906 .v.verbs = (const struct hda_verb[]) {
7907 /* Enables internal speaker */
7908 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
7909 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
7910 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
7911 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
7912 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
7913 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
7914 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
7915 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
7916 {}
7917 }
7918 },
92266651
KY
7919 [ALC274_FIXUP_DELL_BIND_DACS] = {
7920 .type = HDA_FIXUP_FUNC,
7921 .v.func = alc274_fixup_bind_dacs,
7922 .chained = true,
7923 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7924 },
7925 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
7926 .type = HDA_FIXUP_PINS,
7927 .v.pins = (const struct hda_pintbl[]) {
7928 { 0x1b, 0x0401102f },
7929 { }
7930 },
7931 .chained = true,
7932 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
7933 },
399c01aa 7934 [ALC298_FIXUP_TPT470_DOCK_FIX] = {
61fcf8ec
KY
7935 .type = HDA_FIXUP_FUNC,
7936 .v.func = alc_fixup_tpt470_dock,
7937 .chained = true,
7938 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
7939 },
399c01aa
TI
7940 [ALC298_FIXUP_TPT470_DOCK] = {
7941 .type = HDA_FIXUP_FUNC,
7942 .v.func = alc_fixup_tpt470_dacs,
7943 .chained = true,
7944 .chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
7945 },
ae104a21
KY
7946 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
7947 .type = HDA_FIXUP_PINS,
7948 .v.pins = (const struct hda_pintbl[]) {
7949 { 0x14, 0x0201101f },
7950 { }
7951 },
7952 .chained = true,
7953 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7954 },
f0ba9d69
KY
7955 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
7956 .type = HDA_FIXUP_PINS,
7957 .v.pins = (const struct hda_pintbl[]) {
7958 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7959 { }
7960 },
3ce0d5aa
HW
7961 .chained = true,
7962 .chain_id = ALC269_FIXUP_HEADSET_MIC
f0ba9d69 7963 },
bbf8ff6b
TB
7964 [ALC295_FIXUP_HP_X360] = {
7965 .type = HDA_FIXUP_FUNC,
7966 .v.func = alc295_fixup_hp_top_speakers,
7967 .chained = true,
7968 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
8a328ac1
KY
7969 },
7970 [ALC221_FIXUP_HP_HEADSET_MIC] = {
7971 .type = HDA_FIXUP_PINS,
7972 .v.pins = (const struct hda_pintbl[]) {
7973 { 0x19, 0x0181313f},
7974 { }
7975 },
7976 .chained = true,
7977 .chain_id = ALC269_FIXUP_HEADSET_MIC
7978 },
c4cfcf6f
HW
7979 [ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
7980 .type = HDA_FIXUP_FUNC,
7981 .v.func = alc285_fixup_invalidate_dacs,
6ba189c5
HW
7982 .chained = true,
7983 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
c4cfcf6f 7984 },
e8ed64b0
GKK
7985 [ALC295_FIXUP_HP_AUTO_MUTE] = {
7986 .type = HDA_FIXUP_FUNC,
7987 .v.func = alc_fixup_auto_mute_via_amp,
7988 },
33aaebd4
CC
7989 [ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
7990 .type = HDA_FIXUP_PINS,
7991 .v.pins = (const struct hda_pintbl[]) {
7992 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7993 { }
7994 },
7995 .chained = true,
7996 .chain_id = ALC269_FIXUP_HEADSET_MIC
7997 },
d8ae458e
CC
7998 [ALC294_FIXUP_ASUS_MIC] = {
7999 .type = HDA_FIXUP_PINS,
8000 .v.pins = (const struct hda_pintbl[]) {
8001 { 0x13, 0x90a60160 }, /* use as internal mic */
8002 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8003 { }
8004 },
8005 .chained = true,
ef9ddb9d 8006 .chain_id = ALC269_FIXUP_HEADSET_MIC
d8ae458e 8007 },
4e051106
JHP
8008 [ALC294_FIXUP_ASUS_HEADSET_MIC] = {
8009 .type = HDA_FIXUP_PINS,
8010 .v.pins = (const struct hda_pintbl[]) {
82b01149 8011 { 0x19, 0x01a1103c }, /* use as headset mic */
4e051106
JHP
8012 { }
8013 },
8014 .chained = true,
ef9ddb9d 8015 .chain_id = ALC269_FIXUP_HEADSET_MIC
4e051106
JHP
8016 },
8017 [ALC294_FIXUP_ASUS_SPK] = {
8018 .type = HDA_FIXUP_VERBS,
8019 .v.verbs = (const struct hda_verb[]) {
8020 /* Set EAPD high */
8021 { 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
8022 { 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
473fbe13
KY
8023 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8024 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
4e051106
JHP
8025 { }
8026 },
8027 .chained = true,
8028 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8029 },
c8a9afa6 8030 [ALC295_FIXUP_CHROME_BOOK] = {
e854747d 8031 .type = HDA_FIXUP_FUNC,
c8a9afa6 8032 .v.func = alc295_fixup_chromebook,
8983eb60
KY
8033 .chained = true,
8034 .chain_id = ALC225_FIXUP_HEADSET_JACK
8035 },
8036 [ALC225_FIXUP_HEADSET_JACK] = {
8037 .type = HDA_FIXUP_FUNC,
8038 .v.func = alc_fixup_headset_jack,
e854747d 8039 },
89e3a568
JS
8040 [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
8041 .type = HDA_FIXUP_PINS,
8042 .v.pins = (const struct hda_pintbl[]) {
8043 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8044 { }
8045 },
8046 .chained = true,
8047 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8048 },
c8c6ee61
HW
8049 [ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
8050 .type = HDA_FIXUP_VERBS,
8051 .v.verbs = (const struct hda_verb[]) {
8052 /* Disable PCBEEP-IN passthrough */
8053 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
8054 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
8055 { }
8056 },
8057 .chained = true,
8058 .chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
8059 },
cbc05fd6
JHP
8060 [ALC255_FIXUP_ACER_HEADSET_MIC] = {
8061 .type = HDA_FIXUP_PINS,
8062 .v.pins = (const struct hda_pintbl[]) {
8063 { 0x19, 0x03a11130 },
8064 { 0x1a, 0x90a60140 }, /* use as internal mic */
8065 { }
8066 },
8067 .chained = true,
8068 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
8069 },
136824ef
KY
8070 [ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
8071 .type = HDA_FIXUP_PINS,
8072 .v.pins = (const struct hda_pintbl[]) {
8073 { 0x16, 0x01011020 }, /* Rear Line out */
8074 { 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
8075 { }
8076 },
8077 .chained = true,
8078 .chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
8079 },
8080 [ALC225_FIXUP_WYSE_AUTO_MUTE] = {
8081 .type = HDA_FIXUP_FUNC,
8082 .v.func = alc_fixup_auto_mute_via_amp,
8083 .chained = true,
8084 .chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
8085 },
8086 [ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
8087 .type = HDA_FIXUP_FUNC,
8088 .v.func = alc_fixup_disable_mic_vref,
8089 .chained = true,
8090 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8091 },
667a8f73
JHP
8092 [ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
8093 .type = HDA_FIXUP_VERBS,
8094 .v.verbs = (const struct hda_verb[]) {
8095 { 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
8096 { 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
8097 { }
8098 },
8099 .chained = true,
8100 .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
8101 },
8c8967a7
DD
8102 [ALC256_FIXUP_ASUS_HEADSET_MIC] = {
8103 .type = HDA_FIXUP_PINS,
8104 .v.pins = (const struct hda_pintbl[]) {
8105 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
8106 { }
8107 },
8108 .chained = true,
8109 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8110 },
e1037354
JHP
8111 [ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8112 .type = HDA_FIXUP_PINS,
8113 .v.pins = (const struct hda_pintbl[]) {
8114 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8115 { }
8116 },
8117 .chained = true,
8118 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8119 },
e2a829b3
BR
8120 [ALC299_FIXUP_PREDATOR_SPK] = {
8121 .type = HDA_FIXUP_PINS,
8122 .v.pins = (const struct hda_pintbl[]) {
8123 { 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
8124 { }
8125 }
8126 },
bd9c10bc 8127 [ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
60083f9e
JHP
8128 .type = HDA_FIXUP_PINS,
8129 .v.pins = (const struct hda_pintbl[]) {
bd9c10bc
JMG
8130 { 0x19, 0x04a11040 },
8131 { 0x21, 0x04211020 },
60083f9e
JHP
8132 { }
8133 },
8134 .chained = true,
bd9c10bc 8135 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
60083f9e 8136 },
e79c2269 8137 [ALC289_FIXUP_DELL_SPK2] = {
bd9c10bc
JMG
8138 .type = HDA_FIXUP_PINS,
8139 .v.pins = (const struct hda_pintbl[]) {
e79c2269 8140 { 0x17, 0x90170130 }, /* bass spk */
bd9c10bc
JMG
8141 { }
8142 },
8143 .chained = true,
e79c2269 8144 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
bd9c10bc 8145 },
e79c2269
KY
8146 [ALC289_FIXUP_DUAL_SPK] = {
8147 .type = HDA_FIXUP_FUNC,
8148 .v.func = alc285_fixup_speaker2_to_dac1,
8149 .chained = true,
8150 .chain_id = ALC289_FIXUP_DELL_SPK2
8151 },
48e01504
CC
8152 [ALC294_FIXUP_SPK2_TO_DAC1] = {
8153 .type = HDA_FIXUP_FUNC,
8154 .v.func = alc285_fixup_speaker2_to_dac1,
8155 .chained = true,
8156 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8157 },
8158 [ALC294_FIXUP_ASUS_DUAL_SPK] = {
436e2550
JHP
8159 .type = HDA_FIXUP_FUNC,
8160 /* The GPIO must be pulled to initialize the AMP */
8161 .v.func = alc_fixup_gpio4,
8162 .chained = true,
48e01504 8163 .chain_id = ALC294_FIXUP_SPK2_TO_DAC1
436e2550 8164 },
6a6660d0
TI
8165 [ALC285_FIXUP_THINKPAD_X1_GEN7] = {
8166 .type = HDA_FIXUP_FUNC,
8167 .v.func = alc285_fixup_thinkpad_x1_gen7,
8168 .chained = true,
8169 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8170 },
76f7dec0
KY
8171 [ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
8172 .type = HDA_FIXUP_FUNC,
8173 .v.func = alc_fixup_headset_jack,
8174 .chained = true,
6a6660d0 8175 .chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
76f7dec0 8176 },
8b33a134
JHP
8177 [ALC294_FIXUP_ASUS_HPE] = {
8178 .type = HDA_FIXUP_VERBS,
8179 .v.verbs = (const struct hda_verb[]) {
8180 /* Set EAPD high */
8181 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8182 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
8183 { }
8184 },
8185 .chained = true,
8186 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8187 },
c3cdf189
LJ
8188 [ALC294_FIXUP_ASUS_GX502_PINS] = {
8189 .type = HDA_FIXUP_PINS,
8190 .v.pins = (const struct hda_pintbl[]) {
8191 { 0x19, 0x03a11050 }, /* front HP mic */
8192 { 0x1a, 0x01a11830 }, /* rear external mic */
8193 { 0x21, 0x03211020 }, /* front HP out */
8194 { }
8195 },
8196 .chained = true,
8197 .chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
8198 },
8199 [ALC294_FIXUP_ASUS_GX502_VERBS] = {
8200 .type = HDA_FIXUP_VERBS,
8201 .v.verbs = (const struct hda_verb[]) {
8202 /* set 0x15 to HP-OUT ctrl */
8203 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8204 /* unmute the 0x15 amp */
8205 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8206 { }
8207 },
8208 .chained = true,
8209 .chain_id = ALC294_FIXUP_ASUS_GX502_HP
8210 },
8211 [ALC294_FIXUP_ASUS_GX502_HP] = {
8212 .type = HDA_FIXUP_FUNC,
8213 .v.func = alc294_fixup_gx502_hp,
8214 },
c1b55029
DC
8215 [ALC294_FIXUP_ASUS_GU502_PINS] = {
8216 .type = HDA_FIXUP_PINS,
8217 .v.pins = (const struct hda_pintbl[]) {
8218 { 0x19, 0x01a11050 }, /* rear HP mic */
8219 { 0x1a, 0x01a11830 }, /* rear external mic */
8220 { 0x21, 0x012110f0 }, /* rear HP out */
8221 { }
8222 },
8223 .chained = true,
8224 .chain_id = ALC294_FIXUP_ASUS_GU502_VERBS
8225 },
8226 [ALC294_FIXUP_ASUS_GU502_VERBS] = {
8227 .type = HDA_FIXUP_VERBS,
8228 .v.verbs = (const struct hda_verb[]) {
8229 /* set 0x15 to HP-OUT ctrl */
8230 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8231 /* unmute the 0x15 amp */
8232 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8233 /* set 0x1b to HP-OUT */
8234 { 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
8235 { }
8236 },
8237 .chained = true,
8238 .chain_id = ALC294_FIXUP_ASUS_GU502_HP
8239 },
8240 [ALC294_FIXUP_ASUS_GU502_HP] = {
8241 .type = HDA_FIXUP_FUNC,
8242 .v.func = alc294_fixup_gu502_hp,
8243 },
1b94e59d
TI
8244 [ALC294_FIXUP_ASUS_COEF_1B] = {
8245 .type = HDA_FIXUP_VERBS,
8246 .v.verbs = (const struct hda_verb[]) {
8247 /* Set bit 10 to correct noisy output after reboot from
8248 * Windows 10 (due to pop noise reduction?)
8249 */
8250 { 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
8251 { 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
8252 { }
8253 },
f8fbcdfb
TI
8254 .chained = true,
8255 .chain_id = ALC289_FIXUP_ASUS_GA401,
1b94e59d 8256 },
f5a88b0a
KHF
8257 [ALC285_FIXUP_HP_GPIO_LED] = {
8258 .type = HDA_FIXUP_FUNC,
8259 .v.func = alc285_fixup_hp_gpio_led,
8260 },
431e76c3
KY
8261 [ALC285_FIXUP_HP_MUTE_LED] = {
8262 .type = HDA_FIXUP_FUNC,
8263 .v.func = alc285_fixup_hp_mute_led,
8264 },
e7d66cf7
JS
8265 [ALC236_FIXUP_HP_GPIO_LED] = {
8266 .type = HDA_FIXUP_FUNC,
8267 .v.func = alc236_fixup_hp_gpio_led,
8268 },
24164f43
KY
8269 [ALC236_FIXUP_HP_MUTE_LED] = {
8270 .type = HDA_FIXUP_FUNC,
8271 .v.func = alc236_fixup_hp_mute_led,
8272 },
75b62ab6
JW
8273 [ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF] = {
8274 .type = HDA_FIXUP_FUNC,
8275 .v.func = alc236_fixup_hp_mute_led_micmute_vref,
8276 },
14425f1f
MP
8277 [ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
8278 .type = HDA_FIXUP_VERBS,
8279 .v.verbs = (const struct hda_verb[]) {
8280 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
8281 { }
8282 },
8283 },
ef248d9b
MK
8284 [ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
8285 .type = HDA_FIXUP_VERBS,
8286 .v.verbs = (const struct hda_verb[]) {
8287 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08},
8288 { 0x20, AC_VERB_SET_PROC_COEF, 0x2fcf},
8289 { }
8290 },
8291 },
9e43342b
CC
8292 [ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8293 .type = HDA_FIXUP_PINS,
8294 .v.pins = (const struct hda_pintbl[]) {
8295 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8296 { }
8297 },
8298 .chained = true,
8299 .chain_id = ALC269_FIXUP_HEADSET_MODE
8300 },
8eae7e9b
JHP
8301 [ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
8302 .type = HDA_FIXUP_PINS,
8303 .v.pins = (const struct hda_pintbl[]) {
8304 { 0x14, 0x90100120 }, /* use as internal speaker */
8305 { 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
8306 { 0x1a, 0x01011020 }, /* use as line out */
8307 { },
8308 },
8309 .chained = true,
8310 .chain_id = ALC269_FIXUP_HEADSET_MIC
8311 },
6e15d126
JHP
8312 [ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
8313 .type = HDA_FIXUP_PINS,
8314 .v.pins = (const struct hda_pintbl[]) {
8315 { 0x18, 0x02a11030 }, /* use as headset mic */
8316 { }
8317 },
8318 .chained = true,
8319 .chain_id = ALC269_FIXUP_HEADSET_MIC
8320 },
781c90c0
JHP
8321 [ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
8322 .type = HDA_FIXUP_PINS,
8323 .v.pins = (const struct hda_pintbl[]) {
8324 { 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
8325 { }
8326 },
8327 .chained = true,
8328 .chain_id = ALC269_FIXUP_HEADSET_MIC
8329 },
293a92c1 8330 [ALC289_FIXUP_ASUS_GA401] = {
c84bfedc
TI
8331 .type = HDA_FIXUP_FUNC,
8332 .v.func = alc289_fixup_asus_ga401,
8333 .chained = true,
8334 .chain_id = ALC289_FIXUP_ASUS_GA502,
ff53664d 8335 },
4b43d05a
AS
8336 [ALC289_FIXUP_ASUS_GA502] = {
8337 .type = HDA_FIXUP_PINS,
8338 .v.pins = (const struct hda_pintbl[]) {
8339 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
8340 { }
8341 },
8342 },
f50a121d
JHP
8343 [ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
8344 .type = HDA_FIXUP_PINS,
8345 .v.pins = (const struct hda_pintbl[]) {
8346 { 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
8347 { }
8348 },
8349 .chained = true,
8350 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8351 },
56496253
KY
8352 [ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
8353 .type = HDA_FIXUP_FUNC,
8354 .v.func = alc285_fixup_hp_gpio_amp_init,
8355 .chained = true,
8356 .chain_id = ALC285_FIXUP_HP_GPIO_LED
8357 },
f1ec5be1
HC
8358 [ALC269_FIXUP_CZC_B20] = {
8359 .type = HDA_FIXUP_PINS,
8360 .v.pins = (const struct hda_pintbl[]) {
8361 { 0x12, 0x411111f0 },
8362 { 0x14, 0x90170110 }, /* speaker */
8363 { 0x15, 0x032f1020 }, /* HP out */
8364 { 0x17, 0x411111f0 },
8365 { 0x18, 0x03ab1040 }, /* mic */
8366 { 0x19, 0xb7a7013f },
8367 { 0x1a, 0x0181305f },
8368 { 0x1b, 0x411111f0 },
8369 { 0x1d, 0x411111f0 },
8370 { 0x1e, 0x411111f0 },
8371 { }
8372 },
8373 .chain_id = ALC269_FIXUP_DMIC,
8374 },
8375 [ALC269_FIXUP_CZC_TMI] = {
8376 .type = HDA_FIXUP_PINS,
8377 .v.pins = (const struct hda_pintbl[]) {
8378 { 0x12, 0x4000c000 },
8379 { 0x14, 0x90170110 }, /* speaker */
8380 { 0x15, 0x0421401f }, /* HP out */
8381 { 0x17, 0x411111f0 },
8382 { 0x18, 0x04a19020 }, /* mic */
8383 { 0x19, 0x411111f0 },
8384 { 0x1a, 0x411111f0 },
8385 { 0x1b, 0x411111f0 },
8386 { 0x1d, 0x40448505 },
8387 { 0x1e, 0x411111f0 },
8388 { 0x20, 0x8000ffff },
8389 { }
8390 },
8391 .chain_id = ALC269_FIXUP_DMIC,
8392 },
8393 [ALC269_FIXUP_CZC_L101] = {
8394 .type = HDA_FIXUP_PINS,
8395 .v.pins = (const struct hda_pintbl[]) {
8396 { 0x12, 0x40000000 },
8397 { 0x14, 0x01014010 }, /* speaker */
8398 { 0x15, 0x411111f0 }, /* HP out */
8399 { 0x16, 0x411111f0 },
8400 { 0x18, 0x01a19020 }, /* mic */
8401 { 0x19, 0x02a19021 },
8402 { 0x1a, 0x0181302f },
8403 { 0x1b, 0x0221401f },
8404 { 0x1c, 0x411111f0 },
8405 { 0x1d, 0x4044c601 },
8406 { 0x1e, 0x411111f0 },
8407 { }
8408 },
8409 .chain_id = ALC269_FIXUP_DMIC,
8410 },
8411 [ALC269_FIXUP_LEMOTE_A1802] = {
8412 .type = HDA_FIXUP_PINS,
8413 .v.pins = (const struct hda_pintbl[]) {
8414 { 0x12, 0x40000000 },
8415 { 0x14, 0x90170110 }, /* speaker */
8416 { 0x17, 0x411111f0 },
8417 { 0x18, 0x03a19040 }, /* mic1 */
8418 { 0x19, 0x90a70130 }, /* mic2 */
8419 { 0x1a, 0x411111f0 },
8420 { 0x1b, 0x411111f0 },
8421 { 0x1d, 0x40489d2d },
8422 { 0x1e, 0x411111f0 },
8423 { 0x20, 0x0003ffff },
8424 { 0x21, 0x03214020 },
8425 { }
8426 },
8427 .chain_id = ALC269_FIXUP_DMIC,
8428 },
8429 [ALC269_FIXUP_LEMOTE_A190X] = {
8430 .type = HDA_FIXUP_PINS,
8431 .v.pins = (const struct hda_pintbl[]) {
8432 { 0x14, 0x99130110 }, /* speaker */
8433 { 0x15, 0x0121401f }, /* HP out */
8434 { 0x18, 0x01a19c20 }, /* rear mic */
8435 { 0x19, 0x99a3092f }, /* front mic */
8436 { 0x1b, 0x0201401f }, /* front lineout */
8437 { }
8438 },
8439 .chain_id = ALC269_FIXUP_DMIC,
8440 },
e2d2fded
KHF
8441 [ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
8442 .type = HDA_FIXUP_PINS,
8443 .v.pins = (const struct hda_pintbl[]) {
8444 { 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8445 { }
8446 },
8447 .chained = true,
8448 .chain_id = ALC269_FIXUP_HEADSET_MODE
8449 },
73e7161e
WS
8450 [ALC256_FIXUP_INTEL_NUC10] = {
8451 .type = HDA_FIXUP_PINS,
8452 .v.pins = (const struct hda_pintbl[]) {
8453 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8454 { }
8455 },
8456 .chained = true,
8457 .chain_id = ALC269_FIXUP_HEADSET_MODE
8458 },
fc19d559
HW
8459 [ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
8460 .type = HDA_FIXUP_VERBS,
8461 .v.verbs = (const struct hda_verb[]) {
8462 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8463 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8464 { }
8465 },
8466 .chained = true,
c84bfedc 8467 .chain_id = ALC289_FIXUP_ASUS_GA502
fc19d559 8468 },
13468bfa
HW
8469 [ALC274_FIXUP_HP_MIC] = {
8470 .type = HDA_FIXUP_VERBS,
8471 .v.verbs = (const struct hda_verb[]) {
8472 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8473 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8474 { }
8475 },
8476 },
8a8de09c
KY
8477 [ALC274_FIXUP_HP_HEADSET_MIC] = {
8478 .type = HDA_FIXUP_FUNC,
8479 .v.func = alc274_fixup_hp_headset_mic,
8480 .chained = true,
8481 .chain_id = ALC274_FIXUP_HP_MIC
8482 },
622464c8
TI
8483 [ALC274_FIXUP_HP_ENVY_GPIO] = {
8484 .type = HDA_FIXUP_FUNC,
8485 .v.func = alc274_fixup_hp_envy_gpio,
8486 },
ef9ce66f
KY
8487 [ALC256_FIXUP_ASUS_HPE] = {
8488 .type = HDA_FIXUP_VERBS,
8489 .v.verbs = (const struct hda_verb[]) {
8490 /* Set EAPD high */
8491 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8492 { 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
8493 { }
8494 },
8495 .chained = true,
8496 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8497 },
446b8185
KY
8498 [ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
8499 .type = HDA_FIXUP_FUNC,
8500 .v.func = alc_fixup_headset_jack,
8501 .chained = true,
8502 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8503 },
a0ccbc53
KY
8504 [ALC287_FIXUP_HP_GPIO_LED] = {
8505 .type = HDA_FIXUP_FUNC,
8506 .v.func = alc287_fixup_hp_gpio_led,
8507 },
9e885770
KY
8508 [ALC256_FIXUP_HP_HEADSET_MIC] = {
8509 .type = HDA_FIXUP_FUNC,
8510 .v.func = alc274_fixup_hp_headset_mic,
8511 },
92666d45
KY
8512 [ALC236_FIXUP_DELL_AIO_HEADSET_MIC] = {
8513 .type = HDA_FIXUP_FUNC,
8514 .v.func = alc_fixup_no_int_mic,
8515 .chained = true,
8516 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8517 },
34cdf405
CC
8518 [ALC282_FIXUP_ACER_DISABLE_LINEOUT] = {
8519 .type = HDA_FIXUP_PINS,
8520 .v.pins = (const struct hda_pintbl[]) {
8521 { 0x1b, 0x411111f0 },
8522 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8523 { },
8524 },
8525 .chained = true,
8526 .chain_id = ALC269_FIXUP_HEADSET_MODE
8527 },
495dc763
CC
8528 [ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST] = {
8529 .type = HDA_FIXUP_FUNC,
8530 .v.func = alc269_fixup_limit_int_mic_boost,
8531 .chained = true,
8532 .chain_id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
8533 },
d0e18561
CC
8534 [ALC256_FIXUP_ACER_HEADSET_MIC] = {
8535 .type = HDA_FIXUP_PINS,
8536 .v.pins = (const struct hda_pintbl[]) {
8537 { 0x19, 0x02a1113c }, /* use as headset mic, without its own jack detect */
8538 { 0x1a, 0x90a1092f }, /* use as internal mic */
8539 { }
8540 },
8541 .chained = true,
8542 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8543 },
26928ca1
TI
8544 [ALC285_FIXUP_IDEAPAD_S740_COEF] = {
8545 .type = HDA_FIXUP_FUNC,
8546 .v.func = alc285_fixup_ideapad_s740_coef,
8547 .chained = true,
8548 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8549 },
bd15b155
KHF
8550 [ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
8551 .type = HDA_FIXUP_FUNC,
8552 .v.func = alc269_fixup_limit_int_mic_boost,
8553 .chained = true,
8554 .chain_id = ALC285_FIXUP_HP_MUTE_LED,
8555 },
8eedd3a7
TI
8556 [ALC295_FIXUP_ASUS_DACS] = {
8557 .type = HDA_FIXUP_FUNC,
8558 .v.func = alc295_fixup_asus_dacs,
8559 },
5d84b531
TI
8560 [ALC295_FIXUP_HP_OMEN] = {
8561 .type = HDA_FIXUP_PINS,
8562 .v.pins = (const struct hda_pintbl[]) {
8563 { 0x12, 0xb7a60130 },
8564 { 0x13, 0x40000000 },
8565 { 0x14, 0x411111f0 },
8566 { 0x16, 0x411111f0 },
8567 { 0x17, 0x90170110 },
8568 { 0x18, 0x411111f0 },
8569 { 0x19, 0x02a11030 },
8570 { 0x1a, 0x411111f0 },
8571 { 0x1b, 0x04a19030 },
8572 { 0x1d, 0x40600001 },
8573 { 0x1e, 0x411111f0 },
8574 { 0x21, 0x03211020 },
8575 {}
8576 },
8577 .chained = true,
8578 .chain_id = ALC269_FIXUP_HP_LINE1_MIC1_LED,
8579 },
f2be77fe 8580 [ALC285_FIXUP_HP_SPECTRE_X360] = {
434591b2
ED
8581 .type = HDA_FIXUP_FUNC,
8582 .v.func = alc285_fixup_hp_spectre_x360,
f2be77fe 8583 },
d94befbb
DB
8584 [ALC285_FIXUP_HP_SPECTRE_X360_EB1] = {
8585 .type = HDA_FIXUP_FUNC,
8586 .v.func = alc285_fixup_hp_spectre_x360_eb1
8587 },
9ebaef05
HW
8588 [ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = {
8589 .type = HDA_FIXUP_FUNC,
8590 .v.func = alc285_fixup_ideapad_s740_coef,
8591 .chained = true,
8592 .chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
8593 },
29c8f40b
PU
8594 [ALC623_FIXUP_LENOVO_THINKSTATION_P340] = {
8595 .type = HDA_FIXUP_FUNC,
8596 .v.func = alc_fixup_no_shutup,
8597 .chained = true,
8598 .chain_id = ALC283_FIXUP_HEADSET_MIC,
8599 },
57c9e21a
HW
8600 [ALC255_FIXUP_ACER_HEADPHONE_AND_MIC] = {
8601 .type = HDA_FIXUP_PINS,
8602 .v.pins = (const struct hda_pintbl[]) {
8603 { 0x21, 0x03211030 }, /* Change the Headphone location to Left */
8604 { }
8605 },
8606 .chained = true,
8607 .chain_id = ALC255_FIXUP_XIAOMI_HEADSET_MIC
8608 },
8903376d
KHF
8609 [ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
8610 .type = HDA_FIXUP_FUNC,
8611 .v.func = alc269_fixup_limit_int_mic_boost,
8612 .chained = true,
8613 .chain_id = ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
8614 },
8f4c9042
BF
8615 [ALC285_FIXUP_LEGION_Y9000X_SPEAKERS] = {
8616 .type = HDA_FIXUP_FUNC,
8617 .v.func = alc285_fixup_ideapad_s740_coef,
8618 .chained = true,
8619 .chain_id = ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
8620 },
8621 [ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE] = {
8622 .type = HDA_FIXUP_FUNC,
8623 .v.func = alc287_fixup_legion_15imhg05_speakers,
8624 .chained = true,
8625 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8626 },
ad7cc2d4
CB
8627 [ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS] = {
8628 .type = HDA_FIXUP_VERBS,
8629 //.v.verbs = legion_15imhg05_coefs,
8630 .v.verbs = (const struct hda_verb[]) {
8631 // set left speaker Legion 7i.
8632 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8633 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
8634
8635 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8636 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8637 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8638 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
8639 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8640
8641 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8642 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8643 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8644 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8645 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8646
8647 // set right speaker Legion 7i.
8648 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8649 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
8650
8651 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8652 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8653 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8654 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
8655 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8656
8657 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8658 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8659 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8660 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8661 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8662 {}
8663 },
8664 .chained = true,
8665 .chain_id = ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
8666 },
8667 [ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE] = {
8668 .type = HDA_FIXUP_FUNC,
8669 .v.func = alc287_fixup_legion_15imhg05_speakers,
8670 .chained = true,
8671 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8672 },
8673 [ALC287_FIXUP_YOGA7_14ITL_SPEAKERS] = {
8674 .type = HDA_FIXUP_VERBS,
8675 .v.verbs = (const struct hda_verb[]) {
8676 // set left speaker Yoga 7i.
8677 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8678 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
8679
8680 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8681 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8682 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8683 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
8684 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8685
8686 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8687 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8688 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8689 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8690 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8691
8692 // set right speaker Yoga 7i.
8693 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8694 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
8695
8696 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8697 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8698 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8699 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
8700 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8701
8702 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8703 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8704 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8705 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8706 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8707 {}
8708 },
8709 .chained = true,
8710 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8711 },
8712 [ALC287_FIXUP_13S_GEN2_SPEAKERS] = {
8713 .type = HDA_FIXUP_VERBS,
8714 .v.verbs = (const struct hda_verb[]) {
8715 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8716 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
023a062f 8717 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
ad7cc2d4
CB
8718 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8719 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8720 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8721 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8722 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8723 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
8724 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8725 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8726 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8727 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8728 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8729 {}
8730 },
8731 .chained = true,
8732 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8733 },
619764cc 8734 [ALC256_FIXUP_SET_COEF_DEFAULTS] = {
dd6dd6e3 8735 .type = HDA_FIXUP_FUNC,
619764cc 8736 .v.func = alc256_fixup_set_coef_defaults,
dd6dd6e3 8737 },
5fc462c3
JC
8738 [ALC245_FIXUP_HP_GPIO_LED] = {
8739 .type = HDA_FIXUP_FUNC,
8740 .v.func = alc245_fixup_hp_gpio_led,
8741 },
1278cc5a
JS
8742 [ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
8743 .type = HDA_FIXUP_PINS,
8744 .v.pins = (const struct hda_pintbl[]) {
8745 { 0x19, 0x03a11120 }, /* use as headset mic, without its own jack detect */
8746 { }
8747 },
8748 .chained = true,
8749 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
8750 },
174a7fb3
WS
8751 [ALC233_FIXUP_NO_AUDIO_JACK] = {
8752 .type = HDA_FIXUP_FUNC,
8753 .v.func = alc233_fixup_no_audio_jack,
8754 },
edca7cc4
WS
8755 [ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME] = {
8756 .type = HDA_FIXUP_FUNC,
8757 .v.func = alc256_fixup_mic_no_presence_and_resume,
8758 .chained = true,
8759 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8760 },
d3dca026
LT
8761 [ALC287_FIXUP_LEGION_16ACHG6] = {
8762 .type = HDA_FIXUP_FUNC,
8763 .v.func = alc287_fixup_legion_16achg6_speakers,
8764 },
ae7abe36
SB
8765 [ALC287_FIXUP_CS35L41_I2C_2] = {
8766 .type = HDA_FIXUP_FUNC,
8767 .v.func = cs35l41_fixup_i2c_two,
a6ac60b3
HW
8768 .chained = true,
8769 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
ae7abe36 8770 },
b3fbe536
AC
8771 [ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED] = {
8772 .type = HDA_FIXUP_FUNC,
8773 .v.func = cs35l41_fixup_i2c_two,
8774 .chained = true,
8775 .chain_id = ALC285_FIXUP_HP_MUTE_LED,
ae7abe36 8776 },
07bcab93
LT
8777 [ALC245_FIXUP_CS35L41_SPI_2] = {
8778 .type = HDA_FIXUP_FUNC,
8779 .v.func = cs35l41_fixup_spi_two,
8780 },
ce18f905
KHF
8781 [ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED] = {
8782 .type = HDA_FIXUP_FUNC,
8783 .v.func = cs35l41_fixup_spi_two,
8784 .chained = true,
8785 .chain_id = ALC285_FIXUP_HP_GPIO_LED,
8786 },
07bcab93
LT
8787 [ALC245_FIXUP_CS35L41_SPI_4] = {
8788 .type = HDA_FIXUP_FUNC,
8789 .v.func = cs35l41_fixup_spi_four,
8790 },
8791 [ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED] = {
8792 .type = HDA_FIXUP_FUNC,
864cb14c 8793 .v.func = cs35l41_fixup_spi_four,
07bcab93 8794 .chained = true,
864cb14c 8795 .chain_id = ALC285_FIXUP_HP_GPIO_LED,
07bcab93 8796 },
91502a9a
AS
8797 [ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED] = {
8798 .type = HDA_FIXUP_VERBS,
8799 .v.verbs = (const struct hda_verb[]) {
8800 { 0x20, AC_VERB_SET_COEF_INDEX, 0x19 },
8801 { 0x20, AC_VERB_SET_PROC_COEF, 0x8e11 },
8802 { }
8803 },
8804 .chained = true,
8805 .chain_id = ALC285_FIXUP_HP_MUTE_LED,
8806 },
1efcdd9c
GM
8807 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET] = {
8808 .type = HDA_FIXUP_FUNC,
8809 .v.func = alc_fixup_dell4_mic_no_presence_quiet,
8810 .chained = true,
8811 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
8812 },
309d7363
DH
8813 [ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE] = {
8814 .type = HDA_FIXUP_PINS,
8815 .v.pins = (const struct hda_pintbl[]) {
8816 { 0x19, 0x02a1112c }, /* use as headset mic, without its own jack detect */
8817 { }
8818 },
8819 .chained = true,
8820 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8821 },
f1d4e28b
KY
8822};
8823
1d045db9 8824static const struct snd_pci_quirk alc269_fixup_tbl[] = {
a6b92b66 8825 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
693b613d
DH
8826 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
8827 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
aaedfb47 8828 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
7819717b 8829 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
aaedfb47
DH
8830 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
8831 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
02322ac9 8832 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
b1e8972e 8833 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
1a22e775 8834 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
433f894e 8835 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
c8426b27 8836 SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF),
13be30f1 8837 SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK),
705b65f1 8838 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
6e15d126 8839 SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
b9c2fa52 8840 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
495dc763 8841 SND_PCI_QUIRK(0x1025, 0x1094, "Acer Aspire E5-575T", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
c7531e31
CC
8842 SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
8843 SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
13be30f1
CC
8844 SND_PCI_QUIRK(0x1025, 0x1166, "Acer Veriton N4640G", ALC269_FIXUP_LIFEBOOK),
8845 SND_PCI_QUIRK(0x1025, 0x1167, "Acer Veriton N6640G", ALC269_FIXUP_LIFEBOOK),
e2a829b3 8846 SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
8eae7e9b 8847 SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
781c90c0 8848 SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
d0e18561 8849 SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
667a8f73
JHP
8850 SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8851 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8852 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
d0e18561 8853 SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
35171fbf 8854 SND_PCI_QUIRK(0x1025, 0x1300, "Acer SWIFT SF314-56", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
2733cceb 8855 SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
ea5c7eba 8856 SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
cbc05fd6 8857 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
2a5bb694 8858 SND_PCI_QUIRK(0x1025, 0x141f, "Acer Spin SP513-54N", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
0d4867a1 8859 SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
f50a121d 8860 SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
57c9e21a 8861 SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC),
aaedfb47 8862 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
6ed1131f 8863 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
86f799b8 8864 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
cf52103a 8865 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
8b99aba7
TI
8866 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
8867 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
0f4881dc 8868 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
73bdd597
DH
8869 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
8870 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
8871 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
0f4881dc
DH
8872 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
8873 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
98070576 8874 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
4275554d 8875 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
0f4881dc 8876 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
a22aa26f
KY
8877 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8878 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
831bfdf9 8879 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
afecb146 8880 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
3a05d12f 8881 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
8b72415d 8882 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
b734304f
KY
8883 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8884 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
c04017ea
DH
8885 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8886 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8887 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8888 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8889 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
fd06c77e 8890 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
3b43b71f 8891 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
c0ca5ece 8892 SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
709ae62e 8893 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
dd9aa335 8894 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
493de342 8895 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
aa143ad3 8896 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
5f364135 8897 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
40e2c4e5
KY
8898 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
8899 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
f0ba9d69
KY
8900 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
8901 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
ae104a21 8902 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
136824ef 8903 SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
da484d00 8904 SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
c2a7c55a 8905 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
e79c2269 8906 SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
aa143ad3 8907 SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
78def224
KY
8908 SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
8909 SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
92666d45
KY
8910 SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
8911 SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
1efcdd9c 8912 SND_PCI_QUIRK(0x1028, 0x0a38, "Dell Latitude 7520", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET),
c1e89523 8913 SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC),
da946920 8914 SND_PCI_QUIRK(0x1028, 0x0a61, "Dell XPS 15 9510", ALC289_FIXUP_DUAL_SPK),
eb676622 8915 SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK),
2b987fe8
CC
8916 SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
8917 SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
15dad62f 8918 SND_PCI_QUIRK(0x1028, 0x0b19, "Dell XPS 15 9520", ALC289_FIXUP_DUAL_SPK),
a22aa26f
KY
8919 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8920 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
08fb0d0e 8921 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
9f5c6faf 8922 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
8e35cd4a 8923 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
7976eb49 8924 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8a02b164 8925 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8a02b164 8926 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
45461e3b
TI
8927 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8928 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
8929 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8930 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9c5dc3bf
KY
8931 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8932 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8933 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8934 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9c5dc3bf 8935 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9c5dc3bf
KY
8936 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8937 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8938 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8939 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8940 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9c5dc3bf 8941 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
04d5466a 8942 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
45461e3b 8943 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
c60666bd 8944 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd
KY
8945 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8946 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8947 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
45461e3b
TI
8948 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8949 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8950 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8951 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8952 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
9c5dc3bf 8953 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
45461e3b 8954 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
9c5dc3bf 8955 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
45461e3b 8956 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
9c5dc3bf 8957 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
c60666bd 8958 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 8959 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 8960 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 8961 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
45461e3b
TI
8962 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8963 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8964 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8965 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8966 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 8967 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd
KY
8968 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8969 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
45461e3b
TI
8970 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8971 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
8972 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8973 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8a02b164
KY
8974 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8975 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8976 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8977 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
167897f4
JK
8978 SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8979 SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
1c9d9dfd
KY
8980 SND_PCI_QUIRK(0x103c, 0x8077, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
8981 SND_PCI_QUIRK(0x103c, 0x8158, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
563785ed 8982 SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
e549d190 8983 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
bbf8ff6b 8984 SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
aeedad25 8985 SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
167897f4
JK
8986 SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8987 SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
56e40eb6 8988 SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
901be145 8989 SND_PCI_QUIRK(0x103c, 0x841c, "HP Pavilion 15-CK0xx", ALC269_FIXUP_HP_MUTE_LED_MIC3),
190d0381 8990 SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
5d84b531 8991 SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
d33cd42d 8992 SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
f2be77fe 8993 SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
d296a74b 8994 SND_PCI_QUIRK(0x103c, 0x860f, "HP ZBook 15 G6", ALC285_FIXUP_HP_GPIO_AMP_INIT),
0ac05b25 8995 SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
b2c22910 8996 SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
622464c8 8997 SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
15d295b5 8998 SND_PCI_QUIRK(0x103c, 0x8716, "HP Elite Dragonfly G2 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
61d3e874 8999 SND_PCI_QUIRK(0x103c, 0x8720, "HP EliteBook x360 1040 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
a598098c 9000 SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
c058493d 9001 SND_PCI_QUIRK(0x103c, 0x8728, "HP EliteBook 840 G7", ALC285_FIXUP_HP_GPIO_LED),
b2c22910 9002 SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
75b62ab6 9003 SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
05ec7161 9004 SND_PCI_QUIRK(0x103c, 0x8735, "HP ProBook 435 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
56496253 9005 SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
08befca4 9006 SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
431e76c3 9007 SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
24164f43 9008 SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
91bc1568
JS
9009 SND_PCI_QUIRK(0x103c, 0x8780, "HP ZBook Fury 17 G7 Mobile Workstation",
9010 ALC285_FIXUP_HP_GPIO_AMP_INIT),
9011 SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation",
9012 ALC285_FIXUP_HP_GPIO_AMP_INIT),
375f8426 9013 SND_PCI_QUIRK(0x103c, 0x8788, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
48422958 9014 SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
e7d66cf7 9015 SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
2b70b264 9016 SND_PCI_QUIRK(0x103c, 0x87e7, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
fb3acdb2 9017 SND_PCI_QUIRK(0x103c, 0x87f1, "HP ProBook 630 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
417eadfd 9018 SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
a0ccbc53
KY
9019 SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
9020 SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
93ab3eaf 9021 SND_PCI_QUIRK(0x103c, 0x87f6, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
c3bb2b52 9022 SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
d07149ab 9023 SND_PCI_QUIRK(0x103c, 0x8805, "HP ProBook 650 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
dfc2e8ae 9024 SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
d94befbb
DB
9025 SND_PCI_QUIRK(0x103c, 0x8811, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9026 SND_PCI_QUIRK(0x103c, 0x8812, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
53b861be 9027 SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
c3d2c882 9028 SND_PCI_QUIRK(0x103c, 0x8847, "HP EliteBook x360 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
dfb06401 9029 SND_PCI_QUIRK(0x103c, 0x884b, "HP EliteBook 840 Aero G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
ca688339 9030 SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
8903376d
KHF
9031 SND_PCI_QUIRK(0x103c, 0x8862, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9032 SND_PCI_QUIRK(0x103c, 0x8863, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
50dbfae9 9033 SND_PCI_QUIRK(0x103c, 0x886d, "HP ZBook Fury 17.3 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
e650c1a9 9034 SND_PCI_QUIRK(0x103c, 0x8870, "HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
bbe183e0 9035 SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
600dd2a7 9036 SND_PCI_QUIRK(0x103c, 0x888d, "HP ZBook Power 15.6 inch G8 Mobile Workstation PC", ALC236_FIXUP_HP_GPIO_LED),
91502a9a 9037 SND_PCI_QUIRK(0x103c, 0x8895, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED),
0e68c4b1 9038 SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
bd15b155 9039 SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
42334fbc 9040 SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED),
5f5d8890
AC
9041 SND_PCI_QUIRK(0x103c, 0x896e, "HP EliteBook x360 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9042 SND_PCI_QUIRK(0x103c, 0x8971, "HP EliteBook 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9043 SND_PCI_QUIRK(0x103c, 0x8972, "HP EliteBook 840 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9044 SND_PCI_QUIRK(0x103c, 0x8973, "HP EliteBook 860 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9045 SND_PCI_QUIRK(0x103c, 0x8974, "HP EliteBook 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9046 SND_PCI_QUIRK(0x103c, 0x8975, "HP EliteBook x360 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
07bcab93
LT
9047 SND_PCI_QUIRK(0x103c, 0x8981, "HP Elite Dragonfly G3", ALC245_FIXUP_CS35L41_SPI_4),
9048 SND_PCI_QUIRK(0x103c, 0x898e, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
9049 SND_PCI_QUIRK(0x103c, 0x898f, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
b3fbe536 9050 SND_PCI_QUIRK(0x103c, 0x8991, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
07bcab93 9051 SND_PCI_QUIRK(0x103c, 0x8992, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2),
b3fbe536 9052 SND_PCI_QUIRK(0x103c, 0x8994, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
07bcab93 9053 SND_PCI_QUIRK(0x103c, 0x8995, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2),
e6194c8d
AC
9054 SND_PCI_QUIRK(0x103c, 0x89a4, "HP ProBook 440 G9", ALC236_FIXUP_HP_GPIO_LED),
9055 SND_PCI_QUIRK(0x103c, 0x89a6, "HP ProBook 450 G9", ALC236_FIXUP_HP_GPIO_LED),
024a7ad9 9056 SND_PCI_QUIRK(0x103c, 0x89aa, "HP EliteBook 630 G9", ALC236_FIXUP_HP_GPIO_LED),
e6194c8d
AC
9057 SND_PCI_QUIRK(0x103c, 0x89ac, "HP EliteBook 640 G9", ALC236_FIXUP_HP_GPIO_LED),
9058 SND_PCI_QUIRK(0x103c, 0x89ae, "HP EliteBook 650 G9", ALC236_FIXUP_HP_GPIO_LED),
07bcab93 9059 SND_PCI_QUIRK(0x103c, 0x89c3, "Zbook Studio G9", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
ce18f905 9060 SND_PCI_QUIRK(0x103c, 0x89c6, "Zbook Fury 17 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
f7ac570d 9061 SND_PCI_QUIRK(0x103c, 0x89ca, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
c1732ede 9062 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
7bba2157 9063 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
3e0d611b 9064 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9cf6533e 9065 SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
c1732ede 9066 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
4eab0ea1 9067 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
3e0d611b 9068 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4eab0ea1 9069 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
3cd0ed63 9070 SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
5cfca596 9071 SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
4eab0ea1
TI
9072 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
9073 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
c1732ede 9074 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
3cd0ed63 9075 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
c1732ede 9076 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
2cede303 9077 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
23870831 9078 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
3e0d611b 9079 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
8eedd3a7 9080 SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
48e01504 9081 SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
739d0959 9082 SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
3cd0ed63 9083 SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
8c8967a7 9084 SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
4963d66b 9085 SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
158ae2f5 9086 SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
4fad4fb9 9087 SND_PCI_QUIRK(0x1043, 0x1970, "ASUS UX550VE", ALC289_FIXUP_ASUS_GA401),
5de3b943 9088 SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE),
8b33a134 9089 SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
7900e817 9090 SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
017f2a10 9091 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
28e8af8a 9092 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
1b94e59d 9093 SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
693b613d 9094 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
615966ad 9095 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
4eab0ea1 9096 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
c1732ede 9097 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
ef9ce66f 9098 SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
4b43d05a 9099 SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
c1b55029 9100 SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
76fae618 9101 SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
293a92c1 9102 SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
b7557267 9103 SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401),
94db9cc8 9104 SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
eeed4cd1 9105 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
adabb3ec
TI
9106 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
9107 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
9108 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
9109 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
d240d1dc 9110 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
1d045db9
TI
9111 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
9112 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
9113 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
e9bd7d5c 9114 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
cab561f8
TI
9115 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
9116 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
24519911 9117 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
4df3fd17 9118 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
cc7016ab 9119 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
fdcc968a 9120 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
c656f747 9121 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
2041d564 9122 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
b84e8436 9123 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
c656f747 9124 SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
6fa38ef1 9125 SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
ce2e79b2
PH
9126 SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
9127 SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
0fca97a2 9128 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
a33cc48d 9129 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
14425f1f
MP
9130 SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
9131 SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
f70fff83 9132 SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
8bcea6cb 9133 SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
823ff161 9134 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
568e4e82 9135 SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
c656f747 9136 SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
ef248d9b 9137 SND_PCI_QUIRK(0x144d, 0xc832, "Samsung Galaxy Book Flex Alpha (NP730QCJ)", ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
abaa2274
AA
9138 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
9139 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
8cd65271 9140 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
6ca653e3 9141 SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK),
b5acfe15 9142 SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
745f260b 9143 SND_PCI_QUIRK(0x1558, 0x1325, "Clevo N15[01][CW]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15
PH
9144 SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9145 SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9146 SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9147 SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9148 SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9149 SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9150 SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9151 SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9152 SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9153 SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1278cc5a
JS
9154 SND_PCI_QUIRK(0x1558, 0x5015, "Clevo NH5[58]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9155 SND_PCI_QUIRK(0x1558, 0x5017, "Clevo NH7[79]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15
PH
9156 SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9157 SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9158 SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9159 SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9160 SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1278cc5a
JS
9161 SND_PCI_QUIRK(0x1558, 0x50e1, "Clevo NH5[58]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9162 SND_PCI_QUIRK(0x1558, 0x50e2, "Clevo NH7[79]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15 9163 SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1d5cfca2 9164 SND_PCI_QUIRK(0x1558, 0x50f2, "Clevo NH50E[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15 9165 SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1d5cfca2
PH
9166 SND_PCI_QUIRK(0x1558, 0x50f5, "Clevo NH55EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9167 SND_PCI_QUIRK(0x1558, 0x50f6, "Clevo NH55DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15
PH
9168 SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9169 SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9170 SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9171 SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9172 SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1d5cfca2
PH
9173 SND_PCI_QUIRK(0x1558, 0x70f2, "Clevo NH79EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9174 SND_PCI_QUIRK(0x1558, 0x70f3, "Clevo NH77DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9175 SND_PCI_QUIRK(0x1558, 0x70f4, "Clevo NH77EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9176 SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15
PH
9177 SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9178 SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9179 SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9180 SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9181 SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
745f260b
WS
9182 SND_PCI_QUIRK(0x1558, 0x8550, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9183 SND_PCI_QUIRK(0x1558, 0x8551, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9184 SND_PCI_QUIRK(0x1558, 0x8560, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
9185 SND_PCI_QUIRK(0x1558, 0x8561, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
9186 SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[57][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
b5acfe15 9187 SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9cb72750 9188 SND_PCI_QUIRK(0x1558, 0x866d, "Clevo NP5[05]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
86222af0 9189 SND_PCI_QUIRK(0x1558, 0x867c, "Clevo NP7[01]PNP", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
0c20fce1 9190 SND_PCI_QUIRK(0x1558, 0x867d, "Clevo NP7[01]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15 9191 SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
edca7cc4 9192 SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME),
b5acfe15
PH
9193 SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9194 SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9195 SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9196 SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1d5cfca2 9197 SND_PCI_QUIRK(0x1558, 0x9600, "Clevo N960K[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15
PH
9198 SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9199 SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
745f260b
WS
9200 SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL5[03]RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9201 SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL50NU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1d5cfca2
PH
9202 SND_PCI_QUIRK(0x1558, 0xb018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9203 SND_PCI_QUIRK(0x1558, 0xb019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9204 SND_PCI_QUIRK(0x1558, 0xb022, "Clevo NH77D[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9205 SND_PCI_QUIRK(0x1558, 0xc018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9206 SND_PCI_QUIRK(0x1558, 0xc019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9207 SND_PCI_QUIRK(0x1558, 0xc022, "Clevo NH77[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
ca169cc2 9208 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
29c8f40b 9209 SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
1d045db9
TI
9210 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
9211 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
9212 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
9213 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
9214 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
f552ff54 9215 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
b590b38c 9216 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
c8415a48 9217 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
4407be6b 9218 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
108cc108 9219 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
aaedfb47 9220 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
9a811230 9221 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
1c37c223 9222 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
a12137e7 9223 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
59a51a6b 9224 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
6d16941a 9225 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
7c21539c 9226 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
a4a9e082 9227 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
b6903c0e 9228 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
d05ea7da 9229 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
c0278669 9230 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
61fcf8ec
KY
9231 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9232 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
dab38e43 9233 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
c636b95e 9234 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
61fcf8ec
KY
9235 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
9236 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9237 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
e4c07b3b 9238 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
61fcf8ec
KY
9239 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9240 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9241 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
85981dfd 9242 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9774dc21 9243 SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
ca707b3f 9244 SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
446b8185
KY
9245 SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
9246 SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
ae7abe36
SB
9247 SND_PCI_QUIRK(0x17aa, 0x22f1, "Thinkpad", ALC287_FIXUP_CS35L41_I2C_2),
9248 SND_PCI_QUIRK(0x17aa, 0x22f2, "Thinkpad", ALC287_FIXUP_CS35L41_I2C_2),
9249 SND_PCI_QUIRK(0x17aa, 0x22f3, "Thinkpad", ALC287_FIXUP_CS35L41_I2C_2),
3694cb29 9250 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
6ef2f68f 9251 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
f33f79f3 9252 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
bef33e19 9253 SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
e41fc8c5 9254 SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
65811834 9255 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
8da5bbfc 9256 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
2a36c16e 9257 SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
8a6c55d0
AM
9258 SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
9259 SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
e4efa826 9260 SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
2aac550d 9261 SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
f86de9b1 9262 SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940", ALC298_FIXUP_LENOVO_SPK_VOLUME),
2aac550d 9263 SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
3b79954f 9264 SND_PCI_QUIRK(0x17aa, 0x3820, "Yoga Duet 7 13ITL6", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
8f4c9042 9265 SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
2aac550d 9266 SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
b81e9e5c 9267 SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
c07f2c7b 9268 SND_PCI_QUIRK(0x17aa, 0x383d, "Legion Y9000X 2019", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
9ebaef05 9269 SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
d3dca026 9270 SND_PCI_QUIRK(0x17aa, 0x3847, "Legion 7 16ACHG6", ALC287_FIXUP_LEGION_16ACHG6),
2aac550d 9271 SND_PCI_QUIRK(0x17aa, 0x384a, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
ad7cc2d4
CB
9272 SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
9273 SND_PCI_QUIRK(0x17aa, 0x3853, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
56f27013 9274 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
fedb2245 9275 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
56df90b6 9276 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
f552ff54 9277 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
a4a9e082 9278 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
1bb3e062 9279 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
c497d9f9 9280 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
cd5302c0 9281 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
f2aa1110 9282 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
80b311d3 9283 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
09ea9976 9284 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
037e1197 9285 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
23adc192 9286 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
0f087ee3 9287 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
9cd25743 9288 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
0f087ee3 9289 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
61fcf8ec
KY
9290 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9291 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9292 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
264fb034 9293 SND_PCI_QUIRK(0x17aa, 0x508b, "Thinkpad X12 Gen 1", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
cd5302c0 9294 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
61fcf8ec
KY
9295 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9296 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
1d045db9 9297 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
174a7fb3 9298 SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_NO_AUDIO_JACK),
0fbf21c3 9299 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
f1ec5be1
HC
9300 SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
9301 SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
9302 SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
02b504d9 9303 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
c656f747
TI
9304 SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
9305 SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
619764cc 9306 SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_SET_COEF_DEFAULTS),
8b3b2392
WS
9307 SND_PCI_QUIRK(0x1d05, 0x1096, "TongFang GMxMRxx", ALC269_FIXUP_NO_SHUTUP),
9308 SND_PCI_QUIRK(0x1d05, 0x1100, "TongFang GKxNRxx", ALC269_FIXUP_NO_SHUTUP),
9309 SND_PCI_QUIRK(0x1d05, 0x1111, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
9310 SND_PCI_QUIRK(0x1d05, 0x1119, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
9311 SND_PCI_QUIRK(0x1d05, 0x1129, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
9312 SND_PCI_QUIRK(0x1d05, 0x1147, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
9313 SND_PCI_QUIRK(0x1d05, 0x115c, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
9314 SND_PCI_QUIRK(0x1d05, 0x121b, "TongFang GMxAGxx", ALC269_FIXUP_NO_SHUTUP),
fc19d559 9315 SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
b95bc12e 9316 SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
695d1ec3 9317 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
e1c86210 9318 SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
d1ee66c5 9319 SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
e2d2fded 9320 SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
73e7161e 9321 SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
309d7363 9322 SND_PCI_QUIRK(0xf111, 0x0001, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
a4297b5d 9323
a7f3eedc 9324#if 0
a4297b5d
TI
9325 /* Below is a quirk table taken from the old code.
9326 * Basically the device should work as is without the fixup table.
9327 * If BIOS doesn't give a proper info, enable the corresponding
9328 * fixup entry.
7d7eb9ea 9329 */
a4297b5d
TI
9330 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
9331 ALC269_FIXUP_AMIC),
9332 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
a4297b5d
TI
9333 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
9334 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
9335 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
9336 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
9337 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
9338 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
9339 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
9340 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
9341 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
9342 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
9343 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
9344 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
9345 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
9346 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
9347 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
9348 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
9349 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
9350 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
9351 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
9352 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
9353 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
9354 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
9355 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
9356 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
9357 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
9358 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
9359 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
9360 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
9361 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
9362 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
9363 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
9364 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
9365 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
9366 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
9367 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
9368 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
9369 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
9370 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
9371#endif
9372 {}
9373};
9374
214eef76
DH
9375static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
9376 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
9377 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
9378 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
9379 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
0fbf21c3 9380 SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
214eef76
DH
9381 {}
9382};
9383
1727a771 9384static const struct hda_model_fixup alc269_fixup_models[] = {
a4297b5d
TI
9385 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
9386 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
6e72aa5f
TI
9387 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
9388 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
9389 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
7c478f03 9390 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
b016951e
TI
9391 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
9392 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
108cc108 9393 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
b590b38c 9394 {.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
9f5c6faf 9395 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
04d5466a 9396 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
e32aa85a
DH
9397 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
9398 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
a26d96c7
TI
9399 {.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
9400 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
be8ef16a 9401 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
0202e99c 9402 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
1c37c223 9403 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
9a811230 9404 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
c636b95e 9405 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
399c01aa 9406 {.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
a26d96c7 9407 {.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
ba90d6a6 9408 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
28d1d6d2 9409 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
a26d96c7
TI
9410 {.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
9411 {.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
9412 {.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
9413 {.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
9414 {.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
9415 {.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
9416 {.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
9417 {.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
9418 {.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
9419 {.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
9420 {.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
9421 {.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
9422 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
9423 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
9424 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
9425 {.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
9426 {.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
9427 {.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
9428 {.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
9429 {.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
9430 {.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
9431 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
9432 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
9433 {.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
9434 {.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
9435 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
9436 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
9437 {.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
9438 {.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
9439 {.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
9440 {.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
9441 {.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
9442 {.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
9443 {.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
9444 {.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
9445 {.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
9446 {.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
9447 {.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
9448 {.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
9449 {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
b3802783 9450 {.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
a26d96c7 9451 {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
c8426b27 9452 {.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"},
a26d96c7
TI
9453 {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
9454 {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
9455 {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
9456 {.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
9457 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
9458 {.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
9459 {.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
9460 {.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
9461 {.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
9462 {.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
9463 {.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
9464 {.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
9465 {.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
9466 {.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
a26d96c7
TI
9467 {.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
9468 {.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
9469 {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
82aa0d7e 9470 {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
a26d96c7 9471 {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
d2cd795c 9472 {.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
a26d96c7
TI
9473 {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
9474 {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
9475 {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
9476 {.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
9477 {.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
9478 {.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
9479 {.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
9480 {.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
9481 {.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
9482 {.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
9483 {.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
9484 {.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
9485 {.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
9486 {.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
9487 {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
9488 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
9489 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
8983eb60
KY
9490 {.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
9491 {.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
e2a829b3 9492 {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
a2ef03fe 9493 {.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
bd9c10bc 9494 {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
23dc9586 9495 {.id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc298-samsung-headphone"},
ef248d9b 9496 {.id = ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc256-samsung-headphone"},
fc19d559 9497 {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
13468bfa 9498 {.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
c3bb2b52 9499 {.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
5d84b531 9500 {.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
f2be77fe 9501 {.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
d94befbb 9502 {.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"},
9ebaef05 9503 {.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
29c8f40b 9504 {.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
57c9e21a 9505 {.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
aa723946 9506 {.id = ALC285_FIXUP_HP_GPIO_AMP_INIT, .name = "alc285-hp-amp-init"},
1d045db9 9507 {}
6dda9f4a 9508};
cfc5a845 9509#define ALC225_STANDARD_PINS \
cfc5a845 9510 {0x21, 0x04211020}
6dda9f4a 9511
e8191a8e
HW
9512#define ALC256_STANDARD_PINS \
9513 {0x12, 0x90a60140}, \
9514 {0x14, 0x90170110}, \
e8191a8e
HW
9515 {0x21, 0x02211020}
9516
fea185e2 9517#define ALC282_STANDARD_PINS \
11580297 9518 {0x14, 0x90170110}
e1e62b98 9519
fea185e2 9520#define ALC290_STANDARD_PINS \
11580297 9521 {0x12, 0x99a30130}
fea185e2
DH
9522
9523#define ALC292_STANDARD_PINS \
9524 {0x14, 0x90170110}, \
11580297 9525 {0x15, 0x0221401f}
977e6276 9526
3f640970
HW
9527#define ALC295_STANDARD_PINS \
9528 {0x12, 0xb7a60130}, \
9529 {0x14, 0x90170110}, \
3f640970
HW
9530 {0x21, 0x04211020}
9531
703867e2
WS
9532#define ALC298_STANDARD_PINS \
9533 {0x12, 0x90a60130}, \
9534 {0x21, 0x03211020}
9535
e1918938 9536static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
8a328ac1
KY
9537 SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
9538 {0x14, 0x01014020},
9539 {0x17, 0x90170110},
9540 {0x18, 0x02a11030},
9541 {0x19, 0x0181303F},
9542 {0x21, 0x0221102f}),
5824ce8d
CC
9543 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
9544 {0x12, 0x90a601c0},
9545 {0x14, 0x90171120},
9546 {0x21, 0x02211030}),
615966ad
CC
9547 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9548 {0x14, 0x90170110},
9549 {0x1b, 0x90a70130},
9550 {0x21, 0x03211020}),
9551 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9552 {0x1a, 0x90a70130},
9553 {0x1b, 0x90170110},
9554 {0x21, 0x03211020}),
2ae95577 9555 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
cfc5a845 9556 ALC225_STANDARD_PINS,
8a132099 9557 {0x12, 0xb7a60130},
cfc5a845 9558 {0x14, 0x901701a0}),
2ae95577 9559 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
cfc5a845 9560 ALC225_STANDARD_PINS,
8a132099 9561 {0x12, 0xb7a60130},
cfc5a845 9562 {0x14, 0x901701b0}),
8a132099
HW
9563 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9564 ALC225_STANDARD_PINS,
9565 {0x12, 0xb7a60150},
9566 {0x14, 0x901701a0}),
9567 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9568 ALC225_STANDARD_PINS,
9569 {0x12, 0xb7a60150},
9570 {0x14, 0x901701b0}),
9571 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9572 ALC225_STANDARD_PINS,
9573 {0x12, 0xb7a60130},
9574 {0x1b, 0x90170110}),
0ce48e17
KHF
9575 SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9576 {0x1b, 0x01111010},
9577 {0x1e, 0x01451130},
9578 {0x21, 0x02211020}),
986376b6
HW
9579 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
9580 {0x12, 0x90a60140},
9581 {0x14, 0x90170110},
9582 {0x19, 0x02a11030},
9583 {0x21, 0x02211020}),
e41fc8c5
HW
9584 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9585 {0x14, 0x90170110},
9586 {0x19, 0x02a11030},
9587 {0x1a, 0x02a11040},
9588 {0x1b, 0x01014020},
9589 {0x21, 0x0221101f}),
d06fb562
HW
9590 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9591 {0x14, 0x90170110},
9592 {0x19, 0x02a11030},
9593 {0x1a, 0x02a11040},
9594 {0x1b, 0x01011020},
9595 {0x21, 0x0221101f}),
c6b17f10
HW
9596 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9597 {0x14, 0x90170110},
9598 {0x19, 0x02a11020},
9599 {0x1a, 0x02a11030},
9600 {0x21, 0x0221101f}),
92666d45
KY
9601 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
9602 {0x21, 0x02211010}),
9e885770
KY
9603 SND_HDA_PIN_QUIRK(0x10ec0236, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
9604 {0x14, 0x90170110},
9605 {0x19, 0x02a11020},
9606 {0x21, 0x02211030}),
c77900e6 9607 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
c77900e6 9608 {0x14, 0x90170110},
c77900e6 9609 {0x21, 0x02211020}),
86c72d1c
HW
9610 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9611 {0x14, 0x90170130},
9612 {0x21, 0x02211040}),
76c2132e
DH
9613 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9614 {0x12, 0x90a60140},
9615 {0x14, 0x90170110},
76c2132e
DH
9616 {0x21, 0x02211020}),
9617 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9618 {0x12, 0x90a60160},
9619 {0x14, 0x90170120},
76c2132e 9620 {0x21, 0x02211030}),
392c9da2
HW
9621 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9622 {0x14, 0x90170110},
9623 {0x1b, 0x02011020},
9624 {0x21, 0x0221101f}),
6aecd871
HW
9625 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9626 {0x14, 0x90170110},
9627 {0x1b, 0x01011020},
9628 {0x21, 0x0221101f}),
cba59972 9629 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
cba59972 9630 {0x14, 0x90170130},
cba59972 9631 {0x1b, 0x01014020},
cba59972 9632 {0x21, 0x0221103f}),
6aecd871
HW
9633 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9634 {0x14, 0x90170130},
9635 {0x1b, 0x01011020},
9636 {0x21, 0x0221103f}),
59ec4b57
HW
9637 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9638 {0x14, 0x90170130},
9639 {0x1b, 0x02011020},
9640 {0x21, 0x0221103f}),
e9c28e16 9641 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
e9c28e16 9642 {0x14, 0x90170150},
e9c28e16 9643 {0x1b, 0x02011020},
e9c28e16
WS
9644 {0x21, 0x0221105f}),
9645 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
e9c28e16 9646 {0x14, 0x90170110},
e9c28e16 9647 {0x1b, 0x01014020},
e9c28e16 9648 {0x21, 0x0221101f}),
76c2132e
DH
9649 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9650 {0x12, 0x90a60160},
9651 {0x14, 0x90170120},
9652 {0x17, 0x90170140},
76c2132e
DH
9653 {0x21, 0x0321102f}),
9654 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9655 {0x12, 0x90a60160},
9656 {0x14, 0x90170130},
76c2132e
DH
9657 {0x21, 0x02211040}),
9658 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9659 {0x12, 0x90a60160},
9660 {0x14, 0x90170140},
76c2132e
DH
9661 {0x21, 0x02211050}),
9662 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9663 {0x12, 0x90a60170},
9664 {0x14, 0x90170120},
76c2132e
DH
9665 {0x21, 0x02211030}),
9666 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9667 {0x12, 0x90a60170},
9668 {0x14, 0x90170130},
76c2132e 9669 {0x21, 0x02211040}),
0a1f90a9
HW
9670 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9671 {0x12, 0x90a60170},
9672 {0x14, 0x90171130},
9673 {0x21, 0x02211040}),
70658b99 9674 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
70658b99
HW
9675 {0x12, 0x90a60170},
9676 {0x14, 0x90170140},
70658b99 9677 {0x21, 0x02211050}),
9b5a4e39 9678 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9b5a4e39
DH
9679 {0x12, 0x90a60180},
9680 {0x14, 0x90170130},
9b5a4e39 9681 {0x21, 0x02211040}),
f90d83b3
AK
9682 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9683 {0x12, 0x90a60180},
9684 {0x14, 0x90170120},
9685 {0x21, 0x02211030}),
989dbe4a
HW
9686 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9687 {0x1b, 0x01011020},
9688 {0x21, 0x02211010}),
c1732ede
CC
9689 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
9690 {0x14, 0x90170110},
9691 {0x1b, 0x90a70130},
9692 {0x21, 0x04211020}),
9693 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
9694 {0x14, 0x90170110},
9695 {0x1b, 0x90a70130},
9696 {0x21, 0x03211020}),
a806ef1c
CC
9697 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
9698 {0x12, 0x90a60130},
9699 {0x14, 0x90170110},
9700 {0x21, 0x03211020}),
6ac371aa
JHP
9701 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
9702 {0x12, 0x90a60130},
9703 {0x14, 0x90170110},
9704 {0x21, 0x04211020}),
e1037354
JHP
9705 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
9706 {0x1a, 0x90a70130},
9707 {0x1b, 0x90170110},
9708 {0x21, 0x03211020}),
9e885770
KY
9709 SND_HDA_PIN_QUIRK(0x10ec0256, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
9710 {0x14, 0x90170110},
9711 {0x19, 0x02a11020},
9712 {0x21, 0x0221101f}),
8a8de09c
KY
9713 SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
9714 {0x17, 0x90170110},
9715 {0x19, 0x03a11030},
9716 {0x21, 0x03211020}),
cf51eb9d
DH
9717 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
9718 {0x12, 0x90a60130},
cf51eb9d
DH
9719 {0x14, 0x90170110},
9720 {0x15, 0x0421101f},
11580297 9721 {0x1a, 0x04a11020}),
0279661b
HW
9722 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
9723 {0x12, 0x90a60140},
0279661b
HW
9724 {0x14, 0x90170110},
9725 {0x15, 0x0421101f},
0279661b 9726 {0x18, 0x02811030},
0279661b 9727 {0x1a, 0x04a1103f},
11580297 9728 {0x1b, 0x02011020}),
42304474 9729 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9730 ALC282_STANDARD_PINS,
42304474 9731 {0x12, 0x99a30130},
42304474 9732 {0x19, 0x03a11020},
42304474 9733 {0x21, 0x0321101f}),
2c609999 9734 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9735 ALC282_STANDARD_PINS,
2c609999 9736 {0x12, 0x99a30130},
2c609999 9737 {0x19, 0x03a11020},
2c609999
HW
9738 {0x21, 0x03211040}),
9739 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9740 ALC282_STANDARD_PINS,
2c609999 9741 {0x12, 0x99a30130},
2c609999 9742 {0x19, 0x03a11030},
2c609999
HW
9743 {0x21, 0x03211020}),
9744 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9745 ALC282_STANDARD_PINS,
2c609999 9746 {0x12, 0x99a30130},
2c609999 9747 {0x19, 0x04a11020},
2c609999 9748 {0x21, 0x0421101f}),
200afc09 9749 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
aec856d0 9750 ALC282_STANDARD_PINS,
200afc09 9751 {0x12, 0x90a60140},
200afc09 9752 {0x19, 0x04a11030},
200afc09 9753 {0x21, 0x04211020}),
34cdf405
CC
9754 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
9755 ALC282_STANDARD_PINS,
9756 {0x12, 0x90a609c0},
9757 {0x18, 0x03a11830},
9758 {0x19, 0x04a19831},
9759 {0x1a, 0x0481303f},
9760 {0x1b, 0x04211020},
9761 {0x21, 0x0321101f}),
9762 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
9763 ALC282_STANDARD_PINS,
9764 {0x12, 0x90a60940},
9765 {0x18, 0x03a11830},
9766 {0x19, 0x04a19831},
9767 {0x1a, 0x0481303f},
9768 {0x1b, 0x04211020},
9769 {0x21, 0x0321101f}),
76c2132e 9770 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 9771 ALC282_STANDARD_PINS,
76c2132e 9772 {0x12, 0x90a60130},
76c2132e
DH
9773 {0x21, 0x0321101f}),
9774 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9775 {0x12, 0x90a60160},
9776 {0x14, 0x90170120},
76c2132e 9777 {0x21, 0x02211030}),
bc262179 9778 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 9779 ALC282_STANDARD_PINS,
bc262179 9780 {0x12, 0x90a60130},
bc262179 9781 {0x19, 0x03a11020},
bc262179 9782 {0x21, 0x0321101f}),
c8c6ee61 9783 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
266fd994
SL
9784 {0x12, 0x90a60130},
9785 {0x14, 0x90170110},
9786 {0x19, 0x04a11040},
9787 {0x21, 0x04211020}),
9788 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
9789 {0x14, 0x90170110},
9790 {0x19, 0x04a11040},
9791 {0x1d, 0x40600001},
9792 {0x21, 0x04211020}),
9793 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
c4cfcf6f
HW
9794 {0x14, 0x90170110},
9795 {0x19, 0x04a11040},
9796 {0x21, 0x04211020}),
c72b9bfe
HW
9797 SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9798 {0x14, 0x90170110},
9799 {0x17, 0x90170111},
9800 {0x19, 0x03a11030},
9801 {0x21, 0x03211020}),
33aaebd4
CC
9802 SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
9803 {0x12, 0x90a60130},
9804 {0x17, 0x90170110},
9805 {0x21, 0x02211020}),
d44a6864 9806 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
e1e62b98 9807 {0x12, 0x90a60120},
e1e62b98 9808 {0x14, 0x90170110},
e1e62b98 9809 {0x21, 0x0321101f}),
e4442bcf 9810 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9811 ALC290_STANDARD_PINS,
e4442bcf 9812 {0x15, 0x04211040},
e4442bcf 9813 {0x18, 0x90170112},
11580297 9814 {0x1a, 0x04a11020}),
e4442bcf 9815 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9816 ALC290_STANDARD_PINS,
e4442bcf 9817 {0x15, 0x04211040},
e4442bcf 9818 {0x18, 0x90170110},
11580297 9819 {0x1a, 0x04a11020}),
e4442bcf 9820 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9821 ALC290_STANDARD_PINS,
e4442bcf 9822 {0x15, 0x0421101f},
11580297 9823 {0x1a, 0x04a11020}),
e4442bcf 9824 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9825 ALC290_STANDARD_PINS,
e4442bcf 9826 {0x15, 0x04211020},
11580297 9827 {0x1a, 0x04a11040}),
e4442bcf 9828 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9829 ALC290_STANDARD_PINS,
e4442bcf
HW
9830 {0x14, 0x90170110},
9831 {0x15, 0x04211020},
11580297 9832 {0x1a, 0x04a11040}),
e4442bcf 9833 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9834 ALC290_STANDARD_PINS,
e4442bcf
HW
9835 {0x14, 0x90170110},
9836 {0x15, 0x04211020},
11580297 9837 {0x1a, 0x04a11020}),
e4442bcf 9838 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9839 ALC290_STANDARD_PINS,
e4442bcf
HW
9840 {0x14, 0x90170110},
9841 {0x15, 0x0421101f},
11580297 9842 {0x1a, 0x04a11020}),
e8818fa8 9843 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
aec856d0 9844 ALC292_STANDARD_PINS,
e8818fa8 9845 {0x12, 0x90a60140},
e8818fa8 9846 {0x16, 0x01014020},
11580297 9847 {0x19, 0x01a19030}),
e8818fa8 9848 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
aec856d0 9849 ALC292_STANDARD_PINS,
e8818fa8 9850 {0x12, 0x90a60140},
e8818fa8
HW
9851 {0x16, 0x01014020},
9852 {0x18, 0x02a19031},
11580297 9853 {0x19, 0x01a1903e}),
76c2132e 9854 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
aec856d0 9855 ALC292_STANDARD_PINS,
11580297 9856 {0x12, 0x90a60140}),
76c2132e 9857 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 9858 ALC292_STANDARD_PINS,
76c2132e 9859 {0x13, 0x90a60140},
76c2132e 9860 {0x16, 0x21014020},
11580297 9861 {0x19, 0x21a19030}),
e03fdbde 9862 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 9863 ALC292_STANDARD_PINS,
11580297 9864 {0x13, 0x90a60140}),
eeacd80f
JHP
9865 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_HPE,
9866 {0x17, 0x90170110},
9867 {0x21, 0x04211020}),
d8ae458e
CC
9868 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
9869 {0x14, 0x90170110},
9870 {0x1b, 0x90a70130},
9871 {0x21, 0x04211020}),
8bb37a2a
JHP
9872 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9873 {0x12, 0x90a60130},
9874 {0x17, 0x90170110},
9875 {0x21, 0x03211020}),
0bea4cc8
JHP
9876 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9877 {0x12, 0x90a60130},
9878 {0x17, 0x90170110},
9879 {0x21, 0x04211020}),
3887c26c
TI
9880 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9881 {0x12, 0x90a60130},
9882 {0x17, 0x90170110},
9883 {0x21, 0x03211020}),
9e43342b 9884 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
ad97d667
JHP
9885 {0x12, 0x90a60120},
9886 {0x17, 0x90170110},
9887 {0x21, 0x04211030}),
9888 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
9e43342b
CC
9889 {0x12, 0x90a60130},
9890 {0x17, 0x90170110},
9891 {0x21, 0x03211020}),
9892 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
9893 {0x12, 0x90a60130},
9894 {0x17, 0x90170110},
9895 {0x21, 0x03211020}),
fbc57129 9896 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
0a29c57b
KY
9897 {0x14, 0x90170110},
9898 {0x21, 0x04211020}),
fbc57129
KY
9899 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9900 {0x14, 0x90170110},
9901 {0x21, 0x04211030}),
3f640970 9902 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
f771d5bb
HW
9903 ALC295_STANDARD_PINS,
9904 {0x17, 0x21014020},
9905 {0x18, 0x21a19030}),
9906 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9907 ALC295_STANDARD_PINS,
9908 {0x17, 0x21014040},
9909 {0x18, 0x21a19050}),
3f307834
HW
9910 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9911 ALC295_STANDARD_PINS),
9f502ff5
TI
9912 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
9913 ALC298_STANDARD_PINS,
9914 {0x17, 0x90170110}),
977e6276 9915 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
703867e2
WS
9916 ALC298_STANDARD_PINS,
9917 {0x17, 0x90170140}),
9918 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
9919 ALC298_STANDARD_PINS,
9f502ff5 9920 {0x17, 0x90170150}),
9f1bc2c4
KHF
9921 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
9922 {0x12, 0xb7a60140},
9923 {0x13, 0xb7a60150},
9924 {0x17, 0x90170110},
9925 {0x1a, 0x03011020},
9926 {0x21, 0x03211030}),
54324221
JM
9927 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
9928 {0x12, 0xb7a60140},
9929 {0x17, 0x90170110},
9930 {0x1a, 0x03a11030},
9931 {0x21, 0x03211020}),
fcc6c877
KY
9932 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9933 ALC225_STANDARD_PINS,
9934 {0x12, 0xb7a60130},
fcc6c877 9935 {0x17, 0x90170110}),
573fcbfd
HW
9936 SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
9937 {0x14, 0x01014010},
9938 {0x17, 0x90170120},
9939 {0x18, 0x02a11030},
9940 {0x19, 0x02a1103f},
9941 {0x21, 0x0221101f}),
e1918938
HW
9942 {}
9943};
6dda9f4a 9944
7c0a6939
HW
9945/* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
9946 * more machines, don't need to match all valid pins, just need to match
9947 * all the pins defined in the tbl. Just because of this reason, it is possible
9948 * that a single machine matches multiple tbls, so there is one limitation:
9949 * at most one tbl is allowed to define for the same vendor and same codec
9950 */
9951static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
9952 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9953 {0x19, 0x40000000},
9954 {0x1b, 0x40000000}),
aed8c7f4
HW
9955 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9956 {0x19, 0x40000000},
9957 {0x1a, 0x40000000}),
d64ebdbf
HW
9958 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9959 {0x19, 0x40000000},
9960 {0x1a, 0x40000000}),
5815bdfd
HW
9961 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
9962 {0x19, 0x40000000},
9963 {0x1a, 0x40000000}),
7c0a6939
HW
9964 {}
9965};
9966
546bb678 9967static void alc269_fill_coef(struct hda_codec *codec)
1d045db9 9968{
526af6eb 9969 struct alc_spec *spec = codec->spec;
1d045db9 9970 int val;
ebb83eeb 9971
526af6eb 9972 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
546bb678 9973 return;
526af6eb 9974
1bb7e43e 9975 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
1d045db9
TI
9976 alc_write_coef_idx(codec, 0xf, 0x960b);
9977 alc_write_coef_idx(codec, 0xe, 0x8817);
9978 }
ebb83eeb 9979
1bb7e43e 9980 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
1d045db9
TI
9981 alc_write_coef_idx(codec, 0xf, 0x960b);
9982 alc_write_coef_idx(codec, 0xe, 0x8814);
9983 }
ebb83eeb 9984
1bb7e43e 9985 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
1d045db9 9986 /* Power up output pin */
98b24883 9987 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
1d045db9 9988 }
ebb83eeb 9989
1bb7e43e 9990 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
1d045db9 9991 val = alc_read_coef_idx(codec, 0xd);
f3ee07d8 9992 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
1d045db9
TI
9993 /* Capless ramp up clock control */
9994 alc_write_coef_idx(codec, 0xd, val | (1<<10));
9995 }
9996 val = alc_read_coef_idx(codec, 0x17);
f3ee07d8 9997 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
1d045db9
TI
9998 /* Class D power on reset */
9999 alc_write_coef_idx(codec, 0x17, val | (1<<7));
10000 }
10001 }
ebb83eeb 10002
98b24883
TI
10003 /* HP */
10004 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
1d045db9 10005}
a7f2371f 10006
1d045db9
TI
10007/*
10008 */
1d045db9
TI
10009static int patch_alc269(struct hda_codec *codec)
10010{
10011 struct alc_spec *spec;
3de95173 10012 int err;
f1d4e28b 10013
3de95173 10014 err = alc_alloc_spec(codec, 0x0b);
e16fb6d1 10015 if (err < 0)
3de95173
TI
10016 return err;
10017
10018 spec = codec->spec;
08c189f2 10019 spec->gen.shared_mic_vref_pin = 0x18;
317d9313 10020 codec->power_save_node = 0;
e16fb6d1 10021
225068ab
TI
10022#ifdef CONFIG_PM
10023 codec->patch_ops.suspend = alc269_suspend;
10024 codec->patch_ops.resume = alc269_resume;
10025#endif
c2d6af53
KY
10026 spec->shutup = alc_default_shutup;
10027 spec->init_hook = alc_default_init;
225068ab 10028
7639a06c 10029 switch (codec->core.vendor_id) {
065380f0 10030 case 0x10ec0269:
1d045db9 10031 spec->codec_variant = ALC269_TYPE_ALC269VA;
1bb7e43e
TI
10032 switch (alc_get_coef0(codec) & 0x00f0) {
10033 case 0x0010:
5100cd07
TI
10034 if (codec->bus->pci &&
10035 codec->bus->pci->subsystem_vendor == 0x1025 &&
e16fb6d1 10036 spec->cdefine.platform_type == 1)
20ca0c35 10037 err = alc_codec_rename(codec, "ALC271X");
1d045db9 10038 spec->codec_variant = ALC269_TYPE_ALC269VB;
1bb7e43e
TI
10039 break;
10040 case 0x0020:
5100cd07
TI
10041 if (codec->bus->pci &&
10042 codec->bus->pci->subsystem_vendor == 0x17aa &&
e16fb6d1 10043 codec->bus->pci->subsystem_device == 0x21f3)
20ca0c35 10044 err = alc_codec_rename(codec, "ALC3202");
1d045db9 10045 spec->codec_variant = ALC269_TYPE_ALC269VC;
1bb7e43e 10046 break;
adcc70b2
KY
10047 case 0x0030:
10048 spec->codec_variant = ALC269_TYPE_ALC269VD;
10049 break;
1bb7e43e 10050 default:
1d045db9 10051 alc_fix_pll_init(codec, 0x20, 0x04, 15);
1bb7e43e 10052 }
e16fb6d1
TI
10053 if (err < 0)
10054 goto error;
c2d6af53 10055 spec->shutup = alc269_shutup;
546bb678 10056 spec->init_hook = alc269_fill_coef;
1d045db9 10057 alc269_fill_coef(codec);
065380f0
KY
10058 break;
10059
10060 case 0x10ec0280:
10061 case 0x10ec0290:
10062 spec->codec_variant = ALC269_TYPE_ALC280;
10063 break;
10064 case 0x10ec0282:
065380f0 10065 spec->codec_variant = ALC269_TYPE_ALC282;
7b5c7a02
KY
10066 spec->shutup = alc282_shutup;
10067 spec->init_hook = alc282_init;
065380f0 10068 break;
2af02be7
KY
10069 case 0x10ec0233:
10070 case 0x10ec0283:
10071 spec->codec_variant = ALC269_TYPE_ALC283;
10072 spec->shutup = alc283_shutup;
10073 spec->init_hook = alc283_init;
10074 break;
065380f0
KY
10075 case 0x10ec0284:
10076 case 0x10ec0292:
10077 spec->codec_variant = ALC269_TYPE_ALC284;
10078 break;
161ebf29 10079 case 0x10ec0293:
4731d5de 10080 spec->codec_variant = ALC269_TYPE_ALC293;
161ebf29 10081 break;
7fc7d047 10082 case 0x10ec0286:
7c665932 10083 case 0x10ec0288:
7fc7d047
KY
10084 spec->codec_variant = ALC269_TYPE_ALC286;
10085 break;
506b62c3
KY
10086 case 0x10ec0298:
10087 spec->codec_variant = ALC269_TYPE_ALC298;
10088 break;
ea04a1db 10089 case 0x10ec0235:
1d04c9de
KY
10090 case 0x10ec0255:
10091 spec->codec_variant = ALC269_TYPE_ALC255;
ab3b8e51
KY
10092 spec->shutup = alc256_shutup;
10093 spec->init_hook = alc256_init;
1d04c9de 10094 break;
1948fc06 10095 case 0x10ec0230:
736f20a7 10096 case 0x10ec0236:
4344aec8
KY
10097 case 0x10ec0256:
10098 spec->codec_variant = ALC269_TYPE_ALC256;
4a219ef8
KY
10099 spec->shutup = alc256_shutup;
10100 spec->init_hook = alc256_init;
7d1b6e29 10101 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
4344aec8 10102 break;
f429e7e4
KY
10103 case 0x10ec0257:
10104 spec->codec_variant = ALC269_TYPE_ALC257;
88d42b2b
KY
10105 spec->shutup = alc256_shutup;
10106 spec->init_hook = alc256_init;
f429e7e4
KY
10107 spec->gen.mixer_nid = 0;
10108 break;
0a6f0600 10109 case 0x10ec0215:
7fbdcd83 10110 case 0x10ec0245:
0a6f0600
KY
10111 case 0x10ec0285:
10112 case 0x10ec0289:
60571929
KY
10113 if (alc_get_coef0(codec) & 0x0010)
10114 spec->codec_variant = ALC269_TYPE_ALC245;
10115 else
10116 spec->codec_variant = ALC269_TYPE_ALC215;
1b6832be
KY
10117 spec->shutup = alc225_shutup;
10118 spec->init_hook = alc225_init;
0a6f0600
KY
10119 spec->gen.mixer_nid = 0;
10120 break;
4231430d 10121 case 0x10ec0225:
7d727869 10122 case 0x10ec0295:
28f1f9b2 10123 case 0x10ec0299:
4231430d 10124 spec->codec_variant = ALC269_TYPE_ALC225;
da911b1f
KY
10125 spec->shutup = alc225_shutup;
10126 spec->init_hook = alc225_init;
c1350bff 10127 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
4231430d 10128 break;
99cee034
KY
10129 case 0x10ec0287:
10130 spec->codec_variant = ALC269_TYPE_ALC287;
10131 spec->shutup = alc225_shutup;
10132 spec->init_hook = alc225_init;
10133 spec->gen.mixer_nid = 0; /* no loopback on ALC287 */
10134 break;
dcd4f0db
KY
10135 case 0x10ec0234:
10136 case 0x10ec0274:
10137 case 0x10ec0294:
10138 spec->codec_variant = ALC269_TYPE_ALC294;
532a7784 10139 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
71683c32 10140 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
693abe11 10141 spec->init_hook = alc294_init;
dcd4f0db 10142 break;
1078bef0
KY
10143 case 0x10ec0300:
10144 spec->codec_variant = ALC269_TYPE_ALC300;
10145 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
dcd4f0db 10146 break;
f0778871
KY
10147 case 0x10ec0623:
10148 spec->codec_variant = ALC269_TYPE_ALC623;
10149 break;
6fbae35a
KY
10150 case 0x10ec0700:
10151 case 0x10ec0701:
10152 case 0x10ec0703:
83629532 10153 case 0x10ec0711:
6fbae35a
KY
10154 spec->codec_variant = ALC269_TYPE_ALC700;
10155 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
2d7fe618 10156 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
693abe11 10157 spec->init_hook = alc294_init;
6fbae35a
KY
10158 break;
10159
1d045db9 10160 }
6dda9f4a 10161
ad60d502 10162 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
97a26570 10163 spec->has_alc5505_dsp = 1;
ad60d502
KY
10164 spec->init_hook = alc5505_dsp_init;
10165 }
10166
c9af753f
TI
10167 alc_pre_init(codec);
10168
efe55732
TI
10169 snd_hda_pick_fixup(codec, alc269_fixup_models,
10170 alc269_fixup_tbl, alc269_fixups);
13d9c6b9
TI
10171 /* FIXME: both TX300 and ROG Strix G17 have the same SSID, and
10172 * the quirk breaks the latter (bko#214101).
10173 * Clear the wrong entry.
10174 */
10175 if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 &&
10176 codec->core.vendor_id == 0x10ec0294) {
10177 codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n");
10178 codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
10179 }
10180
0fc1e447 10181 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
7c0a6939 10182 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
efe55732
TI
10183 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
10184 alc269_fixups);
10185 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
10186
10187 alc_auto_parse_customize_define(codec);
10188
10189 if (has_cdefine_beep(codec))
10190 spec->gen.beep_nid = 0x01;
10191
a4297b5d
TI
10192 /* automatic parse from the BIOS config */
10193 err = alc269_parse_auto_config(codec);
e16fb6d1
TI
10194 if (err < 0)
10195 goto error;
6dda9f4a 10196
fea80fae
TI
10197 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
10198 err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
10199 if (err < 0)
10200 goto error;
10201 }
f1d4e28b 10202
1727a771 10203 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 10204
1d045db9 10205 return 0;
e16fb6d1
TI
10206
10207 error:
10208 alc_free(codec);
10209 return err;
1d045db9 10210}
f1d4e28b 10211
1d045db9
TI
10212/*
10213 * ALC861
10214 */
622e84cd 10215
1d045db9 10216static int alc861_parse_auto_config(struct hda_codec *codec)
6dda9f4a 10217{
1d045db9 10218 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
3e6179b8
TI
10219 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
10220 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
604401a9
TI
10221}
10222
1d045db9
TI
10223/* Pin config fixes */
10224enum {
e652f4c8
TI
10225 ALC861_FIXUP_FSC_AMILO_PI1505,
10226 ALC861_FIXUP_AMP_VREF_0F,
10227 ALC861_FIXUP_NO_JACK_DETECT,
10228 ALC861_FIXUP_ASUS_A6RP,
6ddf0fd1 10229 ALC660_FIXUP_ASUS_W7J,
1d045db9 10230};
7085ec12 10231
31150f23
TI
10232/* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
10233static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
1727a771 10234 const struct hda_fixup *fix, int action)
31150f23
TI
10235{
10236 struct alc_spec *spec = codec->spec;
10237 unsigned int val;
10238
1727a771 10239 if (action != HDA_FIXUP_ACT_INIT)
31150f23 10240 return;
d3f02d60 10241 val = snd_hda_codec_get_pin_target(codec, 0x0f);
31150f23
TI
10242 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
10243 val |= AC_PINCTL_IN_EN;
10244 val |= AC_PINCTL_VREF_50;
cdd03ced 10245 snd_hda_set_pin_ctl(codec, 0x0f, val);
08c189f2 10246 spec->gen.keep_vref_in_automute = 1;
31150f23
TI
10247}
10248
e652f4c8
TI
10249/* suppress the jack-detection */
10250static void alc_fixup_no_jack_detect(struct hda_codec *codec,
1727a771 10251 const struct hda_fixup *fix, int action)
e652f4c8 10252{
1727a771 10253 if (action == HDA_FIXUP_ACT_PRE_PROBE)
e652f4c8 10254 codec->no_jack_detect = 1;
7d7eb9ea 10255}
e652f4c8 10256
1727a771 10257static const struct hda_fixup alc861_fixups[] = {
e652f4c8 10258 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
1727a771
TI
10259 .type = HDA_FIXUP_PINS,
10260 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
10261 { 0x0b, 0x0221101f }, /* HP */
10262 { 0x0f, 0x90170310 }, /* speaker */
10263 { }
10264 }
10265 },
e652f4c8 10266 [ALC861_FIXUP_AMP_VREF_0F] = {
1727a771 10267 .type = HDA_FIXUP_FUNC,
31150f23 10268 .v.func = alc861_fixup_asus_amp_vref_0f,
3b25eb69 10269 },
e652f4c8 10270 [ALC861_FIXUP_NO_JACK_DETECT] = {
1727a771 10271 .type = HDA_FIXUP_FUNC,
e652f4c8
TI
10272 .v.func = alc_fixup_no_jack_detect,
10273 },
10274 [ALC861_FIXUP_ASUS_A6RP] = {
1727a771 10275 .type = HDA_FIXUP_FUNC,
e652f4c8
TI
10276 .v.func = alc861_fixup_asus_amp_vref_0f,
10277 .chained = true,
10278 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
6ddf0fd1
TI
10279 },
10280 [ALC660_FIXUP_ASUS_W7J] = {
10281 .type = HDA_FIXUP_VERBS,
10282 .v.verbs = (const struct hda_verb[]) {
10283 /* ASUS W7J needs a magic pin setup on unused NID 0x10
10284 * for enabling outputs
10285 */
10286 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10287 { }
10288 },
e652f4c8 10289 }
1d045db9 10290};
7085ec12 10291
1d045db9 10292static const struct snd_pci_quirk alc861_fixup_tbl[] = {
6ddf0fd1 10293 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
e7ca237b 10294 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
e652f4c8
TI
10295 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
10296 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
10297 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
defce244 10298 SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F),
e652f4c8 10299 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
1d045db9
TI
10300 {}
10301};
3af9ee6b 10302
1d045db9
TI
10303/*
10304 */
1d045db9 10305static int patch_alc861(struct hda_codec *codec)
7085ec12 10306{
1d045db9 10307 struct alc_spec *spec;
1d045db9 10308 int err;
7085ec12 10309
3de95173
TI
10310 err = alc_alloc_spec(codec, 0x15);
10311 if (err < 0)
10312 return err;
1d045db9 10313
3de95173 10314 spec = codec->spec;
2722b535
TI
10315 if (has_cdefine_beep(codec))
10316 spec->gen.beep_nid = 0x23;
1d045db9 10317
225068ab
TI
10318#ifdef CONFIG_PM
10319 spec->power_hook = alc_power_eapd;
10320#endif
10321
c9af753f
TI
10322 alc_pre_init(codec);
10323
1727a771
TI
10324 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
10325 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
3af9ee6b 10326
cb4e4824
TI
10327 /* automatic parse from the BIOS config */
10328 err = alc861_parse_auto_config(codec);
e16fb6d1
TI
10329 if (err < 0)
10330 goto error;
3af9ee6b 10331
fea80fae
TI
10332 if (!spec->gen.no_analog) {
10333 err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
10334 if (err < 0)
10335 goto error;
10336 }
7085ec12 10337
1727a771 10338 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 10339
1d045db9 10340 return 0;
e16fb6d1
TI
10341
10342 error:
10343 alc_free(codec);
10344 return err;
7085ec12
TI
10345}
10346
1d045db9
TI
10347/*
10348 * ALC861-VD support
10349 *
10350 * Based on ALC882
10351 *
10352 * In addition, an independent DAC
10353 */
1d045db9 10354static int alc861vd_parse_auto_config(struct hda_codec *codec)
bc9f98a9 10355{
1d045db9 10356 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
3e6179b8
TI
10357 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
10358 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
ce764ab2
TI
10359}
10360
1d045db9 10361enum {
8fdcb6fe
TI
10362 ALC660VD_FIX_ASUS_GPIO1,
10363 ALC861VD_FIX_DALLAS,
1d045db9 10364};
ce764ab2 10365
8fdcb6fe
TI
10366/* exclude VREF80 */
10367static void alc861vd_fixup_dallas(struct hda_codec *codec,
1727a771 10368 const struct hda_fixup *fix, int action)
8fdcb6fe 10369{
1727a771 10370 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
b78562b1
TI
10371 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
10372 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
8fdcb6fe
TI
10373 }
10374}
10375
df73d83f
TI
10376/* reset GPIO1 */
10377static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
10378 const struct hda_fixup *fix, int action)
10379{
10380 struct alc_spec *spec = codec->spec;
10381
10382 if (action == HDA_FIXUP_ACT_PRE_PROBE)
10383 spec->gpio_mask |= 0x02;
10384 alc_fixup_gpio(codec, action, 0x01);
10385}
10386
1727a771 10387static const struct hda_fixup alc861vd_fixups[] = {
1d045db9 10388 [ALC660VD_FIX_ASUS_GPIO1] = {
df73d83f
TI
10389 .type = HDA_FIXUP_FUNC,
10390 .v.func = alc660vd_fixup_asus_gpio1,
1d045db9 10391 },
8fdcb6fe 10392 [ALC861VD_FIX_DALLAS] = {
1727a771 10393 .type = HDA_FIXUP_FUNC,
8fdcb6fe
TI
10394 .v.func = alc861vd_fixup_dallas,
10395 },
1d045db9 10396};
ce764ab2 10397
1d045db9 10398static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
8fdcb6fe 10399 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
1d045db9 10400 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
8fdcb6fe 10401 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
1d045db9
TI
10402 {}
10403};
ce764ab2 10404
1d045db9
TI
10405/*
10406 */
1d045db9 10407static int patch_alc861vd(struct hda_codec *codec)
ce764ab2 10408{
1d045db9 10409 struct alc_spec *spec;
cb4e4824 10410 int err;
ce764ab2 10411
3de95173
TI
10412 err = alc_alloc_spec(codec, 0x0b);
10413 if (err < 0)
10414 return err;
1d045db9 10415
3de95173 10416 spec = codec->spec;
2722b535
TI
10417 if (has_cdefine_beep(codec))
10418 spec->gen.beep_nid = 0x23;
1d045db9 10419
225068ab
TI
10420 spec->shutup = alc_eapd_shutup;
10421
c9af753f
TI
10422 alc_pre_init(codec);
10423
1727a771
TI
10424 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
10425 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1d045db9 10426
cb4e4824
TI
10427 /* automatic parse from the BIOS config */
10428 err = alc861vd_parse_auto_config(codec);
e16fb6d1
TI
10429 if (err < 0)
10430 goto error;
ce764ab2 10431
fea80fae
TI
10432 if (!spec->gen.no_analog) {
10433 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10434 if (err < 0)
10435 goto error;
10436 }
1d045db9 10437
1727a771 10438 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 10439
ce764ab2 10440 return 0;
e16fb6d1
TI
10441
10442 error:
10443 alc_free(codec);
10444 return err;
ce764ab2
TI
10445}
10446
1d045db9
TI
10447/*
10448 * ALC662 support
10449 *
10450 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
10451 * configuration. Each pin widget can choose any input DACs and a mixer.
10452 * Each ADC is connected from a mixer of all inputs. This makes possible
10453 * 6-channel independent captures.
10454 *
10455 * In addition, an independent DAC for the multi-playback (not used in this
10456 * driver yet).
10457 */
1d045db9
TI
10458
10459/*
10460 * BIOS auto configuration
10461 */
10462
bc9f98a9
KY
10463static int alc662_parse_auto_config(struct hda_codec *codec)
10464{
4c6d72d1 10465 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
3e6179b8
TI
10466 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
10467 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
10468 const hda_nid_t *ssids;
ee979a14 10469
7639a06c
TI
10470 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
10471 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
10472 codec->core.vendor_id == 0x10ec0671)
3e6179b8 10473 ssids = alc663_ssids;
6227cdce 10474 else
3e6179b8
TI
10475 ssids = alc662_ssids;
10476 return alc_parse_auto_config(codec, alc662_ignore, ssids);
bc9f98a9
KY
10477}
10478
6be7948f 10479static void alc272_fixup_mario(struct hda_codec *codec,
1727a771 10480 const struct hda_fixup *fix, int action)
6fc398cb 10481{
9bb1f06f 10482 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6fc398cb 10483 return;
6be7948f
TB
10484 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
10485 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
10486 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
10487 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
10488 (0 << AC_AMPCAP_MUTE_SHIFT)))
4e76a883 10489 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
6be7948f
TB
10490}
10491
8e383953
TI
10492static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
10493 { .channels = 2,
10494 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
10495 { .channels = 4,
10496 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
10497 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
10498 { }
10499};
10500
10501/* override the 2.1 chmap */
eb9ca3ab 10502static void alc_fixup_bass_chmap(struct hda_codec *codec,
8e383953
TI
10503 const struct hda_fixup *fix, int action)
10504{
10505 if (action == HDA_FIXUP_ACT_BUILD) {
10506 struct alc_spec *spec = codec->spec;
bbbc7e85 10507 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
8e383953
TI
10508 }
10509}
10510
bf68665d
TI
10511/* avoid D3 for keeping GPIO up */
10512static unsigned int gpio_led_power_filter(struct hda_codec *codec,
10513 hda_nid_t nid,
10514 unsigned int power_state)
10515{
10516 struct alc_spec *spec = codec->spec;
d261eec8 10517 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
bf68665d
TI
10518 return AC_PWRST_D0;
10519 return power_state;
10520}
10521
3e887f37
TI
10522static void alc662_fixup_led_gpio1(struct hda_codec *codec,
10523 const struct hda_fixup *fix, int action)
10524{
10525 struct alc_spec *spec = codec->spec;
3e887f37 10526
01e4a275 10527 alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
3e887f37 10528 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
0f32fd19 10529 spec->mute_led_polarity = 1;
bf68665d 10530 codec->power_filter = gpio_led_power_filter;
3e887f37
TI
10531 }
10532}
10533
c6790c8e
KY
10534static void alc662_usi_automute_hook(struct hda_codec *codec,
10535 struct hda_jack_callback *jack)
10536{
10537 struct alc_spec *spec = codec->spec;
10538 int vref;
10539 msleep(200);
10540 snd_hda_gen_hp_automute(codec, jack);
10541
10542 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
10543 msleep(100);
10544 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10545 vref);
10546}
10547
10548static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
10549 const struct hda_fixup *fix, int action)
10550{
10551 struct alc_spec *spec = codec->spec;
10552 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10553 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
10554 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
10555 }
10556}
10557
00066e97
SB
10558static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
10559 struct hda_jack_callback *cb)
10560{
10561 /* surround speakers at 0x1b already get muted automatically when
10562 * headphones are plugged in, but we have to mute/unmute the remaining
10563 * channels manually:
10564 * 0x15 - front left/front right
10565 * 0x18 - front center/ LFE
10566 */
10567 if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
10568 snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
10569 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
10570 } else {
10571 snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
10572 snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
10573 }
10574}
10575
10576static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
10577 const struct hda_fixup *fix, int action)
10578{
10579 /* Pin 0x1b: shared headphones jack and surround speakers */
10580 if (!is_jack_detectable(codec, 0x1b))
10581 return;
10582
10583 switch (action) {
10584 case HDA_FIXUP_ACT_PRE_PROBE:
10585 snd_hda_jack_detect_enable_callback(codec, 0x1b,
10586 alc662_aspire_ethos_mute_speakers);
336820c4
TI
10587 /* subwoofer needs an extra GPIO setting to become audible */
10588 alc_setup_gpio(codec, 0x02);
00066e97
SB
10589 break;
10590 case HDA_FIXUP_ACT_INIT:
10591 /* Make sure to start in a correct state, i.e. if
10592 * headphones have been plugged in before powering up the system
10593 */
10594 alc662_aspire_ethos_mute_speakers(codec, NULL);
10595 break;
10596 }
10597}
10598
5af29028
KY
10599static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
10600 const struct hda_fixup *fix, int action)
10601{
10602 struct alc_spec *spec = codec->spec;
10603
10604 static const struct hda_pintbl pincfgs[] = {
10605 { 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
10606 { 0x1b, 0x0181304f },
10607 { }
10608 };
10609
10610 switch (action) {
10611 case HDA_FIXUP_ACT_PRE_PROBE:
10612 spec->gen.mixer_nid = 0;
10613 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
10614 snd_hda_apply_pincfgs(codec, pincfgs);
10615 break;
10616 case HDA_FIXUP_ACT_INIT:
10617 alc_write_coef_idx(codec, 0x19, 0xa054);
10618 break;
10619 }
10620}
10621
d7f32791
KY
10622static void alc897_hp_automute_hook(struct hda_codec *codec,
10623 struct hda_jack_callback *jack)
10624{
10625 struct alc_spec *spec = codec->spec;
10626 int vref;
10627
10628 snd_hda_gen_hp_automute(codec, jack);
10629 vref = spec->gen.hp_jack_present ? (PIN_HP | AC_PINCTL_VREF_100) : PIN_HP;
10630 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10631 vref);
10632}
10633
10634static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec,
10635 const struct hda_fixup *fix, int action)
10636{
10637 struct alc_spec *spec = codec->spec;
10638 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10639 spec->gen.hp_automute_hook = alc897_hp_automute_hook;
10640 }
10641}
10642
6b0f95c4 10643static const struct coef_fw alc668_coefs[] = {
f3f9185f
KY
10644 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
10645 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
10646 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
10647 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
10648 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
10649 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
10650 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
10651 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
10652 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
10653 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
10654 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
10655 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
10656 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
10657 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
10658 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
10659 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
10660 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
10661 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
10662 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
10663 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
10664 {}
10665};
10666
10667static void alc668_restore_default_value(struct hda_codec *codec)
10668{
10669 alc_process_coef_fw(codec, alc668_coefs);
10670}
10671
6cb3b707 10672enum {
2df03514 10673 ALC662_FIXUP_ASPIRE,
3e887f37 10674 ALC662_FIXUP_LED_GPIO1,
6cb3b707 10675 ALC662_FIXUP_IDEAPAD,
6be7948f 10676 ALC272_FIXUP_MARIO,
f1ec5be1 10677 ALC662_FIXUP_CZC_ET26,
d2ebd479 10678 ALC662_FIXUP_CZC_P10T,
94024cd1 10679 ALC662_FIXUP_SKU_IGNORE,
e59ea3ed 10680 ALC662_FIXUP_HP_RP5800,
53c334ad
TI
10681 ALC662_FIXUP_ASUS_MODE1,
10682 ALC662_FIXUP_ASUS_MODE2,
10683 ALC662_FIXUP_ASUS_MODE3,
10684 ALC662_FIXUP_ASUS_MODE4,
10685 ALC662_FIXUP_ASUS_MODE5,
10686 ALC662_FIXUP_ASUS_MODE6,
10687 ALC662_FIXUP_ASUS_MODE7,
10688 ALC662_FIXUP_ASUS_MODE8,
1565cc35 10689 ALC662_FIXUP_NO_JACK_DETECT,
edfe3bfc 10690 ALC662_FIXUP_ZOTAC_Z68,
125821ae 10691 ALC662_FIXUP_INV_DMIC,
1f8b46cd 10692 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
73bdd597 10693 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
1f8b46cd 10694 ALC662_FIXUP_HEADSET_MODE,
73bdd597 10695 ALC668_FIXUP_HEADSET_MODE,
8e54b4ac 10696 ALC662_FIXUP_BASS_MODE4_CHMAP,
61a75f13 10697 ALC662_FIXUP_BASS_16,
a30c9aaa 10698 ALC662_FIXUP_BASS_1A,
8e54b4ac 10699 ALC662_FIXUP_BASS_CHMAP,
493a52a9 10700 ALC668_FIXUP_AUTO_MUTE,
5e6db669 10701 ALC668_FIXUP_DELL_DISABLE_AAMIX,
033b0a7c 10702 ALC668_FIXUP_DELL_XPS13,
9d4dc584 10703 ALC662_FIXUP_ASUS_Nx50,
fc7438b1 10704 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
3231e205 10705 ALC668_FIXUP_ASUS_Nx51,
5b7c5e1f 10706 ALC668_FIXUP_MIC_COEF,
11ba6111 10707 ALC668_FIXUP_ASUS_G751,
78f4f7c2
KY
10708 ALC891_FIXUP_HEADSET_MODE,
10709 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
9b51fe3e 10710 ALC662_FIXUP_ACER_VERITON,
1a3f0991 10711 ALC892_FIXUP_ASROCK_MOBO,
c6790c8e
KY
10712 ALC662_FIXUP_USI_FUNC,
10713 ALC662_FIXUP_USI_HEADSET_MODE,
ca169cc2 10714 ALC662_FIXUP_LENOVO_MULTI_CODECS,
00066e97 10715 ALC669_FIXUP_ACER_ASPIRE_ETHOS,
00066e97 10716 ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
5af29028 10717 ALC671_FIXUP_HP_HEADSET_MIC2,
d858c706 10718 ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
a124458a 10719 ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
a3fd1a98
HW
10720 ALC668_FIXUP_ASUS_NO_HEADSET_MIC,
10721 ALC668_FIXUP_HEADSET_MIC,
10722 ALC668_FIXUP_MIC_DET_COEF,
d7f32791
KY
10723 ALC897_FIXUP_LENOVO_HEADSET_MIC,
10724 ALC897_FIXUP_HEADSET_MIC_PIN,
6cb3b707
DH
10725};
10726
1727a771 10727static const struct hda_fixup alc662_fixups[] = {
2df03514 10728 [ALC662_FIXUP_ASPIRE] = {
1727a771
TI
10729 .type = HDA_FIXUP_PINS,
10730 .v.pins = (const struct hda_pintbl[]) {
2df03514
DC
10731 { 0x15, 0x99130112 }, /* subwoofer */
10732 { }
10733 }
10734 },
3e887f37
TI
10735 [ALC662_FIXUP_LED_GPIO1] = {
10736 .type = HDA_FIXUP_FUNC,
10737 .v.func = alc662_fixup_led_gpio1,
10738 },
6cb3b707 10739 [ALC662_FIXUP_IDEAPAD] = {
1727a771
TI
10740 .type = HDA_FIXUP_PINS,
10741 .v.pins = (const struct hda_pintbl[]) {
6cb3b707
DH
10742 { 0x17, 0x99130112 }, /* subwoofer */
10743 { }
3e887f37
TI
10744 },
10745 .chained = true,
10746 .chain_id = ALC662_FIXUP_LED_GPIO1,
6cb3b707 10747 },
6be7948f 10748 [ALC272_FIXUP_MARIO] = {
1727a771 10749 .type = HDA_FIXUP_FUNC,
b5bfbc67 10750 .v.func = alc272_fixup_mario,
d2ebd479 10751 },
f1ec5be1
HC
10752 [ALC662_FIXUP_CZC_ET26] = {
10753 .type = HDA_FIXUP_PINS,
10754 .v.pins = (const struct hda_pintbl[]) {
10755 {0x12, 0x403cc000},
10756 {0x14, 0x90170110}, /* speaker */
10757 {0x15, 0x411111f0},
10758 {0x16, 0x411111f0},
10759 {0x18, 0x01a19030}, /* mic */
10760 {0x19, 0x90a7013f}, /* int-mic */
10761 {0x1a, 0x01014020},
10762 {0x1b, 0x0121401f},
10763 {0x1c, 0x411111f0},
10764 {0x1d, 0x411111f0},
10765 {0x1e, 0x40478e35},
10766 {}
10767 },
10768 .chained = true,
10769 .chain_id = ALC662_FIXUP_SKU_IGNORE
10770 },
d2ebd479 10771 [ALC662_FIXUP_CZC_P10T] = {
1727a771 10772 .type = HDA_FIXUP_VERBS,
d2ebd479
AA
10773 .v.verbs = (const struct hda_verb[]) {
10774 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
10775 {}
10776 }
10777 },
94024cd1 10778 [ALC662_FIXUP_SKU_IGNORE] = {
1727a771 10779 .type = HDA_FIXUP_FUNC,
23d30f28 10780 .v.func = alc_fixup_sku_ignore,
c6b35874 10781 },
e59ea3ed 10782 [ALC662_FIXUP_HP_RP5800] = {
1727a771
TI
10783 .type = HDA_FIXUP_PINS,
10784 .v.pins = (const struct hda_pintbl[]) {
e59ea3ed
TI
10785 { 0x14, 0x0221201f }, /* HP out */
10786 { }
10787 },
10788 .chained = true,
10789 .chain_id = ALC662_FIXUP_SKU_IGNORE
10790 },
53c334ad 10791 [ALC662_FIXUP_ASUS_MODE1] = {
1727a771
TI
10792 .type = HDA_FIXUP_PINS,
10793 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
10794 { 0x14, 0x99130110 }, /* speaker */
10795 { 0x18, 0x01a19c20 }, /* mic */
10796 { 0x19, 0x99a3092f }, /* int-mic */
10797 { 0x21, 0x0121401f }, /* HP out */
10798 { }
10799 },
10800 .chained = true,
10801 .chain_id = ALC662_FIXUP_SKU_IGNORE
10802 },
10803 [ALC662_FIXUP_ASUS_MODE2] = {
1727a771
TI
10804 .type = HDA_FIXUP_PINS,
10805 .v.pins = (const struct hda_pintbl[]) {
2996bdba
TI
10806 { 0x14, 0x99130110 }, /* speaker */
10807 { 0x18, 0x01a19820 }, /* mic */
10808 { 0x19, 0x99a3092f }, /* int-mic */
10809 { 0x1b, 0x0121401f }, /* HP out */
10810 { }
10811 },
53c334ad
TI
10812 .chained = true,
10813 .chain_id = ALC662_FIXUP_SKU_IGNORE
10814 },
10815 [ALC662_FIXUP_ASUS_MODE3] = {
1727a771
TI
10816 .type = HDA_FIXUP_PINS,
10817 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
10818 { 0x14, 0x99130110 }, /* speaker */
10819 { 0x15, 0x0121441f }, /* HP */
10820 { 0x18, 0x01a19840 }, /* mic */
10821 { 0x19, 0x99a3094f }, /* int-mic */
10822 { 0x21, 0x01211420 }, /* HP2 */
10823 { }
10824 },
10825 .chained = true,
10826 .chain_id = ALC662_FIXUP_SKU_IGNORE
10827 },
10828 [ALC662_FIXUP_ASUS_MODE4] = {
1727a771
TI
10829 .type = HDA_FIXUP_PINS,
10830 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
10831 { 0x14, 0x99130110 }, /* speaker */
10832 { 0x16, 0x99130111 }, /* speaker */
10833 { 0x18, 0x01a19840 }, /* mic */
10834 { 0x19, 0x99a3094f }, /* int-mic */
10835 { 0x21, 0x0121441f }, /* HP */
10836 { }
10837 },
10838 .chained = true,
10839 .chain_id = ALC662_FIXUP_SKU_IGNORE
10840 },
10841 [ALC662_FIXUP_ASUS_MODE5] = {
1727a771
TI
10842 .type = HDA_FIXUP_PINS,
10843 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
10844 { 0x14, 0x99130110 }, /* speaker */
10845 { 0x15, 0x0121441f }, /* HP */
10846 { 0x16, 0x99130111 }, /* speaker */
10847 { 0x18, 0x01a19840 }, /* mic */
10848 { 0x19, 0x99a3094f }, /* int-mic */
10849 { }
10850 },
10851 .chained = true,
10852 .chain_id = ALC662_FIXUP_SKU_IGNORE
10853 },
10854 [ALC662_FIXUP_ASUS_MODE6] = {
1727a771
TI
10855 .type = HDA_FIXUP_PINS,
10856 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
10857 { 0x14, 0x99130110 }, /* speaker */
10858 { 0x15, 0x01211420 }, /* HP2 */
10859 { 0x18, 0x01a19840 }, /* mic */
10860 { 0x19, 0x99a3094f }, /* int-mic */
10861 { 0x1b, 0x0121441f }, /* HP */
10862 { }
10863 },
10864 .chained = true,
10865 .chain_id = ALC662_FIXUP_SKU_IGNORE
10866 },
10867 [ALC662_FIXUP_ASUS_MODE7] = {
1727a771
TI
10868 .type = HDA_FIXUP_PINS,
10869 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
10870 { 0x14, 0x99130110 }, /* speaker */
10871 { 0x17, 0x99130111 }, /* speaker */
10872 { 0x18, 0x01a19840 }, /* mic */
10873 { 0x19, 0x99a3094f }, /* int-mic */
10874 { 0x1b, 0x01214020 }, /* HP */
10875 { 0x21, 0x0121401f }, /* HP */
10876 { }
10877 },
10878 .chained = true,
10879 .chain_id = ALC662_FIXUP_SKU_IGNORE
10880 },
10881 [ALC662_FIXUP_ASUS_MODE8] = {
1727a771
TI
10882 .type = HDA_FIXUP_PINS,
10883 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
10884 { 0x14, 0x99130110 }, /* speaker */
10885 { 0x12, 0x99a30970 }, /* int-mic */
10886 { 0x15, 0x01214020 }, /* HP */
10887 { 0x17, 0x99130111 }, /* speaker */
10888 { 0x18, 0x01a19840 }, /* mic */
10889 { 0x21, 0x0121401f }, /* HP */
10890 { }
10891 },
10892 .chained = true,
10893 .chain_id = ALC662_FIXUP_SKU_IGNORE
2996bdba 10894 },
1565cc35 10895 [ALC662_FIXUP_NO_JACK_DETECT] = {
1727a771 10896 .type = HDA_FIXUP_FUNC,
1565cc35
TI
10897 .v.func = alc_fixup_no_jack_detect,
10898 },
edfe3bfc 10899 [ALC662_FIXUP_ZOTAC_Z68] = {
1727a771
TI
10900 .type = HDA_FIXUP_PINS,
10901 .v.pins = (const struct hda_pintbl[]) {
edfe3bfc
DH
10902 { 0x1b, 0x02214020 }, /* Front HP */
10903 { }
10904 }
10905 },
125821ae 10906 [ALC662_FIXUP_INV_DMIC] = {
1727a771 10907 .type = HDA_FIXUP_FUNC,
9d36a7dc 10908 .v.func = alc_fixup_inv_dmic,
125821ae 10909 },
033b0a7c
GM
10910 [ALC668_FIXUP_DELL_XPS13] = {
10911 .type = HDA_FIXUP_FUNC,
10912 .v.func = alc_fixup_dell_xps13,
10913 .chained = true,
10914 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
10915 },
5e6db669
GM
10916 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
10917 .type = HDA_FIXUP_FUNC,
10918 .v.func = alc_fixup_disable_aamix,
10919 .chained = true,
10920 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
10921 },
493a52a9
HW
10922 [ALC668_FIXUP_AUTO_MUTE] = {
10923 .type = HDA_FIXUP_FUNC,
10924 .v.func = alc_fixup_auto_mute_via_amp,
10925 .chained = true,
10926 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
10927 },
1f8b46cd
DH
10928 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
10929 .type = HDA_FIXUP_PINS,
10930 .v.pins = (const struct hda_pintbl[]) {
10931 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10932 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
10933 { }
10934 },
10935 .chained = true,
10936 .chain_id = ALC662_FIXUP_HEADSET_MODE
10937 },
10938 [ALC662_FIXUP_HEADSET_MODE] = {
10939 .type = HDA_FIXUP_FUNC,
10940 .v.func = alc_fixup_headset_mode_alc662,
10941 },
73bdd597
DH
10942 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
10943 .type = HDA_FIXUP_PINS,
10944 .v.pins = (const struct hda_pintbl[]) {
10945 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10946 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10947 { }
10948 },
10949 .chained = true,
10950 .chain_id = ALC668_FIXUP_HEADSET_MODE
10951 },
10952 [ALC668_FIXUP_HEADSET_MODE] = {
10953 .type = HDA_FIXUP_FUNC,
10954 .v.func = alc_fixup_headset_mode_alc668,
10955 },
8e54b4ac 10956 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
8e383953 10957 .type = HDA_FIXUP_FUNC,
eb9ca3ab 10958 .v.func = alc_fixup_bass_chmap,
8e383953
TI
10959 .chained = true,
10960 .chain_id = ALC662_FIXUP_ASUS_MODE4
10961 },
61a75f13
DH
10962 [ALC662_FIXUP_BASS_16] = {
10963 .type = HDA_FIXUP_PINS,
10964 .v.pins = (const struct hda_pintbl[]) {
10965 {0x16, 0x80106111}, /* bass speaker */
10966 {}
10967 },
10968 .chained = true,
10969 .chain_id = ALC662_FIXUP_BASS_CHMAP,
10970 },
a30c9aaa
TI
10971 [ALC662_FIXUP_BASS_1A] = {
10972 .type = HDA_FIXUP_PINS,
10973 .v.pins = (const struct hda_pintbl[]) {
10974 {0x1a, 0x80106111}, /* bass speaker */
10975 {}
10976 },
8e54b4ac
DH
10977 .chained = true,
10978 .chain_id = ALC662_FIXUP_BASS_CHMAP,
a30c9aaa 10979 },
8e54b4ac 10980 [ALC662_FIXUP_BASS_CHMAP] = {
a30c9aaa 10981 .type = HDA_FIXUP_FUNC,
eb9ca3ab 10982 .v.func = alc_fixup_bass_chmap,
a30c9aaa 10983 },
9d4dc584
BM
10984 [ALC662_FIXUP_ASUS_Nx50] = {
10985 .type = HDA_FIXUP_FUNC,
10986 .v.func = alc_fixup_auto_mute_via_amp,
10987 .chained = true,
10988 .chain_id = ALC662_FIXUP_BASS_1A
10989 },
fc7438b1
MP
10990 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
10991 .type = HDA_FIXUP_FUNC,
10992 .v.func = alc_fixup_headset_mode_alc668,
10993 .chain_id = ALC662_FIXUP_BASS_CHMAP
10994 },
3231e205
YP
10995 [ALC668_FIXUP_ASUS_Nx51] = {
10996 .type = HDA_FIXUP_PINS,
10997 .v.pins = (const struct hda_pintbl[]) {
fc7438b1
MP
10998 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10999 { 0x1a, 0x90170151 }, /* bass speaker */
11000 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
3231e205
YP
11001 {}
11002 },
11003 .chained = true,
fc7438b1 11004 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
3231e205 11005 },
5b7c5e1f 11006 [ALC668_FIXUP_MIC_COEF] = {
11ba6111
TI
11007 .type = HDA_FIXUP_VERBS,
11008 .v.verbs = (const struct hda_verb[]) {
11009 { 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
11010 { 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
11011 {}
11012 },
11013 },
5b7c5e1f
TI
11014 [ALC668_FIXUP_ASUS_G751] = {
11015 .type = HDA_FIXUP_PINS,
11016 .v.pins = (const struct hda_pintbl[]) {
11017 { 0x16, 0x0421101f }, /* HP */
11018 {}
11019 },
11020 .chained = true,
11021 .chain_id = ALC668_FIXUP_MIC_COEF
11022 },
78f4f7c2
KY
11023 [ALC891_FIXUP_HEADSET_MODE] = {
11024 .type = HDA_FIXUP_FUNC,
11025 .v.func = alc_fixup_headset_mode,
11026 },
11027 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
11028 .type = HDA_FIXUP_PINS,
11029 .v.pins = (const struct hda_pintbl[]) {
11030 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
11031 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
11032 { }
11033 },
11034 .chained = true,
11035 .chain_id = ALC891_FIXUP_HEADSET_MODE
11036 },
9b51fe3e
SB
11037 [ALC662_FIXUP_ACER_VERITON] = {
11038 .type = HDA_FIXUP_PINS,
11039 .v.pins = (const struct hda_pintbl[]) {
11040 { 0x15, 0x50170120 }, /* no internal speaker */
11041 { }
11042 }
11043 },
1a3f0991
TI
11044 [ALC892_FIXUP_ASROCK_MOBO] = {
11045 .type = HDA_FIXUP_PINS,
11046 .v.pins = (const struct hda_pintbl[]) {
11047 { 0x15, 0x40f000f0 }, /* disabled */
11048 { 0x16, 0x40f000f0 }, /* disabled */
1a3f0991
TI
11049 { }
11050 }
11051 },
c6790c8e
KY
11052 [ALC662_FIXUP_USI_FUNC] = {
11053 .type = HDA_FIXUP_FUNC,
11054 .v.func = alc662_fixup_usi_headset_mic,
11055 },
11056 [ALC662_FIXUP_USI_HEADSET_MODE] = {
11057 .type = HDA_FIXUP_PINS,
11058 .v.pins = (const struct hda_pintbl[]) {
11059 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
11060 { 0x18, 0x01a1903d },
11061 { }
11062 },
11063 .chained = true,
11064 .chain_id = ALC662_FIXUP_USI_FUNC
11065 },
ca169cc2
KY
11066 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
11067 .type = HDA_FIXUP_FUNC,
11068 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
11069 },
00066e97
SB
11070 [ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
11071 .type = HDA_FIXUP_FUNC,
11072 .v.func = alc662_fixup_aspire_ethos_hp,
11073 },
00066e97
SB
11074 [ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
11075 .type = HDA_FIXUP_PINS,
11076 .v.pins = (const struct hda_pintbl[]) {
11077 { 0x15, 0x92130110 }, /* front speakers */
11078 { 0x18, 0x99130111 }, /* center/subwoofer */
11079 { 0x1b, 0x11130012 }, /* surround plus jack for HP */
11080 { }
11081 },
11082 .chained = true,
336820c4 11083 .chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
00066e97 11084 },
5af29028
KY
11085 [ALC671_FIXUP_HP_HEADSET_MIC2] = {
11086 .type = HDA_FIXUP_FUNC,
11087 .v.func = alc671_fixup_hp_headset_mic2,
11088 },
d858c706
JHP
11089 [ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
11090 .type = HDA_FIXUP_PINS,
11091 .v.pins = (const struct hda_pintbl[]) {
11092 { 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
11093 { }
11094 },
11095 .chained = true,
11096 .chain_id = ALC662_FIXUP_USI_FUNC
11097 },
a124458a
JHP
11098 [ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
11099 .type = HDA_FIXUP_PINS,
11100 .v.pins = (const struct hda_pintbl[]) {
11101 { 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
11102 { 0x1b, 0x0221144f },
11103 { }
11104 },
11105 .chained = true,
11106 .chain_id = ALC662_FIXUP_USI_FUNC
11107 },
a3fd1a98
HW
11108 [ALC668_FIXUP_ASUS_NO_HEADSET_MIC] = {
11109 .type = HDA_FIXUP_PINS,
11110 .v.pins = (const struct hda_pintbl[]) {
11111 { 0x1b, 0x04a1112c },
11112 { }
11113 },
11114 .chained = true,
11115 .chain_id = ALC668_FIXUP_HEADSET_MIC
11116 },
11117 [ALC668_FIXUP_HEADSET_MIC] = {
11118 .type = HDA_FIXUP_FUNC,
11119 .v.func = alc269_fixup_headset_mic,
11120 .chained = true,
11121 .chain_id = ALC668_FIXUP_MIC_DET_COEF
11122 },
11123 [ALC668_FIXUP_MIC_DET_COEF] = {
11124 .type = HDA_FIXUP_VERBS,
11125 .v.verbs = (const struct hda_verb[]) {
11126 { 0x20, AC_VERB_SET_COEF_INDEX, 0x15 },
11127 { 0x20, AC_VERB_SET_PROC_COEF, 0x0d60 },
11128 {}
11129 },
11130 },
d7f32791
KY
11131 [ALC897_FIXUP_LENOVO_HEADSET_MIC] = {
11132 .type = HDA_FIXUP_FUNC,
11133 .v.func = alc897_fixup_lenovo_headset_mic,
11134 },
11135 [ALC897_FIXUP_HEADSET_MIC_PIN] = {
11136 .type = HDA_FIXUP_PINS,
11137 .v.pins = (const struct hda_pintbl[]) {
11138 { 0x1a, 0x03a11050 },
11139 { }
11140 },
11141 .chained = true,
11142 .chain_id = ALC897_FIXUP_LENOVO_HEADSET_MIC
11143 },
6cb3b707
DH
11144};
11145
a9111321 11146static const struct snd_pci_quirk alc662_fixup_tbl[] = {
53c334ad 11147 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
d3d3835c 11148 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
02f6ff90 11149 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
a6c47a85 11150 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
94024cd1 11151 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
125821ae 11152 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
1801928e 11153 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
2df03514 11154 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
9edeb110 11155 SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
a124458a 11156 SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
d858c706 11157 SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
73bdd597
DH
11158 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
11159 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
c5d019c3 11160 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
033b0a7c 11161 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
467e1436 11162 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
09d2014f 11163 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
ad8ff99e 11164 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8dc9abb9
KY
11165 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
11166 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
6a98e34b 11167 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
e59ea3ed 11168 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
148ebf54 11169 SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
882bd07f 11170 SND_PCI_QUIRK(0x103c, 0x885f, "HP 288 Pro G8", ALC671_FIXUP_HP_HEADSET_MIC2),
2da2dc9e 11171 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
83a9efb5 11172 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
9d4dc584 11173 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
11ba6111 11174 SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
9edeb110 11175 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
8e54b4ac 11176 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
61a75f13 11177 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
3231e205
YP
11178 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
11179 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
a3fd1a98 11180 SND_PCI_QUIRK(0x1043, 0x185d, "ASUS G551JW", ALC668_FIXUP_ASUS_NO_HEADSET_MIC),
c7efff92 11181 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
61a75f13 11182 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
8e54b4ac 11183 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
1565cc35 11184 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
53c334ad 11185 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
a0e90acc 11186 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
c6790c8e 11187 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
ca169cc2 11188 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
5a873857 11189 SND_PCI_QUIRK(0x17aa, 0x1057, "Lenovo P360", ALC897_FIXUP_HEADSET_MIC_PIN),
d7f32791
KY
11190 SND_PCI_QUIRK(0x17aa, 0x32ca, "Lenovo ThinkCentre M80", ALC897_FIXUP_HEADSET_MIC_PIN),
11191 SND_PCI_QUIRK(0x17aa, 0x32cb, "Lenovo ThinkCentre M70", ALC897_FIXUP_HEADSET_MIC_PIN),
11192 SND_PCI_QUIRK(0x17aa, 0x32cf, "Lenovo ThinkCentre M950", ALC897_FIXUP_HEADSET_MIC_PIN),
11193 SND_PCI_QUIRK(0x17aa, 0x32f7, "Lenovo ThinkCentre M90", ALC897_FIXUP_HEADSET_MIC_PIN),
d4118588 11194 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
6cb3b707 11195 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
1a3f0991 11196 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
edfe3bfc 11197 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
9b51fe3e 11198 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
f1ec5be1 11199 SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
d2ebd479 11200 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
53c334ad
TI
11201
11202#if 0
11203 /* Below is a quirk table taken from the old code.
11204 * Basically the device should work as is without the fixup table.
11205 * If BIOS doesn't give a proper info, enable the corresponding
11206 * fixup entry.
7d7eb9ea 11207 */
53c334ad
TI
11208 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
11209 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
11210 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
11211 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
11212 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
11213 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11214 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
11215 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
11216 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
11217 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11218 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
11219 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
11220 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
11221 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
11222 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
11223 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11224 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
11225 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
11226 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11227 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
11228 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
11229 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11230 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
11231 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
11232 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
11233 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11234 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
11235 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
11236 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11237 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
11238 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11239 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11240 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
11241 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
11242 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
11243 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
11244 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
11245 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
11246 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
11247 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11248 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
11249 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
11250 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
11251 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
11252 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
11253 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
11254 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
11255 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
11256 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
11257 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
11258#endif
6cb3b707
DH
11259 {}
11260};
11261
1727a771 11262static const struct hda_model_fixup alc662_fixup_models[] = {
aa3841b5
TI
11263 {.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
11264 {.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
6be7948f 11265 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
aa3841b5 11266 {.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
53c334ad
TI
11267 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
11268 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
11269 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
11270 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
11271 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
11272 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
11273 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
11274 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
aa3841b5 11275 {.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
6e72aa5f 11276 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
aa3841b5 11277 {.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
e32aa85a 11278 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
aa3841b5
TI
11279 {.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
11280 {.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
11281 {.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
11282 {.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
11283 {.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
11284 {.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
11285 {.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
11286 {.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
40c51675 11287 {.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
aa3841b5
TI
11288 {.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
11289 {.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
11290 {.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
11291 {.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
11292 {.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
ba90d6a6 11293 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
00066e97 11294 {.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
6be7948f
TB
11295 {}
11296};
6cb3b707 11297
532895c5 11298static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
78f4f7c2
KY
11299 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
11300 {0x17, 0x02211010},
11301 {0x18, 0x01a19030},
11302 {0x1a, 0x01813040},
11303 {0x21, 0x01014020}),
4b4e0e32
HW
11304 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
11305 {0x16, 0x01813030},
11306 {0x17, 0x02211010},
11307 {0x18, 0x01a19040},
11308 {0x21, 0x01014020}),
1f8b46cd 11309 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
1f8b46cd 11310 {0x14, 0x01014010},
1f8b46cd 11311 {0x18, 0x01a19020},
1f8b46cd 11312 {0x1a, 0x0181302f},
11580297 11313 {0x1b, 0x0221401f}),
76c2132e
DH
11314 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
11315 {0x12, 0x99a30130},
11316 {0x14, 0x90170110},
11317 {0x15, 0x0321101f},
11580297 11318 {0x16, 0x03011020}),
76c2132e
DH
11319 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
11320 {0x12, 0x99a30140},
11321 {0x14, 0x90170110},
11322 {0x15, 0x0321101f},
11580297 11323 {0x16, 0x03011020}),
76c2132e
DH
11324 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
11325 {0x12, 0x99a30150},
11326 {0x14, 0x90170110},
11327 {0x15, 0x0321101f},
11580297 11328 {0x16, 0x03011020}),
76c2132e 11329 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
76c2132e
DH
11330 {0x14, 0x90170110},
11331 {0x15, 0x0321101f},
11580297 11332 {0x16, 0x03011020}),
76c2132e
DH
11333 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
11334 {0x12, 0x90a60130},
11335 {0x14, 0x90170110},
11580297 11336 {0x15, 0x0321101f}),
5af29028
KY
11337 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
11338 {0x14, 0x01014010},
11339 {0x17, 0x90170150},
f2adbae0 11340 {0x19, 0x02a11060},
5af29028
KY
11341 {0x1b, 0x01813030},
11342 {0x21, 0x02211020}),
11343 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
11344 {0x14, 0x01014010},
11345 {0x18, 0x01a19040},
11346 {0x1b, 0x01813030},
11347 {0x21, 0x02211020}),
11348 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
11349 {0x14, 0x01014020},
11350 {0x17, 0x90170110},
11351 {0x18, 0x01a19050},
11352 {0x1b, 0x01813040},
11353 {0x21, 0x02211030}),
532895c5
HW
11354 {}
11355};
11356
1d045db9
TI
11357/*
11358 */
bc9f98a9
KY
11359static int patch_alc662(struct hda_codec *codec)
11360{
11361 struct alc_spec *spec;
3de95173 11362 int err;
bc9f98a9 11363
3de95173
TI
11364 err = alc_alloc_spec(codec, 0x0b);
11365 if (err < 0)
11366 return err;
bc9f98a9 11367
3de95173 11368 spec = codec->spec;
1f0f4b80 11369
225068ab
TI
11370 spec->shutup = alc_eapd_shutup;
11371
53c334ad
TI
11372 /* handle multiple HPs as is */
11373 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
11374
2c3bf9ab
TI
11375 alc_fix_pll_init(codec, 0x20, 0x04, 15);
11376
7639a06c 11377 switch (codec->core.vendor_id) {
f3f9185f
KY
11378 case 0x10ec0668:
11379 spec->init_hook = alc668_restore_default_value;
11380 break;
f3f9185f 11381 }
8663ff75 11382
c9af753f
TI
11383 alc_pre_init(codec);
11384
1727a771 11385 snd_hda_pick_fixup(codec, alc662_fixup_models,
8e5a0509 11386 alc662_fixup_tbl, alc662_fixups);
0fc1e447 11387 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
1727a771 11388 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
8e5a0509
TI
11389
11390 alc_auto_parse_customize_define(codec);
11391
7504b6cd
TI
11392 if (has_cdefine_beep(codec))
11393 spec->gen.beep_nid = 0x01;
11394
1bb7e43e 11395 if ((alc_get_coef0(codec) & (1 << 14)) &&
5100cd07 11396 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
e16fb6d1 11397 spec->cdefine.platform_type == 1) {
6134b1a2
WY
11398 err = alc_codec_rename(codec, "ALC272X");
11399 if (err < 0)
e16fb6d1 11400 goto error;
20ca0c35 11401 }
274693f3 11402
b9c5106c
TI
11403 /* automatic parse from the BIOS config */
11404 err = alc662_parse_auto_config(codec);
e16fb6d1
TI
11405 if (err < 0)
11406 goto error;
bc9f98a9 11407
7504b6cd 11408 if (!spec->gen.no_analog && spec->gen.beep_nid) {
7639a06c 11409 switch (codec->core.vendor_id) {
da00c244 11410 case 0x10ec0662:
fea80fae 11411 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
da00c244
KY
11412 break;
11413 case 0x10ec0272:
11414 case 0x10ec0663:
11415 case 0x10ec0665:
9ad54547 11416 case 0x10ec0668:
fea80fae 11417 err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
da00c244
KY
11418 break;
11419 case 0x10ec0273:
fea80fae 11420 err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
da00c244
KY
11421 break;
11422 }
fea80fae
TI
11423 if (err < 0)
11424 goto error;
cec27c89 11425 }
2134ea4f 11426
1727a771 11427 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 11428
bc9f98a9 11429 return 0;
801f49d3 11430
e16fb6d1
TI
11431 error:
11432 alc_free(codec);
11433 return err;
b478b998
KY
11434}
11435
d1eb57f4
KY
11436/*
11437 * ALC680 support
11438 */
d1eb57f4 11439
d1eb57f4
KY
11440static int alc680_parse_auto_config(struct hda_codec *codec)
11441{
3e6179b8 11442 return alc_parse_auto_config(codec, NULL, NULL);
d1eb57f4
KY
11443}
11444
d1eb57f4 11445/*
d1eb57f4 11446 */
d1eb57f4
KY
11447static int patch_alc680(struct hda_codec *codec)
11448{
d1eb57f4
KY
11449 int err;
11450
1f0f4b80 11451 /* ALC680 has no aa-loopback mixer */
3de95173
TI
11452 err = alc_alloc_spec(codec, 0);
11453 if (err < 0)
11454 return err;
1f0f4b80 11455
1ebec5f2
TI
11456 /* automatic parse from the BIOS config */
11457 err = alc680_parse_auto_config(codec);
11458 if (err < 0) {
11459 alc_free(codec);
11460 return err;
d1eb57f4
KY
11461 }
11462
d1eb57f4
KY
11463 return 0;
11464}
11465
1da177e4
LT
11466/*
11467 * patch entries
11468 */
b9a94a9c 11469static const struct hda_device_id snd_hda_id_realtek[] = {
0a6f0600 11470 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
b9a94a9c 11471 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
2a36c16e 11472 HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
4231430d 11473 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
1948fc06 11474 HDA_CODEC_ENTRY(0x10ec0230, "ALC236", patch_alc269),
b9a94a9c
TI
11475 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
11476 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
dcd4f0db 11477 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
b9a94a9c 11478 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
736f20a7 11479 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
7fbdcd83 11480 HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
b9a94a9c
TI
11481 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
11482 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
f429e7e4 11483 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
b9a94a9c
TI
11484 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
11485 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
11486 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
11487 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
11488 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
11489 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
11490 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
dcd4f0db 11491 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
b9a94a9c
TI
11492 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
11493 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
11494 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
11495 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
11496 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
11497 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
0a6f0600 11498 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
b9a94a9c 11499 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
630e3612 11500 HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
b9a94a9c 11501 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
0a6f0600 11502 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
b9a94a9c
TI
11503 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
11504 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
11505 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
dcd4f0db 11506 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
7d727869 11507 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
b9a94a9c 11508 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
28f1f9b2 11509 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
1078bef0 11510 HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
f0778871 11511 HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
b9a94a9c
TI
11512 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
11513 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
11514 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
11515 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
11516 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
11517 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
11518 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
11519 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
11520 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
11521 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
11522 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
11523 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
11524 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
11525 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
6fbae35a
KY
11526 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
11527 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
11528 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
83629532 11529 HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
78f4f7c2 11530 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
b9a94a9c
TI
11531 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
11532 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
11533 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
11534 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
11535 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
11536 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
11537 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
11538 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
11539 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
11540 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
11541 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
e5782a5d 11542 HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
b9a94a9c
TI
11543 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
11544 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
6d9ffcff 11545 HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
65553b12 11546 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
a535ad57 11547 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
1da177e4
LT
11548 {} /* terminator */
11549};
b9a94a9c 11550MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
1289e9e8
TI
11551
11552MODULE_LICENSE("GPL");
11553MODULE_DESCRIPTION("Realtek HD-audio codec");
11554
d8a766a1 11555static struct hda_codec_driver realtek_driver = {
b9a94a9c 11556 .id = snd_hda_id_realtek,
1289e9e8
TI
11557};
11558
d8a766a1 11559module_hda_codec_driver(realtek_driver);