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