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