]> git.ipfire.org Git - thirdparty/linux.git/blame - sound/pci/hda/patch_realtek.c
ALSA: usb-audio: Don't abort resume upon errors
[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
b837a9f5
TI
141static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
142 unsigned int coef_idx)
f2a227cd
TI
143{
144 unsigned int val;
145
146 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
147 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
148 return val;
149}
150
b837a9f5
TI
151static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
152 unsigned int coef_idx)
153{
154 struct alc_spec *spec = codec->spec;
155 unsigned int val;
156
157 mutex_lock(&spec->coef_mutex);
158 val = __alc_read_coefex_idx(codec, nid, coef_idx);
159 mutex_unlock(&spec->coef_mutex);
160 return val;
161}
162
f2a227cd
TI
163#define alc_read_coef_idx(codec, coef_idx) \
164 alc_read_coefex_idx(codec, 0x20, coef_idx)
165
b837a9f5
TI
166static void __alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
167 unsigned int coef_idx, unsigned int coef_val)
f2a227cd
TI
168{
169 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
170 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
171}
172
b837a9f5
TI
173static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
174 unsigned int coef_idx, unsigned int coef_val)
175{
176 struct alc_spec *spec = codec->spec;
177
178 mutex_lock(&spec->coef_mutex);
179 __alc_write_coefex_idx(codec, nid, coef_idx, coef_val);
180 mutex_unlock(&spec->coef_mutex);
181}
182
f2a227cd
TI
183#define alc_write_coef_idx(codec, coef_idx, coef_val) \
184 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
185
b837a9f5
TI
186static void __alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
187 unsigned int coef_idx, unsigned int mask,
188 unsigned int bits_set)
189{
190 unsigned int val = __alc_read_coefex_idx(codec, nid, coef_idx);
191
192 if (val != -1)
193 __alc_write_coefex_idx(codec, nid, coef_idx,
194 (val & ~mask) | bits_set);
195}
196
98b24883
TI
197static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
198 unsigned int coef_idx, unsigned int mask,
199 unsigned int bits_set)
200{
b837a9f5 201 struct alc_spec *spec = codec->spec;
98b24883 202
b837a9f5
TI
203 mutex_lock(&spec->coef_mutex);
204 __alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set);
205 mutex_unlock(&spec->coef_mutex);
98b24883
TI
206}
207
208#define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
209 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
210
f2a227cd
TI
211/* a special bypass for COEF 0; read the cached value at the second time */
212static unsigned int alc_get_coef0(struct hda_codec *codec)
213{
214 struct alc_spec *spec = codec->spec;
215
216 if (!spec->coef0)
217 spec->coef0 = alc_read_coef_idx(codec, 0);
218 return spec->coef0;
219}
220
54db6c39
TI
221/* coef writes/updates batch */
222struct coef_fw {
223 unsigned char nid;
224 unsigned char idx;
225 unsigned short mask;
226 unsigned short val;
227};
228
229#define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
230 { .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
231#define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
232#define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
233#define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
234
235static void alc_process_coef_fw(struct hda_codec *codec,
236 const struct coef_fw *fw)
237{
b837a9f5
TI
238 struct alc_spec *spec = codec->spec;
239
240 mutex_lock(&spec->coef_mutex);
54db6c39
TI
241 for (; fw->nid; fw++) {
242 if (fw->mask == (unsigned short)-1)
b837a9f5 243 __alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
54db6c39 244 else
b837a9f5
TI
245 __alc_update_coefex_idx(codec, fw->nid, fw->idx,
246 fw->mask, fw->val);
54db6c39 247 }
b837a9f5 248 mutex_unlock(&spec->coef_mutex);
54db6c39
TI
249}
250
df694daa 251/*
1d045db9 252 * GPIO setup tables, used in initialization
df694daa 253 */
5579cd6f 254
bc9f98a9 255/* Enable GPIO mask and set output */
5579cd6f
TI
256static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
257{
258 struct alc_spec *spec = codec->spec;
bc9f98a9 259
5579cd6f
TI
260 spec->gpio_mask |= mask;
261 spec->gpio_dir |= mask;
262 spec->gpio_data |= mask;
263}
bc9f98a9 264
5579cd6f
TI
265static void alc_write_gpio_data(struct hda_codec *codec)
266{
267 struct alc_spec *spec = codec->spec;
268
269 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
270 spec->gpio_data);
271}
272
aaf312de
TI
273static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
274 bool on)
275{
276 struct alc_spec *spec = codec->spec;
277 unsigned int oldval = spec->gpio_data;
278
279 if (on)
280 spec->gpio_data |= mask;
281 else
282 spec->gpio_data &= ~mask;
283 if (oldval != spec->gpio_data)
284 alc_write_gpio_data(codec);
285}
286
5579cd6f
TI
287static void alc_write_gpio(struct hda_codec *codec)
288{
289 struct alc_spec *spec = codec->spec;
290
291 if (!spec->gpio_mask)
292 return;
293
294 snd_hda_codec_write(codec, codec->core.afg, 0,
295 AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
296 snd_hda_codec_write(codec, codec->core.afg, 0,
297 AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir);
215c850c
TI
298 if (spec->gpio_write_delay)
299 msleep(1);
5579cd6f
TI
300 alc_write_gpio_data(codec);
301}
302
303static void alc_fixup_gpio(struct hda_codec *codec, int action,
304 unsigned int mask)
305{
306 if (action == HDA_FIXUP_ACT_PRE_PROBE)
307 alc_setup_gpio(codec, mask);
308}
309
310static void alc_fixup_gpio1(struct hda_codec *codec,
311 const struct hda_fixup *fix, int action)
312{
313 alc_fixup_gpio(codec, action, 0x01);
314}
315
316static void alc_fixup_gpio2(struct hda_codec *codec,
317 const struct hda_fixup *fix, int action)
318{
319 alc_fixup_gpio(codec, action, 0x02);
320}
321
322static void alc_fixup_gpio3(struct hda_codec *codec,
323 const struct hda_fixup *fix, int action)
324{
325 alc_fixup_gpio(codec, action, 0x03);
326}
bdd148a3 327
ae065f1c
TI
328static void alc_fixup_gpio4(struct hda_codec *codec,
329 const struct hda_fixup *fix, int action)
330{
331 alc_fixup_gpio(codec, action, 0x04);
332}
333
8a503555
TI
334static void alc_fixup_micmute_led(struct hda_codec *codec,
335 const struct hda_fixup *fix, int action)
336{
e65bf997 337 if (action == HDA_FIXUP_ACT_PRE_PROBE)
8a503555
TI
338 snd_hda_gen_add_micmute_led_cdev(codec, NULL);
339}
340
2c3bf9ab
TI
341/*
342 * Fix hardware PLL issue
343 * On some codecs, the analog PLL gating control must be off while
344 * the default value is 1.
345 */
346static void alc_fix_pll(struct hda_codec *codec)
347{
348 struct alc_spec *spec = codec->spec;
2c3bf9ab 349
98b24883
TI
350 if (spec->pll_nid)
351 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
352 1 << spec->pll_coef_bit, 0);
2c3bf9ab
TI
353}
354
355static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
356 unsigned int coef_idx, unsigned int coef_bit)
357{
358 struct alc_spec *spec = codec->spec;
359 spec->pll_nid = nid;
360 spec->pll_coef_idx = coef_idx;
361 spec->pll_coef_bit = coef_bit;
362 alc_fix_pll(codec);
363}
364
cf5a2279 365/* update the master volume per volume-knob's unsol event */
1a4f69d5
TI
366static void alc_update_knob_master(struct hda_codec *codec,
367 struct hda_jack_callback *jack)
cf5a2279
TI
368{
369 unsigned int val;
370 struct snd_kcontrol *kctl;
371 struct snd_ctl_elem_value *uctl;
372
373 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
374 if (!kctl)
375 return;
376 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
377 if (!uctl)
378 return;
2ebab40e 379 val = snd_hda_codec_read(codec, jack->nid, 0,
cf5a2279
TI
380 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
381 val &= HDA_AMP_VOLMASK;
382 uctl->value.integer.value[0] = val;
383 uctl->value.integer.value[1] = val;
384 kctl->put(kctl, uctl);
385 kfree(uctl);
386}
387
29adc4b9 388static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
f21d78e2 389{
29adc4b9
DH
390 /* For some reason, the res given from ALC880 is broken.
391 Here we adjust it properly. */
392 snd_hda_jack_unsol_event(codec, res >> 2);
f21d78e2
TI
393}
394
394c97f8
KY
395/* Change EAPD to verb control */
396static void alc_fill_eapd_coef(struct hda_codec *codec)
397{
398 int coef;
399
400 coef = alc_get_coef0(codec);
401
7639a06c 402 switch (codec->core.vendor_id) {
394c97f8
KY
403 case 0x10ec0262:
404 alc_update_coef_idx(codec, 0x7, 0, 1<<5);
405 break;
406 case 0x10ec0267:
407 case 0x10ec0268:
408 alc_update_coef_idx(codec, 0x7, 0, 1<<13);
409 break;
410 case 0x10ec0269:
411 if ((coef & 0x00f0) == 0x0010)
412 alc_update_coef_idx(codec, 0xd, 0, 1<<14);
413 if ((coef & 0x00f0) == 0x0020)
414 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
415 if ((coef & 0x00f0) == 0x0030)
416 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
417 break;
418 case 0x10ec0280:
419 case 0x10ec0284:
420 case 0x10ec0290:
421 case 0x10ec0292:
422 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
423 break;
4231430d 424 case 0x10ec0225:
44be77c5
TI
425 case 0x10ec0295:
426 case 0x10ec0299:
427 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
c0dbbdad 428 fallthrough;
44be77c5 429 case 0x10ec0215:
1948fc06 430 case 0x10ec0230:
394c97f8 431 case 0x10ec0233:
ea04a1db 432 case 0x10ec0235:
c4473744 433 case 0x10ec0236:
7fbdcd83 434 case 0x10ec0245:
394c97f8 435 case 0x10ec0255:
c4473744 436 case 0x10ec0256:
f429e7e4 437 case 0x10ec0257:
394c97f8
KY
438 case 0x10ec0282:
439 case 0x10ec0283:
440 case 0x10ec0286:
441 case 0x10ec0288:
0a6f0600 442 case 0x10ec0285:
506b62c3 443 case 0x10ec0298:
0a6f0600 444 case 0x10ec0289:
1078bef0 445 case 0x10ec0300:
394c97f8
KY
446 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
447 break;
3aabf94c
KY
448 case 0x10ec0275:
449 alc_update_coef_idx(codec, 0xe, 0, 1<<0);
450 break;
8822702f
HW
451 case 0x10ec0287:
452 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
453 alc_write_coef_idx(codec, 0x8, 0x4ab7);
454 break;
394c97f8
KY
455 case 0x10ec0293:
456 alc_update_coef_idx(codec, 0xa, 1<<13, 0);
457 break;
dcd4f0db
KY
458 case 0x10ec0234:
459 case 0x10ec0274:
460 case 0x10ec0294:
6fbae35a
KY
461 case 0x10ec0700:
462 case 0x10ec0701:
463 case 0x10ec0703:
83629532 464 case 0x10ec0711:
dcd4f0db
KY
465 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
466 break;
394c97f8
KY
467 case 0x10ec0662:
468 if ((coef & 0x00f0) == 0x0030)
469 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
470 break;
471 case 0x10ec0272:
472 case 0x10ec0273:
473 case 0x10ec0663:
474 case 0x10ec0665:
475 case 0x10ec0670:
476 case 0x10ec0671:
477 case 0x10ec0672:
478 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
479 break;
9194a1eb 480 case 0x10ec0222:
f0778871
KY
481 case 0x10ec0623:
482 alc_update_coef_idx(codec, 0x19, 1<<13, 0);
483 break;
394c97f8
KY
484 case 0x10ec0668:
485 alc_update_coef_idx(codec, 0x7, 3<<13, 0);
486 break;
487 case 0x10ec0867:
488 alc_update_coef_idx(codec, 0x4, 1<<10, 0);
489 break;
490 case 0x10ec0888:
491 if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
492 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
493 break;
494 case 0x10ec0892:
e5782a5d 495 case 0x10ec0897:
394c97f8
KY
496 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
497 break;
498 case 0x10ec0899:
499 case 0x10ec0900:
6d9ffcff 500 case 0x10ec0b00:
65553b12 501 case 0x10ec1168:
a535ad57 502 case 0x10ec1220:
394c97f8
KY
503 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
504 break;
505 }
506}
507
f9423e7a
KY
508/* additional initialization for ALC888 variants */
509static void alc888_coef_init(struct hda_codec *codec)
510{
1df8874b
KY
511 switch (alc_get_coef0(codec) & 0x00f0) {
512 /* alc888-VA */
513 case 0x00:
514 /* alc888-VB */
515 case 0x10:
516 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
517 break;
518 }
87a8c370
JK
519}
520
3fb4a508
TI
521/* turn on/off EAPD control (only if available) */
522static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
523{
524 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
525 return;
526 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
527 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
528 on ? 2 : 0);
529}
530
691f1fcc
TI
531/* turn on/off EAPD controls of the codec */
532static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
533{
534 /* We currently only handle front, HP */
caf3c043 535 static const hda_nid_t pins[] = {
af95b414 536 0x0f, 0x10, 0x14, 0x15, 0x17, 0
39fa84e9 537 };
caf3c043 538 const hda_nid_t *p;
39fa84e9
TI
539 for (p = pins; *p; p++)
540 set_eapd(codec, *p, on);
691f1fcc
TI
541}
542
dad3197d
KY
543static int find_ext_mic_pin(struct hda_codec *codec);
544
545static void alc_headset_mic_no_shutup(struct hda_codec *codec)
546{
547 const struct hda_pincfg *pin;
548 int mic_pin = find_ext_mic_pin(codec);
549 int i;
550
551 /* don't shut up pins when unloading the driver; otherwise it breaks
552 * the default pin setup at the next load of the driver
553 */
554 if (codec->bus->shutdown)
555 return;
556
557 snd_array_for_each(&codec->init_pins, i, pin) {
558 /* use read here for syncing after issuing each verb */
559 if (pin->nid != mic_pin)
560 snd_hda_codec_read(codec, pin->nid, 0,
561 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
562 }
563
564 codec->pins_shutup = 1;
565}
566
c0ca5ece
TI
567static void alc_shutup_pins(struct hda_codec *codec)
568{
569 struct alc_spec *spec = codec->spec;
570
dad3197d 571 switch (codec->core.vendor_id) {
5aec9891
KY
572 case 0x10ec0236:
573 case 0x10ec0256:
66c5d718 574 case 0x10ec0283:
dad3197d
KY
575 case 0x10ec0286:
576 case 0x10ec0288:
577 case 0x10ec0298:
578 alc_headset_mic_no_shutup(codec);
579 break;
580 default:
581 if (!spec->no_shutup_pins)
582 snd_hda_shutup_pins(codec);
583 break;
584 }
c0ca5ece
TI
585}
586
1c716153 587/* generic shutup callback;
4ce8e6a5 588 * just turning off EAPD and a little pause for avoiding pop-noise
1c716153
TI
589 */
590static void alc_eapd_shutup(struct hda_codec *codec)
591{
97a26570
KY
592 struct alc_spec *spec = codec->spec;
593
1c716153 594 alc_auto_setup_eapd(codec, false);
97a26570
KY
595 if (!spec->no_depop_delay)
596 msleep(200);
c0ca5ece 597 alc_shutup_pins(codec);
1c716153
TI
598}
599
1d045db9 600/* generic EAPD initialization */
4a79ba34 601static void alc_auto_init_amp(struct hda_codec *codec, int type)
bc9f98a9 602{
39fa84e9 603 alc_auto_setup_eapd(codec, true);
5579cd6f 604 alc_write_gpio(codec);
4a79ba34 605 switch (type) {
4a79ba34 606 case ALC_INIT_DEFAULT:
7639a06c 607 switch (codec->core.vendor_id) {
c9b58006 608 case 0x10ec0260:
98b24883 609 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
c9b58006 610 break;
c9b58006
KY
611 case 0x10ec0880:
612 case 0x10ec0882:
613 case 0x10ec0883:
614 case 0x10ec0885:
1df8874b 615 alc_update_coef_idx(codec, 7, 0, 0x2030);
c9b58006 616 break;
f9423e7a 617 case 0x10ec0888:
4a79ba34 618 alc888_coef_init(codec);
f9423e7a 619 break;
bc9f98a9 620 }
4a79ba34
TI
621 break;
622 }
623}
624
35a39f98
TI
625/* get a primary headphone pin if available */
626static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
627{
628 if (spec->gen.autocfg.hp_pins[0])
629 return spec->gen.autocfg.hp_pins[0];
630 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
631 return spec->gen.autocfg.line_out_pins[0];
632 return 0;
633}
08c189f2 634
1d045db9 635/*
08c189f2 636 * Realtek SSID verification
1d045db9 637 */
42cf0d01 638
08c189f2
TI
639/* Could be any non-zero and even value. When used as fixup, tells
640 * the driver to ignore any present sku defines.
641 */
642#define ALC_FIXUP_SKU_IGNORE (2)
1a1455de 643
08c189f2
TI
644static void alc_fixup_sku_ignore(struct hda_codec *codec,
645 const struct hda_fixup *fix, int action)
1a1455de 646{
1a1455de 647 struct alc_spec *spec = codec->spec;
08c189f2
TI
648 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
649 spec->cdefine.fixup = 1;
650 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
1a1455de 651 }
1a1455de
TI
652}
653
b5c6611f
ML
654static void alc_fixup_no_depop_delay(struct hda_codec *codec,
655 const struct hda_fixup *fix, int action)
656{
657 struct alc_spec *spec = codec->spec;
658
84d2dc3e 659 if (action == HDA_FIXUP_ACT_PROBE) {
b5c6611f 660 spec->no_depop_delay = 1;
84d2dc3e
ML
661 codec->depop_delay = 0;
662 }
b5c6611f
ML
663}
664
08c189f2 665static int alc_auto_parse_customize_define(struct hda_codec *codec)
4a79ba34 666{
08c189f2
TI
667 unsigned int ass, tmp, i;
668 unsigned nid = 0;
4a79ba34
TI
669 struct alc_spec *spec = codec->spec;
670
08c189f2 671 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
4a79ba34 672
08c189f2
TI
673 if (spec->cdefine.fixup) {
674 ass = spec->cdefine.sku_cfg;
675 if (ass == ALC_FIXUP_SKU_IGNORE)
676 return -1;
677 goto do_sku;
bb35febd
TI
678 }
679
5100cd07
TI
680 if (!codec->bus->pci)
681 return -1;
7639a06c 682 ass = codec->core.subsystem_id & 0xffff;
08c189f2
TI
683 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
684 goto do_sku;
4a79ba34 685
08c189f2 686 nid = 0x1d;
7639a06c 687 if (codec->core.vendor_id == 0x10ec0260)
08c189f2
TI
688 nid = 0x17;
689 ass = snd_hda_codec_get_pincfg(codec, nid);
42cf0d01 690
08c189f2 691 if (!(ass & 1)) {
4e76a883 692 codec_info(codec, "%s: SKU not ready 0x%08x\n",
7639a06c 693 codec->core.chip_name, ass);
08c189f2 694 return -1;
42cf0d01
DH
695 }
696
08c189f2
TI
697 /* check sum */
698 tmp = 0;
699 for (i = 1; i < 16; i++) {
700 if ((ass >> i) & 1)
701 tmp++;
ae8a60a5 702 }
08c189f2
TI
703 if (((ass >> 16) & 0xf) != tmp)
704 return -1;
ae8a60a5 705
da00c244
KY
706 spec->cdefine.port_connectivity = ass >> 30;
707 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
708 spec->cdefine.check_sum = (ass >> 16) & 0xf;
709 spec->cdefine.customization = ass >> 8;
710do_sku:
711 spec->cdefine.sku_cfg = ass;
712 spec->cdefine.external_amp = (ass & 0x38) >> 3;
713 spec->cdefine.platform_type = (ass & 0x4) >> 2;
714 spec->cdefine.swap = (ass & 0x2) >> 1;
715 spec->cdefine.override = ass & 0x1;
716
4e76a883 717 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
da00c244 718 nid, spec->cdefine.sku_cfg);
4e76a883 719 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
da00c244 720 spec->cdefine.port_connectivity);
4e76a883
TI
721 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
722 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
723 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
724 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
725 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
726 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
727 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
da00c244
KY
728
729 return 0;
730}
731
08c189f2
TI
732/* return the position of NID in the list, or -1 if not found */
733static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
734{
735 int i;
736 for (i = 0; i < nums; i++)
737 if (list[i] == nid)
738 return i;
739 return -1;
740}
1d045db9 741/* return true if the given NID is found in the list */
3af9ee6b
TI
742static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
743{
21268961 744 return find_idx_in_nid_list(nid, list, nums) >= 0;
3af9ee6b
TI
745}
746
4a79ba34
TI
747/* check subsystem ID and set up device-specific initialization;
748 * return 1 if initialized, 0 if invalid SSID
749 */
750/* 32-bit subsystem ID for BIOS loading in HD Audio codec.
751 * 31 ~ 16 : Manufacture ID
752 * 15 ~ 8 : SKU ID
753 * 7 ~ 0 : Assembly ID
754 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
755 */
58c57cfa 756static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
4a79ba34
TI
757{
758 unsigned int ass, tmp, i;
759 unsigned nid;
760 struct alc_spec *spec = codec->spec;
761
90622917
DH
762 if (spec->cdefine.fixup) {
763 ass = spec->cdefine.sku_cfg;
764 if (ass == ALC_FIXUP_SKU_IGNORE)
765 return 0;
766 goto do_sku;
767 }
768
7639a06c 769 ass = codec->core.subsystem_id & 0xffff;
5100cd07
TI
770 if (codec->bus->pci &&
771 ass != codec->bus->pci->subsystem_device && (ass & 1))
4a79ba34
TI
772 goto do_sku;
773
774 /* invalid SSID, check the special NID pin defcfg instead */
775 /*
def319f9 776 * 31~30 : port connectivity
4a79ba34
TI
777 * 29~21 : reserve
778 * 20 : PCBEEP input
779 * 19~16 : Check sum (15:1)
780 * 15~1 : Custom
781 * 0 : override
782 */
783 nid = 0x1d;
7639a06c 784 if (codec->core.vendor_id == 0x10ec0260)
4a79ba34
TI
785 nid = 0x17;
786 ass = snd_hda_codec_get_pincfg(codec, nid);
4e76a883
TI
787 codec_dbg(codec,
788 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
cb6605c1 789 ass, nid);
6227cdce 790 if (!(ass & 1))
4a79ba34
TI
791 return 0;
792 if ((ass >> 30) != 1) /* no physical connection */
793 return 0;
794
795 /* check sum */
796 tmp = 0;
797 for (i = 1; i < 16; i++) {
798 if ((ass >> i) & 1)
799 tmp++;
800 }
801 if (((ass >> 16) & 0xf) != tmp)
802 return 0;
803do_sku:
4e76a883 804 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
7639a06c 805 ass & 0xffff, codec->core.vendor_id);
4a79ba34
TI
806 /*
807 * 0 : override
808 * 1 : Swap Jack
809 * 2 : 0 --> Desktop, 1 --> Laptop
810 * 3~5 : External Amplifier control
811 * 7~6 : Reserved
812 */
813 tmp = (ass & 0x38) >> 3; /* external Amp control */
1c76aa5f
TI
814 if (spec->init_amp == ALC_INIT_UNDEFINED) {
815 switch (tmp) {
816 case 1:
5579cd6f 817 alc_setup_gpio(codec, 0x01);
1c76aa5f
TI
818 break;
819 case 3:
5579cd6f 820 alc_setup_gpio(codec, 0x02);
1c76aa5f
TI
821 break;
822 case 7:
5579cd6f 823 alc_setup_gpio(codec, 0x03);
1c76aa5f
TI
824 break;
825 case 5:
826 default:
827 spec->init_amp = ALC_INIT_DEFAULT;
828 break;
829 }
bc9f98a9 830 }
ea1fb29a 831
8c427226 832 /* is laptop or Desktop and enable the function "Mute internal speaker
c9b58006
KY
833 * when the external headphone out jack is plugged"
834 */
8c427226 835 if (!(ass & 0x8000))
4a79ba34 836 return 1;
c9b58006
KY
837 /*
838 * 10~8 : Jack location
839 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
840 * 14~13: Resvered
841 * 15 : 1 --> enable the function "Mute internal speaker
842 * when the external headphone out jack is plugged"
843 */
35a39f98 844 if (!alc_get_hp_pin(spec)) {
01d4825d 845 hda_nid_t nid;
c9b58006 846 tmp = (ass >> 11) & 0x3; /* HP to chassis */
58c57cfa 847 nid = ports[tmp];
08c189f2
TI
848 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
849 spec->gen.autocfg.line_outs))
3af9ee6b 850 return 1;
08c189f2 851 spec->gen.autocfg.hp_pins[0] = nid;
c9b58006 852 }
4a79ba34
TI
853 return 1;
854}
ea1fb29a 855
3e6179b8
TI
856/* Check the validity of ALC subsystem-id
857 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
858static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
4a79ba34 859{
58c57cfa 860 if (!alc_subsystem_id(codec, ports)) {
4a79ba34 861 struct alc_spec *spec = codec->spec;
67791202
TI
862 if (spec->init_amp == ALC_INIT_UNDEFINED) {
863 codec_dbg(codec,
864 "realtek: Enable default setup for auto mode as fallback\n");
865 spec->init_amp = ALC_INIT_DEFAULT;
866 }
4a79ba34 867 }
21268961 868}
1a1455de 869
1d045db9 870/*
ef8ef5fb 871 */
f9e336f6 872
9d36a7dc
DH
873static void alc_fixup_inv_dmic(struct hda_codec *codec,
874 const struct hda_fixup *fix, int action)
125821ae
TI
875{
876 struct alc_spec *spec = codec->spec;
668d1e96 877
9d36a7dc 878 spec->gen.inv_dmic_split = 1;
6e72aa5f
TI
879}
880
e9edcee0 881
08c189f2 882static int alc_build_controls(struct hda_codec *codec)
1d045db9 883{
a5cb463a 884 int err;
e9427969 885
08c189f2
TI
886 err = snd_hda_gen_build_controls(codec);
887 if (err < 0)
888 return err;
1da177e4 889
1727a771 890 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
1c4a54b4 891 return 0;
a361d84b
KY
892}
893
a361d84b 894
df694daa 895/*
08c189f2 896 * Common callbacks
df694daa 897 */
a361d84b 898
c9af753f
TI
899static void alc_pre_init(struct hda_codec *codec)
900{
901 alc_fill_eapd_coef(codec);
902}
903
aeac1a0d
KY
904#define is_s3_resume(codec) \
905 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
c9af753f
TI
906#define is_s4_resume(codec) \
907 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
908
08c189f2 909static int alc_init(struct hda_codec *codec)
1d045db9
TI
910{
911 struct alc_spec *spec = codec->spec;
a361d84b 912
c9af753f
TI
913 /* hibernation resume needs the full chip initialization */
914 if (is_s4_resume(codec))
915 alc_pre_init(codec);
916
08c189f2
TI
917 if (spec->init_hook)
918 spec->init_hook(codec);
a361d84b 919
89781d08 920 spec->gen.skip_verbs = 1; /* applied in below */
607ca3bd 921 snd_hda_gen_init(codec);
08c189f2
TI
922 alc_fix_pll(codec);
923 alc_auto_init_amp(codec, spec->init_amp);
89781d08 924 snd_hda_apply_verbs(codec); /* apply verbs here after own init */
3abf2f36 925
1727a771 926 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
a361d84b 927
1d045db9
TI
928 return 0;
929}
a361d84b 930
08c189f2 931static inline void alc_shutup(struct hda_codec *codec)
1d045db9
TI
932{
933 struct alc_spec *spec = codec->spec;
a361d84b 934
c7273bd6
TI
935 if (!snd_hda_get_bool_hint(codec, "shutup"))
936 return; /* disabled explicitly by hints */
937
08c189f2
TI
938 if (spec && spec->shutup)
939 spec->shutup(codec);
9bfb2844 940 else
c0ca5ece 941 alc_shutup_pins(codec);
1d045db9
TI
942}
943
8a02c0cc 944#define alc_free snd_hda_gen_free
2134ea4f 945
08c189f2
TI
946#ifdef CONFIG_PM
947static void alc_power_eapd(struct hda_codec *codec)
1d045db9 948{
08c189f2 949 alc_auto_setup_eapd(codec, false);
1d045db9 950}
2134ea4f 951
08c189f2 952static int alc_suspend(struct hda_codec *codec)
1d045db9
TI
953{
954 struct alc_spec *spec = codec->spec;
08c189f2
TI
955 alc_shutup(codec);
956 if (spec && spec->power_hook)
957 spec->power_hook(codec);
a361d84b
KY
958 return 0;
959}
08c189f2 960#endif
a361d84b 961
08c189f2
TI
962#ifdef CONFIG_PM
963static int alc_resume(struct hda_codec *codec)
1d045db9 964{
97a26570
KY
965 struct alc_spec *spec = codec->spec;
966
967 if (!spec->no_depop_delay)
968 msleep(150); /* to avoid pop noise */
08c189f2 969 codec->patch_ops.init(codec);
1a462be5 970 snd_hda_regmap_sync(codec);
08c189f2
TI
971 hda_call_check_power_status(codec, 0x01);
972 return 0;
1d045db9 973}
08c189f2 974#endif
f6a92248 975
1d045db9 976/*
1d045db9 977 */
08c189f2
TI
978static const struct hda_codec_ops alc_patch_ops = {
979 .build_controls = alc_build_controls,
980 .build_pcms = snd_hda_gen_build_pcms,
981 .init = alc_init,
982 .free = alc_free,
983 .unsol_event = snd_hda_jack_unsol_event,
984#ifdef CONFIG_PM
985 .resume = alc_resume,
08c189f2 986 .suspend = alc_suspend,
fce52a3b 987 .check_power_status = snd_hda_gen_check_power_status,
08c189f2 988#endif
08c189f2 989};
f6a92248 990
f53281e6 991
ded255be 992#define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
e01bf509 993
e4770629 994/*
4b016931 995 * Rename codecs appropriately from COEF value or subvendor id
e4770629 996 */
08c189f2
TI
997struct alc_codec_rename_table {
998 unsigned int vendor_id;
999 unsigned short coef_mask;
1000 unsigned short coef_bits;
1001 const char *name;
1002};
84898e87 1003
4b016931
KY
1004struct alc_codec_rename_pci_table {
1005 unsigned int codec_vendor_id;
1006 unsigned short pci_subvendor;
1007 unsigned short pci_subdevice;
1008 const char *name;
1009};
1010
6b0f95c4 1011static const struct alc_codec_rename_table rename_tbl[] = {
e6e5f7ad 1012 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
08c189f2
TI
1013 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
1014 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
1015 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
1016 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
1017 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
1018 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
1019 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
1020 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
e6e5f7ad 1021 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
08c189f2
TI
1022 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
1023 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
1024 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
1025 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
1026 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
1027 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
1028 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
1029 { } /* terminator */
1030};
84898e87 1031
6b0f95c4 1032static const struct alc_codec_rename_pci_table rename_pci_tbl[] = {
4b016931
KY
1033 { 0x10ec0280, 0x1028, 0, "ALC3220" },
1034 { 0x10ec0282, 0x1028, 0, "ALC3221" },
1035 { 0x10ec0283, 0x1028, 0, "ALC3223" },
193177de 1036 { 0x10ec0288, 0x1028, 0, "ALC3263" },
4b016931 1037 { 0x10ec0292, 0x1028, 0, "ALC3226" },
193177de 1038 { 0x10ec0293, 0x1028, 0, "ALC3235" },
4b016931
KY
1039 { 0x10ec0255, 0x1028, 0, "ALC3234" },
1040 { 0x10ec0668, 0x1028, 0, "ALC3661" },
e6e5f7ad
KY
1041 { 0x10ec0275, 0x1028, 0, "ALC3260" },
1042 { 0x10ec0899, 0x1028, 0, "ALC3861" },
2c674fac 1043 { 0x10ec0298, 0x1028, 0, "ALC3266" },
736f20a7 1044 { 0x10ec0236, 0x1028, 0, "ALC3204" },
82324502 1045 { 0x10ec0256, 0x1028, 0, "ALC3246" },
4231430d 1046 { 0x10ec0225, 0x1028, 0, "ALC3253" },
7d727869 1047 { 0x10ec0295, 0x1028, 0, "ALC3254" },
28f1f9b2 1048 { 0x10ec0299, 0x1028, 0, "ALC3271" },
e6e5f7ad
KY
1049 { 0x10ec0670, 0x1025, 0, "ALC669X" },
1050 { 0x10ec0676, 0x1025, 0, "ALC679X" },
1051 { 0x10ec0282, 0x1043, 0, "ALC3229" },
1052 { 0x10ec0233, 0x1043, 0, "ALC3236" },
1053 { 0x10ec0280, 0x103c, 0, "ALC3228" },
1054 { 0x10ec0282, 0x103c, 0, "ALC3227" },
1055 { 0x10ec0286, 0x103c, 0, "ALC3242" },
1056 { 0x10ec0290, 0x103c, 0, "ALC3241" },
1057 { 0x10ec0668, 0x103c, 0, "ALC3662" },
1058 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
1059 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
4b016931
KY
1060 { } /* terminator */
1061};
1062
08c189f2 1063static int alc_codec_rename_from_preset(struct hda_codec *codec)
1d045db9 1064{
08c189f2 1065 const struct alc_codec_rename_table *p;
4b016931 1066 const struct alc_codec_rename_pci_table *q;
60db6b53 1067
08c189f2 1068 for (p = rename_tbl; p->vendor_id; p++) {
7639a06c 1069 if (p->vendor_id != codec->core.vendor_id)
08c189f2
TI
1070 continue;
1071 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
1072 return alc_codec_rename(codec, p->name);
1d045db9 1073 }
4b016931 1074
5100cd07
TI
1075 if (!codec->bus->pci)
1076 return 0;
4b016931 1077 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
7639a06c 1078 if (q->codec_vendor_id != codec->core.vendor_id)
4b016931
KY
1079 continue;
1080 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1081 continue;
1082 if (!q->pci_subdevice ||
1083 q->pci_subdevice == codec->bus->pci->subsystem_device)
1084 return alc_codec_rename(codec, q->name);
1085 }
1086
08c189f2 1087 return 0;
1d045db9 1088}
f53281e6 1089
e4770629 1090
1d045db9
TI
1091/*
1092 * Digital-beep handlers
1093 */
1094#ifdef CONFIG_SND_HDA_INPUT_BEEP
fea80fae
TI
1095
1096/* additional beep mixers; private_value will be overwritten */
1097static const struct snd_kcontrol_new alc_beep_mixer[] = {
1098 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1099 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1100};
1101
1102/* set up and create beep controls */
1103static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1104 int idx, int dir)
1105{
1106 struct snd_kcontrol_new *knew;
1107 unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1108 int i;
1109
1110 for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1111 knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1112 &alc_beep_mixer[i]);
1113 if (!knew)
1114 return -ENOMEM;
1115 knew->private_value = beep_amp;
1116 }
1117 return 0;
1118}
84898e87 1119
6317e5eb 1120static const struct snd_pci_quirk beep_allow_list[] = {
7110005e 1121 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
a4b7f21d 1122 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
1d045db9 1123 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
8554ee40 1124 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
1d045db9
TI
1125 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1126 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1127 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
78f8baf1 1128 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
1d045db9 1129 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
6317e5eb 1130 /* denylist -- no beep available */
051c78af
TI
1131 SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
1132 SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
1d045db9 1133 {}
fe3eb0a7
KY
1134};
1135
1d045db9
TI
1136static inline int has_cdefine_beep(struct hda_codec *codec)
1137{
1138 struct alc_spec *spec = codec->spec;
1139 const struct snd_pci_quirk *q;
6317e5eb 1140 q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list);
1d045db9
TI
1141 if (q)
1142 return q->value;
1143 return spec->cdefine.enable_pcbeep;
1144}
1145#else
fea80fae 1146#define set_beep_amp(spec, nid, idx, dir) 0
1d045db9
TI
1147#define has_cdefine_beep(codec) 0
1148#endif
84898e87 1149
1d045db9
TI
1150/* parse the BIOS configuration and set up the alc_spec */
1151/* return 1 if successful, 0 if the proper config is not found,
1152 * or a negative error code
1153 */
3e6179b8
TI
1154static int alc_parse_auto_config(struct hda_codec *codec,
1155 const hda_nid_t *ignore_nids,
1156 const hda_nid_t *ssid_nids)
1d045db9
TI
1157{
1158 struct alc_spec *spec = codec->spec;
08c189f2 1159 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
1d045db9 1160 int err;
26f5df26 1161
53c334ad
TI
1162 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1163 spec->parse_flags);
1d045db9
TI
1164 if (err < 0)
1165 return err;
3e6179b8
TI
1166
1167 if (ssid_nids)
1168 alc_ssid_check(codec, ssid_nids);
64154835 1169
08c189f2
TI
1170 err = snd_hda_gen_parse_auto_config(codec, cfg);
1171 if (err < 0)
1172 return err;
070cff4c 1173
1d045db9 1174 return 1;
60db6b53 1175}
f6a92248 1176
3de95173
TI
1177/* common preparation job for alc_spec */
1178static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1179{
1180 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1181 int err;
1182
1183 if (!spec)
1184 return -ENOMEM;
1185 codec->spec = spec;
08c189f2
TI
1186 snd_hda_gen_spec_init(&spec->gen);
1187 spec->gen.mixer_nid = mixer_nid;
1188 spec->gen.own_eapd_ctl = 1;
1098b7c2 1189 codec->single_adc_amp = 1;
08c189f2
TI
1190 /* FIXME: do we need this for all Realtek codec models? */
1191 codec->spdif_status_reset = 1;
a6e7d0a4 1192 codec->forced_resume = 1;
225068ab 1193 codec->patch_ops = alc_patch_ops;
b837a9f5 1194 mutex_init(&spec->coef_mutex);
3de95173
TI
1195
1196 err = alc_codec_rename_from_preset(codec);
1197 if (err < 0) {
1198 kfree(spec);
1199 return err;
1200 }
1201 return 0;
1202}
1203
3e6179b8
TI
1204static int alc880_parse_auto_config(struct hda_codec *codec)
1205{
1206 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
7d7eb9ea 1207 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3e6179b8
TI
1208 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1209}
1210
ee3b2969
TI
1211/*
1212 * ALC880 fix-ups
1213 */
1214enum {
411225a0 1215 ALC880_FIXUP_GPIO1,
ee3b2969
TI
1216 ALC880_FIXUP_GPIO2,
1217 ALC880_FIXUP_MEDION_RIM,
dc6af52d 1218 ALC880_FIXUP_LG,
db8a38e5 1219 ALC880_FIXUP_LG_LW25,
f02aab5d 1220 ALC880_FIXUP_W810,
27e917f8 1221 ALC880_FIXUP_EAPD_COEF,
b9368f5c 1222 ALC880_FIXUP_TCL_S700,
cf5a2279
TI
1223 ALC880_FIXUP_VOL_KNOB,
1224 ALC880_FIXUP_FUJITSU,
ba533818 1225 ALC880_FIXUP_F1734,
817de92f 1226 ALC880_FIXUP_UNIWILL,
967b88c4 1227 ALC880_FIXUP_UNIWILL_DIG,
96e225f6 1228 ALC880_FIXUP_Z71V,
487a588d 1229 ALC880_FIXUP_ASUS_W5A,
67b6ec31
TI
1230 ALC880_FIXUP_3ST_BASE,
1231 ALC880_FIXUP_3ST,
1232 ALC880_FIXUP_3ST_DIG,
1233 ALC880_FIXUP_5ST_BASE,
1234 ALC880_FIXUP_5ST,
1235 ALC880_FIXUP_5ST_DIG,
1236 ALC880_FIXUP_6ST_BASE,
1237 ALC880_FIXUP_6ST,
1238 ALC880_FIXUP_6ST_DIG,
5397145f 1239 ALC880_FIXUP_6ST_AUTOMUTE,
ee3b2969
TI
1240};
1241
cf5a2279
TI
1242/* enable the volume-knob widget support on NID 0x21 */
1243static void alc880_fixup_vol_knob(struct hda_codec *codec,
1727a771 1244 const struct hda_fixup *fix, int action)
cf5a2279 1245{
1727a771 1246 if (action == HDA_FIXUP_ACT_PROBE)
62f949bf
TI
1247 snd_hda_jack_detect_enable_callback(codec, 0x21,
1248 alc_update_knob_master);
cf5a2279
TI
1249}
1250
1727a771 1251static const struct hda_fixup alc880_fixups[] = {
411225a0 1252 [ALC880_FIXUP_GPIO1] = {
5579cd6f
TI
1253 .type = HDA_FIXUP_FUNC,
1254 .v.func = alc_fixup_gpio1,
411225a0 1255 },
ee3b2969 1256 [ALC880_FIXUP_GPIO2] = {
5579cd6f
TI
1257 .type = HDA_FIXUP_FUNC,
1258 .v.func = alc_fixup_gpio2,
ee3b2969
TI
1259 },
1260 [ALC880_FIXUP_MEDION_RIM] = {
1727a771 1261 .type = HDA_FIXUP_VERBS,
ee3b2969
TI
1262 .v.verbs = (const struct hda_verb[]) {
1263 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1264 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1265 { }
1266 },
1267 .chained = true,
1268 .chain_id = ALC880_FIXUP_GPIO2,
1269 },
dc6af52d 1270 [ALC880_FIXUP_LG] = {
1727a771
TI
1271 .type = HDA_FIXUP_PINS,
1272 .v.pins = (const struct hda_pintbl[]) {
dc6af52d
TI
1273 /* disable bogus unused pins */
1274 { 0x16, 0x411111f0 },
1275 { 0x18, 0x411111f0 },
1276 { 0x1a, 0x411111f0 },
1277 { }
1278 }
1279 },
db8a38e5
TI
1280 [ALC880_FIXUP_LG_LW25] = {
1281 .type = HDA_FIXUP_PINS,
1282 .v.pins = (const struct hda_pintbl[]) {
1283 { 0x1a, 0x0181344f }, /* line-in */
1284 { 0x1b, 0x0321403f }, /* headphone */
1285 { }
1286 }
1287 },
f02aab5d 1288 [ALC880_FIXUP_W810] = {
1727a771
TI
1289 .type = HDA_FIXUP_PINS,
1290 .v.pins = (const struct hda_pintbl[]) {
f02aab5d
TI
1291 /* disable bogus unused pins */
1292 { 0x17, 0x411111f0 },
1293 { }
1294 },
1295 .chained = true,
1296 .chain_id = ALC880_FIXUP_GPIO2,
1297 },
27e917f8 1298 [ALC880_FIXUP_EAPD_COEF] = {
1727a771 1299 .type = HDA_FIXUP_VERBS,
27e917f8
TI
1300 .v.verbs = (const struct hda_verb[]) {
1301 /* change to EAPD mode */
1302 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1303 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1304 {}
1305 },
1306 },
b9368f5c 1307 [ALC880_FIXUP_TCL_S700] = {
1727a771 1308 .type = HDA_FIXUP_VERBS,
b9368f5c
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, 0x3070 },
1313 {}
1314 },
1315 .chained = true,
1316 .chain_id = ALC880_FIXUP_GPIO2,
1317 },
cf5a2279 1318 [ALC880_FIXUP_VOL_KNOB] = {
1727a771 1319 .type = HDA_FIXUP_FUNC,
cf5a2279
TI
1320 .v.func = alc880_fixup_vol_knob,
1321 },
1322 [ALC880_FIXUP_FUJITSU] = {
1323 /* override all pins as BIOS on old Amilo is broken */
1727a771
TI
1324 .type = HDA_FIXUP_PINS,
1325 .v.pins = (const struct hda_pintbl[]) {
bb148bde 1326 { 0x14, 0x0121401f }, /* HP */
cf5a2279
TI
1327 { 0x15, 0x99030120 }, /* speaker */
1328 { 0x16, 0x99030130 }, /* bass speaker */
1329 { 0x17, 0x411111f0 }, /* N/A */
1330 { 0x18, 0x411111f0 }, /* N/A */
1331 { 0x19, 0x01a19950 }, /* mic-in */
1332 { 0x1a, 0x411111f0 }, /* N/A */
1333 { 0x1b, 0x411111f0 }, /* N/A */
1334 { 0x1c, 0x411111f0 }, /* N/A */
1335 { 0x1d, 0x411111f0 }, /* N/A */
1336 { 0x1e, 0x01454140 }, /* SPDIF out */
1337 { }
1338 },
1339 .chained = true,
1340 .chain_id = ALC880_FIXUP_VOL_KNOB,
1341 },
ba533818
TI
1342 [ALC880_FIXUP_F1734] = {
1343 /* almost compatible with FUJITSU, but no bass and SPDIF */
1727a771
TI
1344 .type = HDA_FIXUP_PINS,
1345 .v.pins = (const struct hda_pintbl[]) {
bb148bde 1346 { 0x14, 0x0121401f }, /* HP */
ba533818
TI
1347 { 0x15, 0x99030120 }, /* speaker */
1348 { 0x16, 0x411111f0 }, /* N/A */
1349 { 0x17, 0x411111f0 }, /* N/A */
1350 { 0x18, 0x411111f0 }, /* N/A */
1351 { 0x19, 0x01a19950 }, /* mic-in */
1352 { 0x1a, 0x411111f0 }, /* N/A */
1353 { 0x1b, 0x411111f0 }, /* N/A */
1354 { 0x1c, 0x411111f0 }, /* N/A */
1355 { 0x1d, 0x411111f0 }, /* N/A */
1356 { 0x1e, 0x411111f0 }, /* N/A */
1357 { }
1358 },
1359 .chained = true,
1360 .chain_id = ALC880_FIXUP_VOL_KNOB,
1361 },
817de92f
TI
1362 [ALC880_FIXUP_UNIWILL] = {
1363 /* need to fix HP and speaker pins to be parsed correctly */
1727a771
TI
1364 .type = HDA_FIXUP_PINS,
1365 .v.pins = (const struct hda_pintbl[]) {
817de92f
TI
1366 { 0x14, 0x0121411f }, /* HP */
1367 { 0x15, 0x99030120 }, /* speaker */
1368 { 0x16, 0x99030130 }, /* bass speaker */
1369 { }
1370 },
1371 },
967b88c4 1372 [ALC880_FIXUP_UNIWILL_DIG] = {
1727a771
TI
1373 .type = HDA_FIXUP_PINS,
1374 .v.pins = (const struct hda_pintbl[]) {
967b88c4
TI
1375 /* disable bogus unused pins */
1376 { 0x17, 0x411111f0 },
1377 { 0x19, 0x411111f0 },
1378 { 0x1b, 0x411111f0 },
1379 { 0x1f, 0x411111f0 },
1380 { }
1381 }
1382 },
96e225f6 1383 [ALC880_FIXUP_Z71V] = {
1727a771
TI
1384 .type = HDA_FIXUP_PINS,
1385 .v.pins = (const struct hda_pintbl[]) {
96e225f6
TI
1386 /* set up the whole pins as BIOS is utterly broken */
1387 { 0x14, 0x99030120 }, /* speaker */
1388 { 0x15, 0x0121411f }, /* HP */
1389 { 0x16, 0x411111f0 }, /* N/A */
1390 { 0x17, 0x411111f0 }, /* N/A */
1391 { 0x18, 0x01a19950 }, /* mic-in */
1392 { 0x19, 0x411111f0 }, /* N/A */
1393 { 0x1a, 0x01813031 }, /* line-in */
1394 { 0x1b, 0x411111f0 }, /* N/A */
1395 { 0x1c, 0x411111f0 }, /* N/A */
1396 { 0x1d, 0x411111f0 }, /* N/A */
1397 { 0x1e, 0x0144111e }, /* SPDIF */
1398 { }
1399 }
1400 },
487a588d
TI
1401 [ALC880_FIXUP_ASUS_W5A] = {
1402 .type = HDA_FIXUP_PINS,
1403 .v.pins = (const struct hda_pintbl[]) {
1404 /* set up the whole pins as BIOS is utterly broken */
1405 { 0x14, 0x0121411f }, /* HP */
1406 { 0x15, 0x411111f0 }, /* N/A */
1407 { 0x16, 0x411111f0 }, /* N/A */
1408 { 0x17, 0x411111f0 }, /* N/A */
1409 { 0x18, 0x90a60160 }, /* mic */
1410 { 0x19, 0x411111f0 }, /* N/A */
1411 { 0x1a, 0x411111f0 }, /* N/A */
1412 { 0x1b, 0x411111f0 }, /* N/A */
1413 { 0x1c, 0x411111f0 }, /* N/A */
1414 { 0x1d, 0x411111f0 }, /* N/A */
1415 { 0x1e, 0xb743111e }, /* SPDIF out */
1416 { }
1417 },
1418 .chained = true,
1419 .chain_id = ALC880_FIXUP_GPIO1,
1420 },
67b6ec31 1421 [ALC880_FIXUP_3ST_BASE] = {
1727a771
TI
1422 .type = HDA_FIXUP_PINS,
1423 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1424 { 0x14, 0x01014010 }, /* line-out */
1425 { 0x15, 0x411111f0 }, /* N/A */
1426 { 0x16, 0x411111f0 }, /* N/A */
1427 { 0x17, 0x411111f0 }, /* N/A */
1428 { 0x18, 0x01a19c30 }, /* mic-in */
1429 { 0x19, 0x0121411f }, /* HP */
1430 { 0x1a, 0x01813031 }, /* line-in */
1431 { 0x1b, 0x02a19c40 }, /* front-mic */
1432 { 0x1c, 0x411111f0 }, /* N/A */
1433 { 0x1d, 0x411111f0 }, /* N/A */
1434 /* 0x1e is filled in below */
1435 { 0x1f, 0x411111f0 }, /* N/A */
1436 { }
1437 }
1438 },
1439 [ALC880_FIXUP_3ST] = {
1727a771
TI
1440 .type = HDA_FIXUP_PINS,
1441 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1442 { 0x1e, 0x411111f0 }, /* N/A */
1443 { }
1444 },
1445 .chained = true,
1446 .chain_id = ALC880_FIXUP_3ST_BASE,
1447 },
1448 [ALC880_FIXUP_3ST_DIG] = {
1727a771
TI
1449 .type = HDA_FIXUP_PINS,
1450 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1451 { 0x1e, 0x0144111e }, /* SPDIF */
1452 { }
1453 },
1454 .chained = true,
1455 .chain_id = ALC880_FIXUP_3ST_BASE,
1456 },
1457 [ALC880_FIXUP_5ST_BASE] = {
1727a771
TI
1458 .type = HDA_FIXUP_PINS,
1459 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1460 { 0x14, 0x01014010 }, /* front */
1461 { 0x15, 0x411111f0 }, /* N/A */
1462 { 0x16, 0x01011411 }, /* CLFE */
1463 { 0x17, 0x01016412 }, /* surr */
1464 { 0x18, 0x01a19c30 }, /* mic-in */
1465 { 0x19, 0x0121411f }, /* HP */
1466 { 0x1a, 0x01813031 }, /* line-in */
1467 { 0x1b, 0x02a19c40 }, /* front-mic */
1468 { 0x1c, 0x411111f0 }, /* N/A */
1469 { 0x1d, 0x411111f0 }, /* N/A */
1470 /* 0x1e is filled in below */
1471 { 0x1f, 0x411111f0 }, /* N/A */
1472 { }
1473 }
1474 },
1475 [ALC880_FIXUP_5ST] = {
1727a771
TI
1476 .type = HDA_FIXUP_PINS,
1477 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1478 { 0x1e, 0x411111f0 }, /* N/A */
1479 { }
1480 },
1481 .chained = true,
1482 .chain_id = ALC880_FIXUP_5ST_BASE,
1483 },
1484 [ALC880_FIXUP_5ST_DIG] = {
1727a771
TI
1485 .type = HDA_FIXUP_PINS,
1486 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1487 { 0x1e, 0x0144111e }, /* SPDIF */
1488 { }
1489 },
1490 .chained = true,
1491 .chain_id = ALC880_FIXUP_5ST_BASE,
1492 },
1493 [ALC880_FIXUP_6ST_BASE] = {
1727a771
TI
1494 .type = HDA_FIXUP_PINS,
1495 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1496 { 0x14, 0x01014010 }, /* front */
1497 { 0x15, 0x01016412 }, /* surr */
1498 { 0x16, 0x01011411 }, /* CLFE */
1499 { 0x17, 0x01012414 }, /* side */
1500 { 0x18, 0x01a19c30 }, /* mic-in */
1501 { 0x19, 0x02a19c40 }, /* front-mic */
1502 { 0x1a, 0x01813031 }, /* line-in */
1503 { 0x1b, 0x0121411f }, /* HP */
1504 { 0x1c, 0x411111f0 }, /* N/A */
1505 { 0x1d, 0x411111f0 }, /* N/A */
1506 /* 0x1e is filled in below */
1507 { 0x1f, 0x411111f0 }, /* N/A */
1508 { }
1509 }
1510 },
1511 [ALC880_FIXUP_6ST] = {
1727a771
TI
1512 .type = HDA_FIXUP_PINS,
1513 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1514 { 0x1e, 0x411111f0 }, /* N/A */
1515 { }
1516 },
1517 .chained = true,
1518 .chain_id = ALC880_FIXUP_6ST_BASE,
1519 },
1520 [ALC880_FIXUP_6ST_DIG] = {
1727a771
TI
1521 .type = HDA_FIXUP_PINS,
1522 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1523 { 0x1e, 0x0144111e }, /* SPDIF */
1524 { }
1525 },
1526 .chained = true,
1527 .chain_id = ALC880_FIXUP_6ST_BASE,
1528 },
5397145f
TI
1529 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1530 .type = HDA_FIXUP_PINS,
1531 .v.pins = (const struct hda_pintbl[]) {
1532 { 0x1b, 0x0121401f }, /* HP with jack detect */
1533 { }
1534 },
1535 .chained_before = true,
1536 .chain_id = ALC880_FIXUP_6ST_BASE,
1537 },
ee3b2969
TI
1538};
1539
1540static const struct snd_pci_quirk alc880_fixup_tbl[] = {
f02aab5d 1541 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
487a588d 1542 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
96e225f6 1543 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
29e3fdcc 1544 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
6538de03 1545 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
29e3fdcc 1546 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
27e917f8 1547 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
967b88c4 1548 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
ba533818 1549 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
817de92f 1550 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
7833c7e8 1551 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
f02aab5d 1552 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
ee3b2969 1553 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
5397145f 1554 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
a161574e 1555 SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
cf5a2279 1556 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
ba533818 1557 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
cf5a2279 1558 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
dc6af52d
TI
1559 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1560 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1561 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
db8a38e5 1562 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
b9368f5c 1563 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
67b6ec31
TI
1564
1565 /* Below is the copied entries from alc880_quirks.c.
1566 * It's not quite sure whether BIOS sets the correct pin-config table
1567 * on these machines, thus they are kept to be compatible with
1568 * the old static quirks. Once when it's confirmed to work without
1569 * these overrides, it'd be better to remove.
1570 */
1571 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1572 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1573 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1574 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1575 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1576 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1577 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1578 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1579 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1580 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1581 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1582 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1583 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1584 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1585 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1586 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1587 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1588 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1589 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1590 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1591 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1592 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1593 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1594 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1595 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1596 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1597 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1598 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1599 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1600 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1601 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1602 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1603 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1604 /* default Intel */
1605 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1606 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1607 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1608 {}
1609};
1610
1727a771 1611static const struct hda_model_fixup alc880_fixup_models[] = {
67b6ec31
TI
1612 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1613 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1614 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1615 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1616 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1617 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
5397145f 1618 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
ee3b2969
TI
1619 {}
1620};
1621
1622
1d045db9
TI
1623/*
1624 * OK, here we have finally the patch for ALC880
1625 */
1d045db9 1626static int patch_alc880(struct hda_codec *codec)
60db6b53 1627{
1d045db9 1628 struct alc_spec *spec;
1d045db9 1629 int err;
f6a92248 1630
3de95173
TI
1631 err = alc_alloc_spec(codec, 0x0b);
1632 if (err < 0)
1633 return err;
64154835 1634
3de95173 1635 spec = codec->spec;
08c189f2 1636 spec->gen.need_dac_fix = 1;
7504b6cd 1637 spec->gen.beep_nid = 0x01;
f53281e6 1638
225068ab
TI
1639 codec->patch_ops.unsol_event = alc880_unsol_event;
1640
c9af753f
TI
1641 alc_pre_init(codec);
1642
1727a771 1643 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
67b6ec31 1644 alc880_fixups);
1727a771 1645 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
ee3b2969 1646
67b6ec31
TI
1647 /* automatic parse from the BIOS config */
1648 err = alc880_parse_auto_config(codec);
1649 if (err < 0)
1650 goto error;
fe3eb0a7 1651
fea80fae
TI
1652 if (!spec->gen.no_analog) {
1653 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1654 if (err < 0)
1655 goto error;
1656 }
f53281e6 1657
1727a771 1658 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 1659
1d045db9 1660 return 0;
e16fb6d1
TI
1661
1662 error:
1663 alc_free(codec);
1664 return err;
226b1ec8
KY
1665}
1666
1d045db9 1667
60db6b53 1668/*
1d045db9 1669 * ALC260 support
60db6b53 1670 */
1d045db9 1671static int alc260_parse_auto_config(struct hda_codec *codec)
f6a92248 1672{
1d045db9 1673 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
3e6179b8
TI
1674 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1675 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
f6a92248
KY
1676}
1677
1d045db9
TI
1678/*
1679 * Pin config fixes
1680 */
1681enum {
ca8f0424
TI
1682 ALC260_FIXUP_HP_DC5750,
1683 ALC260_FIXUP_HP_PIN_0F,
1684 ALC260_FIXUP_COEF,
15317ab2 1685 ALC260_FIXUP_GPIO1,
20f7d928
TI
1686 ALC260_FIXUP_GPIO1_TOGGLE,
1687 ALC260_FIXUP_REPLACER,
0a1c4fa2 1688 ALC260_FIXUP_HP_B1900,
118cb4a4 1689 ALC260_FIXUP_KN1,
39aedee7 1690 ALC260_FIXUP_FSC_S7020,
5ebd3bbd 1691 ALC260_FIXUP_FSC_S7020_JWSE,
d08c5ef2 1692 ALC260_FIXUP_VAIO_PINS,
1d045db9
TI
1693};
1694
20f7d928
TI
1695static void alc260_gpio1_automute(struct hda_codec *codec)
1696{
1697 struct alc_spec *spec = codec->spec;
aaf312de
TI
1698
1699 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
20f7d928
TI
1700}
1701
1702static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1727a771 1703 const struct hda_fixup *fix, int action)
20f7d928
TI
1704{
1705 struct alc_spec *spec = codec->spec;
1727a771 1706 if (action == HDA_FIXUP_ACT_PROBE) {
20f7d928
TI
1707 /* although the machine has only one output pin, we need to
1708 * toggle GPIO1 according to the jack state
1709 */
08c189f2
TI
1710 spec->gen.automute_hook = alc260_gpio1_automute;
1711 spec->gen.detect_hp = 1;
1712 spec->gen.automute_speaker = 1;
1713 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
62f949bf 1714 snd_hda_jack_detect_enable_callback(codec, 0x0f,
08c189f2 1715 snd_hda_gen_hp_automute);
5579cd6f 1716 alc_setup_gpio(codec, 0x01);
20f7d928
TI
1717 }
1718}
1719
118cb4a4 1720static void alc260_fixup_kn1(struct hda_codec *codec,
1727a771 1721 const struct hda_fixup *fix, int action)
118cb4a4
TI
1722{
1723 struct alc_spec *spec = codec->spec;
1727a771 1724 static const struct hda_pintbl pincfgs[] = {
118cb4a4
TI
1725 { 0x0f, 0x02214000 }, /* HP/speaker */
1726 { 0x12, 0x90a60160 }, /* int mic */
1727 { 0x13, 0x02a19000 }, /* ext mic */
1728 { 0x18, 0x01446000 }, /* SPDIF out */
1729 /* disable bogus I/O pins */
1730 { 0x10, 0x411111f0 },
1731 { 0x11, 0x411111f0 },
1732 { 0x14, 0x411111f0 },
1733 { 0x15, 0x411111f0 },
1734 { 0x16, 0x411111f0 },
1735 { 0x17, 0x411111f0 },
1736 { 0x19, 0x411111f0 },
1737 { }
1738 };
1739
1740 switch (action) {
1727a771
TI
1741 case HDA_FIXUP_ACT_PRE_PROBE:
1742 snd_hda_apply_pincfgs(codec, pincfgs);
118cb4a4
TI
1743 spec->init_amp = ALC_INIT_NONE;
1744 break;
1745 }
1746}
1747
39aedee7
TI
1748static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1749 const struct hda_fixup *fix, int action)
1750{
1751 struct alc_spec *spec = codec->spec;
1c76aa5f 1752 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5ebd3bbd
TI
1753 spec->init_amp = ALC_INIT_NONE;
1754}
39aedee7 1755
5ebd3bbd
TI
1756static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1757 const struct hda_fixup *fix, int action)
1758{
1759 struct alc_spec *spec = codec->spec;
1760 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
f811c3cf 1761 spec->gen.add_jack_modes = 1;
5ebd3bbd 1762 spec->gen.hp_mic = 1;
e6e0ee50 1763 }
39aedee7
TI
1764}
1765
1727a771 1766static const struct hda_fixup alc260_fixups[] = {
ca8f0424 1767 [ALC260_FIXUP_HP_DC5750] = {
1727a771
TI
1768 .type = HDA_FIXUP_PINS,
1769 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
1770 { 0x11, 0x90130110 }, /* speaker */
1771 { }
1772 }
1773 },
ca8f0424 1774 [ALC260_FIXUP_HP_PIN_0F] = {
1727a771
TI
1775 .type = HDA_FIXUP_PINS,
1776 .v.pins = (const struct hda_pintbl[]) {
ca8f0424
TI
1777 { 0x0f, 0x01214000 }, /* HP */
1778 { }
1779 }
1780 },
1781 [ALC260_FIXUP_COEF] = {
1727a771 1782 .type = HDA_FIXUP_VERBS,
ca8f0424 1783 .v.verbs = (const struct hda_verb[]) {
e30cf2d2
RM
1784 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1785 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
ca8f0424
TI
1786 { }
1787 },
ca8f0424 1788 },
15317ab2 1789 [ALC260_FIXUP_GPIO1] = {
5579cd6f
TI
1790 .type = HDA_FIXUP_FUNC,
1791 .v.func = alc_fixup_gpio1,
15317ab2 1792 },
20f7d928 1793 [ALC260_FIXUP_GPIO1_TOGGLE] = {
1727a771 1794 .type = HDA_FIXUP_FUNC,
20f7d928
TI
1795 .v.func = alc260_fixup_gpio1_toggle,
1796 .chained = true,
1797 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1798 },
1799 [ALC260_FIXUP_REPLACER] = {
1727a771 1800 .type = HDA_FIXUP_VERBS,
20f7d928 1801 .v.verbs = (const struct hda_verb[]) {
192a98e2
TI
1802 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1803 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
20f7d928
TI
1804 { }
1805 },
1806 .chained = true,
1807 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1808 },
0a1c4fa2 1809 [ALC260_FIXUP_HP_B1900] = {
1727a771 1810 .type = HDA_FIXUP_FUNC,
0a1c4fa2
TI
1811 .v.func = alc260_fixup_gpio1_toggle,
1812 .chained = true,
1813 .chain_id = ALC260_FIXUP_COEF,
118cb4a4
TI
1814 },
1815 [ALC260_FIXUP_KN1] = {
1727a771 1816 .type = HDA_FIXUP_FUNC,
118cb4a4
TI
1817 .v.func = alc260_fixup_kn1,
1818 },
39aedee7
TI
1819 [ALC260_FIXUP_FSC_S7020] = {
1820 .type = HDA_FIXUP_FUNC,
1821 .v.func = alc260_fixup_fsc_s7020,
1822 },
5ebd3bbd
TI
1823 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1824 .type = HDA_FIXUP_FUNC,
1825 .v.func = alc260_fixup_fsc_s7020_jwse,
1826 .chained = true,
1827 .chain_id = ALC260_FIXUP_FSC_S7020,
1828 },
d08c5ef2
TI
1829 [ALC260_FIXUP_VAIO_PINS] = {
1830 .type = HDA_FIXUP_PINS,
1831 .v.pins = (const struct hda_pintbl[]) {
1832 /* Pin configs are missing completely on some VAIOs */
1833 { 0x0f, 0x01211020 },
1834 { 0x10, 0x0001003f },
1835 { 0x11, 0x411111f0 },
1836 { 0x12, 0x01a15930 },
1837 { 0x13, 0x411111f0 },
1838 { 0x14, 0x411111f0 },
1839 { 0x15, 0x411111f0 },
1840 { 0x16, 0x411111f0 },
1841 { 0x17, 0x411111f0 },
1842 { 0x18, 0x411111f0 },
1843 { 0x19, 0x411111f0 },
1844 { }
1845 }
1846 },
1d045db9
TI
1847};
1848
1849static const struct snd_pci_quirk alc260_fixup_tbl[] = {
15317ab2 1850 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
ca8f0424 1851 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
15317ab2 1852 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
ca8f0424 1853 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
0a1c4fa2 1854 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
d08c5ef2 1855 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
0f5a5b85 1856 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
39aedee7 1857 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
b1f58085 1858 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
118cb4a4 1859 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
20f7d928 1860 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
ca8f0424 1861 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
1d045db9
TI
1862 {}
1863};
1864
5ebd3bbd
TI
1865static const struct hda_model_fixup alc260_fixup_models[] = {
1866 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1867 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1868 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1869 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1870 {}
1871};
1872
1d045db9
TI
1873/*
1874 */
1d045db9 1875static int patch_alc260(struct hda_codec *codec)
977ddd6b 1876{
1d045db9 1877 struct alc_spec *spec;
c3c2c9e7 1878 int err;
1d045db9 1879
3de95173
TI
1880 err = alc_alloc_spec(codec, 0x07);
1881 if (err < 0)
1882 return err;
1d045db9 1883
3de95173 1884 spec = codec->spec;
ea46c3c8
TI
1885 /* as quite a few machines require HP amp for speaker outputs,
1886 * it's easier to enable it unconditionally; even if it's unneeded,
1887 * it's almost harmless.
1888 */
1889 spec->gen.prefer_hp_amp = 1;
7504b6cd 1890 spec->gen.beep_nid = 0x01;
1d045db9 1891
225068ab
TI
1892 spec->shutup = alc_eapd_shutup;
1893
c9af753f
TI
1894 alc_pre_init(codec);
1895
5ebd3bbd
TI
1896 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1897 alc260_fixups);
1727a771 1898 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
977ddd6b 1899
c3c2c9e7
TI
1900 /* automatic parse from the BIOS config */
1901 err = alc260_parse_auto_config(codec);
1902 if (err < 0)
1903 goto error;
977ddd6b 1904
fea80fae
TI
1905 if (!spec->gen.no_analog) {
1906 err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1907 if (err < 0)
1908 goto error;
1909 }
977ddd6b 1910
1727a771 1911 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 1912
1d045db9 1913 return 0;
e16fb6d1
TI
1914
1915 error:
1916 alc_free(codec);
1917 return err;
6981d184
TI
1918}
1919
1d045db9
TI
1920
1921/*
1922 * ALC882/883/885/888/889 support
1923 *
1924 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1925 * configuration. Each pin widget can choose any input DACs and a mixer.
1926 * Each ADC is connected from a mixer of all inputs. This makes possible
1927 * 6-channel independent captures.
1928 *
1929 * In addition, an independent DAC for the multi-playback (not used in this
1930 * driver yet).
1931 */
1d045db9
TI
1932
1933/*
1934 * Pin config fixes
1935 */
ff818c24 1936enum {
5c0ebfbe
TI
1937 ALC882_FIXUP_ABIT_AW9D_MAX,
1938 ALC882_FIXUP_LENOVO_Y530,
1939 ALC882_FIXUP_PB_M5210,
1940 ALC882_FIXUP_ACER_ASPIRE_7736,
1941 ALC882_FIXUP_ASUS_W90V,
8f239214 1942 ALC889_FIXUP_CD,
b2c53e20 1943 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
5c0ebfbe 1944 ALC889_FIXUP_VAIO_TT,
0e7cc2e7 1945 ALC888_FIXUP_EEE1601,
4841b8e6 1946 ALC886_FIXUP_EAPD,
177943a3 1947 ALC882_FIXUP_EAPD,
7a6069bf 1948 ALC883_FIXUP_EAPD,
8812c4f9 1949 ALC883_FIXUP_ACER_EAPD,
1a97b7f2
TI
1950 ALC882_FIXUP_GPIO1,
1951 ALC882_FIXUP_GPIO2,
eb844d51 1952 ALC882_FIXUP_GPIO3,
68ef0561
TI
1953 ALC889_FIXUP_COEF,
1954 ALC882_FIXUP_ASUS_W2JC,
c3e837bb
TI
1955 ALC882_FIXUP_ACER_ASPIRE_4930G,
1956 ALC882_FIXUP_ACER_ASPIRE_8930G,
1957 ALC882_FIXUP_ASPIRE_8930G_VERBS,
5671087f 1958 ALC885_FIXUP_MACPRO_GPIO,
02a237b2 1959 ALC889_FIXUP_DAC_ROUTE,
1a97b7f2
TI
1960 ALC889_FIXUP_MBP_VREF,
1961 ALC889_FIXUP_IMAC91_VREF,
e7729a41 1962 ALC889_FIXUP_MBA11_VREF,
0756f09c 1963 ALC889_FIXUP_MBA21_VREF,
c20f31ec 1964 ALC889_FIXUP_MP11_VREF,
9f660a1c 1965 ALC889_FIXUP_MP41_VREF,
6e72aa5f 1966 ALC882_FIXUP_INV_DMIC,
e427c237 1967 ALC882_FIXUP_NO_PRIMARY_HP,
1f0bbf03 1968 ALC887_FIXUP_ASUS_BASS,
eb9ca3ab 1969 ALC887_FIXUP_BASS_CHMAP,
7beb3a6e 1970 ALC1220_FIXUP_GB_DUAL_CODECS,
c1933008 1971 ALC1220_FIXUP_GB_X570,
0202f5cd 1972 ALC1220_FIXUP_CLEVO_P950,
80690a27
RS
1973 ALC1220_FIXUP_CLEVO_PB51ED,
1974 ALC1220_FIXUP_CLEVO_PB51ED_PINS,
ca184355
JHP
1975 ALC887_FIXUP_ASUS_AUDIO,
1976 ALC887_FIXUP_ASUS_HMIC,
ff818c24
TI
1977};
1978
68ef0561 1979static void alc889_fixup_coef(struct hda_codec *codec,
1727a771 1980 const struct hda_fixup *fix, int action)
68ef0561 1981{
1727a771 1982 if (action != HDA_FIXUP_ACT_INIT)
68ef0561 1983 return;
1df8874b 1984 alc_update_coef_idx(codec, 7, 0, 0x2030);
68ef0561
TI
1985}
1986
5671087f
TI
1987/* set up GPIO at initialization */
1988static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
1727a771 1989 const struct hda_fixup *fix, int action)
5671087f 1990{
215c850c
TI
1991 struct alc_spec *spec = codec->spec;
1992
1993 spec->gpio_write_delay = true;
1994 alc_fixup_gpio3(codec, fix, action);
5671087f
TI
1995}
1996
02a237b2
TI
1997/* Fix the connection of some pins for ALC889:
1998 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
1999 * work correctly (bko#42740)
2000 */
2001static void alc889_fixup_dac_route(struct hda_codec *codec,
1727a771 2002 const struct hda_fixup *fix, int action)
02a237b2 2003{
1727a771 2004 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
ef8d60fb 2005 /* fake the connections during parsing the tree */
caf3c043
MM
2006 static const hda_nid_t conn1[] = { 0x0c, 0x0d };
2007 static const hda_nid_t conn2[] = { 0x0e, 0x0f };
2008 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2009 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
2010 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
2011 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
1727a771 2012 } else if (action == HDA_FIXUP_ACT_PROBE) {
ef8d60fb 2013 /* restore the connections */
caf3c043
MM
2014 static const hda_nid_t conn[] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
2015 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
2016 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
2017 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
2018 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
02a237b2
TI
2019 }
2020}
2021
1a97b7f2
TI
2022/* Set VREF on HP pin */
2023static void alc889_fixup_mbp_vref(struct hda_codec *codec,
1727a771 2024 const struct hda_fixup *fix, int action)
1a97b7f2 2025{
caf3c043 2026 static const hda_nid_t nids[] = { 0x14, 0x15, 0x19 };
1a97b7f2 2027 struct alc_spec *spec = codec->spec;
1a97b7f2
TI
2028 int i;
2029
1727a771 2030 if (action != HDA_FIXUP_ACT_INIT)
1a97b7f2
TI
2031 return;
2032 for (i = 0; i < ARRAY_SIZE(nids); i++) {
2033 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
2034 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
2035 continue;
d3f02d60 2036 val = snd_hda_codec_get_pin_target(codec, nids[i]);
1a97b7f2 2037 val |= AC_PINCTL_VREF_80;
cdd03ced 2038 snd_hda_set_pin_ctl(codec, nids[i], val);
08c189f2 2039 spec->gen.keep_vref_in_automute = 1;
1a97b7f2
TI
2040 break;
2041 }
2042}
2043
0756f09c
TI
2044static void alc889_fixup_mac_pins(struct hda_codec *codec,
2045 const hda_nid_t *nids, int num_nids)
1a97b7f2
TI
2046{
2047 struct alc_spec *spec = codec->spec;
1a97b7f2
TI
2048 int i;
2049
0756f09c 2050 for (i = 0; i < num_nids; i++) {
1a97b7f2 2051 unsigned int val;
d3f02d60 2052 val = snd_hda_codec_get_pin_target(codec, nids[i]);
1a97b7f2 2053 val |= AC_PINCTL_VREF_50;
cdd03ced 2054 snd_hda_set_pin_ctl(codec, nids[i], val);
1a97b7f2 2055 }
08c189f2 2056 spec->gen.keep_vref_in_automute = 1;
1a97b7f2
TI
2057}
2058
0756f09c
TI
2059/* Set VREF on speaker pins on imac91 */
2060static void alc889_fixup_imac91_vref(struct hda_codec *codec,
2061 const struct hda_fixup *fix, int action)
2062{
caf3c043 2063 static const hda_nid_t nids[] = { 0x18, 0x1a };
0756f09c
TI
2064
2065 if (action == HDA_FIXUP_ACT_INIT)
2066 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2067}
2068
e7729a41
AV
2069/* Set VREF on speaker pins on mba11 */
2070static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2071 const struct hda_fixup *fix, int action)
2072{
caf3c043 2073 static const hda_nid_t nids[] = { 0x18 };
e7729a41
AV
2074
2075 if (action == HDA_FIXUP_ACT_INIT)
2076 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2077}
2078
0756f09c
TI
2079/* Set VREF on speaker pins on mba21 */
2080static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2081 const struct hda_fixup *fix, int action)
2082{
caf3c043 2083 static const hda_nid_t nids[] = { 0x18, 0x19 };
0756f09c
TI
2084
2085 if (action == HDA_FIXUP_ACT_INIT)
2086 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2087}
2088
e427c237 2089/* Don't take HP output as primary
d9111496
FLVC
2090 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2091 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
e427c237
TI
2092 */
2093static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
1727a771 2094 const struct hda_fixup *fix, int action)
e427c237
TI
2095{
2096 struct alc_spec *spec = codec->spec;
da96fb5b 2097 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
08c189f2 2098 spec->gen.no_primary_hp = 1;
da96fb5b
TI
2099 spec->gen.no_multi_io = 1;
2100 }
e427c237
TI
2101}
2102
eb9ca3ab
TI
2103static void alc_fixup_bass_chmap(struct hda_codec *codec,
2104 const struct hda_fixup *fix, int action);
2105
7beb3a6e
TI
2106/* For dual-codec configuration, we need to disable some features to avoid
2107 * conflicts of kctls and PCM streams
2108 */
2109static void alc_fixup_dual_codecs(struct hda_codec *codec,
2110 const struct hda_fixup *fix, int action)
2111{
2112 struct alc_spec *spec = codec->spec;
2113
2114 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2115 return;
2116 /* disable vmaster */
2117 spec->gen.suppress_vmaster = 1;
2118 /* auto-mute and auto-mic switch don't work with multiple codecs */
2119 spec->gen.suppress_auto_mute = 1;
2120 spec->gen.suppress_auto_mic = 1;
2121 /* disable aamix as well */
2122 spec->gen.mixer_nid = 0;
2123 /* add location prefix to avoid conflicts */
2124 codec->force_pin_prefix = 1;
2125}
2126
2127static void rename_ctl(struct hda_codec *codec, const char *oldname,
2128 const char *newname)
2129{
2130 struct snd_kcontrol *kctl;
2131
2132 kctl = snd_hda_find_mixer_ctl(codec, oldname);
2133 if (kctl)
2134 strcpy(kctl->id.name, newname);
2135}
2136
2137static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2138 const struct hda_fixup *fix,
2139 int action)
2140{
2141 alc_fixup_dual_codecs(codec, fix, action);
2142 switch (action) {
2143 case HDA_FIXUP_ACT_PRE_PROBE:
2144 /* override card longname to provide a unique UCM profile */
2145 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2146 break;
2147 case HDA_FIXUP_ACT_BUILD:
2148 /* rename Capture controls depending on the codec */
2149 rename_ctl(codec, "Capture Volume",
2150 codec->addr == 0 ?
2151 "Rear-Panel Capture Volume" :
2152 "Front-Panel Capture Volume");
2153 rename_ctl(codec, "Capture Switch",
2154 codec->addr == 0 ?
2155 "Rear-Panel Capture Switch" :
2156 "Front-Panel Capture Switch");
2157 break;
2158 }
2159}
2160
c1933008
CL
2161static void alc1220_fixup_gb_x570(struct hda_codec *codec,
2162 const struct hda_fixup *fix,
2163 int action)
2164{
2165 static const hda_nid_t conn1[] = { 0x0c };
2166 static const struct coef_fw gb_x570_coefs[] = {
41a86013 2167 WRITE_COEF(0x07, 0x03c0),
c1933008
CL
2168 WRITE_COEF(0x1a, 0x01c1),
2169 WRITE_COEF(0x1b, 0x0202),
2170 WRITE_COEF(0x43, 0x3005),
2171 {}
2172 };
2173
2174 switch (action) {
2175 case HDA_FIXUP_ACT_PRE_PROBE:
2176 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2177 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2178 break;
2179 case HDA_FIXUP_ACT_INIT:
2180 alc_process_coef_fw(codec, gb_x570_coefs);
2181 break;
2182 }
2183}
2184
0202f5cd
P
2185static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2186 const struct hda_fixup *fix,
2187 int action)
2188{
caf3c043 2189 static const hda_nid_t conn1[] = { 0x0c };
0202f5cd
P
2190
2191 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2192 return;
2193
2194 alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2195 /* We therefore want to make sure 0x14 (front headphone) and
2196 * 0x1b (speakers) use the stereo DAC 0x02
2197 */
caf3c043
MM
2198 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2199 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
0202f5cd
P
2200}
2201
7f665b1c
JS
2202static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2203 const struct hda_fixup *fix, int action);
2204
80690a27 2205static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
7f665b1c
JS
2206 const struct hda_fixup *fix,
2207 int action)
2208{
2209 alc1220_fixup_clevo_p950(codec, fix, action);
2210 alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2211}
2212
ca184355
JHP
2213static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
2214 struct hda_jack_callback *jack)
2215{
2216 struct alc_spec *spec = codec->spec;
2217 unsigned int vref;
2218
2219 snd_hda_gen_hp_automute(codec, jack);
2220
2221 if (spec->gen.hp_jack_present)
2222 vref = AC_PINCTL_VREF_80;
2223 else
2224 vref = AC_PINCTL_VREF_HIZ;
2225 snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
2226}
2227
2228static void alc887_fixup_asus_jack(struct hda_codec *codec,
2229 const struct hda_fixup *fix, int action)
2230{
2231 struct alc_spec *spec = codec->spec;
2232 if (action != HDA_FIXUP_ACT_PROBE)
2233 return;
2234 snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
2235 spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook;
2236}
2237
1727a771 2238static const struct hda_fixup alc882_fixups[] = {
5c0ebfbe 2239 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
1727a771
TI
2240 .type = HDA_FIXUP_PINS,
2241 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
2242 { 0x15, 0x01080104 }, /* side */
2243 { 0x16, 0x01011012 }, /* rear */
2244 { 0x17, 0x01016011 }, /* clfe */
2785591a 2245 { }
145a902b
DH
2246 }
2247 },
5c0ebfbe 2248 [ALC882_FIXUP_LENOVO_Y530] = {
1727a771
TI
2249 .type = HDA_FIXUP_PINS,
2250 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
2251 { 0x15, 0x99130112 }, /* rear int speakers */
2252 { 0x16, 0x99130111 }, /* subwoofer */
ac612407
DH
2253 { }
2254 }
2255 },
5c0ebfbe 2256 [ALC882_FIXUP_PB_M5210] = {
fd108215
TI
2257 .type = HDA_FIXUP_PINCTLS,
2258 .v.pins = (const struct hda_pintbl[]) {
2259 { 0x19, PIN_VREF50 },
357f915e
KY
2260 {}
2261 }
2262 },
5c0ebfbe 2263 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
1727a771 2264 .type = HDA_FIXUP_FUNC,
23d30f28 2265 .v.func = alc_fixup_sku_ignore,
6981d184 2266 },
5c0ebfbe 2267 [ALC882_FIXUP_ASUS_W90V] = {
1727a771
TI
2268 .type = HDA_FIXUP_PINS,
2269 .v.pins = (const struct hda_pintbl[]) {
5cdf745e
TI
2270 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
2271 { }
2272 }
2273 },
8f239214 2274 [ALC889_FIXUP_CD] = {
1727a771
TI
2275 .type = HDA_FIXUP_PINS,
2276 .v.pins = (const struct hda_pintbl[]) {
8f239214
MB
2277 { 0x1c, 0x993301f0 }, /* CD */
2278 { }
2279 }
2280 },
b2c53e20
DH
2281 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2282 .type = HDA_FIXUP_PINS,
2283 .v.pins = (const struct hda_pintbl[]) {
2284 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2285 { }
2286 },
2287 .chained = true,
2288 .chain_id = ALC889_FIXUP_CD,
2289 },
5c0ebfbe 2290 [ALC889_FIXUP_VAIO_TT] = {
1727a771
TI
2291 .type = HDA_FIXUP_PINS,
2292 .v.pins = (const struct hda_pintbl[]) {
5c0ebfbe
TI
2293 { 0x17, 0x90170111 }, /* hidden surround speaker */
2294 { }
2295 }
2296 },
0e7cc2e7 2297 [ALC888_FIXUP_EEE1601] = {
1727a771 2298 .type = HDA_FIXUP_VERBS,
0e7cc2e7
TI
2299 .v.verbs = (const struct hda_verb[]) {
2300 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2301 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
2302 { }
2303 }
177943a3 2304 },
4841b8e6
PH
2305 [ALC886_FIXUP_EAPD] = {
2306 .type = HDA_FIXUP_VERBS,
2307 .v.verbs = (const struct hda_verb[]) {
2308 /* change to EAPD mode */
2309 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2310 { 0x20, AC_VERB_SET_PROC_COEF, 0x0068 },
2311 { }
2312 }
2313 },
177943a3 2314 [ALC882_FIXUP_EAPD] = {
1727a771 2315 .type = HDA_FIXUP_VERBS,
177943a3
TI
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, 0x3060 },
2320 { }
2321 }
2322 },
7a6069bf 2323 [ALC883_FIXUP_EAPD] = {
1727a771 2324 .type = HDA_FIXUP_VERBS,
7a6069bf
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, 0x3070 },
2329 { }
2330 }
2331 },
8812c4f9 2332 [ALC883_FIXUP_ACER_EAPD] = {
1727a771 2333 .type = HDA_FIXUP_VERBS,
8812c4f9
TI
2334 .v.verbs = (const struct hda_verb[]) {
2335 /* eanable EAPD on Acer laptops */
2336 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2337 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2338 { }
2339 }
2340 },
1a97b7f2 2341 [ALC882_FIXUP_GPIO1] = {
5579cd6f
TI
2342 .type = HDA_FIXUP_FUNC,
2343 .v.func = alc_fixup_gpio1,
1a97b7f2
TI
2344 },
2345 [ALC882_FIXUP_GPIO2] = {
5579cd6f
TI
2346 .type = HDA_FIXUP_FUNC,
2347 .v.func = alc_fixup_gpio2,
1a97b7f2 2348 },
eb844d51 2349 [ALC882_FIXUP_GPIO3] = {
5579cd6f
TI
2350 .type = HDA_FIXUP_FUNC,
2351 .v.func = alc_fixup_gpio3,
eb844d51 2352 },
68ef0561 2353 [ALC882_FIXUP_ASUS_W2JC] = {
5579cd6f
TI
2354 .type = HDA_FIXUP_FUNC,
2355 .v.func = alc_fixup_gpio1,
68ef0561
TI
2356 .chained = true,
2357 .chain_id = ALC882_FIXUP_EAPD,
2358 },
2359 [ALC889_FIXUP_COEF] = {
1727a771 2360 .type = HDA_FIXUP_FUNC,
68ef0561
TI
2361 .v.func = alc889_fixup_coef,
2362 },
c3e837bb 2363 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
1727a771
TI
2364 .type = HDA_FIXUP_PINS,
2365 .v.pins = (const struct hda_pintbl[]) {
c3e837bb
TI
2366 { 0x16, 0x99130111 }, /* CLFE speaker */
2367 { 0x17, 0x99130112 }, /* surround speaker */
2368 { }
038d4fef
TI
2369 },
2370 .chained = true,
2371 .chain_id = ALC882_FIXUP_GPIO1,
c3e837bb
TI
2372 },
2373 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
1727a771
TI
2374 .type = HDA_FIXUP_PINS,
2375 .v.pins = (const struct hda_pintbl[]) {
c3e837bb
TI
2376 { 0x16, 0x99130111 }, /* CLFE speaker */
2377 { 0x1b, 0x99130112 }, /* surround speaker */
2378 { }
2379 },
2380 .chained = true,
2381 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2382 },
2383 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2384 /* additional init verbs for Acer Aspire 8930G */
1727a771 2385 .type = HDA_FIXUP_VERBS,
c3e837bb
TI
2386 .v.verbs = (const struct hda_verb[]) {
2387 /* Enable all DACs */
2388 /* DAC DISABLE/MUTE 1? */
2389 /* setting bits 1-5 disables DAC nids 0x02-0x06
2390 * apparently. Init=0x38 */
2391 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2392 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2393 /* DAC DISABLE/MUTE 2? */
2394 /* some bit here disables the other DACs.
2395 * Init=0x4900 */
2396 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2397 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2398 /* DMIC fix
2399 * This laptop has a stereo digital microphone.
2400 * The mics are only 1cm apart which makes the stereo
2401 * useless. However, either the mic or the ALC889
2402 * makes the signal become a difference/sum signal
2403 * instead of standard stereo, which is annoying.
2404 * So instead we flip this bit which makes the
2405 * codec replicate the sum signal to both channels,
2406 * turning it into a normal mono mic.
2407 */
2408 /* DMIC_CONTROL? Init value = 0x0001 */
2409 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2410 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2411 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2412 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2413 { }
038d4fef
TI
2414 },
2415 .chained = true,
2416 .chain_id = ALC882_FIXUP_GPIO1,
c3e837bb 2417 },
5671087f 2418 [ALC885_FIXUP_MACPRO_GPIO] = {
1727a771 2419 .type = HDA_FIXUP_FUNC,
5671087f
TI
2420 .v.func = alc885_fixup_macpro_gpio,
2421 },
02a237b2 2422 [ALC889_FIXUP_DAC_ROUTE] = {
1727a771 2423 .type = HDA_FIXUP_FUNC,
02a237b2
TI
2424 .v.func = alc889_fixup_dac_route,
2425 },
1a97b7f2 2426 [ALC889_FIXUP_MBP_VREF] = {
1727a771 2427 .type = HDA_FIXUP_FUNC,
1a97b7f2
TI
2428 .v.func = alc889_fixup_mbp_vref,
2429 .chained = true,
2430 .chain_id = ALC882_FIXUP_GPIO1,
2431 },
2432 [ALC889_FIXUP_IMAC91_VREF] = {
1727a771 2433 .type = HDA_FIXUP_FUNC,
1a97b7f2
TI
2434 .v.func = alc889_fixup_imac91_vref,
2435 .chained = true,
2436 .chain_id = ALC882_FIXUP_GPIO1,
2437 },
e7729a41
AV
2438 [ALC889_FIXUP_MBA11_VREF] = {
2439 .type = HDA_FIXUP_FUNC,
2440 .v.func = alc889_fixup_mba11_vref,
2441 .chained = true,
2442 .chain_id = ALC889_FIXUP_MBP_VREF,
2443 },
0756f09c
TI
2444 [ALC889_FIXUP_MBA21_VREF] = {
2445 .type = HDA_FIXUP_FUNC,
2446 .v.func = alc889_fixup_mba21_vref,
2447 .chained = true,
2448 .chain_id = ALC889_FIXUP_MBP_VREF,
2449 },
c20f31ec
TI
2450 [ALC889_FIXUP_MP11_VREF] = {
2451 .type = HDA_FIXUP_FUNC,
2452 .v.func = alc889_fixup_mba11_vref,
2453 .chained = true,
2454 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2455 },
9f660a1c
MK
2456 [ALC889_FIXUP_MP41_VREF] = {
2457 .type = HDA_FIXUP_FUNC,
2458 .v.func = alc889_fixup_mbp_vref,
2459 .chained = true,
2460 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2461 },
6e72aa5f 2462 [ALC882_FIXUP_INV_DMIC] = {
1727a771 2463 .type = HDA_FIXUP_FUNC,
9d36a7dc 2464 .v.func = alc_fixup_inv_dmic,
6e72aa5f 2465 },
e427c237 2466 [ALC882_FIXUP_NO_PRIMARY_HP] = {
1727a771 2467 .type = HDA_FIXUP_FUNC,
e427c237
TI
2468 .v.func = alc882_fixup_no_primary_hp,
2469 },
1f0bbf03
TI
2470 [ALC887_FIXUP_ASUS_BASS] = {
2471 .type = HDA_FIXUP_PINS,
2472 .v.pins = (const struct hda_pintbl[]) {
2473 {0x16, 0x99130130}, /* bass speaker */
2474 {}
2475 },
eb9ca3ab
TI
2476 .chained = true,
2477 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2478 },
2479 [ALC887_FIXUP_BASS_CHMAP] = {
2480 .type = HDA_FIXUP_FUNC,
2481 .v.func = alc_fixup_bass_chmap,
1f0bbf03 2482 },
7beb3a6e
TI
2483 [ALC1220_FIXUP_GB_DUAL_CODECS] = {
2484 .type = HDA_FIXUP_FUNC,
2485 .v.func = alc1220_fixup_gb_dual_codecs,
2486 },
c1933008
CL
2487 [ALC1220_FIXUP_GB_X570] = {
2488 .type = HDA_FIXUP_FUNC,
2489 .v.func = alc1220_fixup_gb_x570,
2490 },
0202f5cd
P
2491 [ALC1220_FIXUP_CLEVO_P950] = {
2492 .type = HDA_FIXUP_FUNC,
2493 .v.func = alc1220_fixup_clevo_p950,
2494 },
80690a27 2495 [ALC1220_FIXUP_CLEVO_PB51ED] = {
7f665b1c 2496 .type = HDA_FIXUP_FUNC,
80690a27 2497 .v.func = alc1220_fixup_clevo_pb51ed,
7f665b1c 2498 },
80690a27 2499 [ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
7f665b1c
JS
2500 .type = HDA_FIXUP_PINS,
2501 .v.pins = (const struct hda_pintbl[]) {
2502 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2503 {}
2504 },
2505 .chained = true,
80690a27 2506 .chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
7f665b1c 2507 },
ca184355
JHP
2508 [ALC887_FIXUP_ASUS_AUDIO] = {
2509 .type = HDA_FIXUP_PINS,
2510 .v.pins = (const struct hda_pintbl[]) {
2511 { 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */
2512 { 0x19, 0x22219420 },
2513 {}
2514 },
2515 },
2516 [ALC887_FIXUP_ASUS_HMIC] = {
2517 .type = HDA_FIXUP_FUNC,
2518 .v.func = alc887_fixup_asus_jack,
2519 .chained = true,
2520 .chain_id = ALC887_FIXUP_ASUS_AUDIO,
2521 },
ff818c24
TI
2522};
2523
1d045db9 2524static const struct snd_pci_quirk alc882_fixup_tbl[] = {
8812c4f9
TI
2525 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2526 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
b5d724b1 2527 SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
8812c4f9
TI
2528 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2529 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2530 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2531 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
c3e837bb
TI
2532 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2533 ALC882_FIXUP_ACER_ASPIRE_4930G),
2534 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2535 ALC882_FIXUP_ACER_ASPIRE_4930G),
2536 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2537 ALC882_FIXUP_ACER_ASPIRE_8930G),
2538 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2539 ALC882_FIXUP_ACER_ASPIRE_8930G),
b265047a
TI
2540 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2541 ALC882_FIXUP_ACER_ASPIRE_4930G),
2542 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
c3e837bb
TI
2543 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2544 ALC882_FIXUP_ACER_ASPIRE_4930G),
2545 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2546 ALC882_FIXUP_ACER_ASPIRE_4930G),
f5c53d89
TI
2547 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2548 ALC882_FIXUP_ACER_ASPIRE_4930G),
02a237b2 2549 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
fe97da1f 2550 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
ac9b1cdd 2551 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
177943a3 2552 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
5c0ebfbe 2553 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
68ef0561 2554 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
ca184355 2555 SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC),
0e7cc2e7 2556 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
1f0bbf03 2557 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
85bcf96c 2558 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
b7529c18
TI
2559 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2560 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
ac9b1cdd 2561 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
e427c237 2562 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
3f3c3714 2563 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
5671087f
TI
2564
2565 /* All Apple entries are in codec SSIDs */
1a97b7f2
TI
2566 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2567 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2568 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
c20f31ec 2569 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
5671087f
TI
2570 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2571 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
1a97b7f2
TI
2572 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2573 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
5671087f 2574 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
e7729a41 2575 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
0756f09c 2576 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
1a97b7f2
TI
2577 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2578 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
5671087f 2579 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
1a97b7f2
TI
2580 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2581 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2582 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
9f660a1c 2583 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
05193639 2584 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
1a97b7f2
TI
2585 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2586 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
649ccd08 2587 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
5671087f 2588
7a6069bf 2589 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
4841b8e6 2590 SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
b2c53e20 2591 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
7beb3a6e 2592 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
c1933008 2593 SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570),
ea354196 2594 SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_GB_X570),
41a86013 2595 SND_PCI_QUIRK(0x1458, 0xa0d5, "Gigabyte X570S Aorus Master", ALC1220_FIXUP_GB_X570),
a0b03952 2596 SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
a655e2b1 2597 SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
09926202 2598 SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
1d3aa4a5 2599 SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
7dafba37 2600 SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
cc5049ae 2601 SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
d2c3b14e 2602 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
26af1772 2603 SND_PCI_QUIRK(0x1462, 0xcc34, "MSI Godlike X570", ALC1220_FIXUP_GB_DUAL_CODECS),
63691587 2604 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
d2c3b14e 2605 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
5c0ebfbe 2606 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
13e1a4cd
TI
2607 SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2608 SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2609 SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2610 SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2611 SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
aef454b4 2612 SND_PCI_QUIRK(0x1558, 0x65f1, "Clevo PC50HS", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
13e1a4cd
TI
2613 SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2614 SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2615 SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
dbfe8350 2616 SND_PCI_QUIRK(0x1558, 0x67f1, "Clevo PC70H[PRS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
13e1a4cd 2617 SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
1f8d398e 2618 SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170SM", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
cc03069a 2619 SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED),
0202f5cd 2620 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
b5acfe15 2621 SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
13e1a4cd 2622 SND_PCI_QUIRK(0x1558, 0x950a, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
f3d737b6 2623 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2f0d520a 2624 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
b5acfe15
PH
2625 SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
2626 SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950),
2627 SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950),
2628 SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950),
503d90b3
RS
2629 SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2630 SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
b5acfe15 2631 SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
7a6069bf
TI
2632 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2633 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
ac9b1cdd 2634 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
68ef0561 2635 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
ff818c24
TI
2636 {}
2637};
2638
1727a771 2639static const struct hda_model_fixup alc882_fixup_models[] = {
772c2917
TI
2640 {.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2641 {.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2642 {.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2643 {.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2644 {.id = ALC889_FIXUP_CD, .name = "cd"},
2645 {.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2646 {.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2647 {.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2648 {.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2649 {.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2650 {.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2651 {.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2652 {.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2653 {.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2654 {.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
912093bc
TI
2655 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2656 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2657 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
772c2917
TI
2658 {.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2659 {.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2660 {.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2661 {.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2662 {.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2663 {.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2664 {.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2665 {.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
6e72aa5f 2666 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
e427c237 2667 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
772c2917 2668 {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
ba90d6a6 2669 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
63394a16 2670 {.id = ALC1220_FIXUP_GB_X570, .name = "gb-x570"},
772c2917 2671 {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
912093bc
TI
2672 {}
2673};
2674
119b75c1
HW
2675static const struct snd_hda_pin_quirk alc882_pin_fixup_tbl[] = {
2676 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1043, "ASUS", ALC1220_FIXUP_CLEVO_P950,
2677 {0x14, 0x01014010},
2678 {0x15, 0x01011012},
2679 {0x16, 0x01016011},
2680 {0x18, 0x01a19040},
2681 {0x19, 0x02a19050},
2682 {0x1a, 0x0181304f},
2683 {0x1b, 0x0221401f},
2684 {0x1e, 0x01456130}),
2685 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1462, "MS-7C35", ALC1220_FIXUP_CLEVO_P950,
2686 {0x14, 0x01015010},
2687 {0x15, 0x01011012},
2688 {0x16, 0x01011011},
2689 {0x18, 0x01a11040},
2690 {0x19, 0x02a19050},
2691 {0x1a, 0x0181104f},
2692 {0x1b, 0x0221401f},
2693 {0x1e, 0x01451130}),
2694 {}
2695};
2696
f6a92248 2697/*
1d045db9 2698 * BIOS auto configuration
f6a92248 2699 */
1d045db9
TI
2700/* almost identical with ALC880 parser... */
2701static int alc882_parse_auto_config(struct hda_codec *codec)
2702{
1d045db9 2703 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
3e6179b8
TI
2704 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2705 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
1d045db9 2706}
b896b4eb 2707
1d045db9
TI
2708/*
2709 */
1d045db9 2710static int patch_alc882(struct hda_codec *codec)
f6a92248
KY
2711{
2712 struct alc_spec *spec;
1a97b7f2 2713 int err;
f6a92248 2714
3de95173
TI
2715 err = alc_alloc_spec(codec, 0x0b);
2716 if (err < 0)
2717 return err;
f6a92248 2718
3de95173 2719 spec = codec->spec;
1f0f4b80 2720
7639a06c 2721 switch (codec->core.vendor_id) {
1d045db9
TI
2722 case 0x10ec0882:
2723 case 0x10ec0885:
acf08081 2724 case 0x10ec0900:
6d9ffcff 2725 case 0x10ec0b00:
a535ad57 2726 case 0x10ec1220:
1d045db9
TI
2727 break;
2728 default:
2729 /* ALC883 and variants */
2730 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2731 break;
c793bec5 2732 }
977ddd6b 2733
c9af753f
TI
2734 alc_pre_init(codec);
2735
1727a771 2736 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
912093bc 2737 alc882_fixups);
119b75c1 2738 snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true);
1727a771 2739 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
ff818c24 2740
1d045db9
TI
2741 alc_auto_parse_customize_define(codec);
2742
7504b6cd
TI
2743 if (has_cdefine_beep(codec))
2744 spec->gen.beep_nid = 0x01;
2745
1a97b7f2
TI
2746 /* automatic parse from the BIOS config */
2747 err = alc882_parse_auto_config(codec);
2748 if (err < 0)
2749 goto error;
f6a92248 2750
fea80fae
TI
2751 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2752 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2753 if (err < 0)
2754 goto error;
2755 }
f6a92248 2756
1727a771 2757 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 2758
f6a92248 2759 return 0;
e16fb6d1
TI
2760
2761 error:
2762 alc_free(codec);
2763 return err;
f6a92248
KY
2764}
2765
df694daa 2766
df694daa 2767/*
1d045db9 2768 * ALC262 support
df694daa 2769 */
1d045db9 2770static int alc262_parse_auto_config(struct hda_codec *codec)
df694daa 2771{
1d045db9 2772 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
3e6179b8
TI
2773 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2774 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
df694daa
KY
2775}
2776
df694daa 2777/*
1d045db9 2778 * Pin config fixes
df694daa 2779 */
cfc9b06f 2780enum {
ea4e7af1 2781 ALC262_FIXUP_FSC_H270,
7513e6da 2782 ALC262_FIXUP_FSC_S7110,
ea4e7af1
TI
2783 ALC262_FIXUP_HP_Z200,
2784 ALC262_FIXUP_TYAN,
c470150c 2785 ALC262_FIXUP_LENOVO_3000,
b42590b8
TI
2786 ALC262_FIXUP_BENQ,
2787 ALC262_FIXUP_BENQ_T31,
6e72aa5f 2788 ALC262_FIXUP_INV_DMIC,
b5c6611f 2789 ALC262_FIXUP_INTEL_BAYLEYBAY,
cfc9b06f
TI
2790};
2791
1727a771 2792static const struct hda_fixup alc262_fixups[] = {
ea4e7af1 2793 [ALC262_FIXUP_FSC_H270] = {
1727a771
TI
2794 .type = HDA_FIXUP_PINS,
2795 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
2796 { 0x14, 0x99130110 }, /* speaker */
2797 { 0x15, 0x0221142f }, /* front HP */
2798 { 0x1b, 0x0121141f }, /* rear HP */
2799 { }
2800 }
2801 },
7513e6da
TI
2802 [ALC262_FIXUP_FSC_S7110] = {
2803 .type = HDA_FIXUP_PINS,
2804 .v.pins = (const struct hda_pintbl[]) {
2805 { 0x15, 0x90170110 }, /* speaker */
2806 { }
2807 },
2808 .chained = true,
2809 .chain_id = ALC262_FIXUP_BENQ,
2810 },
ea4e7af1 2811 [ALC262_FIXUP_HP_Z200] = {
1727a771
TI
2812 .type = HDA_FIXUP_PINS,
2813 .v.pins = (const struct hda_pintbl[]) {
1d045db9 2814 { 0x16, 0x99130120 }, /* internal speaker */
73413b12
TI
2815 { }
2816 }
cfc9b06f 2817 },
ea4e7af1 2818 [ALC262_FIXUP_TYAN] = {
1727a771
TI
2819 .type = HDA_FIXUP_PINS,
2820 .v.pins = (const struct hda_pintbl[]) {
ea4e7af1
TI
2821 { 0x14, 0x1993e1f0 }, /* int AUX */
2822 { }
2823 }
2824 },
c470150c 2825 [ALC262_FIXUP_LENOVO_3000] = {
fd108215
TI
2826 .type = HDA_FIXUP_PINCTLS,
2827 .v.pins = (const struct hda_pintbl[]) {
2828 { 0x19, PIN_VREF50 },
b42590b8
TI
2829 {}
2830 },
2831 .chained = true,
2832 .chain_id = ALC262_FIXUP_BENQ,
2833 },
2834 [ALC262_FIXUP_BENQ] = {
1727a771 2835 .type = HDA_FIXUP_VERBS,
b42590b8 2836 .v.verbs = (const struct hda_verb[]) {
c470150c
TI
2837 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2838 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2839 {}
2840 }
2841 },
b42590b8 2842 [ALC262_FIXUP_BENQ_T31] = {
1727a771 2843 .type = HDA_FIXUP_VERBS,
b42590b8
TI
2844 .v.verbs = (const struct hda_verb[]) {
2845 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2846 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2847 {}
2848 }
2849 },
6e72aa5f 2850 [ALC262_FIXUP_INV_DMIC] = {
1727a771 2851 .type = HDA_FIXUP_FUNC,
9d36a7dc 2852 .v.func = alc_fixup_inv_dmic,
6e72aa5f 2853 },
b5c6611f
ML
2854 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2855 .type = HDA_FIXUP_FUNC,
2856 .v.func = alc_fixup_no_depop_delay,
2857 },
cfc9b06f
TI
2858};
2859
1d045db9 2860static const struct snd_pci_quirk alc262_fixup_tbl[] = {
ea4e7af1 2861 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
7513e6da 2862 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
3dcd3be3 2863 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
ea4e7af1 2864 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
275ec0cb 2865 SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
ea4e7af1 2866 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
c470150c 2867 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
b42590b8
TI
2868 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2869 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
b5c6611f 2870 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
cfc9b06f
TI
2871 {}
2872};
df694daa 2873
1727a771 2874static const struct hda_model_fixup alc262_fixup_models[] = {
6e72aa5f 2875 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
e43c44d6
TI
2876 {.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2877 {.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2878 {.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2879 {.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2880 {.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2881 {.id = ALC262_FIXUP_BENQ, .name = "benq"},
2882 {.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2883 {.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
6e72aa5f
TI
2884 {}
2885};
1d045db9 2886
1d045db9
TI
2887/*
2888 */
1d045db9 2889static int patch_alc262(struct hda_codec *codec)
df694daa
KY
2890{
2891 struct alc_spec *spec;
df694daa
KY
2892 int err;
2893
3de95173
TI
2894 err = alc_alloc_spec(codec, 0x0b);
2895 if (err < 0)
2896 return err;
df694daa 2897
3de95173 2898 spec = codec->spec;
08c189f2 2899 spec->gen.shared_mic_vref_pin = 0x18;
1d045db9 2900
225068ab
TI
2901 spec->shutup = alc_eapd_shutup;
2902
1d045db9
TI
2903#if 0
2904 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2905 * under-run
2906 */
98b24883 2907 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
1d045db9 2908#endif
1d045db9
TI
2909 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2910
c9af753f
TI
2911 alc_pre_init(codec);
2912
1727a771 2913 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
6e72aa5f 2914 alc262_fixups);
1727a771 2915 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
9c7f852e 2916
af741c15
TI
2917 alc_auto_parse_customize_define(codec);
2918
7504b6cd
TI
2919 if (has_cdefine_beep(codec))
2920 spec->gen.beep_nid = 0x01;
2921
42399f7a
TI
2922 /* automatic parse from the BIOS config */
2923 err = alc262_parse_auto_config(codec);
2924 if (err < 0)
2925 goto error;
df694daa 2926
fea80fae
TI
2927 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2928 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2929 if (err < 0)
2930 goto error;
2931 }
2134ea4f 2932
1727a771 2933 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 2934
1da177e4 2935 return 0;
e16fb6d1
TI
2936
2937 error:
2938 alc_free(codec);
2939 return err;
1da177e4
LT
2940}
2941
f32610ed 2942/*
1d045db9 2943 * ALC268
f32610ed 2944 */
1d045db9 2945/* bind Beep switches of both NID 0x0f and 0x10 */
a717777d
TI
2946static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2947 struct snd_ctl_elem_value *ucontrol)
2948{
2949 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2950 unsigned long pval;
2951 int err;
2952
2953 mutex_lock(&codec->control_mutex);
2954 pval = kcontrol->private_value;
2955 kcontrol->private_value = (pval & ~0xff) | 0x0f;
2956 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2957 if (err >= 0) {
2958 kcontrol->private_value = (pval & ~0xff) | 0x10;
2959 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2960 }
2961 kcontrol->private_value = pval;
2962 mutex_unlock(&codec->control_mutex);
2963 return err;
2964}
f32610ed 2965
1d045db9
TI
2966static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2967 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
a717777d
TI
2968 {
2969 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2970 .name = "Beep Playback Switch",
2971 .subdevice = HDA_SUBDEV_AMP_FLAG,
2972 .info = snd_hda_mixer_amp_switch_info,
2973 .get = snd_hda_mixer_amp_switch_get,
2974 .put = alc268_beep_switch_put,
2975 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
2976 },
f32610ed
JS
2977};
2978
1d045db9
TI
2979/* set PCBEEP vol = 0, mute connections */
2980static const struct hda_verb alc268_beep_init_verbs[] = {
2981 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2982 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2983 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2984 { }
f32610ed
JS
2985};
2986
6e72aa5f
TI
2987enum {
2988 ALC268_FIXUP_INV_DMIC,
cb766404 2989 ALC268_FIXUP_HP_EAPD,
24eff328 2990 ALC268_FIXUP_SPDIF,
6e72aa5f
TI
2991};
2992
1727a771 2993static const struct hda_fixup alc268_fixups[] = {
6e72aa5f 2994 [ALC268_FIXUP_INV_DMIC] = {
1727a771 2995 .type = HDA_FIXUP_FUNC,
9d36a7dc 2996 .v.func = alc_fixup_inv_dmic,
6e72aa5f 2997 },
cb766404 2998 [ALC268_FIXUP_HP_EAPD] = {
1727a771 2999 .type = HDA_FIXUP_VERBS,
cb766404
TI
3000 .v.verbs = (const struct hda_verb[]) {
3001 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
3002 {}
3003 }
3004 },
24eff328
TI
3005 [ALC268_FIXUP_SPDIF] = {
3006 .type = HDA_FIXUP_PINS,
3007 .v.pins = (const struct hda_pintbl[]) {
3008 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
3009 {}
3010 }
3011 },
6e72aa5f
TI
3012};
3013
1727a771 3014static const struct hda_model_fixup alc268_fixup_models[] = {
6e72aa5f 3015 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
cb766404 3016 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
03bf11c9 3017 {.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
cb766404
TI
3018 {}
3019};
3020
3021static const struct snd_pci_quirk alc268_fixup_tbl[] = {
24eff328 3022 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
fcd8f3b1 3023 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
cb766404
TI
3024 /* below is codec SSID since multiple Toshiba laptops have the
3025 * same PCI SSID 1179:ff00
3026 */
3027 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
6e72aa5f
TI
3028 {}
3029};
3030
f32610ed
JS
3031/*
3032 * BIOS auto configuration
3033 */
1d045db9 3034static int alc268_parse_auto_config(struct hda_codec *codec)
f32610ed 3035{
3e6179b8 3036 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
7504b6cd 3037 return alc_parse_auto_config(codec, NULL, alc268_ssids);
f32610ed
JS
3038}
3039
1d045db9
TI
3040/*
3041 */
1d045db9 3042static int patch_alc268(struct hda_codec *codec)
f32610ed
JS
3043{
3044 struct alc_spec *spec;
a5cb463a 3045 int i, err;
f32610ed 3046
1d045db9 3047 /* ALC268 has no aa-loopback mixer */
3de95173
TI
3048 err = alc_alloc_spec(codec, 0);
3049 if (err < 0)
3050 return err;
3051
3052 spec = codec->spec;
2722b535
TI
3053 if (has_cdefine_beep(codec))
3054 spec->gen.beep_nid = 0x01;
1f0f4b80 3055
225068ab
TI
3056 spec->shutup = alc_eapd_shutup;
3057
c9af753f
TI
3058 alc_pre_init(codec);
3059
1727a771
TI
3060 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
3061 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
6e72aa5f 3062
6ebb8053
TI
3063 /* automatic parse from the BIOS config */
3064 err = alc268_parse_auto_config(codec);
e16fb6d1
TI
3065 if (err < 0)
3066 goto error;
f32610ed 3067
7504b6cd
TI
3068 if (err > 0 && !spec->gen.no_analog &&
3069 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
a5cb463a
TI
3070 for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
3071 if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
3072 &alc268_beep_mixer[i])) {
3073 err = -ENOMEM;
3074 goto error;
3075 }
3076 }
7504b6cd 3077 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
1d045db9
TI
3078 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
3079 /* override the amp caps for beep generator */
3080 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
3081 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
3082 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
3083 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
3084 (0 << AC_AMPCAP_MUTE_SHIFT));
2f893286
KY
3085 }
3086
1727a771 3087 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
6e72aa5f 3088
f32610ed 3089 return 0;
e16fb6d1
TI
3090
3091 error:
3092 alc_free(codec);
3093 return err;
f32610ed
JS
3094}
3095
bc9f98a9 3096/*
1d045db9 3097 * ALC269
bc9f98a9 3098 */
08c189f2 3099
1d045db9 3100static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
1d045db9 3101 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
bc9f98a9
KY
3102};
3103
1d045db9 3104static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
1d045db9 3105 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
bc9f98a9 3106};
291702f0 3107
1d045db9
TI
3108/* different alc269-variants */
3109enum {
3110 ALC269_TYPE_ALC269VA,
3111 ALC269_TYPE_ALC269VB,
3112 ALC269_TYPE_ALC269VC,
adcc70b2 3113 ALC269_TYPE_ALC269VD,
065380f0
KY
3114 ALC269_TYPE_ALC280,
3115 ALC269_TYPE_ALC282,
2af02be7 3116 ALC269_TYPE_ALC283,
065380f0 3117 ALC269_TYPE_ALC284,
4731d5de 3118 ALC269_TYPE_ALC293,
7fc7d047 3119 ALC269_TYPE_ALC286,
506b62c3 3120 ALC269_TYPE_ALC298,
1d04c9de 3121 ALC269_TYPE_ALC255,
4344aec8 3122 ALC269_TYPE_ALC256,
f429e7e4 3123 ALC269_TYPE_ALC257,
0a6f0600 3124 ALC269_TYPE_ALC215,
4231430d 3125 ALC269_TYPE_ALC225,
99cee034 3126 ALC269_TYPE_ALC287,
dcd4f0db 3127 ALC269_TYPE_ALC294,
1078bef0 3128 ALC269_TYPE_ALC300,
f0778871 3129 ALC269_TYPE_ALC623,
6fbae35a 3130 ALC269_TYPE_ALC700,
bc9f98a9
KY
3131};
3132
3133/*
1d045db9 3134 * BIOS auto configuration
bc9f98a9 3135 */
1d045db9
TI
3136static int alc269_parse_auto_config(struct hda_codec *codec)
3137{
1d045db9 3138 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
3e6179b8
TI
3139 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
3140 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3141 struct alc_spec *spec = codec->spec;
adcc70b2
KY
3142 const hda_nid_t *ssids;
3143
3144 switch (spec->codec_variant) {
3145 case ALC269_TYPE_ALC269VA:
3146 case ALC269_TYPE_ALC269VC:
065380f0
KY
3147 case ALC269_TYPE_ALC280:
3148 case ALC269_TYPE_ALC284:
4731d5de 3149 case ALC269_TYPE_ALC293:
adcc70b2
KY
3150 ssids = alc269va_ssids;
3151 break;
3152 case ALC269_TYPE_ALC269VB:
3153 case ALC269_TYPE_ALC269VD:
065380f0 3154 case ALC269_TYPE_ALC282:
2af02be7 3155 case ALC269_TYPE_ALC283:
7fc7d047 3156 case ALC269_TYPE_ALC286:
506b62c3 3157 case ALC269_TYPE_ALC298:
1d04c9de 3158 case ALC269_TYPE_ALC255:
4344aec8 3159 case ALC269_TYPE_ALC256:
f429e7e4 3160 case ALC269_TYPE_ALC257:
0a6f0600 3161 case ALC269_TYPE_ALC215:
4231430d 3162 case ALC269_TYPE_ALC225:
99cee034 3163 case ALC269_TYPE_ALC287:
dcd4f0db 3164 case ALC269_TYPE_ALC294:
1078bef0 3165 case ALC269_TYPE_ALC300:
f0778871 3166 case ALC269_TYPE_ALC623:
6fbae35a 3167 case ALC269_TYPE_ALC700:
adcc70b2
KY
3168 ssids = alc269_ssids;
3169 break;
3170 default:
3171 ssids = alc269_ssids;
3172 break;
3173 }
bc9f98a9 3174
3e6179b8 3175 return alc_parse_auto_config(codec, alc269_ignore, ssids);
1d045db9 3176}
bc9f98a9 3177
476c02e0
HW
3178static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
3179 { SND_JACK_BTN_0, KEY_PLAYPAUSE },
3180 { SND_JACK_BTN_1, KEY_VOICECOMMAND },
3181 { SND_JACK_BTN_2, KEY_VOLUMEUP },
3182 { SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3183 {}
3184};
3185
3186static void alc_headset_btn_callback(struct hda_codec *codec,
3187 struct hda_jack_callback *jack)
3188{
3189 int report = 0;
3190
3191 if (jack->unsol_res & (7 << 13))
3192 report |= SND_JACK_BTN_0;
3193
3194 if (jack->unsol_res & (1 << 16 | 3 << 8))
3195 report |= SND_JACK_BTN_1;
3196
3197 /* Volume up key */
3198 if (jack->unsol_res & (7 << 23))
3199 report |= SND_JACK_BTN_2;
3200
3201 /* Volume down key */
3202 if (jack->unsol_res & (7 << 10))
3203 report |= SND_JACK_BTN_3;
3204
04f7791b 3205 snd_hda_jack_set_button_state(codec, jack->nid, report);
476c02e0
HW
3206}
3207
3208static void alc_disable_headset_jack_key(struct hda_codec *codec)
3209{
3210 struct alc_spec *spec = codec->spec;
3211
3212 if (!spec->has_hs_key)
3213 return;
3214
3215 switch (codec->core.vendor_id) {
3216 case 0x10ec0215:
3217 case 0x10ec0225:
3218 case 0x10ec0285:
c72b9bfe 3219 case 0x10ec0287:
476c02e0
HW
3220 case 0x10ec0295:
3221 case 0x10ec0289:
3222 case 0x10ec0299:
3223 alc_write_coef_idx(codec, 0x48, 0x0);
3224 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3225 alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3226 break;
1948fc06 3227 case 0x10ec0230:
476c02e0
HW
3228 case 0x10ec0236:
3229 case 0x10ec0256:
3230 alc_write_coef_idx(codec, 0x48, 0x0);
3231 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3232 break;
3233 }
3234}
3235
3236static void alc_enable_headset_jack_key(struct hda_codec *codec)
3237{
3238 struct alc_spec *spec = codec->spec;
3239
3240 if (!spec->has_hs_key)
3241 return;
3242
3243 switch (codec->core.vendor_id) {
3244 case 0x10ec0215:
3245 case 0x10ec0225:
3246 case 0x10ec0285:
c72b9bfe 3247 case 0x10ec0287:
476c02e0
HW
3248 case 0x10ec0295:
3249 case 0x10ec0289:
3250 case 0x10ec0299:
3251 alc_write_coef_idx(codec, 0x48, 0xd011);
3252 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3253 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3254 break;
1948fc06 3255 case 0x10ec0230:
476c02e0
HW
3256 case 0x10ec0236:
3257 case 0x10ec0256:
3258 alc_write_coef_idx(codec, 0x48, 0xd011);
3259 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3260 break;
3261 }
3262}
3263
3264static void alc_fixup_headset_jack(struct hda_codec *codec,
3265 const struct hda_fixup *fix, int action)
3266{
3267 struct alc_spec *spec = codec->spec;
04f7791b 3268 hda_nid_t hp_pin;
476c02e0
HW
3269
3270 switch (action) {
3271 case HDA_FIXUP_ACT_PRE_PROBE:
3272 spec->has_hs_key = 1;
3273 snd_hda_jack_detect_enable_callback(codec, 0x55,
3274 alc_headset_btn_callback);
476c02e0 3275 break;
04f7791b
HW
3276 case HDA_FIXUP_ACT_BUILD:
3277 hp_pin = alc_get_hp_pin(spec);
3278 if (!hp_pin || snd_hda_jack_bind_keymap(codec, 0x55,
3279 alc_headset_btn_keymap,
3280 hp_pin))
3281 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack",
3282 false, SND_JACK_HEADSET,
3283 alc_headset_btn_keymap);
3284
476c02e0
HW
3285 alc_enable_headset_jack_key(codec);
3286 break;
3287 }
3288}
3289
1387e2d1 3290static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
1d045db9 3291{
98b24883 3292 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
1d045db9 3293}
291702f0 3294
1d045db9
TI
3295static void alc269_shutup(struct hda_codec *codec)
3296{
adcc70b2
KY
3297 struct alc_spec *spec = codec->spec;
3298
1387e2d1
KY
3299 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3300 alc269vb_toggle_power_output(codec, 0);
3301 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3302 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
1d045db9
TI
3303 msleep(150);
3304 }
c0ca5ece 3305 alc_shutup_pins(codec);
1d045db9 3306}
291702f0 3307
6b0f95c4 3308static const struct coef_fw alc282_coefs[] = {
54db6c39 3309 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
32fa7e49 3310 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
54db6c39
TI
3311 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3312 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3313 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3314 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3315 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3316 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3317 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3318 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3319 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3320 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3321 WRITE_COEF(0x34, 0xa0c0), /* ANC */
3322 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3323 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3324 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3325 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3326 WRITE_COEF(0x63, 0x2902), /* PLL */
3327 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3328 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3329 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3330 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3331 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3332 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3333 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3334 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3335 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3336 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3337 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3338 {}
3339};
3340
cb149cb3
KY
3341static void alc282_restore_default_value(struct hda_codec *codec)
3342{
54db6c39 3343 alc_process_coef_fw(codec, alc282_coefs);
cb149cb3
KY
3344}
3345
7b5c7a02
KY
3346static void alc282_init(struct hda_codec *codec)
3347{
3348 struct alc_spec *spec = codec->spec;
35a39f98 3349 hda_nid_t hp_pin = alc_get_hp_pin(spec);
7b5c7a02
KY
3350 bool hp_pin_sense;
3351 int coef78;
3352
cb149cb3
KY
3353 alc282_restore_default_value(codec);
3354
7b5c7a02
KY
3355 if (!hp_pin)
3356 return;
3357 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3358 coef78 = alc_read_coef_idx(codec, 0x78);
3359
3360 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3361 /* Headphone capless set to high power mode */
3362 alc_write_coef_idx(codec, 0x78, 0x9004);
3363
3364 if (hp_pin_sense)
3365 msleep(2);
3366
3367 snd_hda_codec_write(codec, hp_pin, 0,
3368 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3369
3370 if (hp_pin_sense)
3371 msleep(85);
3372
3373 snd_hda_codec_write(codec, hp_pin, 0,
3374 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3375
3376 if (hp_pin_sense)
3377 msleep(100);
3378
3379 /* Headphone capless set to normal mode */
3380 alc_write_coef_idx(codec, 0x78, coef78);
3381}
3382
3383static void alc282_shutup(struct hda_codec *codec)
3384{
3385 struct alc_spec *spec = codec->spec;
35a39f98 3386 hda_nid_t hp_pin = alc_get_hp_pin(spec);
7b5c7a02
KY
3387 bool hp_pin_sense;
3388 int coef78;
3389
3390 if (!hp_pin) {
3391 alc269_shutup(codec);
3392 return;
3393 }
3394
3395 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3396 coef78 = alc_read_coef_idx(codec, 0x78);
3397 alc_write_coef_idx(codec, 0x78, 0x9004);
3398
3399 if (hp_pin_sense)
3400 msleep(2);
3401
3402 snd_hda_codec_write(codec, hp_pin, 0,
3403 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3404
3405 if (hp_pin_sense)
3406 msleep(85);
3407
c0ca5ece
TI
3408 if (!spec->no_shutup_pins)
3409 snd_hda_codec_write(codec, hp_pin, 0,
3410 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
7b5c7a02
KY
3411
3412 if (hp_pin_sense)
3413 msleep(100);
3414
3415 alc_auto_setup_eapd(codec, false);
c0ca5ece 3416 alc_shutup_pins(codec);
7b5c7a02
KY
3417 alc_write_coef_idx(codec, 0x78, coef78);
3418}
3419
6b0f95c4 3420static const struct coef_fw alc283_coefs[] = {
54db6c39 3421 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
56779864 3422 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
54db6c39
TI
3423 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3424 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3425 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3426 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3427 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3428 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3429 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3430 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3431 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3432 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3433 WRITE_COEF(0x22, 0xa0c0), /* ANC */
3434 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3435 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3436 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3437 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3438 WRITE_COEF(0x2e, 0x2902), /* PLL */
3439 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3440 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3441 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3442 WRITE_COEF(0x36, 0x0), /* capless control 5 */
3443 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3444 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3445 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3446 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3447 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3448 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3449 WRITE_COEF(0x49, 0x0), /* test mode */
3450 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3451 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3452 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
56779864 3453 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
54db6c39
TI
3454 {}
3455};
3456
6bd55b04
KY
3457static void alc283_restore_default_value(struct hda_codec *codec)
3458{
54db6c39 3459 alc_process_coef_fw(codec, alc283_coefs);
6bd55b04
KY
3460}
3461
2af02be7
KY
3462static void alc283_init(struct hda_codec *codec)
3463{
3464 struct alc_spec *spec = codec->spec;
35a39f98 3465 hda_nid_t hp_pin = alc_get_hp_pin(spec);
2af02be7 3466 bool hp_pin_sense;
2af02be7 3467
6bd55b04
KY
3468 alc283_restore_default_value(codec);
3469
2af02be7
KY
3470 if (!hp_pin)
3471 return;
a59d7199
KY
3472
3473 msleep(30);
2af02be7
KY
3474 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3475
3476 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3477 /* Headphone capless set to high power mode */
3478 alc_write_coef_idx(codec, 0x43, 0x9004);
3479
3480 snd_hda_codec_write(codec, hp_pin, 0,
3481 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3482
3483 if (hp_pin_sense)
3484 msleep(85);
3485
3486 snd_hda_codec_write(codec, hp_pin, 0,
3487 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3488
3489 if (hp_pin_sense)
3490 msleep(85);
3491 /* Index 0x46 Combo jack auto switch control 2 */
3492 /* 3k pull low control for Headset jack. */
98b24883 3493 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
2af02be7
KY
3494 /* Headphone capless set to normal mode */
3495 alc_write_coef_idx(codec, 0x43, 0x9614);
3496}
3497
3498static void alc283_shutup(struct hda_codec *codec)
3499{
3500 struct alc_spec *spec = codec->spec;
35a39f98 3501 hda_nid_t hp_pin = alc_get_hp_pin(spec);
2af02be7 3502 bool hp_pin_sense;
2af02be7
KY
3503
3504 if (!hp_pin) {
3505 alc269_shutup(codec);
3506 return;
3507 }
3508
3509 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3510
3511 alc_write_coef_idx(codec, 0x43, 0x9004);
3512
b450b17c
HP
3513 /*depop hp during suspend*/
3514 alc_write_coef_idx(codec, 0x06, 0x2100);
3515
2af02be7
KY
3516 snd_hda_codec_write(codec, hp_pin, 0,
3517 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3518
3519 if (hp_pin_sense)
88011c09 3520 msleep(100);
2af02be7 3521
c0ca5ece
TI
3522 if (!spec->no_shutup_pins)
3523 snd_hda_codec_write(codec, hp_pin, 0,
3524 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
2af02be7 3525
98b24883 3526 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
2af02be7
KY
3527
3528 if (hp_pin_sense)
88011c09 3529 msleep(100);
0435b3ff 3530 alc_auto_setup_eapd(codec, false);
c0ca5ece 3531 alc_shutup_pins(codec);
2af02be7
KY
3532 alc_write_coef_idx(codec, 0x43, 0x9614);
3533}
3534
4a219ef8
KY
3535static void alc256_init(struct hda_codec *codec)
3536{
3537 struct alc_spec *spec = codec->spec;
35a39f98 3538 hda_nid_t hp_pin = alc_get_hp_pin(spec);
4a219ef8
KY
3539 bool hp_pin_sense;
3540
3541 if (!hp_pin)
6447c962 3542 hp_pin = 0x21;
4a219ef8
KY
3543
3544 msleep(30);
3545
3546 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3547
3548 if (hp_pin_sense)
3549 msleep(2);
3550
3551 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
6447c962
KY
3552 if (spec->ultra_low_power) {
3553 alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3554 alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3555 alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3556 alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3557 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3558 msleep(30);
3559 }
4a219ef8
KY
3560
3561 snd_hda_codec_write(codec, hp_pin, 0,
3562 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3563
6447c962 3564 if (hp_pin_sense || spec->ultra_low_power)
4a219ef8
KY
3565 msleep(85);
3566
3567 snd_hda_codec_write(codec, hp_pin, 0,
3568 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3569
6447c962 3570 if (hp_pin_sense || spec->ultra_low_power)
4a219ef8
KY
3571 msleep(100);
3572
3573 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3574 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
88d42b2b
KY
3575 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3576 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
c4473744
TH
3577 /*
3578 * Expose headphone mic (or possibly Line In on some machines) instead
3579 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3580 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3581 * this register.
3582 */
3583 alc_write_coef_idx(codec, 0x36, 0x5757);
4a219ef8
KY
3584}
3585
3586static void alc256_shutup(struct hda_codec *codec)
3587{
3588 struct alc_spec *spec = codec->spec;
35a39f98 3589 hda_nid_t hp_pin = alc_get_hp_pin(spec);
4a219ef8
KY
3590 bool hp_pin_sense;
3591
6447c962
KY
3592 if (!hp_pin)
3593 hp_pin = 0x21;
4a219ef8
KY
3594
3595 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3596
3597 if (hp_pin_sense)
3598 msleep(2);
3599
3600 snd_hda_codec_write(codec, hp_pin, 0,
3601 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3602
6447c962 3603 if (hp_pin_sense || spec->ultra_low_power)
4a219ef8
KY
3604 msleep(85);
3605
1c9609e3
TI
3606 /* 3k pull low control for Headset jack. */
3607 /* NOTE: call this before clearing the pin, otherwise codec stalls */
3f742490
HW
3608 /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
3609 * when booting with headset plugged. So skip setting it for the codec alc257
3610 */
5aec9891
KY
3611 if (spec->codec_variant != ALC269_TYPE_ALC257 &&
3612 spec->codec_variant != ALC269_TYPE_ALC256)
3f742490 3613 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
1c9609e3 3614
c0ca5ece
TI
3615 if (!spec->no_shutup_pins)
3616 snd_hda_codec_write(codec, hp_pin, 0,
3617 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4a219ef8 3618
6447c962 3619 if (hp_pin_sense || spec->ultra_low_power)
4a219ef8
KY
3620 msleep(100);
3621
3622 alc_auto_setup_eapd(codec, false);
c0ca5ece 3623 alc_shutup_pins(codec);
6447c962
KY
3624 if (spec->ultra_low_power) {
3625 msleep(50);
3626 alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3627 alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3628 alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3629 alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3630 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3631 msleep(30);
3632 }
4a219ef8
KY
3633}
3634
3c24e483
KY
3635static void alc285_hp_init(struct hda_codec *codec)
3636{
3637 struct alc_spec *spec = codec->spec;
3638 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3639 int i, val;
3640 int coef38, coef0d, coef36;
3641
3642 alc_update_coef_idx(codec, 0x4a, 1<<15, 1<<15); /* Reset HP JD */
3643 coef38 = alc_read_coef_idx(codec, 0x38); /* Amp control */
3644 coef0d = alc_read_coef_idx(codec, 0x0d); /* Digital Misc control */
3645 coef36 = alc_read_coef_idx(codec, 0x36); /* Passthrough Control */
3646 alc_update_coef_idx(codec, 0x38, 1<<4, 0x0);
3647 alc_update_coef_idx(codec, 0x0d, 0x110, 0x0);
3648
3649 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
3650
3651 if (hp_pin)
3652 snd_hda_codec_write(codec, hp_pin, 0,
3653 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3654
3655 msleep(130);
3656 alc_update_coef_idx(codec, 0x36, 1<<14, 1<<14);
3657 alc_update_coef_idx(codec, 0x36, 1<<13, 0x0);
3658
3659 if (hp_pin)
3660 snd_hda_codec_write(codec, hp_pin, 0,
3661 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3662 msleep(10);
3663 alc_write_coef_idx(codec, 0x67, 0x0); /* Set HP depop to manual mode */
3664 alc_write_coefex_idx(codec, 0x58, 0x00, 0x7880);
3665 alc_write_coefex_idx(codec, 0x58, 0x0f, 0xf049);
3666 alc_update_coefex_idx(codec, 0x58, 0x03, 0x00f0, 0x00c0);
3667
3668 alc_write_coefex_idx(codec, 0x58, 0x00, 0xf888); /* HP depop procedure start */
3669 val = alc_read_coefex_idx(codec, 0x58, 0x00);
3670 for (i = 0; i < 20 && val & 0x8000; i++) {
3671 msleep(50);
3672 val = alc_read_coefex_idx(codec, 0x58, 0x00);
3673 } /* Wait for depop procedure finish */
3674
3675 alc_write_coefex_idx(codec, 0x58, 0x00, val); /* write back the result */
3676 alc_update_coef_idx(codec, 0x38, 1<<4, coef38);
3677 alc_update_coef_idx(codec, 0x0d, 0x110, coef0d);
3678 alc_update_coef_idx(codec, 0x36, 3<<13, coef36);
3679
3680 msleep(50);
3681 alc_update_coef_idx(codec, 0x4a, 1<<15, 0);
3682}
3683
da911b1f
KY
3684static void alc225_init(struct hda_codec *codec)
3685{
3686 struct alc_spec *spec = codec->spec;
35a39f98 3687 hda_nid_t hp_pin = alc_get_hp_pin(spec);
da911b1f
KY
3688 bool hp1_pin_sense, hp2_pin_sense;
3689
3c24e483
KY
3690 if (spec->codec_variant != ALC269_TYPE_ALC287)
3691 /* required only at boot or S3 and S4 resume time */
3692 if (!spec->done_hp_init ||
3693 is_s3_resume(codec) ||
3694 is_s4_resume(codec)) {
3695 alc285_hp_init(codec);
3696 spec->done_hp_init = true;
3697 }
3698
da911b1f 3699 if (!hp_pin)
d3ba58bb 3700 hp_pin = 0x21;
da911b1f
KY
3701 msleep(30);
3702
3703 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3704 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3705
3706 if (hp1_pin_sense || hp2_pin_sense)
3707 msleep(2);
3708
3709 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
d3ba58bb
KY
3710 if (spec->ultra_low_power) {
3711 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3712 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3713 alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3714 msleep(30);
3715 }
da911b1f 3716
d3ba58bb 3717 if (hp1_pin_sense || spec->ultra_low_power)
da911b1f
KY
3718 snd_hda_codec_write(codec, hp_pin, 0,
3719 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3720 if (hp2_pin_sense)
3721 snd_hda_codec_write(codec, 0x16, 0,
3722 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3723
d3ba58bb 3724 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
da911b1f
KY
3725 msleep(85);
3726
d3ba58bb 3727 if (hp1_pin_sense || spec->ultra_low_power)
da911b1f
KY
3728 snd_hda_codec_write(codec, hp_pin, 0,
3729 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3730 if (hp2_pin_sense)
3731 snd_hda_codec_write(codec, 0x16, 0,
3732 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3733
d3ba58bb 3734 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
da911b1f
KY
3735 msleep(100);
3736
3737 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3738 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3739}
3740
3741static void alc225_shutup(struct hda_codec *codec)
3742{
3743 struct alc_spec *spec = codec->spec;
35a39f98 3744 hda_nid_t hp_pin = alc_get_hp_pin(spec);
da911b1f
KY
3745 bool hp1_pin_sense, hp2_pin_sense;
3746
d3ba58bb
KY
3747 if (!hp_pin)
3748 hp_pin = 0x21;
476c02e0
HW
3749
3750 alc_disable_headset_jack_key(codec);
da911b1f
KY
3751 /* 3k pull low control for Headset jack. */
3752 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3753
3754 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3755 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3756
3757 if (hp1_pin_sense || hp2_pin_sense)
3758 msleep(2);
3759
d3ba58bb 3760 if (hp1_pin_sense || spec->ultra_low_power)
da911b1f
KY
3761 snd_hda_codec_write(codec, hp_pin, 0,
3762 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3763 if (hp2_pin_sense)
3764 snd_hda_codec_write(codec, 0x16, 0,
3765 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3766
d3ba58bb 3767 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
da911b1f
KY
3768 msleep(85);
3769
d3ba58bb 3770 if (hp1_pin_sense || spec->ultra_low_power)
da911b1f
KY
3771 snd_hda_codec_write(codec, hp_pin, 0,
3772 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3773 if (hp2_pin_sense)
3774 snd_hda_codec_write(codec, 0x16, 0,
3775 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3776
d3ba58bb 3777 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
da911b1f
KY
3778 msleep(100);
3779
3780 alc_auto_setup_eapd(codec, false);
c0ca5ece 3781 alc_shutup_pins(codec);
d3ba58bb
KY
3782 if (spec->ultra_low_power) {
3783 msleep(50);
3784 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3785 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3786 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3787 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3788 msleep(30);
3789 }
476c02e0
HW
3790
3791 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3792 alc_enable_headset_jack_key(codec);
da911b1f
KY
3793}
3794
c2d6af53
KY
3795static void alc_default_init(struct hda_codec *codec)
3796{
3797 struct alc_spec *spec = codec->spec;
35a39f98 3798 hda_nid_t hp_pin = alc_get_hp_pin(spec);
c2d6af53
KY
3799 bool hp_pin_sense;
3800
3801 if (!hp_pin)
3802 return;
3803
3804 msleep(30);
3805
3806 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3807
3808 if (hp_pin_sense)
3809 msleep(2);
3810
3811 snd_hda_codec_write(codec, hp_pin, 0,
3812 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3813
3814 if (hp_pin_sense)
3815 msleep(85);
3816
3817 snd_hda_codec_write(codec, hp_pin, 0,
3818 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3819
3820 if (hp_pin_sense)
3821 msleep(100);
3822}
3823
3824static void alc_default_shutup(struct hda_codec *codec)
3825{
3826 struct alc_spec *spec = codec->spec;
35a39f98 3827 hda_nid_t hp_pin = alc_get_hp_pin(spec);
c2d6af53
KY
3828 bool hp_pin_sense;
3829
3830 if (!hp_pin) {
3831 alc269_shutup(codec);
3832 return;
3833 }
3834
3835 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3836
3837 if (hp_pin_sense)
3838 msleep(2);
3839
3840 snd_hda_codec_write(codec, hp_pin, 0,
3841 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3842
3843 if (hp_pin_sense)
3844 msleep(85);
3845
c0ca5ece
TI
3846 if (!spec->no_shutup_pins)
3847 snd_hda_codec_write(codec, hp_pin, 0,
3848 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
c2d6af53
KY
3849
3850 if (hp_pin_sense)
3851 msleep(100);
3852
3853 alc_auto_setup_eapd(codec, false);
c0ca5ece 3854 alc_shutup_pins(codec);
c2d6af53
KY
3855}
3856
693abe11
KY
3857static void alc294_hp_init(struct hda_codec *codec)
3858{
3859 struct alc_spec *spec = codec->spec;
35a39f98 3860 hda_nid_t hp_pin = alc_get_hp_pin(spec);
693abe11
KY
3861 int i, val;
3862
3863 if (!hp_pin)
3864 return;
3865
3866 snd_hda_codec_write(codec, hp_pin, 0,
3867 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3868
3869 msleep(100);
3870
c0ca5ece
TI
3871 if (!spec->no_shutup_pins)
3872 snd_hda_codec_write(codec, hp_pin, 0,
3873 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
693abe11
KY
3874
3875 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3876 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3877
3878 /* Wait for depop procedure finish */
3879 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3880 for (i = 0; i < 20 && val & 0x0080; i++) {
3881 msleep(50);
3882 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3883 }
3884 /* Set HP depop to auto mode */
3885 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3886 msleep(50);
3887}
3888
3889static void alc294_init(struct hda_codec *codec)
3890{
3891 struct alc_spec *spec = codec->spec;
3892
f6ef4e0e
TI
3893 /* required only at boot or S4 resume time */
3894 if (!spec->done_hp_init ||
3895 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
693abe11
KY
3896 alc294_hp_init(codec);
3897 spec->done_hp_init = true;
3898 }
3899 alc_default_init(codec);
3900}
3901
ad60d502
KY
3902static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3903 unsigned int val)
3904{
3905 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3906 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3907 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3908}
3909
3910static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3911{
3912 unsigned int val;
3913
3914 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3915 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3916 & 0xffff;
3917 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3918 << 16;
3919 return val;
3920}
3921
3922static void alc5505_dsp_halt(struct hda_codec *codec)
3923{
3924 unsigned int val;
3925
3926 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3927 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3928 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3929 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3930 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3931 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3932 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3933 val = alc5505_coef_get(codec, 0x6220);
3934 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3935}
3936
3937static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3938{
3939 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3940 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3941 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3942 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3943 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3944 alc5505_coef_set(codec, 0x880c, 0x00000004);
3945}
3946
3947static void alc5505_dsp_init(struct hda_codec *codec)
3948{
3949 unsigned int val;
3950
3951 alc5505_dsp_halt(codec);
3952 alc5505_dsp_back_from_halt(codec);
3953 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3954 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3955 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3956 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3957 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3958 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3959 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3960 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3961 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3962 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3963 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3964 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3965 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3966
3967 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3968 if (val <= 3)
3969 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3970 else
3971 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3972
3973 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3974 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3975 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3976 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3977 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3978 alc5505_coef_set(codec, 0x880c, 0x00000003);
3979 alc5505_coef_set(codec, 0x880c, 0x00000010);
cd63a5ff
TI
3980
3981#ifdef HALT_REALTEK_ALC5505
3982 alc5505_dsp_halt(codec);
3983#endif
ad60d502
KY
3984}
3985
cd63a5ff 3986#ifdef HALT_REALTEK_ALC5505
8a71821f
PLB
3987#define alc5505_dsp_suspend(codec) do { } while (0) /* NOP */
3988#define alc5505_dsp_resume(codec) do { } while (0) /* NOP */
cd63a5ff
TI
3989#else
3990#define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
3991#define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
3992#endif
3993
2a43952a 3994#ifdef CONFIG_PM
ad60d502
KY
3995static int alc269_suspend(struct hda_codec *codec)
3996{
3997 struct alc_spec *spec = codec->spec;
3998
3999 if (spec->has_alc5505_dsp)
cd63a5ff 4000 alc5505_dsp_suspend(codec);
ad60d502
KY
4001 return alc_suspend(codec);
4002}
4003
1d045db9
TI
4004static int alc269_resume(struct hda_codec *codec)
4005{
adcc70b2
KY
4006 struct alc_spec *spec = codec->spec;
4007
1387e2d1
KY
4008 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4009 alc269vb_toggle_power_output(codec, 0);
4010 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
adcc70b2 4011 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
1d045db9
TI
4012 msleep(150);
4013 }
8c427226 4014
1d045db9 4015 codec->patch_ops.init(codec);
f1d4e28b 4016
1387e2d1
KY
4017 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4018 alc269vb_toggle_power_output(codec, 1);
4019 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
adcc70b2 4020 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
1d045db9
TI
4021 msleep(200);
4022 }
f1d4e28b 4023
1a462be5 4024 snd_hda_regmap_sync(codec);
1d045db9 4025 hda_call_check_power_status(codec, 0x01);
f475371a
HW
4026
4027 /* on some machine, the BIOS will clear the codec gpio data when enter
4028 * suspend, and won't restore the data after resume, so we restore it
4029 * in the driver.
4030 */
d261eec8
TI
4031 if (spec->gpio_data)
4032 alc_write_gpio_data(codec);
f475371a 4033
ad60d502 4034 if (spec->has_alc5505_dsp)
cd63a5ff 4035 alc5505_dsp_resume(codec);
c5177c86 4036
1d045db9
TI
4037 return 0;
4038}
2a43952a 4039#endif /* CONFIG_PM */
f1d4e28b 4040
108cc108 4041static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
1727a771 4042 const struct hda_fixup *fix, int action)
108cc108
DH
4043{
4044 struct alc_spec *spec = codec->spec;
4045
1727a771 4046 if (action == HDA_FIXUP_ACT_PRE_PROBE)
108cc108
DH
4047 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
4048}
4049
fdcc968a
JMG
4050static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
4051 const struct hda_fixup *fix,
4052 int action)
4053{
4054 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
4055 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
4056
4057 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
4058 snd_hda_codec_set_pincfg(codec, 0x19,
4059 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
4060 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
4061}
4062
1d045db9 4063static void alc269_fixup_hweq(struct hda_codec *codec,
1727a771 4064 const struct hda_fixup *fix, int action)
1d045db9 4065{
98b24883
TI
4066 if (action == HDA_FIXUP_ACT_INIT)
4067 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
1d045db9 4068}
f1d4e28b 4069
7c478f03
DH
4070static void alc269_fixup_headset_mic(struct hda_codec *codec,
4071 const struct hda_fixup *fix, int action)
4072{
4073 struct alc_spec *spec = codec->spec;
4074
4075 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4076 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4077}
4078
1d045db9 4079static void alc271_fixup_dmic(struct hda_codec *codec,
1727a771 4080 const struct hda_fixup *fix, int action)
1d045db9
TI
4081{
4082 static const struct hda_verb verbs[] = {
4083 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
4084 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
4085 {}
4086 };
4087 unsigned int cfg;
f1d4e28b 4088
7639a06c
TI
4089 if (strcmp(codec->core.chip_name, "ALC271X") &&
4090 strcmp(codec->core.chip_name, "ALC269VB"))
1d045db9
TI
4091 return;
4092 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
4093 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
4094 snd_hda_sequence_write(codec, verbs);
4095}
f1d4e28b 4096
c8426b27
TI
4097/* Fix the speaker amp after resume, etc */
4098static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec,
4099 const struct hda_fixup *fix,
4100 int action)
4101{
4102 if (action == HDA_FIXUP_ACT_INIT)
4103 alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000);
4104}
4105
017f2a10 4106static void alc269_fixup_pcm_44k(struct hda_codec *codec,
1727a771 4107 const struct hda_fixup *fix, int action)
017f2a10
TI
4108{
4109 struct alc_spec *spec = codec->spec;
4110
1727a771 4111 if (action != HDA_FIXUP_ACT_PROBE)
017f2a10
TI
4112 return;
4113
4114 /* Due to a hardware problem on Lenovo Ideadpad, we need to
4115 * fix the sample rate of analog I/O to 44.1kHz
4116 */
08c189f2
TI
4117 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
4118 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
017f2a10
TI
4119}
4120
adabb3ec 4121static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
1727a771 4122 const struct hda_fixup *fix, int action)
adabb3ec 4123{
adabb3ec
TI
4124 /* The digital-mic unit sends PDM (differential signal) instead of
4125 * the standard PCM, thus you can't record a valid mono stream as is.
4126 * Below is a workaround specific to ALC269 to control the dmic
4127 * signal source as mono.
4128 */
98b24883
TI
4129 if (action == HDA_FIXUP_ACT_INIT)
4130 alc_update_coef_idx(codec, 0x07, 0, 0x80);
adabb3ec
TI
4131}
4132
24519911
TI
4133static void alc269_quanta_automute(struct hda_codec *codec)
4134{
08c189f2 4135 snd_hda_gen_update_outputs(codec);
24519911 4136
1687ccc8
TI
4137 alc_write_coef_idx(codec, 0x0c, 0x680);
4138 alc_write_coef_idx(codec, 0x0c, 0x480);
24519911
TI
4139}
4140
4141static void alc269_fixup_quanta_mute(struct hda_codec *codec,
1727a771 4142 const struct hda_fixup *fix, int action)
24519911
TI
4143{
4144 struct alc_spec *spec = codec->spec;
1727a771 4145 if (action != HDA_FIXUP_ACT_PROBE)
24519911 4146 return;
08c189f2 4147 spec->gen.automute_hook = alc269_quanta_automute;
24519911
TI
4148}
4149
d240d1dc 4150static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
1a4f69d5 4151 struct hda_jack_callback *jack)
d240d1dc
DH
4152{
4153 struct alc_spec *spec = codec->spec;
4154 int vref;
4155 msleep(200);
4156 snd_hda_gen_hp_automute(codec, jack);
4157
4158 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4159 msleep(100);
4160 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4161 vref);
4162 msleep(500);
4163 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4164 vref);
4165}
4166
a2ef03fe
TE
4167/*
4168 * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
4169 */
4170struct hda_alc298_mbxinit {
4171 unsigned char value_0x23;
4172 unsigned char value_0x25;
4173};
4174
4175static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
4176 const struct hda_alc298_mbxinit *initval,
4177 bool first)
4178{
4179 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
4180 alc_write_coef_idx(codec, 0x26, 0xb000);
4181
4182 if (first)
4183 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
4184
4185 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4186 alc_write_coef_idx(codec, 0x26, 0xf000);
4187 alc_write_coef_idx(codec, 0x23, initval->value_0x23);
4188
4189 if (initval->value_0x23 != 0x1e)
4190 alc_write_coef_idx(codec, 0x25, initval->value_0x25);
4191
4192 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4193 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4194}
4195
4196static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
4197 const struct hda_fixup *fix,
4198 int action)
4199{
4200 /* Initialization magic */
4201 static const struct hda_alc298_mbxinit dac_init[] = {
4202 {0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
4203 {0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
4204 {0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
4205 {0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
4206 {0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
4207 {0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
4208 {0x2f, 0x00},
4209 {0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
4210 {0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
4211 {0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
4212 {}
4213 };
4214 const struct hda_alc298_mbxinit *seq;
4215
4216 if (action != HDA_FIXUP_ACT_INIT)
4217 return;
4218
4219 /* Start */
4220 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4221 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4222 alc_write_coef_idx(codec, 0x26, 0xf000);
4223 alc_write_coef_idx(codec, 0x22, 0x31);
4224 alc_write_coef_idx(codec, 0x23, 0x0b);
4225 alc_write_coef_idx(codec, 0x25, 0x00);
4226 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4227 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4228
4229 for (seq = dac_init; seq->value_0x23; seq++)
4230 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4231}
4232
d240d1dc
DH
4233static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4234 const struct hda_fixup *fix, int action)
4235{
4236 struct alc_spec *spec = codec->spec;
4237 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4238 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4239 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
4240 }
4241}
4242
766538ac
TI
4243static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4244 bool polarity, bool on)
4245{
4246 unsigned int pinval;
4247
4248 if (!pin)
4249 return;
4250 if (polarity)
4251 on = !on;
4252 pinval = snd_hda_codec_get_pin_target(codec, pin);
4253 pinval &= ~AC_PINCTL_VREFEN;
4254 pinval |= on ? AC_PINCTL_VREF_80 : AC_PINCTL_VREF_HIZ;
4255 /* temporarily power up/down for setting VREF */
4256 snd_hda_power_up_pm(codec);
4257 snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4258 snd_hda_power_down_pm(codec);
4259}
d240d1dc 4260
08fb0d0e 4261/* update mute-LED according to the speaker mute state via mic VREF pin */
8d3d1ece
TI
4262static int vref_mute_led_set(struct led_classdev *led_cdev,
4263 enum led_brightness brightness)
6d3cd5d4 4264{
8d3d1ece 4265 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
08fb0d0e 4266 struct alc_spec *spec = codec->spec;
08fb0d0e 4267
766538ac
TI
4268 alc_update_vref_led(codec, spec->mute_led_nid,
4269 spec->mute_led_polarity, brightness);
8d3d1ece 4270 return 0;
6d3cd5d4
DH
4271}
4272
d5b6b65e
DH
4273/* Make sure the led works even in runtime suspend */
4274static unsigned int led_power_filter(struct hda_codec *codec,
4275 hda_nid_t nid,
4276 unsigned int power_state)
4277{
4278 struct alc_spec *spec = codec->spec;
4279
50dd9050
HW
4280 if (power_state != AC_PWRST_D3 || nid == 0 ||
4281 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
d5b6b65e
DH
4282 return power_state;
4283
4284 /* Set pin ctl again, it might have just been set to 0 */
4285 snd_hda_set_pin_ctl(codec, nid,
4286 snd_hda_codec_get_pin_target(codec, nid));
4287
cffd3966 4288 return snd_hda_gen_path_power_filter(codec, nid, power_state);
d5b6b65e
DH
4289}
4290
08fb0d0e
TI
4291static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4292 const struct hda_fixup *fix, int action)
6d3cd5d4
DH
4293{
4294 struct alc_spec *spec = codec->spec;
08fb0d0e
TI
4295 const struct dmi_device *dev = NULL;
4296
4297 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4298 return;
4299
4300 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4301 int pol, pin;
4302 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4303 continue;
4304 if (pin < 0x0a || pin >= 0x10)
4305 break;
4306 spec->mute_led_polarity = pol;
4307 spec->mute_led_nid = pin - 0x0a + 0x18;
8d3d1ece 4308 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
d5b6b65e 4309 codec->power_filter = led_power_filter;
4e76a883
TI
4310 codec_dbg(codec,
4311 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
08fb0d0e 4312 spec->mute_led_polarity);
6d3cd5d4
DH
4313 break;
4314 }
4315}
4316
85c467dc
TI
4317static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4318 const struct hda_fixup *fix,
4319 int action, hda_nid_t pin)
d06ac143
DH
4320{
4321 struct alc_spec *spec = codec->spec;
85c467dc 4322
d06ac143
DH
4323 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4324 spec->mute_led_polarity = 0;
85c467dc 4325 spec->mute_led_nid = pin;
8d3d1ece 4326 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
d5b6b65e 4327 codec->power_filter = led_power_filter;
d06ac143
DH
4328 }
4329}
4330
85c467dc
TI
4331static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4332 const struct hda_fixup *fix, int action)
4333{
4334 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4335}
4336
08fb0d0e
TI
4337static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4338 const struct hda_fixup *fix, int action)
420b0feb 4339{
85c467dc 4340 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
420b0feb
TI
4341}
4342
7f783bd5
TB
4343static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4344 const struct hda_fixup *fix, int action)
4345{
85c467dc 4346 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
7f783bd5
TB
4347}
4348
0f32fd19
TI
4349/* update LED status via GPIO */
4350static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
dbd13179 4351 int polarity, bool enabled)
9f5c6faf 4352{
dbd13179 4353 if (polarity)
0f32fd19 4354 enabled = !enabled;
d261eec8 4355 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
9f5c6faf
TI
4356}
4357
0f32fd19 4358/* turn on/off mute LED via GPIO per vmaster hook */
8d3d1ece
TI
4359static int gpio_mute_led_set(struct led_classdev *led_cdev,
4360 enum led_brightness brightness)
9f5c6faf 4361{
8d3d1ece 4362 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
9f5c6faf 4363 struct alc_spec *spec = codec->spec;
9f5c6faf 4364
dbd13179 4365 alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
8d3d1ece
TI
4366 spec->mute_led_polarity, !brightness);
4367 return 0;
0f32fd19 4368}
9f5c6faf 4369
0f32fd19 4370/* turn on/off mic-mute LED via GPIO per capture hook */
87dc3648
KHF
4371static int micmute_led_set(struct led_classdev *led_cdev,
4372 enum led_brightness brightness)
4373{
4374 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4375 struct alc_spec *spec = codec->spec;
4376
4377 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
40469064 4378 spec->micmute_led_polarity, !brightness);
87dc3648
KHF
4379 return 0;
4380}
4381
01e4a275
TI
4382/* setup mute and mic-mute GPIO bits, add hooks appropriately */
4383static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4384 int action,
4385 unsigned int mute_mask,
4386 unsigned int micmute_mask)
9f5c6faf
TI
4387{
4388 struct alc_spec *spec = codec->spec;
9f5c6faf 4389
01e4a275
TI
4390 alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4391
4392 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4393 return;
4394 if (mute_mask) {
4395 spec->gpio_mute_led_mask = mute_mask;
8d3d1ece 4396 snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
01e4a275
TI
4397 }
4398 if (micmute_mask) {
4399 spec->gpio_mic_led_mask = micmute_mask;
7cdf8c49 4400 snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
9f5c6faf
TI
4401 }
4402}
4403
e7d66cf7
JS
4404static void alc236_fixup_hp_gpio_led(struct hda_codec *codec,
4405 const struct hda_fixup *fix, int action)
4406{
4407 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01);
4408}
4409
01e4a275 4410static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
eaa8e5ef
KY
4411 const struct hda_fixup *fix, int action)
4412{
01e4a275
TI
4413 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4414}
eaa8e5ef 4415
f5a88b0a
KHF
4416static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4417 const struct hda_fixup *fix, int action)
4418{
3e0650ab 4419 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
f5a88b0a
KHF
4420}
4421
01e4a275
TI
4422static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4423 const struct hda_fixup *fix, int action)
4424{
4425 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
9f5c6faf
TI
4426}
4427
a0ccbc53
KY
4428static void alc287_fixup_hp_gpio_led(struct hda_codec *codec,
4429 const struct hda_fixup *fix, int action)
4430{
4431 alc_fixup_hp_gpio_led(codec, action, 0x10, 0);
4432}
4433
5fc462c3
JC
4434static void alc245_fixup_hp_gpio_led(struct hda_codec *codec,
4435 const struct hda_fixup *fix, int action)
4436{
4437 struct alc_spec *spec = codec->spec;
4438
4439 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4440 spec->micmute_led_polarity = 1;
4441 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4442}
4443
8a503555
TI
4444/* turn on/off mic-mute LED per capture hook via VREF change */
4445static int vref_micmute_led_set(struct led_classdev *led_cdev,
4446 enum led_brightness brightness)
9c5dc3bf 4447{
8a503555 4448 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
9c5dc3bf 4449 struct alc_spec *spec = codec->spec;
9c5dc3bf 4450
766538ac
TI
4451 alc_update_vref_led(codec, spec->cap_mute_led_nid,
4452 spec->micmute_led_polarity, brightness);
8a503555 4453 return 0;
9c5dc3bf
KY
4454}
4455
4456static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4457 const struct hda_fixup *fix, int action)
4458{
4459 struct alc_spec *spec = codec->spec;
9c5dc3bf 4460
01e4a275 4461 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
9c5dc3bf 4462 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
01e4a275
TI
4463 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4464 * enable headphone amp
4465 */
4466 spec->gpio_mask |= 0x10;
4467 spec->gpio_dir |= 0x10;
9c5dc3bf 4468 spec->cap_mute_led_nid = 0x18;
8a503555 4469 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
50dd9050 4470 codec->power_filter = led_power_filter;
9c5dc3bf
KY
4471 }
4472}
4473
7a5255f1
DH
4474static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4475 const struct hda_fixup *fix, int action)
4476{
7a5255f1 4477 struct alc_spec *spec = codec->spec;
7a5255f1 4478
01e4a275 4479 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
7a5255f1 4480 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
7a5255f1 4481 spec->cap_mute_led_nid = 0x18;
8a503555 4482 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
7a5255f1
DH
4483 codec->power_filter = led_power_filter;
4484 }
4485}
4486
c3bb2b52
TI
4487/* HP Spectre x360 14 model needs a unique workaround for enabling the amp;
4488 * it needs to toggle the GPIO0 once on and off at each time (bko#210633)
4489 */
4490static void alc245_fixup_hp_x360_amp(struct hda_codec *codec,
4491 const struct hda_fixup *fix, int action)
4492{
4493 struct alc_spec *spec = codec->spec;
4494
4495 switch (action) {
4496 case HDA_FIXUP_ACT_PRE_PROBE:
4497 spec->gpio_mask |= 0x01;
4498 spec->gpio_dir |= 0x01;
4499 break;
4500 case HDA_FIXUP_ACT_INIT:
4501 /* need to toggle GPIO to enable the amp */
4502 alc_update_gpio_data(codec, 0x01, true);
4503 msleep(100);
4504 alc_update_gpio_data(codec, 0x01, false);
4505 break;
4506 }
4507}
4508
622464c8
TI
4509/* toggle GPIO2 at each time stream is started; we use PREPARE state instead */
4510static void alc274_hp_envy_pcm_hook(struct hda_pcm_stream *hinfo,
4511 struct hda_codec *codec,
4512 struct snd_pcm_substream *substream,
4513 int action)
4514{
4515 switch (action) {
4516 case HDA_GEN_PCM_ACT_PREPARE:
4517 alc_update_gpio_data(codec, 0x04, true);
4518 break;
4519 case HDA_GEN_PCM_ACT_CLEANUP:
4520 alc_update_gpio_data(codec, 0x04, false);
4521 break;
4522 }
4523}
4524
4525static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
4526 const struct hda_fixup *fix,
4527 int action)
4528{
4529 struct alc_spec *spec = codec->spec;
4530
4531 if (action == HDA_FIXUP_ACT_PROBE) {
4532 spec->gpio_mask |= 0x04;
4533 spec->gpio_dir |= 0x04;
4534 spec->gen.pcm_playback_hook = alc274_hp_envy_pcm_hook;
4535 }
4536}
4537
766538ac
TI
4538static void alc_update_coef_led(struct hda_codec *codec,
4539 struct alc_coef_led *led,
4540 bool polarity, bool on)
4541{
4542 if (polarity)
4543 on = !on;
4544 /* temporarily power up/down for setting COEF bit */
4545 alc_update_coef_idx(codec, led->idx, led->mask,
4546 on ? led->on : led->off);
4547}
4548
431e76c3 4549/* update mute-LED according to the speaker mute state via COEF bit */
8d3d1ece
TI
4550static int coef_mute_led_set(struct led_classdev *led_cdev,
4551 enum led_brightness brightness)
431e76c3 4552{
8d3d1ece 4553 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
431e76c3
KY
4554 struct alc_spec *spec = codec->spec;
4555
766538ac
TI
4556 alc_update_coef_led(codec, &spec->mute_led_coef,
4557 spec->mute_led_polarity, brightness);
8d3d1ece 4558 return 0;
431e76c3
KY
4559}
4560
4561static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4562 const struct hda_fixup *fix,
4563 int action)
4564{
4565 struct alc_spec *spec = codec->spec;
4566
4567 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4568 spec->mute_led_polarity = 0;
766538ac
TI
4569 spec->mute_led_coef.idx = 0x0b;
4570 spec->mute_led_coef.mask = 1 << 3;
4571 spec->mute_led_coef.on = 1 << 3;
4572 spec->mute_led_coef.off = 0;
8d3d1ece 4573 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
431e76c3
KY
4574 }
4575}
4576
24164f43
KY
4577static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4578 const struct hda_fixup *fix,
4579 int action)
4580{
4581 struct alc_spec *spec = codec->spec;
4582
4583 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4584 spec->mute_led_polarity = 0;
766538ac
TI
4585 spec->mute_led_coef.idx = 0x34;
4586 spec->mute_led_coef.mask = 1 << 5;
4587 spec->mute_led_coef.on = 0;
4588 spec->mute_led_coef.off = 1 << 5;
8d3d1ece 4589 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
24164f43
KY
4590 }
4591}
4592
431e76c3 4593/* turn on/off mic-mute LED per capture hook by coef bit */
8a503555
TI
4594static int coef_micmute_led_set(struct led_classdev *led_cdev,
4595 enum led_brightness brightness)
431e76c3 4596{
8a503555 4597 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
431e76c3
KY
4598 struct alc_spec *spec = codec->spec;
4599
766538ac
TI
4600 alc_update_coef_led(codec, &spec->mic_led_coef,
4601 spec->micmute_led_polarity, brightness);
8a503555 4602 return 0;
431e76c3
KY
4603}
4604
4605static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4606 const struct hda_fixup *fix, int action)
4607{
4608 struct alc_spec *spec = codec->spec;
4609
4610 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
766538ac
TI
4611 spec->mic_led_coef.idx = 0x19;
4612 spec->mic_led_coef.mask = 1 << 13;
4613 spec->mic_led_coef.on = 1 << 13;
4614 spec->mic_led_coef.off = 0;
8a503555 4615 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
431e76c3
KY
4616 }
4617}
4618
24164f43
KY
4619static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4620 const struct hda_fixup *fix, int action)
4621{
4622 struct alc_spec *spec = codec->spec;
4623
4624 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
766538ac
TI
4625 spec->mic_led_coef.idx = 0x35;
4626 spec->mic_led_coef.mask = 3 << 2;
4627 spec->mic_led_coef.on = 2 << 2;
4628 spec->mic_led_coef.off = 1 << 2;
8a503555 4629 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
24164f43
KY
4630 }
4631}
4632
431e76c3
KY
4633static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4634 const struct hda_fixup *fix, int action)
4635{
4636 alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4637 alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4638}
4639
24164f43
KY
4640static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4641 const struct hda_fixup *fix, int action)
4642{
4643 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4644 alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4645}
4646
75b62ab6
JW
4647static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec,
4648 const struct hda_fixup *fix, int action)
4649{
4650 struct alc_spec *spec = codec->spec;
4651
4652 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4653 spec->cap_mute_led_nid = 0x1a;
4654 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4655 codec->power_filter = led_power_filter;
4656 }
4657}
4658
4659static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec,
4660 const struct hda_fixup *fix, int action)
4661{
4662 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4663 alc236_fixup_hp_micmute_led_vref(codec, fix, action);
4664}
4665
6a30abaa 4666#if IS_REACHABLE(CONFIG_INPUT)
33f4acd3
DH
4667static void gpio2_mic_hotkey_event(struct hda_codec *codec,
4668 struct hda_jack_callback *event)
4669{
4670 struct alc_spec *spec = codec->spec;
4671
4672 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
4673 send both key on and key off event for every interrupt. */
c7b60a89 4674 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
33f4acd3 4675 input_sync(spec->kb_dev);
c7b60a89 4676 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
33f4acd3
DH
4677 input_sync(spec->kb_dev);
4678}
33f4acd3 4679
3694cb29
K
4680static int alc_register_micmute_input_device(struct hda_codec *codec)
4681{
4682 struct alc_spec *spec = codec->spec;
c7b60a89 4683 int i;
3694cb29
K
4684
4685 spec->kb_dev = input_allocate_device();
4686 if (!spec->kb_dev) {
4687 codec_err(codec, "Out of memory (input_allocate_device)\n");
4688 return -ENOMEM;
4689 }
c7b60a89
HW
4690
4691 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
4692
3694cb29
K
4693 spec->kb_dev->name = "Microphone Mute Button";
4694 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
c7b60a89
HW
4695 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
4696 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
4697 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
4698 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
4699 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
3694cb29
K
4700
4701 if (input_register_device(spec->kb_dev)) {
4702 codec_err(codec, "input_register_device failed\n");
4703 input_free_device(spec->kb_dev);
4704 spec->kb_dev = NULL;
4705 return -ENOMEM;
4706 }
4707
4708 return 0;
4709}
4710
01e4a275
TI
4711/* GPIO1 = set according to SKU external amp
4712 * GPIO2 = mic mute hotkey
4713 * GPIO3 = mute LED
4714 * GPIO4 = mic mute LED
4715 */
33f4acd3
DH
4716static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4717 const struct hda_fixup *fix, int action)
4718{
33f4acd3
DH
4719 struct alc_spec *spec = codec->spec;
4720
01e4a275 4721 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
33f4acd3 4722 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1c76aa5f 4723 spec->init_amp = ALC_INIT_DEFAULT;
3694cb29 4724 if (alc_register_micmute_input_device(codec) != 0)
33f4acd3 4725 return;
33f4acd3 4726
01e4a275
TI
4727 spec->gpio_mask |= 0x06;
4728 spec->gpio_dir |= 0x02;
4729 spec->gpio_data |= 0x02;
7639a06c 4730 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
33f4acd3 4731 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
7639a06c 4732 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
33f4acd3 4733 gpio2_mic_hotkey_event);
33f4acd3
DH
4734 return;
4735 }
4736
4737 if (!spec->kb_dev)
4738 return;
4739
4740 switch (action) {
33f4acd3
DH
4741 case HDA_FIXUP_ACT_FREE:
4742 input_unregister_device(spec->kb_dev);
33f4acd3
DH
4743 spec->kb_dev = NULL;
4744 }
33f4acd3
DH
4745}
4746
01e4a275
TI
4747/* Line2 = mic mute hotkey
4748 * GPIO2 = mic mute LED
4749 */
3694cb29
K
4750static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4751 const struct hda_fixup *fix, int action)
4752{
3694cb29
K
4753 struct alc_spec *spec = codec->spec;
4754
01e4a275 4755 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
3694cb29 4756 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1c76aa5f 4757 spec->init_amp = ALC_INIT_DEFAULT;
3694cb29
K
4758 if (alc_register_micmute_input_device(codec) != 0)
4759 return;
4760
3694cb29
K
4761 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4762 gpio2_mic_hotkey_event);
3694cb29
K
4763 return;
4764 }
4765
4766 if (!spec->kb_dev)
4767 return;
4768
4769 switch (action) {
3694cb29
K
4770 case HDA_FIXUP_ACT_FREE:
4771 input_unregister_device(spec->kb_dev);
4772 spec->kb_dev = NULL;
4773 }
4774}
c469652b
TI
4775#else /* INPUT */
4776#define alc280_fixup_hp_gpio2_mic_hotkey NULL
4777#define alc233_fixup_lenovo_line2_mic_hotkey NULL
4778#endif /* INPUT */
3694cb29 4779
9c5dc3bf
KY
4780static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4781 const struct hda_fixup *fix, int action)
4782{
4783 struct alc_spec *spec = codec->spec;
4784
1bce62a6 4785 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
9c5dc3bf 4786 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
9c5dc3bf 4787 spec->cap_mute_led_nid = 0x18;
8a503555 4788 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
9c5dc3bf
KY
4789 }
4790}
4791
6b0f95c4 4792static const struct coef_fw alc225_pre_hsmode[] = {
5a36767a
KY
4793 UPDATE_COEF(0x4a, 1<<8, 0),
4794 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4795 UPDATE_COEF(0x63, 3<<14, 3<<14),
4796 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4797 UPDATE_COEF(0x4a, 3<<10, 3<<10),
4798 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4799 UPDATE_COEF(0x4a, 3<<10, 0),
4800 {}
4801};
4802
73bdd597
DH
4803static void alc_headset_mode_unplugged(struct hda_codec *codec)
4804{
92666d45 4805 struct alc_spec *spec = codec->spec;
6b0f95c4 4806 static const struct coef_fw coef0255[] = {
717f43d8 4807 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
54db6c39
TI
4808 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4809 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4810 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4811 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4812 {}
4813 };
6b0f95c4 4814 static const struct coef_fw coef0256[] = {
e69e7e03 4815 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
717f43d8
KY
4816 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4817 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4818 WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
4819 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
e69e7e03
KY
4820 {}
4821 };
6b0f95c4 4822 static const struct coef_fw coef0233[] = {
54db6c39
TI
4823 WRITE_COEF(0x1b, 0x0c0b),
4824 WRITE_COEF(0x45, 0xc429),
4825 UPDATE_COEF(0x35, 0x4000, 0),
4826 WRITE_COEF(0x06, 0x2104),
4827 WRITE_COEF(0x1a, 0x0001),
4828 WRITE_COEF(0x26, 0x0004),
4829 WRITE_COEF(0x32, 0x42a3),
4830 {}
4831 };
6b0f95c4 4832 static const struct coef_fw coef0288[] = {
f3b70332
KY
4833 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4834 UPDATE_COEF(0x50, 0x2000, 0x2000),
4835 UPDATE_COEF(0x56, 0x0006, 0x0006),
4836 UPDATE_COEF(0x66, 0x0008, 0),
4837 UPDATE_COEF(0x67, 0x2000, 0),
4838 {}
4839 };
6b0f95c4 4840 static const struct coef_fw coef0298[] = {
89542936
KY
4841 UPDATE_COEF(0x19, 0x1300, 0x0300),
4842 {}
4843 };
6b0f95c4 4844 static const struct coef_fw coef0292[] = {
54db6c39
TI
4845 WRITE_COEF(0x76, 0x000e),
4846 WRITE_COEF(0x6c, 0x2400),
4847 WRITE_COEF(0x18, 0x7308),
4848 WRITE_COEF(0x6b, 0xc429),
4849 {}
4850 };
6b0f95c4 4851 static const struct coef_fw coef0293[] = {
54db6c39
TI
4852 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
4853 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
4854 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
4855 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
4856 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
4857 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4858 {}
4859 };
6b0f95c4 4860 static const struct coef_fw coef0668[] = {
54db6c39
TI
4861 WRITE_COEF(0x15, 0x0d40),
4862 WRITE_COEF(0xb7, 0x802b),
4863 {}
4864 };
6b0f95c4 4865 static const struct coef_fw coef0225[] = {
5a36767a 4866 UPDATE_COEF(0x63, 3<<14, 0),
4cc9b9d6
KY
4867 {}
4868 };
6b0f95c4 4869 static const struct coef_fw coef0274[] = {
71683c32
KY
4870 UPDATE_COEF(0x4a, 0x0100, 0),
4871 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
4872 UPDATE_COEF(0x6b, 0xf000, 0x5000),
4873 UPDATE_COEF(0x4a, 0x0010, 0),
4874 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
4875 WRITE_COEF(0x45, 0x5289),
4876 UPDATE_COEF(0x4a, 0x0c00, 0),
4877 {}
4878 };
54db6c39 4879
92666d45
KY
4880 if (spec->no_internal_mic_pin) {
4881 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
4882 return;
4883 }
4884
7639a06c 4885 switch (codec->core.vendor_id) {
9a22a8f5 4886 case 0x10ec0255:
e69e7e03
KY
4887 alc_process_coef_fw(codec, coef0255);
4888 break;
1948fc06 4889 case 0x10ec0230:
736f20a7 4890 case 0x10ec0236:
7081adf3 4891 case 0x10ec0256:
e69e7e03 4892 alc_process_coef_fw(codec, coef0256);
9a22a8f5 4893 break;
71683c32
KY
4894 case 0x10ec0234:
4895 case 0x10ec0274:
4896 case 0x10ec0294:
4897 alc_process_coef_fw(codec, coef0274);
4898 break;
13fd08a3 4899 case 0x10ec0233:
73bdd597 4900 case 0x10ec0283:
54db6c39 4901 alc_process_coef_fw(codec, coef0233);
73bdd597 4902 break;
f3b70332
KY
4903 case 0x10ec0286:
4904 case 0x10ec0288:
89542936
KY
4905 alc_process_coef_fw(codec, coef0288);
4906 break;
1a5bc8d9 4907 case 0x10ec0298:
89542936 4908 alc_process_coef_fw(codec, coef0298);
f3b70332
KY
4909 alc_process_coef_fw(codec, coef0288);
4910 break;
73bdd597 4911 case 0x10ec0292:
54db6c39 4912 alc_process_coef_fw(codec, coef0292);
73bdd597 4913 break;
a22aa26f 4914 case 0x10ec0293:
54db6c39 4915 alc_process_coef_fw(codec, coef0293);
a22aa26f 4916 break;
73bdd597 4917 case 0x10ec0668:
54db6c39 4918 alc_process_coef_fw(codec, coef0668);
73bdd597 4919 break;
c2b691ee 4920 case 0x10ec0215:
4cc9b9d6 4921 case 0x10ec0225:
c2b691ee 4922 case 0x10ec0285:
7d727869 4923 case 0x10ec0295:
c2b691ee 4924 case 0x10ec0289:
28f1f9b2 4925 case 0x10ec0299:
4d4b0c52 4926 alc_process_coef_fw(codec, alc225_pre_hsmode);
4cc9b9d6
KY
4927 alc_process_coef_fw(codec, coef0225);
4928 break;
78f4f7c2
KY
4929 case 0x10ec0867:
4930 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4931 break;
73bdd597 4932 }
4e76a883 4933 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
73bdd597
DH
4934}
4935
4936
4937static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
4938 hda_nid_t mic_pin)
4939{
6b0f95c4 4940 static const struct coef_fw coef0255[] = {
54db6c39
TI
4941 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
4942 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4943 {}
4944 };
6b0f95c4 4945 static const struct coef_fw coef0256[] = {
717f43d8
KY
4946 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
4947 WRITE_COEFEX(0x57, 0x03, 0x09a3),
4948 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4949 {}
4950 };
6b0f95c4 4951 static const struct coef_fw coef0233[] = {
54db6c39
TI
4952 UPDATE_COEF(0x35, 0, 1<<14),
4953 WRITE_COEF(0x06, 0x2100),
4954 WRITE_COEF(0x1a, 0x0021),
4955 WRITE_COEF(0x26, 0x008c),
4956 {}
4957 };
6b0f95c4 4958 static const struct coef_fw coef0288[] = {
89542936 4959 UPDATE_COEF(0x4f, 0x00c0, 0),
f3b70332
KY
4960 UPDATE_COEF(0x50, 0x2000, 0),
4961 UPDATE_COEF(0x56, 0x0006, 0),
4962 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4963 UPDATE_COEF(0x66, 0x0008, 0x0008),
4964 UPDATE_COEF(0x67, 0x2000, 0x2000),
4965 {}
4966 };
6b0f95c4 4967 static const struct coef_fw coef0292[] = {
54db6c39
TI
4968 WRITE_COEF(0x19, 0xa208),
4969 WRITE_COEF(0x2e, 0xacf0),
4970 {}
4971 };
6b0f95c4 4972 static const struct coef_fw coef0293[] = {
54db6c39
TI
4973 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
4974 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
4975 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4976 {}
4977 };
6b0f95c4 4978 static const struct coef_fw coef0688[] = {
54db6c39
TI
4979 WRITE_COEF(0xb7, 0x802b),
4980 WRITE_COEF(0xb5, 0x1040),
4981 UPDATE_COEF(0xc3, 0, 1<<12),
4982 {}
4983 };
6b0f95c4 4984 static const struct coef_fw coef0225[] = {
4cc9b9d6
KY
4985 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
4986 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4987 UPDATE_COEF(0x63, 3<<14, 0),
4988 {}
4989 };
6b0f95c4 4990 static const struct coef_fw coef0274[] = {
71683c32
KY
4991 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
4992 UPDATE_COEF(0x4a, 0x0010, 0),
4993 UPDATE_COEF(0x6b, 0xf000, 0),
4994 {}
4995 };
54db6c39 4996
7639a06c 4997 switch (codec->core.vendor_id) {
9a22a8f5
KY
4998 case 0x10ec0255:
4999 alc_write_coef_idx(codec, 0x45, 0xc489);
5000 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 5001 alc_process_coef_fw(codec, coef0255);
9a22a8f5
KY
5002 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5003 break;
1948fc06 5004 case 0x10ec0230:
717f43d8
KY
5005 case 0x10ec0236:
5006 case 0x10ec0256:
5007 alc_write_coef_idx(codec, 0x45, 0xc489);
5008 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5009 alc_process_coef_fw(codec, coef0256);
5010 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5011 break;
71683c32
KY
5012 case 0x10ec0234:
5013 case 0x10ec0274:
5014 case 0x10ec0294:
5015 alc_write_coef_idx(codec, 0x45, 0x4689);
5016 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5017 alc_process_coef_fw(codec, coef0274);
5018 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5019 break;
13fd08a3 5020 case 0x10ec0233:
73bdd597
DH
5021 case 0x10ec0283:
5022 alc_write_coef_idx(codec, 0x45, 0xc429);
5023 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 5024 alc_process_coef_fw(codec, coef0233);
73bdd597
DH
5025 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5026 break;
f3b70332
KY
5027 case 0x10ec0286:
5028 case 0x10ec0288:
1a5bc8d9 5029 case 0x10ec0298:
f3b70332
KY
5030 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5031 alc_process_coef_fw(codec, coef0288);
5032 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5033 break;
73bdd597
DH
5034 case 0x10ec0292:
5035 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 5036 alc_process_coef_fw(codec, coef0292);
73bdd597 5037 break;
a22aa26f
KY
5038 case 0x10ec0293:
5039 /* Set to TRS mode */
5040 alc_write_coef_idx(codec, 0x45, 0xc429);
5041 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 5042 alc_process_coef_fw(codec, coef0293);
a22aa26f
KY
5043 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5044 break;
78f4f7c2
KY
5045 case 0x10ec0867:
5046 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
c0dbbdad 5047 fallthrough;
9eb5d0e6 5048 case 0x10ec0221:
1f8b46cd
DH
5049 case 0x10ec0662:
5050 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5051 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5052 break;
73bdd597
DH
5053 case 0x10ec0668:
5054 alc_write_coef_idx(codec, 0x11, 0x0001);
5055 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 5056 alc_process_coef_fw(codec, coef0688);
73bdd597
DH
5057 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5058 break;
c2b691ee 5059 case 0x10ec0215:
4cc9b9d6 5060 case 0x10ec0225:
c2b691ee 5061 case 0x10ec0285:
7d727869 5062 case 0x10ec0295:
c2b691ee 5063 case 0x10ec0289:
28f1f9b2 5064 case 0x10ec0299:
5a36767a 5065 alc_process_coef_fw(codec, alc225_pre_hsmode);
4cc9b9d6
KY
5066 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
5067 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5068 alc_process_coef_fw(codec, coef0225);
5069 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5070 break;
73bdd597 5071 }
4e76a883 5072 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
73bdd597
DH
5073}
5074
5075static void alc_headset_mode_default(struct hda_codec *codec)
5076{
6b0f95c4 5077 static const struct coef_fw coef0225[] = {
5a36767a
KY
5078 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
5079 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
5080 UPDATE_COEF(0x49, 3<<8, 0<<8),
5081 UPDATE_COEF(0x4a, 3<<4, 3<<4),
5082 UPDATE_COEF(0x63, 3<<14, 0),
5083 UPDATE_COEF(0x67, 0xf000, 0x3000),
2ae95577
DH
5084 {}
5085 };
6b0f95c4 5086 static const struct coef_fw coef0255[] = {
54db6c39
TI
5087 WRITE_COEF(0x45, 0xc089),
5088 WRITE_COEF(0x45, 0xc489),
5089 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5090 WRITE_COEF(0x49, 0x0049),
5091 {}
5092 };
6b0f95c4 5093 static const struct coef_fw coef0256[] = {
717f43d8
KY
5094 WRITE_COEF(0x45, 0xc489),
5095 WRITE_COEFEX(0x57, 0x03, 0x0da3),
5096 WRITE_COEF(0x49, 0x0049),
5097 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5098 WRITE_COEF(0x06, 0x6100),
5099 {}
5100 };
6b0f95c4 5101 static const struct coef_fw coef0233[] = {
54db6c39
TI
5102 WRITE_COEF(0x06, 0x2100),
5103 WRITE_COEF(0x32, 0x4ea3),
5104 {}
5105 };
6b0f95c4 5106 static const struct coef_fw coef0288[] = {
f3b70332
KY
5107 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
5108 UPDATE_COEF(0x50, 0x2000, 0x2000),
5109 UPDATE_COEF(0x56, 0x0006, 0x0006),
5110 UPDATE_COEF(0x66, 0x0008, 0),
5111 UPDATE_COEF(0x67, 0x2000, 0),
5112 {}
5113 };
6b0f95c4 5114 static const struct coef_fw coef0292[] = {
54db6c39
TI
5115 WRITE_COEF(0x76, 0x000e),
5116 WRITE_COEF(0x6c, 0x2400),
5117 WRITE_COEF(0x6b, 0xc429),
5118 WRITE_COEF(0x18, 0x7308),
5119 {}
5120 };
6b0f95c4 5121 static const struct coef_fw coef0293[] = {
54db6c39
TI
5122 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5123 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
5124 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5125 {}
5126 };
6b0f95c4 5127 static const struct coef_fw coef0688[] = {
54db6c39
TI
5128 WRITE_COEF(0x11, 0x0041),
5129 WRITE_COEF(0x15, 0x0d40),
5130 WRITE_COEF(0xb7, 0x802b),
5131 {}
5132 };
6b0f95c4 5133 static const struct coef_fw coef0274[] = {
71683c32
KY
5134 WRITE_COEF(0x45, 0x4289),
5135 UPDATE_COEF(0x4a, 0x0010, 0x0010),
5136 UPDATE_COEF(0x6b, 0x0f00, 0),
5137 UPDATE_COEF(0x49, 0x0300, 0x0300),
5138 {}
5139 };
54db6c39 5140
7639a06c 5141 switch (codec->core.vendor_id) {
c2b691ee 5142 case 0x10ec0215:
2ae95577 5143 case 0x10ec0225:
c2b691ee 5144 case 0x10ec0285:
7d727869 5145 case 0x10ec0295:
c2b691ee 5146 case 0x10ec0289:
28f1f9b2 5147 case 0x10ec0299:
5a36767a 5148 alc_process_coef_fw(codec, alc225_pre_hsmode);
2ae95577
DH
5149 alc_process_coef_fw(codec, coef0225);
5150 break;
9a22a8f5 5151 case 0x10ec0255:
54db6c39 5152 alc_process_coef_fw(codec, coef0255);
9a22a8f5 5153 break;
1948fc06 5154 case 0x10ec0230:
717f43d8
KY
5155 case 0x10ec0236:
5156 case 0x10ec0256:
5157 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5158 alc_write_coef_idx(codec, 0x45, 0xc089);
5159 msleep(50);
5160 alc_process_coef_fw(codec, coef0256);
5161 break;
71683c32
KY
5162 case 0x10ec0234:
5163 case 0x10ec0274:
5164 case 0x10ec0294:
5165 alc_process_coef_fw(codec, coef0274);
5166 break;
13fd08a3 5167 case 0x10ec0233:
73bdd597 5168 case 0x10ec0283:
54db6c39 5169 alc_process_coef_fw(codec, coef0233);
73bdd597 5170 break;
f3b70332
KY
5171 case 0x10ec0286:
5172 case 0x10ec0288:
1a5bc8d9 5173 case 0x10ec0298:
f3b70332
KY
5174 alc_process_coef_fw(codec, coef0288);
5175 break;
73bdd597 5176 case 0x10ec0292:
54db6c39 5177 alc_process_coef_fw(codec, coef0292);
73bdd597 5178 break;
a22aa26f 5179 case 0x10ec0293:
54db6c39 5180 alc_process_coef_fw(codec, coef0293);
a22aa26f 5181 break;
73bdd597 5182 case 0x10ec0668:
54db6c39 5183 alc_process_coef_fw(codec, coef0688);
73bdd597 5184 break;
78f4f7c2
KY
5185 case 0x10ec0867:
5186 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5187 break;
73bdd597 5188 }
4e76a883 5189 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
73bdd597
DH
5190}
5191
5192/* Iphone type */
5193static void alc_headset_mode_ctia(struct hda_codec *codec)
5194{
89542936
KY
5195 int val;
5196
6b0f95c4 5197 static const struct coef_fw coef0255[] = {
54db6c39
TI
5198 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5199 WRITE_COEF(0x1b, 0x0c2b),
5200 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5201 {}
5202 };
6b0f95c4 5203 static const struct coef_fw coef0256[] = {
e69e7e03 5204 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
717f43d8 5205 WRITE_COEF(0x1b, 0x0e6b),
e69e7e03
KY
5206 {}
5207 };
6b0f95c4 5208 static const struct coef_fw coef0233[] = {
54db6c39
TI
5209 WRITE_COEF(0x45, 0xd429),
5210 WRITE_COEF(0x1b, 0x0c2b),
5211 WRITE_COEF(0x32, 0x4ea3),
5212 {}
5213 };
6b0f95c4 5214 static const struct coef_fw coef0288[] = {
f3b70332
KY
5215 UPDATE_COEF(0x50, 0x2000, 0x2000),
5216 UPDATE_COEF(0x56, 0x0006, 0x0006),
5217 UPDATE_COEF(0x66, 0x0008, 0),
5218 UPDATE_COEF(0x67, 0x2000, 0),
5219 {}
5220 };
6b0f95c4 5221 static const struct coef_fw coef0292[] = {
54db6c39
TI
5222 WRITE_COEF(0x6b, 0xd429),
5223 WRITE_COEF(0x76, 0x0008),
5224 WRITE_COEF(0x18, 0x7388),
5225 {}
5226 };
6b0f95c4 5227 static const struct coef_fw coef0293[] = {
54db6c39
TI
5228 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
5229 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5230 {}
5231 };
6b0f95c4 5232 static const struct coef_fw coef0688[] = {
54db6c39
TI
5233 WRITE_COEF(0x11, 0x0001),
5234 WRITE_COEF(0x15, 0x0d60),
5235 WRITE_COEF(0xc3, 0x0000),
5236 {}
5237 };
6b0f95c4 5238 static const struct coef_fw coef0225_1[] = {
4cc9b9d6 5239 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5a36767a
KY
5240 UPDATE_COEF(0x63, 3<<14, 2<<14),
5241 {}
5242 };
6b0f95c4 5243 static const struct coef_fw coef0225_2[] = {
5a36767a
KY
5244 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5245 UPDATE_COEF(0x63, 3<<14, 1<<14),
4cc9b9d6
KY
5246 {}
5247 };
54db6c39 5248
7639a06c 5249 switch (codec->core.vendor_id) {
9a22a8f5 5250 case 0x10ec0255:
54db6c39 5251 alc_process_coef_fw(codec, coef0255);
9a22a8f5 5252 break;
1948fc06 5253 case 0x10ec0230:
736f20a7 5254 case 0x10ec0236:
e69e7e03
KY
5255 case 0x10ec0256:
5256 alc_process_coef_fw(codec, coef0256);
5257 break;
71683c32
KY
5258 case 0x10ec0234:
5259 case 0x10ec0274:
5260 case 0x10ec0294:
5261 alc_write_coef_idx(codec, 0x45, 0xd689);
5262 break;
13fd08a3 5263 case 0x10ec0233:
73bdd597 5264 case 0x10ec0283:
54db6c39 5265 alc_process_coef_fw(codec, coef0233);
73bdd597 5266 break;
1a5bc8d9 5267 case 0x10ec0298:
89542936
KY
5268 val = alc_read_coef_idx(codec, 0x50);
5269 if (val & (1 << 12)) {
5270 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5271 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5272 msleep(300);
5273 } else {
5274 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5275 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5276 msleep(300);
5277 }
5278 break;
f3b70332
KY
5279 case 0x10ec0286:
5280 case 0x10ec0288:
5281 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5282 msleep(300);
5283 alc_process_coef_fw(codec, coef0288);
5284 break;
73bdd597 5285 case 0x10ec0292:
54db6c39 5286 alc_process_coef_fw(codec, coef0292);
73bdd597 5287 break;
a22aa26f 5288 case 0x10ec0293:
54db6c39 5289 alc_process_coef_fw(codec, coef0293);
a22aa26f 5290 break;
73bdd597 5291 case 0x10ec0668:
54db6c39 5292 alc_process_coef_fw(codec, coef0688);
73bdd597 5293 break;
c2b691ee 5294 case 0x10ec0215:
4cc9b9d6 5295 case 0x10ec0225:
c2b691ee 5296 case 0x10ec0285:
7d727869 5297 case 0x10ec0295:
c2b691ee 5298 case 0x10ec0289:
28f1f9b2 5299 case 0x10ec0299:
5a36767a
KY
5300 val = alc_read_coef_idx(codec, 0x45);
5301 if (val & (1 << 9))
5302 alc_process_coef_fw(codec, coef0225_2);
5303 else
5304 alc_process_coef_fw(codec, coef0225_1);
4cc9b9d6 5305 break;
78f4f7c2
KY
5306 case 0x10ec0867:
5307 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5308 break;
73bdd597 5309 }
4e76a883 5310 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
73bdd597
DH
5311}
5312
5313/* Nokia type */
5314static void alc_headset_mode_omtp(struct hda_codec *codec)
5315{
6b0f95c4 5316 static const struct coef_fw coef0255[] = {
54db6c39
TI
5317 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5318 WRITE_COEF(0x1b, 0x0c2b),
5319 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5320 {}
5321 };
6b0f95c4 5322 static const struct coef_fw coef0256[] = {
e69e7e03 5323 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
717f43d8 5324 WRITE_COEF(0x1b, 0x0e6b),
e69e7e03
KY
5325 {}
5326 };
6b0f95c4 5327 static const struct coef_fw coef0233[] = {
54db6c39
TI
5328 WRITE_COEF(0x45, 0xe429),
5329 WRITE_COEF(0x1b, 0x0c2b),
5330 WRITE_COEF(0x32, 0x4ea3),
5331 {}
5332 };
6b0f95c4 5333 static const struct coef_fw coef0288[] = {
f3b70332
KY
5334 UPDATE_COEF(0x50, 0x2000, 0x2000),
5335 UPDATE_COEF(0x56, 0x0006, 0x0006),
5336 UPDATE_COEF(0x66, 0x0008, 0),
5337 UPDATE_COEF(0x67, 0x2000, 0),
5338 {}
5339 };
6b0f95c4 5340 static const struct coef_fw coef0292[] = {
54db6c39
TI
5341 WRITE_COEF(0x6b, 0xe429),
5342 WRITE_COEF(0x76, 0x0008),
5343 WRITE_COEF(0x18, 0x7388),
5344 {}
5345 };
6b0f95c4 5346 static const struct coef_fw coef0293[] = {
54db6c39
TI
5347 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5348 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5349 {}
5350 };
6b0f95c4 5351 static const struct coef_fw coef0688[] = {
54db6c39
TI
5352 WRITE_COEF(0x11, 0x0001),
5353 WRITE_COEF(0x15, 0x0d50),
5354 WRITE_COEF(0xc3, 0x0000),
5355 {}
5356 };
6b0f95c4 5357 static const struct coef_fw coef0225[] = {
4cc9b9d6 5358 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
5a36767a 5359 UPDATE_COEF(0x63, 3<<14, 2<<14),
4cc9b9d6
KY
5360 {}
5361 };
54db6c39 5362
7639a06c 5363 switch (codec->core.vendor_id) {
9a22a8f5 5364 case 0x10ec0255:
54db6c39 5365 alc_process_coef_fw(codec, coef0255);
9a22a8f5 5366 break;
1948fc06 5367 case 0x10ec0230:
736f20a7 5368 case 0x10ec0236:
e69e7e03
KY
5369 case 0x10ec0256:
5370 alc_process_coef_fw(codec, coef0256);
5371 break;
71683c32
KY
5372 case 0x10ec0234:
5373 case 0x10ec0274:
5374 case 0x10ec0294:
5375 alc_write_coef_idx(codec, 0x45, 0xe689);
5376 break;
13fd08a3 5377 case 0x10ec0233:
73bdd597 5378 case 0x10ec0283:
54db6c39 5379 alc_process_coef_fw(codec, coef0233);
73bdd597 5380 break;
1a5bc8d9
KY
5381 case 0x10ec0298:
5382 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
89542936
KY
5383 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5384 msleep(300);
5385 break;
f3b70332
KY
5386 case 0x10ec0286:
5387 case 0x10ec0288:
5388 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5389 msleep(300);
5390 alc_process_coef_fw(codec, coef0288);
5391 break;
73bdd597 5392 case 0x10ec0292:
54db6c39 5393 alc_process_coef_fw(codec, coef0292);
73bdd597 5394 break;
a22aa26f 5395 case 0x10ec0293:
54db6c39 5396 alc_process_coef_fw(codec, coef0293);
a22aa26f 5397 break;
73bdd597 5398 case 0x10ec0668:
54db6c39 5399 alc_process_coef_fw(codec, coef0688);
73bdd597 5400 break;
c2b691ee 5401 case 0x10ec0215:
4cc9b9d6 5402 case 0x10ec0225:
c2b691ee 5403 case 0x10ec0285:
7d727869 5404 case 0x10ec0295:
c2b691ee 5405 case 0x10ec0289:
28f1f9b2 5406 case 0x10ec0299:
4cc9b9d6
KY
5407 alc_process_coef_fw(codec, coef0225);
5408 break;
73bdd597 5409 }
4e76a883 5410 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
73bdd597
DH
5411}
5412
5413static void alc_determine_headset_type(struct hda_codec *codec)
5414{
5415 int val;
5416 bool is_ctia = false;
5417 struct alc_spec *spec = codec->spec;
6b0f95c4 5418 static const struct coef_fw coef0255[] = {
54db6c39
TI
5419 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5420 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5421 conteol) */
5422 {}
5423 };
6b0f95c4 5424 static const struct coef_fw coef0288[] = {
f3b70332
KY
5425 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5426 {}
5427 };
6b0f95c4 5428 static const struct coef_fw coef0298[] = {
89542936
KY
5429 UPDATE_COEF(0x50, 0x2000, 0x2000),
5430 UPDATE_COEF(0x56, 0x0006, 0x0006),
5431 UPDATE_COEF(0x66, 0x0008, 0),
5432 UPDATE_COEF(0x67, 0x2000, 0),
5433 UPDATE_COEF(0x19, 0x1300, 0x1300),
5434 {}
5435 };
6b0f95c4 5436 static const struct coef_fw coef0293[] = {
54db6c39
TI
5437 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5438 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5439 {}
5440 };
6b0f95c4 5441 static const struct coef_fw coef0688[] = {
54db6c39
TI
5442 WRITE_COEF(0x11, 0x0001),
5443 WRITE_COEF(0xb7, 0x802b),
5444 WRITE_COEF(0x15, 0x0d60),
5445 WRITE_COEF(0xc3, 0x0c00),
5446 {}
5447 };
6b0f95c4 5448 static const struct coef_fw coef0274[] = {
71683c32
KY
5449 UPDATE_COEF(0x4a, 0x0010, 0),
5450 UPDATE_COEF(0x4a, 0x8000, 0),
5451 WRITE_COEF(0x45, 0xd289),
5452 UPDATE_COEF(0x49, 0x0300, 0x0300),
5453 {}
5454 };
73bdd597 5455
92666d45
KY
5456 if (spec->no_internal_mic_pin) {
5457 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5458 return;
5459 }
5460
7639a06c 5461 switch (codec->core.vendor_id) {
9a22a8f5 5462 case 0x10ec0255:
717f43d8
KY
5463 alc_process_coef_fw(codec, coef0255);
5464 msleep(300);
5465 val = alc_read_coef_idx(codec, 0x46);
5466 is_ctia = (val & 0x0070) == 0x0070;
5467 break;
1948fc06 5468 case 0x10ec0230:
717f43d8 5469 case 0x10ec0236:
7081adf3 5470 case 0x10ec0256:
717f43d8
KY
5471 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5472 alc_write_coef_idx(codec, 0x06, 0x6104);
5473 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5474
5475 snd_hda_codec_write(codec, 0x21, 0,
5476 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5477 msleep(80);
5478 snd_hda_codec_write(codec, 0x21, 0,
5479 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5480
54db6c39 5481 alc_process_coef_fw(codec, coef0255);
9a22a8f5
KY
5482 msleep(300);
5483 val = alc_read_coef_idx(codec, 0x46);
5484 is_ctia = (val & 0x0070) == 0x0070;
717f43d8
KY
5485
5486 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5487 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5488
5489 snd_hda_codec_write(codec, 0x21, 0,
5490 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5491 msleep(80);
5492 snd_hda_codec_write(codec, 0x21, 0,
5493 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
9a22a8f5 5494 break;
71683c32
KY
5495 case 0x10ec0234:
5496 case 0x10ec0274:
5497 case 0x10ec0294:
5498 alc_process_coef_fw(codec, coef0274);
febf2256 5499 msleep(850);
71683c32
KY
5500 val = alc_read_coef_idx(codec, 0x46);
5501 is_ctia = (val & 0x00f0) == 0x00f0;
5502 break;
13fd08a3 5503 case 0x10ec0233:
73bdd597
DH
5504 case 0x10ec0283:
5505 alc_write_coef_idx(codec, 0x45, 0xd029);
5506 msleep(300);
5507 val = alc_read_coef_idx(codec, 0x46);
5508 is_ctia = (val & 0x0070) == 0x0070;
5509 break;
1a5bc8d9 5510 case 0x10ec0298:
89542936
KY
5511 snd_hda_codec_write(codec, 0x21, 0,
5512 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5513 msleep(100);
5514 snd_hda_codec_write(codec, 0x21, 0,
5515 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5516 msleep(200);
5517
5518 val = alc_read_coef_idx(codec, 0x50);
5519 if (val & (1 << 12)) {
5520 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5521 alc_process_coef_fw(codec, coef0288);
5522 msleep(350);
5523 val = alc_read_coef_idx(codec, 0x50);
5524 is_ctia = (val & 0x0070) == 0x0070;
5525 } else {
5526 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5527 alc_process_coef_fw(codec, coef0288);
5528 msleep(350);
5529 val = alc_read_coef_idx(codec, 0x50);
5530 is_ctia = (val & 0x0070) == 0x0070;
5531 }
5532 alc_process_coef_fw(codec, coef0298);
5533 snd_hda_codec_write(codec, 0x21, 0,
5534 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5535 msleep(75);
5536 snd_hda_codec_write(codec, 0x21, 0,
5537 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5538 break;
f3b70332
KY
5539 case 0x10ec0286:
5540 case 0x10ec0288:
5541 alc_process_coef_fw(codec, coef0288);
5542 msleep(350);
5543 val = alc_read_coef_idx(codec, 0x50);
5544 is_ctia = (val & 0x0070) == 0x0070;
5545 break;
73bdd597
DH
5546 case 0x10ec0292:
5547 alc_write_coef_idx(codec, 0x6b, 0xd429);
5548 msleep(300);
5549 val = alc_read_coef_idx(codec, 0x6c);
5550 is_ctia = (val & 0x001c) == 0x001c;
5551 break;
a22aa26f 5552 case 0x10ec0293:
54db6c39 5553 alc_process_coef_fw(codec, coef0293);
a22aa26f
KY
5554 msleep(300);
5555 val = alc_read_coef_idx(codec, 0x46);
5556 is_ctia = (val & 0x0070) == 0x0070;
5557 break;
73bdd597 5558 case 0x10ec0668:
54db6c39 5559 alc_process_coef_fw(codec, coef0688);
73bdd597
DH
5560 msleep(300);
5561 val = alc_read_coef_idx(codec, 0xbe);
5562 is_ctia = (val & 0x1c02) == 0x1c02;
5563 break;
c2b691ee 5564 case 0x10ec0215:
4cc9b9d6 5565 case 0x10ec0225:
c2b691ee 5566 case 0x10ec0285:
7d727869 5567 case 0x10ec0295:
c2b691ee 5568 case 0x10ec0289:
28f1f9b2 5569 case 0x10ec0299:
da911b1f
KY
5570 snd_hda_codec_write(codec, 0x21, 0,
5571 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5572 msleep(80);
5573 snd_hda_codec_write(codec, 0x21, 0,
5574 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5575
5a36767a
KY
5576 alc_process_coef_fw(codec, alc225_pre_hsmode);
5577 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5578 val = alc_read_coef_idx(codec, 0x45);
5579 if (val & (1 << 9)) {
5580 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5581 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5582 msleep(800);
5583 val = alc_read_coef_idx(codec, 0x46);
5584 is_ctia = (val & 0x00f0) == 0x00f0;
5585 } else {
5586 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5587 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5588 msleep(800);
5589 val = alc_read_coef_idx(codec, 0x46);
5590 is_ctia = (val & 0x00f0) == 0x00f0;
5591 }
5592 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
5593 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
5594 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
da911b1f
KY
5595
5596 snd_hda_codec_write(codec, 0x21, 0,
5597 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5598 msleep(80);
5599 snd_hda_codec_write(codec, 0x21, 0,
5600 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
4cc9b9d6 5601 break;
78f4f7c2
KY
5602 case 0x10ec0867:
5603 is_ctia = true;
5604 break;
73bdd597
DH
5605 }
5606
4e76a883 5607 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
73bdd597
DH
5608 is_ctia ? "yes" : "no");
5609 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
5610}
5611
5612static void alc_update_headset_mode(struct hda_codec *codec)
5613{
5614 struct alc_spec *spec = codec->spec;
5615
5616 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
35a39f98 5617 hda_nid_t hp_pin = alc_get_hp_pin(spec);
73bdd597
DH
5618
5619 int new_headset_mode;
5620
5621 if (!snd_hda_jack_detect(codec, hp_pin))
5622 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
5623 else if (mux_pin == spec->headset_mic_pin)
5624 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
5625 else if (mux_pin == spec->headphone_mic_pin)
5626 new_headset_mode = ALC_HEADSET_MODE_MIC;
5627 else
5628 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
5629
5959a6bc
DH
5630 if (new_headset_mode == spec->current_headset_mode) {
5631 snd_hda_gen_update_outputs(codec);
73bdd597 5632 return;
5959a6bc 5633 }
73bdd597
DH
5634
5635 switch (new_headset_mode) {
5636 case ALC_HEADSET_MODE_UNPLUGGED:
5637 alc_headset_mode_unplugged(codec);
aeac1a0d
KY
5638 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5639 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
73bdd597
DH
5640 spec->gen.hp_jack_present = false;
5641 break;
5642 case ALC_HEADSET_MODE_HEADSET:
5643 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
5644 alc_determine_headset_type(codec);
5645 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
5646 alc_headset_mode_ctia(codec);
5647 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
5648 alc_headset_mode_omtp(codec);
5649 spec->gen.hp_jack_present = true;
5650 break;
5651 case ALC_HEADSET_MODE_MIC:
5652 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
5653 spec->gen.hp_jack_present = false;
5654 break;
5655 case ALC_HEADSET_MODE_HEADPHONE:
5656 alc_headset_mode_default(codec);
5657 spec->gen.hp_jack_present = true;
5658 break;
5659 }
5660 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
5661 snd_hda_set_pin_ctl_cache(codec, hp_pin,
5662 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
1f8b46cd 5663 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
73bdd597
DH
5664 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
5665 PIN_VREFHIZ);
5666 }
5667 spec->current_headset_mode = new_headset_mode;
5668
5669 snd_hda_gen_update_outputs(codec);
5670}
5671
5672static void alc_update_headset_mode_hook(struct hda_codec *codec,
7fe30711
TI
5673 struct snd_kcontrol *kcontrol,
5674 struct snd_ctl_elem_value *ucontrol)
73bdd597
DH
5675{
5676 alc_update_headset_mode(codec);
5677}
5678
1a4f69d5
TI
5679static void alc_update_headset_jack_cb(struct hda_codec *codec,
5680 struct hda_jack_callback *jack)
73bdd597 5681{
73bdd597 5682 snd_hda_gen_hp_automute(codec, jack);
e54f30be 5683 alc_update_headset_mode(codec);
73bdd597
DH
5684}
5685
5686static void alc_probe_headset_mode(struct hda_codec *codec)
5687{
5688 int i;
5689 struct alc_spec *spec = codec->spec;
5690 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5691
5692 /* Find mic pins */
5693 for (i = 0; i < cfg->num_inputs; i++) {
5694 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
5695 spec->headset_mic_pin = cfg->inputs[i].pin;
5696 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
5697 spec->headphone_mic_pin = cfg->inputs[i].pin;
5698 }
5699
0bed2aa3 5700 WARN_ON(spec->gen.cap_sync_hook);
73bdd597
DH
5701 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
5702 spec->gen.automute_hook = alc_update_headset_mode;
5703 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
5704}
5705
5706static void alc_fixup_headset_mode(struct hda_codec *codec,
5707 const struct hda_fixup *fix, int action)
5708{
5709 struct alc_spec *spec = codec->spec;
5710
5711 switch (action) {
5712 case HDA_FIXUP_ACT_PRE_PROBE:
5713 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
5714 break;
5715 case HDA_FIXUP_ACT_PROBE:
5716 alc_probe_headset_mode(codec);
5717 break;
5718 case HDA_FIXUP_ACT_INIT:
aeac1a0d
KY
5719 if (is_s3_resume(codec) || is_s4_resume(codec)) {
5720 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5721 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5722 }
73bdd597
DH
5723 alc_update_headset_mode(codec);
5724 break;
5725 }
5726}
5727
5728static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
5729 const struct hda_fixup *fix, int action)
5730{
5731 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5732 struct alc_spec *spec = codec->spec;
5733 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5734 }
5735 else
5736 alc_fixup_headset_mode(codec, fix, action);
5737}
5738
31278997
KY
5739static void alc255_set_default_jack_type(struct hda_codec *codec)
5740{
5741 /* Set to iphone type */
6b0f95c4 5742 static const struct coef_fw alc255fw[] = {
54db6c39
TI
5743 WRITE_COEF(0x1b, 0x880b),
5744 WRITE_COEF(0x45, 0xd089),
5745 WRITE_COEF(0x1b, 0x080b),
5746 WRITE_COEF(0x46, 0x0004),
5747 WRITE_COEF(0x1b, 0x0c0b),
5748 {}
5749 };
6b0f95c4 5750 static const struct coef_fw alc256fw[] = {
e69e7e03
KY
5751 WRITE_COEF(0x1b, 0x884b),
5752 WRITE_COEF(0x45, 0xd089),
5753 WRITE_COEF(0x1b, 0x084b),
5754 WRITE_COEF(0x46, 0x0004),
5755 WRITE_COEF(0x1b, 0x0c4b),
5756 {}
5757 };
5758 switch (codec->core.vendor_id) {
5759 case 0x10ec0255:
5760 alc_process_coef_fw(codec, alc255fw);
5761 break;
1948fc06 5762 case 0x10ec0230:
736f20a7 5763 case 0x10ec0236:
e69e7e03
KY
5764 case 0x10ec0256:
5765 alc_process_coef_fw(codec, alc256fw);
5766 break;
5767 }
31278997
KY
5768 msleep(30);
5769}
5770
9a22a8f5
KY
5771static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
5772 const struct hda_fixup *fix, int action)
5773{
5774 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
31278997 5775 alc255_set_default_jack_type(codec);
9a22a8f5
KY
5776 }
5777 alc_fixup_headset_mode(codec, fix, action);
5778}
5779
31278997
KY
5780static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
5781 const struct hda_fixup *fix, int action)
5782{
5783 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5784 struct alc_spec *spec = codec->spec;
5785 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5786 alc255_set_default_jack_type(codec);
5787 }
5788 else
5789 alc_fixup_headset_mode(codec, fix, action);
5790}
5791
e1e62b98
KY
5792static void alc288_update_headset_jack_cb(struct hda_codec *codec,
5793 struct hda_jack_callback *jack)
5794{
5795 struct alc_spec *spec = codec->spec;
e1e62b98
KY
5796
5797 alc_update_headset_jack_cb(codec, jack);
5798 /* Headset Mic enable or disable, only for Dell Dino */
d44a6864 5799 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
e1e62b98
KY
5800}
5801
5802static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5803 const struct hda_fixup *fix, int action)
5804{
5805 alc_fixup_headset_mode(codec, fix, action);
5806 if (action == HDA_FIXUP_ACT_PROBE) {
5807 struct alc_spec *spec = codec->spec;
d44a6864
TI
5808 /* toggled via hp_automute_hook */
5809 spec->gpio_mask |= 0x40;
5810 spec->gpio_dir |= 0x40;
e1e62b98
KY
5811 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
5812 }
5813}
5814
493a52a9
HW
5815static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5816 const struct hda_fixup *fix, int action)
5817{
5818 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5819 struct alc_spec *spec = codec->spec;
5820 spec->gen.auto_mute_via_amp = 1;
5821 }
5822}
5823
9b745ab8
TI
5824static void alc_fixup_no_shutup(struct hda_codec *codec,
5825 const struct hda_fixup *fix, int action)
5826{
efe55732 5827 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
9b745ab8 5828 struct alc_spec *spec = codec->spec;
c0ca5ece 5829 spec->no_shutup_pins = 1;
9b745ab8
TI
5830 }
5831}
5832
5e6db669
GM
5833static void alc_fixup_disable_aamix(struct hda_codec *codec,
5834 const struct hda_fixup *fix, int action)
5835{
5836 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5837 struct alc_spec *spec = codec->spec;
5838 /* Disable AA-loopback as it causes white noise */
5839 spec->gen.mixer_nid = 0;
5840 }
5841}
5842
7f57d803
TI
5843/* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
5844static void alc_fixup_tpt440_dock(struct hda_codec *codec,
5845 const struct hda_fixup *fix, int action)
5846{
5847 static const struct hda_pintbl pincfgs[] = {
5848 { 0x16, 0x21211010 }, /* dock headphone */
5849 { 0x19, 0x21a11010 }, /* dock mic */
5850 { }
5851 };
5852 struct alc_spec *spec = codec->spec;
5853
5854 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5855 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5856 codec->power_save_node = 0; /* avoid click noises */
5857 snd_hda_apply_pincfgs(codec, pincfgs);
5858 }
5859}
5860
61fcf8ec
KY
5861static void alc_fixup_tpt470_dock(struct hda_codec *codec,
5862 const struct hda_fixup *fix, int action)
5863{
5864 static const struct hda_pintbl pincfgs[] = {
5865 { 0x17, 0x21211010 }, /* dock headphone */
5866 { 0x19, 0x21a11010 }, /* dock mic */
5867 { }
5868 };
5869 struct alc_spec *spec = codec->spec;
5870
5871 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5872 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
71db96dd
TI
5873 snd_hda_apply_pincfgs(codec, pincfgs);
5874 } else if (action == HDA_FIXUP_ACT_INIT) {
61fcf8ec
KY
5875 /* Enable DOCK device */
5876 snd_hda_codec_write(codec, 0x17, 0,
5877 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5878 /* Enable DOCK device */
5879 snd_hda_codec_write(codec, 0x19, 0,
5880 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
61fcf8ec
KY
5881 }
5882}
5883
399c01aa
TI
5884static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
5885 const struct hda_fixup *fix, int action)
5886{
5887 /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
5888 * the speaker output becomes too low by some reason on Thinkpads with
5889 * ALC298 codec
5890 */
5891 static const hda_nid_t preferred_pairs[] = {
5892 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
5893 0
5894 };
5895 struct alc_spec *spec = codec->spec;
5896
5897 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5898 spec->gen.preferred_dacs = preferred_pairs;
5899}
5900
8eedd3a7
TI
5901static void alc295_fixup_asus_dacs(struct hda_codec *codec,
5902 const struct hda_fixup *fix, int action)
5903{
5904 static const hda_nid_t preferred_pairs[] = {
5905 0x17, 0x02, 0x21, 0x03, 0
5906 };
5907 struct alc_spec *spec = codec->spec;
5908
5909 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5910 spec->gen.preferred_dacs = preferred_pairs;
5911}
5912
9476d369 5913static void alc_shutup_dell_xps13(struct hda_codec *codec)
033b0a7c
GM
5914{
5915 struct alc_spec *spec = codec->spec;
35a39f98 5916 int hp_pin = alc_get_hp_pin(spec);
033b0a7c 5917
9476d369
GM
5918 /* Prevent pop noises when headphones are plugged in */
5919 snd_hda_codec_write(codec, hp_pin, 0,
5920 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5921 msleep(20);
033b0a7c
GM
5922}
5923
5924static void alc_fixup_dell_xps13(struct hda_codec *codec,
5925 const struct hda_fixup *fix, int action)
5926{
3e1b0c4a
TI
5927 struct alc_spec *spec = codec->spec;
5928 struct hda_input_mux *imux = &spec->gen.input_mux;
5929 int i;
f38663ab 5930
3e1b0c4a
TI
5931 switch (action) {
5932 case HDA_FIXUP_ACT_PRE_PROBE:
5933 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
5934 * it causes a click noise at start up
5935 */
5936 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
efe55732 5937 spec->shutup = alc_shutup_dell_xps13;
3e1b0c4a
TI
5938 break;
5939 case HDA_FIXUP_ACT_PROBE:
f38663ab
GM
5940 /* Make the internal mic the default input source. */
5941 for (i = 0; i < imux->num_items; i++) {
5942 if (spec->gen.imux_pins[i] == 0x12) {
5943 spec->gen.cur_mux[0] = i;
5944 break;
5945 }
5946 }
3e1b0c4a 5947 break;
033b0a7c
GM
5948 }
5949}
5950
1f8b46cd
DH
5951static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
5952 const struct hda_fixup *fix, int action)
5953{
5954 struct alc_spec *spec = codec->spec;
5955
5956 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5957 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5958 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
b40eda64
DH
5959
5960 /* Disable boost for mic-in permanently. (This code is only called
5961 from quirks that guarantee that the headphone is at NID 0x1b.) */
5962 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
5963 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
1f8b46cd
DH
5964 } else
5965 alc_fixup_headset_mode(codec, fix, action);
5966}
5967
73bdd597
DH
5968static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
5969 const struct hda_fixup *fix, int action)
5970{
5971 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
73bdd597 5972 alc_write_coef_idx(codec, 0xc4, 0x8000);
98b24883 5973 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
73bdd597
DH
5974 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
5975 }
5976 alc_fixup_headset_mode(codec, fix, action);
5977}
5978
bde7bc60
CCC
5979/* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
5980static int find_ext_mic_pin(struct hda_codec *codec)
5981{
5982 struct alc_spec *spec = codec->spec;
5983 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5984 hda_nid_t nid;
5985 unsigned int defcfg;
5986 int i;
5987
5988 for (i = 0; i < cfg->num_inputs; i++) {
5989 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5990 continue;
5991 nid = cfg->inputs[i].pin;
5992 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5993 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
5994 continue;
5995 return nid;
5996 }
5997
5998 return 0;
5999}
6000
08a978db 6001static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
1727a771 6002 const struct hda_fixup *fix,
08a978db
DR
6003 int action)
6004{
6005 struct alc_spec *spec = codec->spec;
6006
0db75790 6007 if (action == HDA_FIXUP_ACT_PROBE) {
bde7bc60 6008 int mic_pin = find_ext_mic_pin(codec);
35a39f98 6009 int hp_pin = alc_get_hp_pin(spec);
bde7bc60
CCC
6010
6011 if (snd_BUG_ON(!mic_pin || !hp_pin))
0db75790 6012 return;
bde7bc60 6013 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
0db75790 6014 }
08a978db 6015}
693b613d 6016
3e0d611b
DH
6017static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
6018 const struct hda_fixup *fix,
6019 int action)
6020{
6021 struct alc_spec *spec = codec->spec;
6022 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6023 int i;
6024
6025 /* The mic boosts on level 2 and 3 are too noisy
6026 on the internal mic input.
6027 Therefore limit the boost to 0 or 1. */
6028
6029 if (action != HDA_FIXUP_ACT_PROBE)
6030 return;
6031
6032 for (i = 0; i < cfg->num_inputs; i++) {
6033 hda_nid_t nid = cfg->inputs[i].pin;
6034 unsigned int defcfg;
6035 if (cfg->inputs[i].type != AUTO_PIN_MIC)
6036 continue;
6037 defcfg = snd_hda_codec_get_pincfg(codec, nid);
6038 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
6039 continue;
6040
6041 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
6042 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
6043 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
6044 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
6045 (0 << AC_AMPCAP_MUTE_SHIFT));
6046 }
6047}
6048
cd217a63 6049static void alc283_hp_automute_hook(struct hda_codec *codec,
1a4f69d5 6050 struct hda_jack_callback *jack)
cd217a63
KY
6051{
6052 struct alc_spec *spec = codec->spec;
6053 int vref;
6054
6055 msleep(200);
6056 snd_hda_gen_hp_automute(codec, jack);
6057
6058 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
6059
6060 msleep(600);
6061 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6062 vref);
6063}
6064
cd217a63
KY
6065static void alc283_fixup_chromebook(struct hda_codec *codec,
6066 const struct hda_fixup *fix, int action)
6067{
6068 struct alc_spec *spec = codec->spec;
cd217a63
KY
6069
6070 switch (action) {
6071 case HDA_FIXUP_ACT_PRE_PROBE:
0202e99c 6072 snd_hda_override_wcaps(codec, 0x03, 0);
d2e92709
TI
6073 /* Disable AA-loopback as it causes white noise */
6074 spec->gen.mixer_nid = 0;
38070219 6075 break;
0202e99c 6076 case HDA_FIXUP_ACT_INIT:
de9481cb
KY
6077 /* MIC2-VREF control */
6078 /* Set to manual mode */
98b24883 6079 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
0202e99c 6080 /* Enable Line1 input control by verb */
98b24883 6081 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
0202e99c
KY
6082 break;
6083 }
6084}
6085
6086static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
6087 const struct hda_fixup *fix, int action)
6088{
6089 struct alc_spec *spec = codec->spec;
0202e99c
KY
6090
6091 switch (action) {
6092 case HDA_FIXUP_ACT_PRE_PROBE:
cd217a63 6093 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
38070219
KY
6094 break;
6095 case HDA_FIXUP_ACT_INIT:
cd217a63
KY
6096 /* MIC2-VREF control */
6097 /* Set to manual mode */
98b24883 6098 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
cd217a63
KY
6099 break;
6100 }
6101}
6102
7bba2157
TI
6103/* mute tablet speaker pin (0x14) via dock plugging in addition */
6104static void asus_tx300_automute(struct hda_codec *codec)
6105{
6106 struct alc_spec *spec = codec->spec;
6107 snd_hda_gen_update_outputs(codec);
6108 if (snd_hda_jack_detect(codec, 0x1b))
6109 spec->gen.mute_bits |= (1ULL << 0x14);
6110}
6111
6112static void alc282_fixup_asus_tx300(struct hda_codec *codec,
6113 const struct hda_fixup *fix, int action)
6114{
6115 struct alc_spec *spec = codec->spec;
7bba2157
TI
6116 static const struct hda_pintbl dock_pins[] = {
6117 { 0x1b, 0x21114000 }, /* dock speaker pin */
6118 {}
6119 };
7bba2157
TI
6120
6121 switch (action) {
6122 case HDA_FIXUP_ACT_PRE_PROBE:
1c76aa5f 6123 spec->init_amp = ALC_INIT_DEFAULT;
ae065f1c
TI
6124 /* TX300 needs to set up GPIO2 for the speaker amp */
6125 alc_setup_gpio(codec, 0x04);
7bba2157
TI
6126 snd_hda_apply_pincfgs(codec, dock_pins);
6127 spec->gen.auto_mute_via_amp = 1;
6128 spec->gen.automute_hook = asus_tx300_automute;
6129 snd_hda_jack_detect_enable_callback(codec, 0x1b,
7bba2157
TI
6130 snd_hda_gen_hp_automute);
6131 break;
5579cd6f
TI
6132 case HDA_FIXUP_ACT_PROBE:
6133 spec->init_amp = ALC_INIT_DEFAULT;
6134 break;
7bba2157
TI
6135 case HDA_FIXUP_ACT_BUILD:
6136 /* this is a bit tricky; give more sane names for the main
6137 * (tablet) speaker and the dock speaker, respectively
6138 */
56798e6b
TI
6139 rename_ctl(codec, "Speaker Playback Switch",
6140 "Dock Speaker Playback Switch");
6141 rename_ctl(codec, "Bass Speaker Playback Switch",
6142 "Speaker Playback Switch");
7bba2157
TI
6143 break;
6144 }
6145}
6146
338cae56
DH
6147static void alc290_fixup_mono_speakers(struct hda_codec *codec,
6148 const struct hda_fixup *fix, int action)
6149{
0f4881dc
DH
6150 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6151 /* DAC node 0x03 is giving mono output. We therefore want to
6152 make sure 0x14 (front speaker) and 0x15 (headphones) use the
6153 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
caf3c043
MM
6154 static const hda_nid_t conn1[] = { 0x0c };
6155 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
6156 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
0f4881dc 6157 }
338cae56
DH
6158}
6159
dd9aa335
HW
6160static void alc298_fixup_speaker_volume(struct hda_codec *codec,
6161 const struct hda_fixup *fix, int action)
6162{
6163 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6164 /* The speaker is routed to the Node 0x06 by a mistake, as a result
6165 we can't adjust the speaker's volume since this node does not has
6166 Amp-out capability. we change the speaker's route to:
6167 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
6168 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
6169 speaker's volume now. */
6170
caf3c043
MM
6171 static const hda_nid_t conn1[] = { 0x0c };
6172 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
dd9aa335
HW
6173 }
6174}
6175
e312a869
TI
6176/* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
6177static void alc295_fixup_disable_dac3(struct hda_codec *codec,
6178 const struct hda_fixup *fix, int action)
6179{
6180 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
caf3c043
MM
6181 static const hda_nid_t conn[] = { 0x02, 0x03 };
6182 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
e312a869
TI
6183 }
6184}
6185
d2cd795c
JK
6186/* force NID 0x17 (Bass Speaker) to DAC1 to share it with the main speaker */
6187static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
6188 const struct hda_fixup *fix, int action)
6189{
6190 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
caf3c043
MM
6191 static const hda_nid_t conn[] = { 0x02 };
6192 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
d2cd795c
JK
6193 }
6194}
6195
98973f2f
KP
6196/* Hook to update amp GPIO4 for automute */
6197static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
6198 struct hda_jack_callback *jack)
6199{
6200 struct alc_spec *spec = codec->spec;
6201
6202 snd_hda_gen_hp_automute(codec, jack);
6203 /* mute_led_polarity is set to 0, so we pass inverted value here */
dbd13179
KHF
6204 alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
6205 !spec->gen.hp_jack_present);
98973f2f
KP
6206}
6207
6208/* Manage GPIOs for HP EliteBook Folio 9480m.
6209 *
6210 * GPIO4 is the headphone amplifier power control
6211 * GPIO3 is the audio output mute indicator LED
6212 */
6213
6214static void alc280_fixup_hp_9480m(struct hda_codec *codec,
6215 const struct hda_fixup *fix,
6216 int action)
6217{
6218 struct alc_spec *spec = codec->spec;
98973f2f 6219
01e4a275 6220 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
98973f2f 6221 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
01e4a275
TI
6222 /* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
6223 spec->gpio_mask |= 0x10;
6224 spec->gpio_dir |= 0x10;
98973f2f 6225 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
98973f2f
KP
6226 }
6227}
6228
ae065f1c
TI
6229static void alc275_fixup_gpio4_off(struct hda_codec *codec,
6230 const struct hda_fixup *fix,
6231 int action)
6232{
6233 struct alc_spec *spec = codec->spec;
6234
6235 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6236 spec->gpio_mask |= 0x04;
6237 spec->gpio_dir |= 0x04;
6238 /* set data bit low */
6239 }
6240}
6241
6a6660d0
TI
6242/* Quirk for Thinkpad X1 7th and 8th Gen
6243 * The following fixed routing needed
6244 * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
6245 * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
6246 * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
6247 */
6248static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
6249 const struct hda_fixup *fix, int action)
6250{
6251 static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
6252 static const hda_nid_t preferred_pairs[] = {
6253 0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
6254 };
6255 struct alc_spec *spec = codec->spec;
6256
6257 switch (action) {
6258 case HDA_FIXUP_ACT_PRE_PROBE:
6259 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6260 spec->gen.preferred_dacs = preferred_pairs;
6261 break;
6262 case HDA_FIXUP_ACT_BUILD:
6263 /* The generic parser creates somewhat unintuitive volume ctls
6264 * with the fixed routing above, and the shared DAC2 may be
6265 * confusing for PA.
6266 * Rename those to unique names so that PA doesn't touch them
6267 * and use only Master volume.
6268 */
6269 rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
6270 rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
6271 break;
6272 }
6273}
6274
ca169cc2
KY
6275static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
6276 const struct hda_fixup *fix,
6277 int action)
6278{
6279 alc_fixup_dual_codecs(codec, fix, action);
6280 switch (action) {
6281 case HDA_FIXUP_ACT_PRE_PROBE:
6282 /* override card longname to provide a unique UCM profile */
6283 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
6284 break;
6285 case HDA_FIXUP_ACT_BUILD:
6286 /* rename Capture controls depending on the codec */
6287 rename_ctl(codec, "Capture Volume",
6288 codec->addr == 0 ?
6289 "Rear-Panel Capture Volume" :
6290 "Front-Panel Capture Volume");
6291 rename_ctl(codec, "Capture Switch",
6292 codec->addr == 0 ?
6293 "Rear-Panel Capture Switch" :
6294 "Front-Panel Capture Switch");
6295 break;
6296 }
6297}
6298
52e4e368
KHF
6299static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
6300 const struct hda_fixup *fix, int action)
6301{
6302 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6303 return;
6304
6305 codec->power_save_node = 1;
6306}
6307
92266651
KY
6308/* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
6309static void alc274_fixup_bind_dacs(struct hda_codec *codec,
6310 const struct hda_fixup *fix, int action)
6311{
6312 struct alc_spec *spec = codec->spec;
caf3c043 6313 static const hda_nid_t preferred_pairs[] = {
92266651
KY
6314 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
6315 0
6316 };
6317
6318 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6319 return;
6320
6321 spec->gen.preferred_dacs = preferred_pairs;
0700d3d1
KY
6322 spec->gen.auto_mute_via_amp = 1;
6323 codec->power_save_node = 0;
92266651
KY
6324}
6325
c84bfedc
TI
6326/* avoid DAC 0x06 for bass speaker 0x17; it has no volume control */
6327static void alc289_fixup_asus_ga401(struct hda_codec *codec,
6328 const struct hda_fixup *fix, int action)
6329{
6330 static const hda_nid_t preferred_pairs[] = {
6331 0x14, 0x02, 0x17, 0x02, 0x21, 0x03, 0
6332 };
6333 struct alc_spec *spec = codec->spec;
6334
6335 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6336 spec->gen.preferred_dacs = preferred_pairs;
6337 spec->gen.obey_preferred_dacs = 1;
6338 }
6339}
6340
c4cfcf6f
HW
6341/* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */
6342static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6343 const struct hda_fixup *fix, int action)
6344{
6345 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6346 return;
6347
6348 snd_hda_override_wcaps(codec, 0x03, 0);
6349}
6350
8a8de09c
KY
6351static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6352{
6353 switch (codec->core.vendor_id) {
6354 case 0x10ec0274:
6355 case 0x10ec0294:
6356 case 0x10ec0225:
6357 case 0x10ec0295:
6358 case 0x10ec0299:
6359 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6360 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6361 break;
1948fc06 6362 case 0x10ec0230:
8a8de09c
KY
6363 case 0x10ec0235:
6364 case 0x10ec0236:
6365 case 0x10ec0255:
6366 case 0x10ec0256:
6367 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6368 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6369 break;
6370 }
6371}
6372
8983eb60
KY
6373static void alc295_fixup_chromebook(struct hda_codec *codec,
6374 const struct hda_fixup *fix, int action)
6375{
d3ba58bb
KY
6376 struct alc_spec *spec = codec->spec;
6377
8983eb60 6378 switch (action) {
d3ba58bb
KY
6379 case HDA_FIXUP_ACT_PRE_PROBE:
6380 spec->ultra_low_power = true;
6381 break;
8983eb60 6382 case HDA_FIXUP_ACT_INIT:
8a8de09c 6383 alc_combo_jack_hp_jd_restart(codec);
8983eb60
KY
6384 break;
6385 }
6386}
6387
d1dd4211
KY
6388static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6389 const struct hda_fixup *fix, int action)
6390{
6391 if (action == HDA_FIXUP_ACT_PRE_PROBE)
6392 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6393}
6394
c3cdf189
LJ
6395
6396static void alc294_gx502_toggle_output(struct hda_codec *codec,
6397 struct hda_jack_callback *cb)
6398{
6399 /* The Windows driver sets the codec up in a very different way where
6400 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6401 */
6402 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6403 alc_write_coef_idx(codec, 0x10, 0x8a20);
6404 else
6405 alc_write_coef_idx(codec, 0x10, 0x0a20);
6406}
6407
6408static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6409 const struct hda_fixup *fix, int action)
6410{
6411 /* Pin 0x21: headphones/headset mic */
6412 if (!is_jack_detectable(codec, 0x21))
6413 return;
6414
6415 switch (action) {
6416 case HDA_FIXUP_ACT_PRE_PROBE:
6417 snd_hda_jack_detect_enable_callback(codec, 0x21,
6418 alc294_gx502_toggle_output);
6419 break;
6420 case HDA_FIXUP_ACT_INIT:
6421 /* Make sure to start in a correct state, i.e. if
6422 * headphones have been plugged in before powering up the system
6423 */
6424 alc294_gx502_toggle_output(codec, NULL);
6425 break;
6426 }
6427}
6428
c1b55029
DC
6429static void alc294_gu502_toggle_output(struct hda_codec *codec,
6430 struct hda_jack_callback *cb)
6431{
6432 /* Windows sets 0x10 to 0x8420 for Node 0x20 which is
6433 * responsible from changes between speakers and headphones
6434 */
6435 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6436 alc_write_coef_idx(codec, 0x10, 0x8420);
6437 else
6438 alc_write_coef_idx(codec, 0x10, 0x0a20);
6439}
6440
6441static void alc294_fixup_gu502_hp(struct hda_codec *codec,
6442 const struct hda_fixup *fix, int action)
6443{
6444 if (!is_jack_detectable(codec, 0x21))
6445 return;
6446
6447 switch (action) {
6448 case HDA_FIXUP_ACT_PRE_PROBE:
6449 snd_hda_jack_detect_enable_callback(codec, 0x21,
6450 alc294_gu502_toggle_output);
6451 break;
6452 case HDA_FIXUP_ACT_INIT:
6453 alc294_gu502_toggle_output(codec, NULL);
6454 break;
6455 }
6456}
6457
56496253
KY
6458static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6459 const struct hda_fixup *fix, int action)
6460{
6461 if (action != HDA_FIXUP_ACT_INIT)
6462 return;
6463
6464 msleep(100);
6465 alc_write_coef_idx(codec, 0x65, 0x0);
6466}
6467
8a8de09c
KY
6468static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6469 const struct hda_fixup *fix, int action)
6470{
6471 switch (action) {
6472 case HDA_FIXUP_ACT_INIT:
6473 alc_combo_jack_hp_jd_restart(codec);
6474 break;
6475 }
6476}
6477
92666d45
KY
6478static void alc_fixup_no_int_mic(struct hda_codec *codec,
6479 const struct hda_fixup *fix, int action)
6480{
6481 struct alc_spec *spec = codec->spec;
6482
6483 switch (action) {
6484 case HDA_FIXUP_ACT_PRE_PROBE:
6485 /* Mic RING SLEEVE swap for combo jack */
6486 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
6487 spec->no_internal_mic_pin = true;
6488 break;
6489 case HDA_FIXUP_ACT_INIT:
6490 alc_combo_jack_hp_jd_restart(codec);
6491 break;
6492 }
6493}
6494
d94befbb
DB
6495/* GPIO1 = amplifier on/off
6496 * GPIO3 = mic mute LED
6497 */
6498static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec,
6499 const struct hda_fixup *fix, int action)
6500{
6501 static const hda_nid_t conn[] = { 0x02 };
6502
6503 struct alc_spec *spec = codec->spec;
6504 static const struct hda_pintbl pincfgs[] = {
6505 { 0x14, 0x90170110 }, /* front/high speakers */
6506 { 0x17, 0x90170130 }, /* back/bass speakers */
6507 { }
6508 };
6509
6510 //enable micmute led
6511 alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04);
6512
6513 switch (action) {
6514 case HDA_FIXUP_ACT_PRE_PROBE:
6515 spec->micmute_led_polarity = 1;
6516 /* needed for amp of back speakers */
6517 spec->gpio_mask |= 0x01;
6518 spec->gpio_dir |= 0x01;
6519 snd_hda_apply_pincfgs(codec, pincfgs);
6520 /* share DAC to have unified volume control */
6521 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
6522 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6523 break;
6524 case HDA_FIXUP_ACT_INIT:
6525 /* need to toggle GPIO to enable the amp of back speakers */
6526 alc_update_gpio_data(codec, 0x01, true);
6527 msleep(100);
6528 alc_update_gpio_data(codec, 0x01, false);
6529 break;
6530 }
6531}
6532
434591b2
ED
6533static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec,
6534 const struct hda_fixup *fix, int action)
6535{
6536 static const hda_nid_t conn[] = { 0x02 };
6537 static const struct hda_pintbl pincfgs[] = {
6538 { 0x14, 0x90170110 }, /* rear speaker */
6539 { }
6540 };
6541
6542 switch (action) {
6543 case HDA_FIXUP_ACT_PRE_PROBE:
6544 snd_hda_apply_pincfgs(codec, pincfgs);
6545 /* force front speaker to DAC1 */
6546 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6547 break;
6548 }
6549}
6550
b317b032
TI
6551/* for hda_fixup_thinkpad_acpi() */
6552#include "thinkpad_helper.c"
b67ae3f1 6553
d5a6cabf
TI
6554static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
6555 const struct hda_fixup *fix, int action)
6556{
6557 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
6558 hda_fixup_thinkpad_acpi(codec, fix, action);
6559}
6560
ad7cc2d4
CB
6561/* Fixup for Lenovo Legion 15IMHg05 speaker output on headset removal. */
6562static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec,
6563 const struct hda_fixup *fix,
6564 int action)
6565{
6566 struct alc_spec *spec = codec->spec;
6567
6568 switch (action) {
6569 case HDA_FIXUP_ACT_PRE_PROBE:
6570 spec->gen.suppress_auto_mute = 1;
6571 break;
6572 }
6573}
6574
d3dca026
LT
6575static int comp_match_dev_name(struct device *dev, void *data)
6576{
6577 return strcmp(dev_name(dev), data) == 0;
6578}
6579
6580static int find_comp_by_dev_name(struct alc_spec *spec, const char *name)
6581{
6582 int i;
6583
6584 for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6585 if (strcmp(spec->comps[i].name, name) == 0)
6586 return i;
6587 }
6588
6589 return -ENODEV;
6590}
6591
6592static int comp_bind(struct device *dev)
6593{
6594 struct hda_codec *cdc = dev_to_hda_codec(dev);
6595 struct alc_spec *spec = cdc->spec;
6596
6597 return component_bind_all(dev, spec->comps);
6598}
6599
6600static void comp_unbind(struct device *dev)
6601{
6602 struct hda_codec *cdc = dev_to_hda_codec(dev);
6603 struct alc_spec *spec = cdc->spec;
6604
6605 component_unbind_all(dev, spec->comps);
6606}
6607
6608static const struct component_master_ops comp_master_ops = {
6609 .bind = comp_bind,
6610 .unbind = comp_unbind,
6611};
6612
6613static void comp_generic_playback_hook(struct hda_pcm_stream *hinfo, struct hda_codec *cdc,
6614 struct snd_pcm_substream *sub, int action)
6615{
6616 struct alc_spec *spec = cdc->spec;
6617 int i;
6618
6619 for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6620 if (spec->comps[i].dev)
6621 spec->comps[i].playback_hook(spec->comps[i].dev, action);
6622 }
6623}
6624
ae7abe36
SB
6625static void cs35l41_generic_fixup(struct hda_codec *cdc, int action, const char *bus,
6626 const char *hid, int count)
6627{
6628 struct device *dev = hda_codec_dev(cdc);
6629 struct alc_spec *spec = cdc->spec;
6630 char *name;
6631 int ret, i;
6632
6633 switch (action) {
6634 case HDA_FIXUP_ACT_PRE_PROBE:
6635 for (i = 0; i < count; i++) {
6636 name = devm_kasprintf(dev, GFP_KERNEL,
6637 "%s-%s:00-cs35l41-hda.%d", bus, hid, i);
6638 if (!name)
6639 return;
6640 component_match_add(dev, &spec->match, comp_match_dev_name, name);
6641 }
6642 ret = component_master_add_with_match(dev, &comp_master_ops, spec->match);
6643 if (ret)
6644 codec_err(cdc, "Fail to register component aggregator %d\n", ret);
6645 else
6646 spec->gen.pcm_playback_hook = comp_generic_playback_hook;
6647 break;
6648 }
6649}
6650
6651static void cs35l41_fixup_i2c_two(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
6652{
6653 cs35l41_generic_fixup(cdc, action, "i2c", "CSC3551", 2);
6654}
6655
d3dca026
LT
6656static void alc287_legion_16achg6_playback_hook(struct hda_pcm_stream *hinfo, struct hda_codec *cdc,
6657 struct snd_pcm_substream *sub, int action)
6658{
6659 struct alc_spec *spec = cdc->spec;
6660 unsigned int rx_slot;
6661 int i;
6662
6663 switch (action) {
6664 case HDA_GEN_PCM_ACT_PREPARE:
6665 rx_slot = 0;
6666 i = find_comp_by_dev_name(spec, "i2c-CLSA0100:00-cs35l41-hda.0");
6667 if (i >= 0)
6668 spec->comps[i].set_channel_map(spec->comps[i].dev, 0, NULL, 1, &rx_slot);
6669
6670 rx_slot = 1;
6671 i = find_comp_by_dev_name(spec, "i2c-CLSA0100:00-cs35l41-hda.1");
6672 if (i >= 0)
6673 spec->comps[i].set_channel_map(spec->comps[i].dev, 0, NULL, 1, &rx_slot);
6674 break;
6675 }
6676
6677 comp_generic_playback_hook(hinfo, cdc, sub, action);
6678}
6679
6680static void alc287_fixup_legion_16achg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
6681 int action)
6682{
6683 struct device *dev = hda_codec_dev(cdc);
6684 struct alc_spec *spec = cdc->spec;
6685 int ret;
6686
6687 switch (action) {
6688 case HDA_FIXUP_ACT_PRE_PROBE:
6689 component_match_add(dev, &spec->match, comp_match_dev_name,
6690 "i2c-CLSA0100:00-cs35l41-hda.0");
6691 component_match_add(dev, &spec->match, comp_match_dev_name,
6692 "i2c-CLSA0100:00-cs35l41-hda.1");
6693 ret = component_master_add_with_match(dev, &comp_master_ops, spec->match);
6694 if (ret)
6695 codec_err(cdc, "Fail to register component aggregator %d\n", ret);
6696 else
6697 spec->gen.pcm_playback_hook = alc287_legion_16achg6_playback_hook;
6698 break;
6699 }
6700}
6701
bbf8ff6b
TB
6702/* for alc295_fixup_hp_top_speakers */
6703#include "hp_x360_helper.c"
6704
26928ca1
TI
6705/* for alc285_fixup_ideapad_s740_coef() */
6706#include "ideapad_s740_helper.c"
6707
619764cc
WS
6708static const struct coef_fw alc256_fixup_set_coef_defaults_coefs[] = {
6709 WRITE_COEF(0x10, 0x0020), WRITE_COEF(0x24, 0x0000),
6710 WRITE_COEF(0x26, 0x0000), WRITE_COEF(0x29, 0x3000),
6711 WRITE_COEF(0x37, 0xfe05), WRITE_COEF(0x45, 0x5089),
6712 {}
6713};
6714
6715static void alc256_fixup_set_coef_defaults(struct hda_codec *codec,
6716 const struct hda_fixup *fix,
6717 int action)
dd6dd6e3
WS
6718{
6719 /*
619764cc
WS
6720 * A certain other OS sets these coeffs to different values. On at least
6721 * one TongFang barebone these settings might survive even a cold
6722 * reboot. So to restore a clean slate the values are explicitly reset
6723 * to default here. Without this, the external microphone is always in a
6724 * plugged-in state, while the internal microphone is always in an
6725 * unplugged state, breaking the ability to use the internal microphone.
6726 */
6727 alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs);
dd6dd6e3
WS
6728}
6729
174a7fb3
WS
6730static const struct coef_fw alc233_fixup_no_audio_jack_coefs[] = {
6731 WRITE_COEF(0x1a, 0x9003), WRITE_COEF(0x1b, 0x0e2b), WRITE_COEF(0x37, 0xfe06),
6732 WRITE_COEF(0x38, 0x4981), WRITE_COEF(0x45, 0xd489), WRITE_COEF(0x46, 0x0074),
6733 WRITE_COEF(0x49, 0x0149),
6734 {}
6735};
6736
6737static void alc233_fixup_no_audio_jack(struct hda_codec *codec,
6738 const struct hda_fixup *fix,
6739 int action)
6740{
6741 /*
6742 * The audio jack input and output is not detected on the ASRock NUC Box
6743 * 1100 series when cold booting without this fix. Warm rebooting from a
6744 * certain other OS makes the audio functional, as COEF settings are
6745 * preserved in this case. This fix sets these altered COEF values as
6746 * the default.
6747 */
6748 alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs);
6749}
6750
edca7cc4
WS
6751static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec,
6752 const struct hda_fixup *fix,
6753 int action)
6754{
6755 /*
6756 * The Clevo NJ51CU comes either with the ALC293 or the ALC256 codec,
6757 * but uses the 0x8686 subproduct id in both cases. The ALC256 codec
6758 * needs an additional quirk for sound working after suspend and resume.
6759 */
6760 if (codec->core.vendor_id == 0x10ec0256) {
6761 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
6762 snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120);
6763 } else {
6764 snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c);
6765 }
6766}
6767
1d045db9 6768enum {
f73bbf63 6769 ALC269_FIXUP_GPIO2,
1d045db9
TI
6770 ALC269_FIXUP_SONY_VAIO,
6771 ALC275_FIXUP_SONY_VAIO_GPIO2,
6772 ALC269_FIXUP_DELL_M101Z,
6773 ALC269_FIXUP_SKU_IGNORE,
6774 ALC269_FIXUP_ASUS_G73JW,
6775 ALC269_FIXUP_LENOVO_EAPD,
6776 ALC275_FIXUP_SONY_HWEQ,
e9bd7d5c 6777 ALC275_FIXUP_SONY_DISABLE_AAMIX,
1d045db9 6778 ALC271_FIXUP_DMIC,
017f2a10 6779 ALC269_FIXUP_PCM_44K,
adabb3ec 6780 ALC269_FIXUP_STEREO_DMIC,
7c478f03 6781 ALC269_FIXUP_HEADSET_MIC,
24519911
TI
6782 ALC269_FIXUP_QUANTA_MUTE,
6783 ALC269_FIXUP_LIFEBOOK,
2041d564 6784 ALC269_FIXUP_LIFEBOOK_EXTMIC,
cc7016ab 6785 ALC269_FIXUP_LIFEBOOK_HP_PIN,
4df3fd17 6786 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
fdcc968a 6787 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
a4297b5d
TI
6788 ALC269_FIXUP_AMIC,
6789 ALC269_FIXUP_DMIC,
6790 ALC269VB_FIXUP_AMIC,
6791 ALC269VB_FIXUP_DMIC,
08fb0d0e 6792 ALC269_FIXUP_HP_MUTE_LED,
d06ac143 6793 ALC269_FIXUP_HP_MUTE_LED_MIC1,
08fb0d0e 6794 ALC269_FIXUP_HP_MUTE_LED_MIC2,
7f783bd5 6795 ALC269_FIXUP_HP_MUTE_LED_MIC3,
9f5c6faf 6796 ALC269_FIXUP_HP_GPIO_LED,
9c5dc3bf
KY
6797 ALC269_FIXUP_HP_GPIO_MIC1_LED,
6798 ALC269_FIXUP_HP_LINE1_MIC1_LED,
693b613d 6799 ALC269_FIXUP_INV_DMIC,
108cc108 6800 ALC269_FIXUP_LENOVO_DOCK,
b590b38c 6801 ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
9b745ab8 6802 ALC269_FIXUP_NO_SHUTUP,
88cfcf86 6803 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
108cc108 6804 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
73bdd597
DH
6805 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6806 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
338cae56 6807 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
fcc6c877 6808 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
73bdd597
DH
6809 ALC269_FIXUP_HEADSET_MODE,
6810 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
7819717b 6811 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
d240d1dc
DH
6812 ALC269_FIXUP_ASUS_X101_FUNC,
6813 ALC269_FIXUP_ASUS_X101_VERB,
6814 ALC269_FIXUP_ASUS_X101,
08a978db
DR
6815 ALC271_FIXUP_AMIC_MIC2,
6816 ALC271_FIXUP_HP_GATE_MIC_JACK,
b1e8972e 6817 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
42397004 6818 ALC269_FIXUP_ACER_AC700,
3e0d611b 6819 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
2cede303 6820 ALC269VB_FIXUP_ASUS_ZENBOOK,
23870831 6821 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
8e35cd4a 6822 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
02b504d9 6823 ALC269VB_FIXUP_ORDISSIMO_EVE2,
cd217a63 6824 ALC283_FIXUP_CHROME_BOOK,
0202e99c 6825 ALC283_FIXUP_SENSE_COMBO_JACK,
7bba2157 6826 ALC282_FIXUP_ASUS_TX300,
1bb3e062 6827 ALC283_FIXUP_INT_MIC,
338cae56 6828 ALC290_FIXUP_MONO_SPEAKERS,
0f4881dc
DH
6829 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6830 ALC290_FIXUP_SUBWOOFER,
6831 ALC290_FIXUP_SUBWOOFER_HSJACK,
b67ae3f1 6832 ALC269_FIXUP_THINKPAD_ACPI,
56f27013 6833 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
5824ce8d 6834 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
615966ad 6835 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9a22a8f5 6836 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
31278997 6837 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
9a22a8f5 6838 ALC255_FIXUP_HEADSET_MODE,
31278997 6839 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
a22aa26f 6840 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
1c37c223 6841 ALC292_FIXUP_TPT440_DOCK,
9a811230 6842 ALC292_FIXUP_TPT440,
abaa2274 6843 ALC283_FIXUP_HEADSET_MIC,
b3802783 6844 ALC255_FIXUP_MIC_MUTE_LED,
1a22e775 6845 ALC282_FIXUP_ASPIRE_V5_PINS,
c8426b27 6846 ALC269VB_FIXUP_ASPIRE_E1_COEF,
7a5255f1 6847 ALC280_FIXUP_HP_GPIO4,
eaa8e5ef 6848 ALC286_FIXUP_HP_GPIO_LED,
33f4acd3 6849 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
b4b33f9d 6850 ALC280_FIXUP_HP_DOCK_PINS,
04d5466a 6851 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
98973f2f 6852 ALC280_FIXUP_HP_9480M,
c3bb2b52 6853 ALC245_FIXUP_HP_X360_AMP,
d94befbb 6854 ALC285_FIXUP_HP_SPECTRE_X360_EB1,
e1e62b98
KY
6855 ALC288_FIXUP_DELL_HEADSET_MODE,
6856 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
831bfdf9
HW
6857 ALC288_FIXUP_DELL_XPS_13,
6858 ALC288_FIXUP_DISABLE_AAMIX,
5fab5829 6859 ALC292_FIXUP_DELL_E7X_AAMIX,
8b99aba7
TI
6860 ALC292_FIXUP_DELL_E7X,
6861 ALC292_FIXUP_DISABLE_AAMIX,
c04017ea 6862 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
54324221 6863 ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
977e6276 6864 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
2f726aec 6865 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
6ed1131f 6866 ALC275_FIXUP_DELL_XPS,
23adc192 6867 ALC293_FIXUP_LENOVO_SPK_NOISE,
3694cb29 6868 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
3b43b71f 6869 ALC255_FIXUP_DELL_SPK_NOISE,
d1dd4211 6870 ALC225_FIXUP_DISABLE_MIC_VREF,
2ae95577 6871 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
e312a869 6872 ALC295_FIXUP_DISABLE_DAC3,
d2cd795c 6873 ALC285_FIXUP_SPEAKER2_TO_DAC1,
f883982d 6874 ALC280_FIXUP_HP_HEADSET_MIC,
e549d190 6875 ALC221_FIXUP_HP_FRONT_MIC,
c636b95e 6876 ALC292_FIXUP_TPT460,
dd9aa335 6877 ALC298_FIXUP_SPK_VOLUME,
f86de9b1 6878 ALC298_FIXUP_LENOVO_SPK_VOLUME,
fd06c77e 6879 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
823ff161 6880 ALC269_FIXUP_ATIV_BOOK_8,
9eb5d0e6 6881 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
c1732ede
CC
6882 ALC256_FIXUP_ASUS_HEADSET_MODE,
6883 ALC256_FIXUP_ASUS_MIC,
eeed4cd1 6884 ALC256_FIXUP_ASUS_AIO_GPIO2,
216d7aeb
CC
6885 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
6886 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
ca169cc2 6887 ALC233_FIXUP_LENOVO_MULTI_CODECS,
ea5c7eba 6888 ALC233_FIXUP_ACER_HEADSET_MIC,
f33f79f3 6889 ALC294_FIXUP_LENOVO_MIC_LOCATION,
5f364135 6890 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
52e4e368 6891 ALC225_FIXUP_S3_POP_NOISE,
b84e8436 6892 ALC700_FIXUP_INTEL_REFERENCE,
92266651
KY
6893 ALC274_FIXUP_DELL_BIND_DACS,
6894 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
399c01aa 6895 ALC298_FIXUP_TPT470_DOCK_FIX,
61fcf8ec 6896 ALC298_FIXUP_TPT470_DOCK,
ae104a21 6897 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
f0ba9d69 6898 ALC255_FIXUP_DELL_HEADSET_MIC,
0fbf21c3 6899 ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
a2ef03fe 6900 ALC298_FIXUP_HUAWEI_MBX_STEREO,
bbf8ff6b 6901 ALC295_FIXUP_HP_X360,
8a328ac1 6902 ALC221_FIXUP_HP_HEADSET_MIC,
c4cfcf6f 6903 ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
e8ed64b0 6904 ALC295_FIXUP_HP_AUTO_MUTE,
33aaebd4 6905 ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
d8ae458e 6906 ALC294_FIXUP_ASUS_MIC,
4e051106
JHP
6907 ALC294_FIXUP_ASUS_HEADSET_MIC,
6908 ALC294_FIXUP_ASUS_SPK,
89e3a568 6909 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
c8c6ee61 6910 ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
cbc05fd6 6911 ALC255_FIXUP_ACER_HEADSET_MIC,
10f5b1b8 6912 ALC295_FIXUP_CHROME_BOOK,
8983eb60 6913 ALC225_FIXUP_HEADSET_JACK,
136824ef
KY
6914 ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
6915 ALC225_FIXUP_WYSE_AUTO_MUTE,
6916 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
667a8f73 6917 ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
8c8967a7 6918 ALC256_FIXUP_ASUS_HEADSET_MIC,
e1037354 6919 ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
e2a829b3 6920 ALC299_FIXUP_PREDATOR_SPK,
bd9c10bc 6921 ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
e79c2269
KY
6922 ALC289_FIXUP_DELL_SPK2,
6923 ALC289_FIXUP_DUAL_SPK,
48e01504
CC
6924 ALC294_FIXUP_SPK2_TO_DAC1,
6925 ALC294_FIXUP_ASUS_DUAL_SPK,
6a6660d0 6926 ALC285_FIXUP_THINKPAD_X1_GEN7,
76f7dec0 6927 ALC285_FIXUP_THINKPAD_HEADSET_JACK,
8b33a134 6928 ALC294_FIXUP_ASUS_HPE,
1b94e59d 6929 ALC294_FIXUP_ASUS_COEF_1B,
c3cdf189
LJ
6930 ALC294_FIXUP_ASUS_GX502_HP,
6931 ALC294_FIXUP_ASUS_GX502_PINS,
6932 ALC294_FIXUP_ASUS_GX502_VERBS,
c1b55029
DC
6933 ALC294_FIXUP_ASUS_GU502_HP,
6934 ALC294_FIXUP_ASUS_GU502_PINS,
6935 ALC294_FIXUP_ASUS_GU502_VERBS,
f5a88b0a 6936 ALC285_FIXUP_HP_GPIO_LED,
431e76c3 6937 ALC285_FIXUP_HP_MUTE_LED,
e7d66cf7 6938 ALC236_FIXUP_HP_GPIO_LED,
24164f43 6939 ALC236_FIXUP_HP_MUTE_LED,
75b62ab6 6940 ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
14425f1f 6941 ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
9e43342b 6942 ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
8eae7e9b 6943 ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
6e15d126 6944 ALC269VC_FIXUP_ACER_HEADSET_MIC,
781c90c0 6945 ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
293a92c1 6946 ALC289_FIXUP_ASUS_GA401,
4b43d05a 6947 ALC289_FIXUP_ASUS_GA502,
f50a121d 6948 ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
56496253 6949 ALC285_FIXUP_HP_GPIO_AMP_INIT,
f1ec5be1
HC
6950 ALC269_FIXUP_CZC_B20,
6951 ALC269_FIXUP_CZC_TMI,
6952 ALC269_FIXUP_CZC_L101,
6953 ALC269_FIXUP_LEMOTE_A1802,
6954 ALC269_FIXUP_LEMOTE_A190X,
e2d2fded 6955 ALC256_FIXUP_INTEL_NUC8_RUGGED,
d1ee66c5
PC
6956 ALC233_FIXUP_INTEL_NUC8_DMIC,
6957 ALC233_FIXUP_INTEL_NUC8_BOOST,
73e7161e 6958 ALC256_FIXUP_INTEL_NUC10,
fc19d559 6959 ALC255_FIXUP_XIAOMI_HEADSET_MIC,
13468bfa 6960 ALC274_FIXUP_HP_MIC,
8a8de09c 6961 ALC274_FIXUP_HP_HEADSET_MIC,
622464c8 6962 ALC274_FIXUP_HP_ENVY_GPIO,
ef9ce66f 6963 ALC256_FIXUP_ASUS_HPE,
446b8185 6964 ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
a0ccbc53 6965 ALC287_FIXUP_HP_GPIO_LED,
9e885770 6966 ALC256_FIXUP_HP_HEADSET_MIC,
5fc462c3 6967 ALC245_FIXUP_HP_GPIO_LED,
92666d45 6968 ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
34cdf405 6969 ALC282_FIXUP_ACER_DISABLE_LINEOUT,
495dc763 6970 ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST,
d0e18561 6971 ALC256_FIXUP_ACER_HEADSET_MIC,
26928ca1 6972 ALC285_FIXUP_IDEAPAD_S740_COEF,
bd15b155 6973 ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST,
8eedd3a7 6974 ALC295_FIXUP_ASUS_DACS,
5d84b531 6975 ALC295_FIXUP_HP_OMEN,
f2be77fe 6976 ALC285_FIXUP_HP_SPECTRE_X360,
9ebaef05 6977 ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP,
29c8f40b 6978 ALC623_FIXUP_LENOVO_THINKSTATION_P340,
57c9e21a 6979 ALC255_FIXUP_ACER_HEADPHONE_AND_MIC,
8903376d 6980 ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST,
ad7cc2d4
CB
6981 ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS,
6982 ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
6983 ALC287_FIXUP_YOGA7_14ITL_SPEAKERS,
dd6dd6e3 6984 ALC287_FIXUP_13S_GEN2_SPEAKERS,
619764cc 6985 ALC256_FIXUP_SET_COEF_DEFAULTS,
1278cc5a 6986 ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
174a7fb3 6987 ALC233_FIXUP_NO_AUDIO_JACK,
edca7cc4 6988 ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME,
8f4c9042
BF
6989 ALC285_FIXUP_LEGION_Y9000X_SPEAKERS,
6990 ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
d3dca026 6991 ALC287_FIXUP_LEGION_16ACHG6,
ae7abe36 6992 ALC287_FIXUP_CS35L41_I2C_2,
91502a9a 6993 ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED,
f1d4e28b
KY
6994};
6995
1727a771 6996static const struct hda_fixup alc269_fixups[] = {
f73bbf63
KHF
6997 [ALC269_FIXUP_GPIO2] = {
6998 .type = HDA_FIXUP_FUNC,
6999 .v.func = alc_fixup_gpio2,
7000 },
1d045db9 7001 [ALC269_FIXUP_SONY_VAIO] = {
fd108215
TI
7002 .type = HDA_FIXUP_PINCTLS,
7003 .v.pins = (const struct hda_pintbl[]) {
7004 {0x19, PIN_VREFGRD},
1d045db9
TI
7005 {}
7006 }
f1d4e28b 7007 },
1d045db9 7008 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
ae065f1c
TI
7009 .type = HDA_FIXUP_FUNC,
7010 .v.func = alc275_fixup_gpio4_off,
1d045db9
TI
7011 .chained = true,
7012 .chain_id = ALC269_FIXUP_SONY_VAIO
7013 },
7014 [ALC269_FIXUP_DELL_M101Z] = {
1727a771 7015 .type = HDA_FIXUP_VERBS,
1d045db9
TI
7016 .v.verbs = (const struct hda_verb[]) {
7017 /* Enables internal speaker */
7018 {0x20, AC_VERB_SET_COEF_INDEX, 13},
7019 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
7020 {}
7021 }
7022 },
7023 [ALC269_FIXUP_SKU_IGNORE] = {
1727a771 7024 .type = HDA_FIXUP_FUNC,
23d30f28 7025 .v.func = alc_fixup_sku_ignore,
1d045db9
TI
7026 },
7027 [ALC269_FIXUP_ASUS_G73JW] = {
1727a771
TI
7028 .type = HDA_FIXUP_PINS,
7029 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
7030 { 0x17, 0x99130111 }, /* subwoofer */
7031 { }
7032 }
7033 },
7034 [ALC269_FIXUP_LENOVO_EAPD] = {
1727a771 7035 .type = HDA_FIXUP_VERBS,
1d045db9
TI
7036 .v.verbs = (const struct hda_verb[]) {
7037 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
7038 {}
7039 }
7040 },
7041 [ALC275_FIXUP_SONY_HWEQ] = {
1727a771 7042 .type = HDA_FIXUP_FUNC,
1d045db9
TI
7043 .v.func = alc269_fixup_hweq,
7044 .chained = true,
7045 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
7046 },
e9bd7d5c
TI
7047 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
7048 .type = HDA_FIXUP_FUNC,
7049 .v.func = alc_fixup_disable_aamix,
7050 .chained = true,
7051 .chain_id = ALC269_FIXUP_SONY_VAIO
7052 },
1d045db9 7053 [ALC271_FIXUP_DMIC] = {
1727a771 7054 .type = HDA_FIXUP_FUNC,
1d045db9 7055 .v.func = alc271_fixup_dmic,
f1d4e28b 7056 },
017f2a10 7057 [ALC269_FIXUP_PCM_44K] = {
1727a771 7058 .type = HDA_FIXUP_FUNC,
017f2a10 7059 .v.func = alc269_fixup_pcm_44k,
012e7eb1
DH
7060 .chained = true,
7061 .chain_id = ALC269_FIXUP_QUANTA_MUTE
017f2a10 7062 },
adabb3ec 7063 [ALC269_FIXUP_STEREO_DMIC] = {
1727a771 7064 .type = HDA_FIXUP_FUNC,
adabb3ec
TI
7065 .v.func = alc269_fixup_stereo_dmic,
7066 },
7c478f03
DH
7067 [ALC269_FIXUP_HEADSET_MIC] = {
7068 .type = HDA_FIXUP_FUNC,
7069 .v.func = alc269_fixup_headset_mic,
7070 },
24519911 7071 [ALC269_FIXUP_QUANTA_MUTE] = {
1727a771 7072 .type = HDA_FIXUP_FUNC,
24519911
TI
7073 .v.func = alc269_fixup_quanta_mute,
7074 },
7075 [ALC269_FIXUP_LIFEBOOK] = {
1727a771
TI
7076 .type = HDA_FIXUP_PINS,
7077 .v.pins = (const struct hda_pintbl[]) {
24519911
TI
7078 { 0x1a, 0x2101103f }, /* dock line-out */
7079 { 0x1b, 0x23a11040 }, /* dock mic-in */
7080 { }
7081 },
7082 .chained = true,
7083 .chain_id = ALC269_FIXUP_QUANTA_MUTE
7084 },
2041d564
DH
7085 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
7086 .type = HDA_FIXUP_PINS,
7087 .v.pins = (const struct hda_pintbl[]) {
7088 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
7089 { }
7090 },
7091 },
cc7016ab
TI
7092 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
7093 .type = HDA_FIXUP_PINS,
7094 .v.pins = (const struct hda_pintbl[]) {
7095 { 0x21, 0x0221102f }, /* HP out */
7096 { }
7097 },
7098 },
4df3fd17
TI
7099 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
7100 .type = HDA_FIXUP_FUNC,
7101 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
7102 },
fdcc968a
JMG
7103 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
7104 .type = HDA_FIXUP_FUNC,
7105 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
7106 },
a4297b5d 7107 [ALC269_FIXUP_AMIC] = {
1727a771
TI
7108 .type = HDA_FIXUP_PINS,
7109 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
7110 { 0x14, 0x99130110 }, /* speaker */
7111 { 0x15, 0x0121401f }, /* HP out */
7112 { 0x18, 0x01a19c20 }, /* mic */
7113 { 0x19, 0x99a3092f }, /* int-mic */
7114 { }
7115 },
7116 },
7117 [ALC269_FIXUP_DMIC] = {
1727a771
TI
7118 .type = HDA_FIXUP_PINS,
7119 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
7120 { 0x12, 0x99a3092f }, /* int-mic */
7121 { 0x14, 0x99130110 }, /* speaker */
7122 { 0x15, 0x0121401f }, /* HP out */
7123 { 0x18, 0x01a19c20 }, /* mic */
7124 { }
7125 },
7126 },
7127 [ALC269VB_FIXUP_AMIC] = {
1727a771
TI
7128 .type = HDA_FIXUP_PINS,
7129 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
7130 { 0x14, 0x99130110 }, /* speaker */
7131 { 0x18, 0x01a19c20 }, /* mic */
7132 { 0x19, 0x99a3092f }, /* int-mic */
7133 { 0x21, 0x0121401f }, /* HP out */
7134 { }
7135 },
7136 },
2267ea97 7137 [ALC269VB_FIXUP_DMIC] = {
1727a771
TI
7138 .type = HDA_FIXUP_PINS,
7139 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
7140 { 0x12, 0x99a3092f }, /* int-mic */
7141 { 0x14, 0x99130110 }, /* speaker */
7142 { 0x18, 0x01a19c20 }, /* mic */
7143 { 0x21, 0x0121401f }, /* HP out */
7144 { }
7145 },
7146 },
08fb0d0e 7147 [ALC269_FIXUP_HP_MUTE_LED] = {
1727a771 7148 .type = HDA_FIXUP_FUNC,
08fb0d0e 7149 .v.func = alc269_fixup_hp_mute_led,
6d3cd5d4 7150 },
d06ac143
DH
7151 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
7152 .type = HDA_FIXUP_FUNC,
7153 .v.func = alc269_fixup_hp_mute_led_mic1,
7154 },
08fb0d0e 7155 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
1727a771 7156 .type = HDA_FIXUP_FUNC,
08fb0d0e 7157 .v.func = alc269_fixup_hp_mute_led_mic2,
420b0feb 7158 },
7f783bd5
TB
7159 [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
7160 .type = HDA_FIXUP_FUNC,
7161 .v.func = alc269_fixup_hp_mute_led_mic3,
e8ed64b0
GKK
7162 .chained = true,
7163 .chain_id = ALC295_FIXUP_HP_AUTO_MUTE
7f783bd5 7164 },
9f5c6faf
TI
7165 [ALC269_FIXUP_HP_GPIO_LED] = {
7166 .type = HDA_FIXUP_FUNC,
7167 .v.func = alc269_fixup_hp_gpio_led,
7168 },
9c5dc3bf
KY
7169 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
7170 .type = HDA_FIXUP_FUNC,
7171 .v.func = alc269_fixup_hp_gpio_mic1_led,
7172 },
7173 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
7174 .type = HDA_FIXUP_FUNC,
7175 .v.func = alc269_fixup_hp_line1_mic1_led,
7176 },
693b613d 7177 [ALC269_FIXUP_INV_DMIC] = {
1727a771 7178 .type = HDA_FIXUP_FUNC,
9d36a7dc 7179 .v.func = alc_fixup_inv_dmic,
693b613d 7180 },
9b745ab8
TI
7181 [ALC269_FIXUP_NO_SHUTUP] = {
7182 .type = HDA_FIXUP_FUNC,
7183 .v.func = alc_fixup_no_shutup,
7184 },
108cc108 7185 [ALC269_FIXUP_LENOVO_DOCK] = {
1727a771
TI
7186 .type = HDA_FIXUP_PINS,
7187 .v.pins = (const struct hda_pintbl[]) {
108cc108
DH
7188 { 0x19, 0x23a11040 }, /* dock mic */
7189 { 0x1b, 0x2121103f }, /* dock headphone */
7190 { }
7191 },
7192 .chained = true,
7193 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
7194 },
b590b38c
TI
7195 [ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
7196 .type = HDA_FIXUP_FUNC,
7197 .v.func = alc269_fixup_limit_int_mic_boost,
7198 .chained = true,
7199 .chain_id = ALC269_FIXUP_LENOVO_DOCK,
7200 },
108cc108 7201 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
1727a771 7202 .type = HDA_FIXUP_FUNC,
108cc108 7203 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
52129000
DH
7204 .chained = true,
7205 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
108cc108 7206 },
73bdd597
DH
7207 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7208 .type = HDA_FIXUP_PINS,
7209 .v.pins = (const struct hda_pintbl[]) {
7210 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7211 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7212 { }
7213 },
7214 .chained = true,
7215 .chain_id = ALC269_FIXUP_HEADSET_MODE
7216 },
7217 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7218 .type = HDA_FIXUP_PINS,
7219 .v.pins = (const struct hda_pintbl[]) {
7220 { 0x16, 0x21014020 }, /* dock line out */
7221 { 0x19, 0x21a19030 }, /* dock mic */
7222 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7223 { }
7224 },
7225 .chained = true,
7226 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7227 },
338cae56
DH
7228 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
7229 .type = HDA_FIXUP_PINS,
7230 .v.pins = (const struct hda_pintbl[]) {
7231 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7232 { }
7233 },
7234 .chained = true,
7235 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7236 },
fcc6c877
KY
7237 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
7238 .type = HDA_FIXUP_PINS,
7239 .v.pins = (const struct hda_pintbl[]) {
7240 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7241 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7242 { }
7243 },
7244 .chained = true,
7245 .chain_id = ALC269_FIXUP_HEADSET_MODE
7246 },
73bdd597
DH
7247 [ALC269_FIXUP_HEADSET_MODE] = {
7248 .type = HDA_FIXUP_FUNC,
7249 .v.func = alc_fixup_headset_mode,
6676f308 7250 .chained = true,
b3802783 7251 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
73bdd597
DH
7252 },
7253 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7254 .type = HDA_FIXUP_FUNC,
7255 .v.func = alc_fixup_headset_mode_no_hp_mic,
7256 },
7819717b
TI
7257 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
7258 .type = HDA_FIXUP_PINS,
7259 .v.pins = (const struct hda_pintbl[]) {
7260 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
7261 { }
7262 },
7263 .chained = true,
7264 .chain_id = ALC269_FIXUP_HEADSET_MODE,
7265 },
88cfcf86
DH
7266 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
7267 .type = HDA_FIXUP_PINS,
7268 .v.pins = (const struct hda_pintbl[]) {
7269 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7270 { }
7271 },
fbc78ad6
DH
7272 .chained = true,
7273 .chain_id = ALC269_FIXUP_HEADSET_MIC
88cfcf86 7274 },
0fbf21c3 7275 [ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
8ac51bbc
AB
7276 .type = HDA_FIXUP_PINS,
7277 .v.pins = (const struct hda_pintbl[]) {
7278 {0x12, 0x90a60130},
7279 {0x13, 0x40000000},
7280 {0x14, 0x90170110},
7281 {0x18, 0x411111f0},
7282 {0x19, 0x04a11040},
7283 {0x1a, 0x411111f0},
7284 {0x1b, 0x90170112},
7285 {0x1d, 0x40759a05},
7286 {0x1e, 0x411111f0},
7287 {0x21, 0x04211020},
7288 { }
7289 },
e2744fd7
AB
7290 .chained = true,
7291 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
8ac51bbc 7292 },
a2ef03fe
TE
7293 [ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
7294 .type = HDA_FIXUP_FUNC,
7295 .v.func = alc298_fixup_huawei_mbx_stereo,
7296 .chained = true,
7297 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
7298 },
d240d1dc
DH
7299 [ALC269_FIXUP_ASUS_X101_FUNC] = {
7300 .type = HDA_FIXUP_FUNC,
7301 .v.func = alc269_fixup_x101_headset_mic,
7302 },
7303 [ALC269_FIXUP_ASUS_X101_VERB] = {
7304 .type = HDA_FIXUP_VERBS,
7305 .v.verbs = (const struct hda_verb[]) {
7306 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
7307 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
7308 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
7309 { }
7310 },
7311 .chained = true,
7312 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
7313 },
7314 [ALC269_FIXUP_ASUS_X101] = {
7315 .type = HDA_FIXUP_PINS,
7316 .v.pins = (const struct hda_pintbl[]) {
7317 { 0x18, 0x04a1182c }, /* Headset mic */
7318 { }
7319 },
7320 .chained = true,
7321 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
7322 },
08a978db 7323 [ALC271_FIXUP_AMIC_MIC2] = {
1727a771
TI
7324 .type = HDA_FIXUP_PINS,
7325 .v.pins = (const struct hda_pintbl[]) {
08a978db
DR
7326 { 0x14, 0x99130110 }, /* speaker */
7327 { 0x19, 0x01a19c20 }, /* mic */
7328 { 0x1b, 0x99a7012f }, /* int-mic */
7329 { 0x21, 0x0121401f }, /* HP out */
7330 { }
7331 },
7332 },
7333 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
1727a771 7334 .type = HDA_FIXUP_FUNC,
08a978db
DR
7335 .v.func = alc271_hp_gate_mic_jack,
7336 .chained = true,
7337 .chain_id = ALC271_FIXUP_AMIC_MIC2,
7338 },
b1e8972e
OR
7339 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
7340 .type = HDA_FIXUP_FUNC,
7341 .v.func = alc269_fixup_limit_int_mic_boost,
7342 .chained = true,
7343 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
7344 },
42397004
DR
7345 [ALC269_FIXUP_ACER_AC700] = {
7346 .type = HDA_FIXUP_PINS,
7347 .v.pins = (const struct hda_pintbl[]) {
7348 { 0x12, 0x99a3092f }, /* int-mic */
7349 { 0x14, 0x99130110 }, /* speaker */
7350 { 0x18, 0x03a11c20 }, /* mic */
7351 { 0x1e, 0x0346101e }, /* SPDIF1 */
7352 { 0x21, 0x0321101f }, /* HP out */
7353 { }
7354 },
7355 .chained = true,
7356 .chain_id = ALC271_FIXUP_DMIC,
7357 },
3e0d611b
DH
7358 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
7359 .type = HDA_FIXUP_FUNC,
7360 .v.func = alc269_fixup_limit_int_mic_boost,
2793769f
DH
7361 .chained = true,
7362 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
3e0d611b 7363 },
2cede303
OR
7364 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
7365 .type = HDA_FIXUP_FUNC,
7366 .v.func = alc269_fixup_limit_int_mic_boost,
7367 .chained = true,
7368 .chain_id = ALC269VB_FIXUP_DMIC,
7369 },
23870831
TI
7370 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
7371 .type = HDA_FIXUP_VERBS,
7372 .v.verbs = (const struct hda_verb[]) {
7373 /* class-D output amp +5dB */
7374 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
7375 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
7376 {}
7377 },
7378 .chained = true,
7379 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
7380 },
8e35cd4a
DH
7381 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
7382 .type = HDA_FIXUP_FUNC,
7383 .v.func = alc269_fixup_limit_int_mic_boost,
7384 .chained = true,
7385 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
7386 },
02b504d9
AA
7387 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
7388 .type = HDA_FIXUP_PINS,
7389 .v.pins = (const struct hda_pintbl[]) {
7390 { 0x12, 0x99a3092f }, /* int-mic */
7391 { 0x18, 0x03a11d20 }, /* mic */
7392 { 0x19, 0x411111f0 }, /* Unused bogus pin */
7393 { }
7394 },
7395 },
cd217a63
KY
7396 [ALC283_FIXUP_CHROME_BOOK] = {
7397 .type = HDA_FIXUP_FUNC,
7398 .v.func = alc283_fixup_chromebook,
7399 },
0202e99c
KY
7400 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
7401 .type = HDA_FIXUP_FUNC,
7402 .v.func = alc283_fixup_sense_combo_jack,
7403 .chained = true,
7404 .chain_id = ALC283_FIXUP_CHROME_BOOK,
7405 },
7bba2157
TI
7406 [ALC282_FIXUP_ASUS_TX300] = {
7407 .type = HDA_FIXUP_FUNC,
7408 .v.func = alc282_fixup_asus_tx300,
7409 },
1bb3e062
KY
7410 [ALC283_FIXUP_INT_MIC] = {
7411 .type = HDA_FIXUP_VERBS,
7412 .v.verbs = (const struct hda_verb[]) {
7413 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
7414 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
7415 { }
7416 },
7417 .chained = true,
7418 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7419 },
0f4881dc
DH
7420 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
7421 .type = HDA_FIXUP_PINS,
7422 .v.pins = (const struct hda_pintbl[]) {
7423 { 0x17, 0x90170112 }, /* subwoofer */
7424 { }
7425 },
7426 .chained = true,
7427 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7428 },
7429 [ALC290_FIXUP_SUBWOOFER] = {
7430 .type = HDA_FIXUP_PINS,
7431 .v.pins = (const struct hda_pintbl[]) {
7432 { 0x17, 0x90170112 }, /* subwoofer */
7433 { }
7434 },
7435 .chained = true,
7436 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
7437 },
338cae56
DH
7438 [ALC290_FIXUP_MONO_SPEAKERS] = {
7439 .type = HDA_FIXUP_FUNC,
7440 .v.func = alc290_fixup_mono_speakers,
0f4881dc
DH
7441 },
7442 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
7443 .type = HDA_FIXUP_FUNC,
7444 .v.func = alc290_fixup_mono_speakers,
338cae56
DH
7445 .chained = true,
7446 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
7447 },
b67ae3f1
DH
7448 [ALC269_FIXUP_THINKPAD_ACPI] = {
7449 .type = HDA_FIXUP_FUNC,
d5a6cabf 7450 .v.func = alc_fixup_thinkpad_acpi,
09da111a
TI
7451 .chained = true,
7452 .chain_id = ALC269_FIXUP_SKU_IGNORE,
b67ae3f1 7453 },
56f27013
DH
7454 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
7455 .type = HDA_FIXUP_FUNC,
7456 .v.func = alc_fixup_inv_dmic,
7457 .chained = true,
7458 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7459 },
5824ce8d 7460 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
17d30460
HW
7461 .type = HDA_FIXUP_PINS,
7462 .v.pins = (const struct hda_pintbl[]) {
7463 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7464 { }
5824ce8d
CC
7465 },
7466 .chained = true,
17d30460 7467 .chain_id = ALC255_FIXUP_HEADSET_MODE
5824ce8d 7468 },
615966ad
CC
7469 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7470 .type = HDA_FIXUP_PINS,
7471 .v.pins = (const struct hda_pintbl[]) {
7472 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7473 { }
7474 },
7475 .chained = true,
7476 .chain_id = ALC255_FIXUP_HEADSET_MODE
7477 },
9a22a8f5
KY
7478 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7479 .type = HDA_FIXUP_PINS,
7480 .v.pins = (const struct hda_pintbl[]) {
7481 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7482 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7483 { }
7484 },
7485 .chained = true,
7486 .chain_id = ALC255_FIXUP_HEADSET_MODE
7487 },
31278997
KY
7488 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7489 .type = HDA_FIXUP_PINS,
7490 .v.pins = (const struct hda_pintbl[]) {
7491 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7492 { }
7493 },
7494 .chained = true,
7495 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
7496 },
9a22a8f5
KY
7497 [ALC255_FIXUP_HEADSET_MODE] = {
7498 .type = HDA_FIXUP_FUNC,
7499 .v.func = alc_fixup_headset_mode_alc255,
4a83d42a 7500 .chained = true,
b3802783 7501 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
9a22a8f5 7502 },
31278997
KY
7503 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7504 .type = HDA_FIXUP_FUNC,
7505 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
7506 },
a22aa26f
KY
7507 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7508 .type = HDA_FIXUP_PINS,
7509 .v.pins = (const struct hda_pintbl[]) {
7510 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7511 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7512 { }
7513 },
7514 .chained = true,
7515 .chain_id = ALC269_FIXUP_HEADSET_MODE
7516 },
1c37c223 7517 [ALC292_FIXUP_TPT440_DOCK] = {
ec56af67 7518 .type = HDA_FIXUP_FUNC,
7f57d803 7519 .v.func = alc_fixup_tpt440_dock,
1c37c223
TI
7520 .chained = true,
7521 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7522 },
9a811230
TI
7523 [ALC292_FIXUP_TPT440] = {
7524 .type = HDA_FIXUP_FUNC,
157f0b7f 7525 .v.func = alc_fixup_disable_aamix,
9a811230
TI
7526 .chained = true,
7527 .chain_id = ALC292_FIXUP_TPT440_DOCK,
7528 },
abaa2274 7529 [ALC283_FIXUP_HEADSET_MIC] = {
9dc12862
DD
7530 .type = HDA_FIXUP_PINS,
7531 .v.pins = (const struct hda_pintbl[]) {
7532 { 0x19, 0x04a110f0 },
7533 { },
7534 },
7535 },
b3802783 7536 [ALC255_FIXUP_MIC_MUTE_LED] = {
00ef9940 7537 .type = HDA_FIXUP_FUNC,
8a503555 7538 .v.func = alc_fixup_micmute_led,
00ef9940 7539 },
1a22e775
TI
7540 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
7541 .type = HDA_FIXUP_PINS,
7542 .v.pins = (const struct hda_pintbl[]) {
7543 { 0x12, 0x90a60130 },
7544 { 0x14, 0x90170110 },
7545 { 0x17, 0x40000008 },
7546 { 0x18, 0x411111f0 },
0420694d 7547 { 0x19, 0x01a1913c },
1a22e775
TI
7548 { 0x1a, 0x411111f0 },
7549 { 0x1b, 0x411111f0 },
7550 { 0x1d, 0x40f89b2d },
7551 { 0x1e, 0x411111f0 },
7552 { 0x21, 0x0321101f },
7553 { },
7554 },
7555 },
c8426b27
TI
7556 [ALC269VB_FIXUP_ASPIRE_E1_COEF] = {
7557 .type = HDA_FIXUP_FUNC,
7558 .v.func = alc269vb_fixup_aspire_e1_coef,
7559 },
7a5255f1
DH
7560 [ALC280_FIXUP_HP_GPIO4] = {
7561 .type = HDA_FIXUP_FUNC,
7562 .v.func = alc280_fixup_hp_gpio4,
7563 },
eaa8e5ef
KY
7564 [ALC286_FIXUP_HP_GPIO_LED] = {
7565 .type = HDA_FIXUP_FUNC,
7566 .v.func = alc286_fixup_hp_gpio_led,
7567 },
33f4acd3
DH
7568 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
7569 .type = HDA_FIXUP_FUNC,
7570 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
7571 },
b4b33f9d
TC
7572 [ALC280_FIXUP_HP_DOCK_PINS] = {
7573 .type = HDA_FIXUP_PINS,
7574 .v.pins = (const struct hda_pintbl[]) {
7575 { 0x1b, 0x21011020 }, /* line-out */
7576 { 0x1a, 0x01a1903c }, /* headset mic */
7577 { 0x18, 0x2181103f }, /* line-in */
7578 { },
7579 },
7580 .chained = true,
7581 .chain_id = ALC280_FIXUP_HP_GPIO4
7582 },
04d5466a
JK
7583 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
7584 .type = HDA_FIXUP_PINS,
7585 .v.pins = (const struct hda_pintbl[]) {
7586 { 0x1b, 0x21011020 }, /* line-out */
7587 { 0x18, 0x2181103f }, /* line-in */
7588 { },
7589 },
7590 .chained = true,
7591 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
7592 },
98973f2f
KP
7593 [ALC280_FIXUP_HP_9480M] = {
7594 .type = HDA_FIXUP_FUNC,
7595 .v.func = alc280_fixup_hp_9480m,
7596 },
c3bb2b52
TI
7597 [ALC245_FIXUP_HP_X360_AMP] = {
7598 .type = HDA_FIXUP_FUNC,
7599 .v.func = alc245_fixup_hp_x360_amp,
5fc462c3
JC
7600 .chained = true,
7601 .chain_id = ALC245_FIXUP_HP_GPIO_LED
c3bb2b52 7602 },
e1e62b98
KY
7603 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
7604 .type = HDA_FIXUP_FUNC,
7605 .v.func = alc_fixup_headset_mode_dell_alc288,
7606 .chained = true,
b3802783 7607 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
e1e62b98
KY
7608 },
7609 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7610 .type = HDA_FIXUP_PINS,
7611 .v.pins = (const struct hda_pintbl[]) {
7612 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7613 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7614 { }
7615 },
7616 .chained = true,
7617 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
7618 },
831bfdf9
HW
7619 [ALC288_FIXUP_DISABLE_AAMIX] = {
7620 .type = HDA_FIXUP_FUNC,
7621 .v.func = alc_fixup_disable_aamix,
7622 .chained = true,
d44a6864 7623 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
831bfdf9
HW
7624 },
7625 [ALC288_FIXUP_DELL_XPS_13] = {
7626 .type = HDA_FIXUP_FUNC,
7627 .v.func = alc_fixup_dell_xps13,
7628 .chained = true,
7629 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
7630 },
8b99aba7
TI
7631 [ALC292_FIXUP_DISABLE_AAMIX] = {
7632 .type = HDA_FIXUP_FUNC,
7633 .v.func = alc_fixup_disable_aamix,
831bfdf9
HW
7634 .chained = true,
7635 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
8b99aba7 7636 },
c04017ea
DH
7637 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
7638 .type = HDA_FIXUP_FUNC,
7639 .v.func = alc_fixup_disable_aamix,
7640 .chained = true,
7641 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
7642 },
5fab5829 7643 [ALC292_FIXUP_DELL_E7X_AAMIX] = {
8b99aba7
TI
7644 .type = HDA_FIXUP_FUNC,
7645 .v.func = alc_fixup_dell_xps13,
7646 .chained = true,
7647 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
7648 },
5fab5829
TI
7649 [ALC292_FIXUP_DELL_E7X] = {
7650 .type = HDA_FIXUP_FUNC,
8a503555 7651 .v.func = alc_fixup_micmute_led,
5fab5829
TI
7652 /* micmute fixup must be applied at last */
7653 .chained_before = true,
7654 .chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
7655 },
54324221
JM
7656 [ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
7657 .type = HDA_FIXUP_PINS,
7658 .v.pins = (const struct hda_pintbl[]) {
7659 { 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
7660 { }
7661 },
7662 .chained_before = true,
7663 .chain_id = ALC269_FIXUP_HEADSET_MODE,
7664 },
977e6276
KY
7665 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7666 .type = HDA_FIXUP_PINS,
7667 .v.pins = (const struct hda_pintbl[]) {
7668 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7669 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7670 { }
7671 },
7672 .chained = true,
7673 .chain_id = ALC269_FIXUP_HEADSET_MODE
7674 },
2f726aec
HW
7675 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
7676 .type = HDA_FIXUP_PINS,
7677 .v.pins = (const struct hda_pintbl[]) {
7678 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7679 { }
7680 },
7681 .chained = true,
7682 .chain_id = ALC269_FIXUP_HEADSET_MODE
7683 },
6ed1131f
KY
7684 [ALC275_FIXUP_DELL_XPS] = {
7685 .type = HDA_FIXUP_VERBS,
7686 .v.verbs = (const struct hda_verb[]) {
7687 /* Enables internal speaker */
7688 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
7689 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
7690 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
7691 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
7692 {}
7693 }
7694 },
23adc192
HW
7695 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
7696 .type = HDA_FIXUP_FUNC,
7697 .v.func = alc_fixup_disable_aamix,
7698 .chained = true,
7699 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7700 },
3694cb29
K
7701 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
7702 .type = HDA_FIXUP_FUNC,
7703 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
7704 },
d1ee66c5
PC
7705 [ALC233_FIXUP_INTEL_NUC8_DMIC] = {
7706 .type = HDA_FIXUP_FUNC,
7707 .v.func = alc_fixup_inv_dmic,
7708 .chained = true,
7709 .chain_id = ALC233_FIXUP_INTEL_NUC8_BOOST,
7710 },
7711 [ALC233_FIXUP_INTEL_NUC8_BOOST] = {
7712 .type = HDA_FIXUP_FUNC,
7713 .v.func = alc269_fixup_limit_int_mic_boost
7714 },
3b43b71f
KHF
7715 [ALC255_FIXUP_DELL_SPK_NOISE] = {
7716 .type = HDA_FIXUP_FUNC,
7717 .v.func = alc_fixup_disable_aamix,
7718 .chained = true,
7719 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7720 },
d1dd4211
KY
7721 [ALC225_FIXUP_DISABLE_MIC_VREF] = {
7722 .type = HDA_FIXUP_FUNC,
7723 .v.func = alc_fixup_disable_mic_vref,
7724 .chained = true,
7725 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7726 },
2ae95577
DH
7727 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7728 .type = HDA_FIXUP_VERBS,
7729 .v.verbs = (const struct hda_verb[]) {
7730 /* Disable pass-through path for FRONT 14h */
7731 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7732 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7733 {}
7734 },
7735 .chained = true,
d1dd4211 7736 .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
2ae95577 7737 },
f883982d
TI
7738 [ALC280_FIXUP_HP_HEADSET_MIC] = {
7739 .type = HDA_FIXUP_FUNC,
7740 .v.func = alc_fixup_disable_aamix,
7741 .chained = true,
7742 .chain_id = ALC269_FIXUP_HEADSET_MIC,
7743 },
e549d190
HW
7744 [ALC221_FIXUP_HP_FRONT_MIC] = {
7745 .type = HDA_FIXUP_PINS,
7746 .v.pins = (const struct hda_pintbl[]) {
7747 { 0x19, 0x02a19020 }, /* Front Mic */
7748 { }
7749 },
7750 },
c636b95e
SE
7751 [ALC292_FIXUP_TPT460] = {
7752 .type = HDA_FIXUP_FUNC,
7753 .v.func = alc_fixup_tpt440_dock,
7754 .chained = true,
7755 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
7756 },
dd9aa335
HW
7757 [ALC298_FIXUP_SPK_VOLUME] = {
7758 .type = HDA_FIXUP_FUNC,
7759 .v.func = alc298_fixup_speaker_volume,
59ec4b57 7760 .chained = true,
2f726aec 7761 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
dd9aa335 7762 },
f86de9b1
KY
7763 [ALC298_FIXUP_LENOVO_SPK_VOLUME] = {
7764 .type = HDA_FIXUP_FUNC,
7765 .v.func = alc298_fixup_speaker_volume,
7766 },
e312a869
TI
7767 [ALC295_FIXUP_DISABLE_DAC3] = {
7768 .type = HDA_FIXUP_FUNC,
7769 .v.func = alc295_fixup_disable_dac3,
7770 },
d2cd795c
JK
7771 [ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
7772 .type = HDA_FIXUP_FUNC,
7773 .v.func = alc285_fixup_speaker2_to_dac1,
c37c0ab0
HW
7774 .chained = true,
7775 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
d2cd795c 7776 },
fd06c77e
KHF
7777 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
7778 .type = HDA_FIXUP_PINS,
7779 .v.pins = (const struct hda_pintbl[]) {
7780 { 0x1b, 0x90170151 },
7781 { }
7782 },
7783 .chained = true,
7784 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7785 },
823ff161
GM
7786 [ALC269_FIXUP_ATIV_BOOK_8] = {
7787 .type = HDA_FIXUP_FUNC,
7788 .v.func = alc_fixup_auto_mute_via_amp,
7789 .chained = true,
7790 .chain_id = ALC269_FIXUP_NO_SHUTUP
7791 },
9eb5d0e6
KY
7792 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
7793 .type = HDA_FIXUP_PINS,
7794 .v.pins = (const struct hda_pintbl[]) {
7795 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7796 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7797 { }
7798 },
7799 .chained = true,
7800 .chain_id = ALC269_FIXUP_HEADSET_MODE
7801 },
c1732ede
CC
7802 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
7803 .type = HDA_FIXUP_FUNC,
7804 .v.func = alc_fixup_headset_mode,
7805 },
7806 [ALC256_FIXUP_ASUS_MIC] = {
7807 .type = HDA_FIXUP_PINS,
7808 .v.pins = (const struct hda_pintbl[]) {
7809 { 0x13, 0x90a60160 }, /* use as internal mic */
7810 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7811 { }
7812 },
7813 .chained = true,
7814 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7815 },
eeed4cd1 7816 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
ae065f1c
TI
7817 .type = HDA_FIXUP_FUNC,
7818 /* Set up GPIO2 for the speaker amp */
7819 .v.func = alc_fixup_gpio4,
eeed4cd1 7820 },
216d7aeb
CC
7821 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7822 .type = HDA_FIXUP_PINS,
7823 .v.pins = (const struct hda_pintbl[]) {
7824 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7825 { }
7826 },
7827 .chained = true,
7828 .chain_id = ALC269_FIXUP_HEADSET_MIC
7829 },
7830 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
7831 .type = HDA_FIXUP_VERBS,
7832 .v.verbs = (const struct hda_verb[]) {
7833 /* Enables internal speaker */
7834 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
7835 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
7836 {}
7837 },
7838 .chained = true,
7839 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7840 },
ca169cc2
KY
7841 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
7842 .type = HDA_FIXUP_FUNC,
7843 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
f73bbf63
KHF
7844 .chained = true,
7845 .chain_id = ALC269_FIXUP_GPIO2
ca169cc2 7846 },
ea5c7eba
JHP
7847 [ALC233_FIXUP_ACER_HEADSET_MIC] = {
7848 .type = HDA_FIXUP_VERBS,
7849 .v.verbs = (const struct hda_verb[]) {
7850 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
7851 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
7852 { }
7853 },
7854 .chained = true,
7855 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7856 },
f33f79f3
HW
7857 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
7858 .type = HDA_FIXUP_PINS,
7859 .v.pins = (const struct hda_pintbl[]) {
7860 /* Change the mic location from front to right, otherwise there are
7861 two front mics with the same name, pulseaudio can't handle them.
7862 This is just a temporary workaround, after applying this fixup,
7863 there will be one "Front Mic" and one "Mic" in this machine.
7864 */
7865 { 0x1a, 0x04a19040 },
7866 { }
7867 },
7868 },
5f364135
KY
7869 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
7870 .type = HDA_FIXUP_PINS,
7871 .v.pins = (const struct hda_pintbl[]) {
7872 { 0x16, 0x0101102f }, /* Rear Headset HP */
7873 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
7874 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
7875 { 0x1b, 0x02011020 },
7876 { }
7877 },
7878 .chained = true,
52e4e368
KHF
7879 .chain_id = ALC225_FIXUP_S3_POP_NOISE
7880 },
7881 [ALC225_FIXUP_S3_POP_NOISE] = {
7882 .type = HDA_FIXUP_FUNC,
7883 .v.func = alc225_fixup_s3_pop_noise,
7884 .chained = true,
5f364135
KY
7885 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7886 },
b84e8436
PH
7887 [ALC700_FIXUP_INTEL_REFERENCE] = {
7888 .type = HDA_FIXUP_VERBS,
7889 .v.verbs = (const struct hda_verb[]) {
7890 /* Enables internal speaker */
7891 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
7892 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
7893 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
7894 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
7895 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
7896 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
7897 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
7898 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
7899 {}
7900 }
7901 },
92266651
KY
7902 [ALC274_FIXUP_DELL_BIND_DACS] = {
7903 .type = HDA_FIXUP_FUNC,
7904 .v.func = alc274_fixup_bind_dacs,
7905 .chained = true,
7906 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7907 },
7908 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
7909 .type = HDA_FIXUP_PINS,
7910 .v.pins = (const struct hda_pintbl[]) {
7911 { 0x1b, 0x0401102f },
7912 { }
7913 },
7914 .chained = true,
7915 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
7916 },
399c01aa 7917 [ALC298_FIXUP_TPT470_DOCK_FIX] = {
61fcf8ec
KY
7918 .type = HDA_FIXUP_FUNC,
7919 .v.func = alc_fixup_tpt470_dock,
7920 .chained = true,
7921 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
7922 },
399c01aa
TI
7923 [ALC298_FIXUP_TPT470_DOCK] = {
7924 .type = HDA_FIXUP_FUNC,
7925 .v.func = alc_fixup_tpt470_dacs,
7926 .chained = true,
7927 .chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
7928 },
ae104a21
KY
7929 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
7930 .type = HDA_FIXUP_PINS,
7931 .v.pins = (const struct hda_pintbl[]) {
7932 { 0x14, 0x0201101f },
7933 { }
7934 },
7935 .chained = true,
7936 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7937 },
f0ba9d69
KY
7938 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
7939 .type = HDA_FIXUP_PINS,
7940 .v.pins = (const struct hda_pintbl[]) {
7941 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7942 { }
7943 },
3ce0d5aa
HW
7944 .chained = true,
7945 .chain_id = ALC269_FIXUP_HEADSET_MIC
f0ba9d69 7946 },
bbf8ff6b
TB
7947 [ALC295_FIXUP_HP_X360] = {
7948 .type = HDA_FIXUP_FUNC,
7949 .v.func = alc295_fixup_hp_top_speakers,
7950 .chained = true,
7951 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
8a328ac1
KY
7952 },
7953 [ALC221_FIXUP_HP_HEADSET_MIC] = {
7954 .type = HDA_FIXUP_PINS,
7955 .v.pins = (const struct hda_pintbl[]) {
7956 { 0x19, 0x0181313f},
7957 { }
7958 },
7959 .chained = true,
7960 .chain_id = ALC269_FIXUP_HEADSET_MIC
7961 },
c4cfcf6f
HW
7962 [ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
7963 .type = HDA_FIXUP_FUNC,
7964 .v.func = alc285_fixup_invalidate_dacs,
6ba189c5
HW
7965 .chained = true,
7966 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
c4cfcf6f 7967 },
e8ed64b0
GKK
7968 [ALC295_FIXUP_HP_AUTO_MUTE] = {
7969 .type = HDA_FIXUP_FUNC,
7970 .v.func = alc_fixup_auto_mute_via_amp,
7971 },
33aaebd4
CC
7972 [ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
7973 .type = HDA_FIXUP_PINS,
7974 .v.pins = (const struct hda_pintbl[]) {
7975 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7976 { }
7977 },
7978 .chained = true,
7979 .chain_id = ALC269_FIXUP_HEADSET_MIC
7980 },
d8ae458e
CC
7981 [ALC294_FIXUP_ASUS_MIC] = {
7982 .type = HDA_FIXUP_PINS,
7983 .v.pins = (const struct hda_pintbl[]) {
7984 { 0x13, 0x90a60160 }, /* use as internal mic */
7985 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7986 { }
7987 },
7988 .chained = true,
ef9ddb9d 7989 .chain_id = ALC269_FIXUP_HEADSET_MIC
d8ae458e 7990 },
4e051106
JHP
7991 [ALC294_FIXUP_ASUS_HEADSET_MIC] = {
7992 .type = HDA_FIXUP_PINS,
7993 .v.pins = (const struct hda_pintbl[]) {
82b01149 7994 { 0x19, 0x01a1103c }, /* use as headset mic */
4e051106
JHP
7995 { }
7996 },
7997 .chained = true,
ef9ddb9d 7998 .chain_id = ALC269_FIXUP_HEADSET_MIC
4e051106
JHP
7999 },
8000 [ALC294_FIXUP_ASUS_SPK] = {
8001 .type = HDA_FIXUP_VERBS,
8002 .v.verbs = (const struct hda_verb[]) {
8003 /* Set EAPD high */
8004 { 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
8005 { 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
473fbe13
KY
8006 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8007 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
4e051106
JHP
8008 { }
8009 },
8010 .chained = true,
8011 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8012 },
c8a9afa6 8013 [ALC295_FIXUP_CHROME_BOOK] = {
e854747d 8014 .type = HDA_FIXUP_FUNC,
c8a9afa6 8015 .v.func = alc295_fixup_chromebook,
8983eb60
KY
8016 .chained = true,
8017 .chain_id = ALC225_FIXUP_HEADSET_JACK
8018 },
8019 [ALC225_FIXUP_HEADSET_JACK] = {
8020 .type = HDA_FIXUP_FUNC,
8021 .v.func = alc_fixup_headset_jack,
e854747d 8022 },
89e3a568
JS
8023 [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
8024 .type = HDA_FIXUP_PINS,
8025 .v.pins = (const struct hda_pintbl[]) {
8026 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8027 { }
8028 },
8029 .chained = true,
8030 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8031 },
c8c6ee61
HW
8032 [ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
8033 .type = HDA_FIXUP_VERBS,
8034 .v.verbs = (const struct hda_verb[]) {
8035 /* Disable PCBEEP-IN passthrough */
8036 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
8037 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
8038 { }
8039 },
8040 .chained = true,
8041 .chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
8042 },
cbc05fd6
JHP
8043 [ALC255_FIXUP_ACER_HEADSET_MIC] = {
8044 .type = HDA_FIXUP_PINS,
8045 .v.pins = (const struct hda_pintbl[]) {
8046 { 0x19, 0x03a11130 },
8047 { 0x1a, 0x90a60140 }, /* use as internal mic */
8048 { }
8049 },
8050 .chained = true,
8051 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
8052 },
136824ef
KY
8053 [ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
8054 .type = HDA_FIXUP_PINS,
8055 .v.pins = (const struct hda_pintbl[]) {
8056 { 0x16, 0x01011020 }, /* Rear Line out */
8057 { 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
8058 { }
8059 },
8060 .chained = true,
8061 .chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
8062 },
8063 [ALC225_FIXUP_WYSE_AUTO_MUTE] = {
8064 .type = HDA_FIXUP_FUNC,
8065 .v.func = alc_fixup_auto_mute_via_amp,
8066 .chained = true,
8067 .chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
8068 },
8069 [ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
8070 .type = HDA_FIXUP_FUNC,
8071 .v.func = alc_fixup_disable_mic_vref,
8072 .chained = true,
8073 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8074 },
667a8f73
JHP
8075 [ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
8076 .type = HDA_FIXUP_VERBS,
8077 .v.verbs = (const struct hda_verb[]) {
8078 { 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
8079 { 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
8080 { }
8081 },
8082 .chained = true,
8083 .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
8084 },
8c8967a7
DD
8085 [ALC256_FIXUP_ASUS_HEADSET_MIC] = {
8086 .type = HDA_FIXUP_PINS,
8087 .v.pins = (const struct hda_pintbl[]) {
8088 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
8089 { }
8090 },
8091 .chained = true,
8092 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8093 },
e1037354
JHP
8094 [ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8095 .type = HDA_FIXUP_PINS,
8096 .v.pins = (const struct hda_pintbl[]) {
8097 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8098 { }
8099 },
8100 .chained = true,
8101 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8102 },
e2a829b3
BR
8103 [ALC299_FIXUP_PREDATOR_SPK] = {
8104 .type = HDA_FIXUP_PINS,
8105 .v.pins = (const struct hda_pintbl[]) {
8106 { 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
8107 { }
8108 }
8109 },
bd9c10bc 8110 [ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
60083f9e
JHP
8111 .type = HDA_FIXUP_PINS,
8112 .v.pins = (const struct hda_pintbl[]) {
bd9c10bc
JMG
8113 { 0x19, 0x04a11040 },
8114 { 0x21, 0x04211020 },
60083f9e
JHP
8115 { }
8116 },
8117 .chained = true,
bd9c10bc 8118 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
60083f9e 8119 },
e79c2269 8120 [ALC289_FIXUP_DELL_SPK2] = {
bd9c10bc
JMG
8121 .type = HDA_FIXUP_PINS,
8122 .v.pins = (const struct hda_pintbl[]) {
e79c2269 8123 { 0x17, 0x90170130 }, /* bass spk */
bd9c10bc
JMG
8124 { }
8125 },
8126 .chained = true,
e79c2269 8127 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
bd9c10bc 8128 },
e79c2269
KY
8129 [ALC289_FIXUP_DUAL_SPK] = {
8130 .type = HDA_FIXUP_FUNC,
8131 .v.func = alc285_fixup_speaker2_to_dac1,
8132 .chained = true,
8133 .chain_id = ALC289_FIXUP_DELL_SPK2
8134 },
48e01504
CC
8135 [ALC294_FIXUP_SPK2_TO_DAC1] = {
8136 .type = HDA_FIXUP_FUNC,
8137 .v.func = alc285_fixup_speaker2_to_dac1,
8138 .chained = true,
8139 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8140 },
8141 [ALC294_FIXUP_ASUS_DUAL_SPK] = {
436e2550
JHP
8142 .type = HDA_FIXUP_FUNC,
8143 /* The GPIO must be pulled to initialize the AMP */
8144 .v.func = alc_fixup_gpio4,
8145 .chained = true,
48e01504 8146 .chain_id = ALC294_FIXUP_SPK2_TO_DAC1
436e2550 8147 },
6a6660d0
TI
8148 [ALC285_FIXUP_THINKPAD_X1_GEN7] = {
8149 .type = HDA_FIXUP_FUNC,
8150 .v.func = alc285_fixup_thinkpad_x1_gen7,
8151 .chained = true,
8152 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8153 },
76f7dec0
KY
8154 [ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
8155 .type = HDA_FIXUP_FUNC,
8156 .v.func = alc_fixup_headset_jack,
8157 .chained = true,
6a6660d0 8158 .chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
76f7dec0 8159 },
8b33a134
JHP
8160 [ALC294_FIXUP_ASUS_HPE] = {
8161 .type = HDA_FIXUP_VERBS,
8162 .v.verbs = (const struct hda_verb[]) {
8163 /* Set EAPD high */
8164 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8165 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
8166 { }
8167 },
8168 .chained = true,
8169 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8170 },
c3cdf189
LJ
8171 [ALC294_FIXUP_ASUS_GX502_PINS] = {
8172 .type = HDA_FIXUP_PINS,
8173 .v.pins = (const struct hda_pintbl[]) {
8174 { 0x19, 0x03a11050 }, /* front HP mic */
8175 { 0x1a, 0x01a11830 }, /* rear external mic */
8176 { 0x21, 0x03211020 }, /* front HP out */
8177 { }
8178 },
8179 .chained = true,
8180 .chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
8181 },
8182 [ALC294_FIXUP_ASUS_GX502_VERBS] = {
8183 .type = HDA_FIXUP_VERBS,
8184 .v.verbs = (const struct hda_verb[]) {
8185 /* set 0x15 to HP-OUT ctrl */
8186 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8187 /* unmute the 0x15 amp */
8188 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8189 { }
8190 },
8191 .chained = true,
8192 .chain_id = ALC294_FIXUP_ASUS_GX502_HP
8193 },
8194 [ALC294_FIXUP_ASUS_GX502_HP] = {
8195 .type = HDA_FIXUP_FUNC,
8196 .v.func = alc294_fixup_gx502_hp,
8197 },
c1b55029
DC
8198 [ALC294_FIXUP_ASUS_GU502_PINS] = {
8199 .type = HDA_FIXUP_PINS,
8200 .v.pins = (const struct hda_pintbl[]) {
8201 { 0x19, 0x01a11050 }, /* rear HP mic */
8202 { 0x1a, 0x01a11830 }, /* rear external mic */
8203 { 0x21, 0x012110f0 }, /* rear HP out */
8204 { }
8205 },
8206 .chained = true,
8207 .chain_id = ALC294_FIXUP_ASUS_GU502_VERBS
8208 },
8209 [ALC294_FIXUP_ASUS_GU502_VERBS] = {
8210 .type = HDA_FIXUP_VERBS,
8211 .v.verbs = (const struct hda_verb[]) {
8212 /* set 0x15 to HP-OUT ctrl */
8213 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8214 /* unmute the 0x15 amp */
8215 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8216 /* set 0x1b to HP-OUT */
8217 { 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
8218 { }
8219 },
8220 .chained = true,
8221 .chain_id = ALC294_FIXUP_ASUS_GU502_HP
8222 },
8223 [ALC294_FIXUP_ASUS_GU502_HP] = {
8224 .type = HDA_FIXUP_FUNC,
8225 .v.func = alc294_fixup_gu502_hp,
8226 },
1b94e59d
TI
8227 [ALC294_FIXUP_ASUS_COEF_1B] = {
8228 .type = HDA_FIXUP_VERBS,
8229 .v.verbs = (const struct hda_verb[]) {
8230 /* Set bit 10 to correct noisy output after reboot from
8231 * Windows 10 (due to pop noise reduction?)
8232 */
8233 { 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
8234 { 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
8235 { }
8236 },
f8fbcdfb
TI
8237 .chained = true,
8238 .chain_id = ALC289_FIXUP_ASUS_GA401,
1b94e59d 8239 },
f5a88b0a
KHF
8240 [ALC285_FIXUP_HP_GPIO_LED] = {
8241 .type = HDA_FIXUP_FUNC,
8242 .v.func = alc285_fixup_hp_gpio_led,
8243 },
431e76c3
KY
8244 [ALC285_FIXUP_HP_MUTE_LED] = {
8245 .type = HDA_FIXUP_FUNC,
8246 .v.func = alc285_fixup_hp_mute_led,
8247 },
e7d66cf7
JS
8248 [ALC236_FIXUP_HP_GPIO_LED] = {
8249 .type = HDA_FIXUP_FUNC,
8250 .v.func = alc236_fixup_hp_gpio_led,
8251 },
24164f43
KY
8252 [ALC236_FIXUP_HP_MUTE_LED] = {
8253 .type = HDA_FIXUP_FUNC,
8254 .v.func = alc236_fixup_hp_mute_led,
8255 },
75b62ab6
JW
8256 [ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF] = {
8257 .type = HDA_FIXUP_FUNC,
8258 .v.func = alc236_fixup_hp_mute_led_micmute_vref,
8259 },
14425f1f
MP
8260 [ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
8261 .type = HDA_FIXUP_VERBS,
8262 .v.verbs = (const struct hda_verb[]) {
8263 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
8264 { }
8265 },
8266 },
9e43342b
CC
8267 [ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8268 .type = HDA_FIXUP_PINS,
8269 .v.pins = (const struct hda_pintbl[]) {
8270 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8271 { }
8272 },
8273 .chained = true,
8274 .chain_id = ALC269_FIXUP_HEADSET_MODE
8275 },
8eae7e9b
JHP
8276 [ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
8277 .type = HDA_FIXUP_PINS,
8278 .v.pins = (const struct hda_pintbl[]) {
8279 { 0x14, 0x90100120 }, /* use as internal speaker */
8280 { 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
8281 { 0x1a, 0x01011020 }, /* use as line out */
8282 { },
8283 },
8284 .chained = true,
8285 .chain_id = ALC269_FIXUP_HEADSET_MIC
8286 },
6e15d126
JHP
8287 [ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
8288 .type = HDA_FIXUP_PINS,
8289 .v.pins = (const struct hda_pintbl[]) {
8290 { 0x18, 0x02a11030 }, /* use as headset mic */
8291 { }
8292 },
8293 .chained = true,
8294 .chain_id = ALC269_FIXUP_HEADSET_MIC
8295 },
781c90c0
JHP
8296 [ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
8297 .type = HDA_FIXUP_PINS,
8298 .v.pins = (const struct hda_pintbl[]) {
8299 { 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
8300 { }
8301 },
8302 .chained = true,
8303 .chain_id = ALC269_FIXUP_HEADSET_MIC
8304 },
293a92c1 8305 [ALC289_FIXUP_ASUS_GA401] = {
c84bfedc
TI
8306 .type = HDA_FIXUP_FUNC,
8307 .v.func = alc289_fixup_asus_ga401,
8308 .chained = true,
8309 .chain_id = ALC289_FIXUP_ASUS_GA502,
ff53664d 8310 },
4b43d05a
AS
8311 [ALC289_FIXUP_ASUS_GA502] = {
8312 .type = HDA_FIXUP_PINS,
8313 .v.pins = (const struct hda_pintbl[]) {
8314 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
8315 { }
8316 },
8317 },
f50a121d
JHP
8318 [ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
8319 .type = HDA_FIXUP_PINS,
8320 .v.pins = (const struct hda_pintbl[]) {
8321 { 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
8322 { }
8323 },
8324 .chained = true,
8325 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8326 },
56496253
KY
8327 [ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
8328 .type = HDA_FIXUP_FUNC,
8329 .v.func = alc285_fixup_hp_gpio_amp_init,
8330 .chained = true,
8331 .chain_id = ALC285_FIXUP_HP_GPIO_LED
8332 },
f1ec5be1
HC
8333 [ALC269_FIXUP_CZC_B20] = {
8334 .type = HDA_FIXUP_PINS,
8335 .v.pins = (const struct hda_pintbl[]) {
8336 { 0x12, 0x411111f0 },
8337 { 0x14, 0x90170110 }, /* speaker */
8338 { 0x15, 0x032f1020 }, /* HP out */
8339 { 0x17, 0x411111f0 },
8340 { 0x18, 0x03ab1040 }, /* mic */
8341 { 0x19, 0xb7a7013f },
8342 { 0x1a, 0x0181305f },
8343 { 0x1b, 0x411111f0 },
8344 { 0x1d, 0x411111f0 },
8345 { 0x1e, 0x411111f0 },
8346 { }
8347 },
8348 .chain_id = ALC269_FIXUP_DMIC,
8349 },
8350 [ALC269_FIXUP_CZC_TMI] = {
8351 .type = HDA_FIXUP_PINS,
8352 .v.pins = (const struct hda_pintbl[]) {
8353 { 0x12, 0x4000c000 },
8354 { 0x14, 0x90170110 }, /* speaker */
8355 { 0x15, 0x0421401f }, /* HP out */
8356 { 0x17, 0x411111f0 },
8357 { 0x18, 0x04a19020 }, /* mic */
8358 { 0x19, 0x411111f0 },
8359 { 0x1a, 0x411111f0 },
8360 { 0x1b, 0x411111f0 },
8361 { 0x1d, 0x40448505 },
8362 { 0x1e, 0x411111f0 },
8363 { 0x20, 0x8000ffff },
8364 { }
8365 },
8366 .chain_id = ALC269_FIXUP_DMIC,
8367 },
8368 [ALC269_FIXUP_CZC_L101] = {
8369 .type = HDA_FIXUP_PINS,
8370 .v.pins = (const struct hda_pintbl[]) {
8371 { 0x12, 0x40000000 },
8372 { 0x14, 0x01014010 }, /* speaker */
8373 { 0x15, 0x411111f0 }, /* HP out */
8374 { 0x16, 0x411111f0 },
8375 { 0x18, 0x01a19020 }, /* mic */
8376 { 0x19, 0x02a19021 },
8377 { 0x1a, 0x0181302f },
8378 { 0x1b, 0x0221401f },
8379 { 0x1c, 0x411111f0 },
8380 { 0x1d, 0x4044c601 },
8381 { 0x1e, 0x411111f0 },
8382 { }
8383 },
8384 .chain_id = ALC269_FIXUP_DMIC,
8385 },
8386 [ALC269_FIXUP_LEMOTE_A1802] = {
8387 .type = HDA_FIXUP_PINS,
8388 .v.pins = (const struct hda_pintbl[]) {
8389 { 0x12, 0x40000000 },
8390 { 0x14, 0x90170110 }, /* speaker */
8391 { 0x17, 0x411111f0 },
8392 { 0x18, 0x03a19040 }, /* mic1 */
8393 { 0x19, 0x90a70130 }, /* mic2 */
8394 { 0x1a, 0x411111f0 },
8395 { 0x1b, 0x411111f0 },
8396 { 0x1d, 0x40489d2d },
8397 { 0x1e, 0x411111f0 },
8398 { 0x20, 0x0003ffff },
8399 { 0x21, 0x03214020 },
8400 { }
8401 },
8402 .chain_id = ALC269_FIXUP_DMIC,
8403 },
8404 [ALC269_FIXUP_LEMOTE_A190X] = {
8405 .type = HDA_FIXUP_PINS,
8406 .v.pins = (const struct hda_pintbl[]) {
8407 { 0x14, 0x99130110 }, /* speaker */
8408 { 0x15, 0x0121401f }, /* HP out */
8409 { 0x18, 0x01a19c20 }, /* rear mic */
8410 { 0x19, 0x99a3092f }, /* front mic */
8411 { 0x1b, 0x0201401f }, /* front lineout */
8412 { }
8413 },
8414 .chain_id = ALC269_FIXUP_DMIC,
8415 },
e2d2fded
KHF
8416 [ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
8417 .type = HDA_FIXUP_PINS,
8418 .v.pins = (const struct hda_pintbl[]) {
8419 { 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8420 { }
8421 },
8422 .chained = true,
8423 .chain_id = ALC269_FIXUP_HEADSET_MODE
8424 },
73e7161e
WS
8425 [ALC256_FIXUP_INTEL_NUC10] = {
8426 .type = HDA_FIXUP_PINS,
8427 .v.pins = (const struct hda_pintbl[]) {
8428 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8429 { }
8430 },
8431 .chained = true,
8432 .chain_id = ALC269_FIXUP_HEADSET_MODE
8433 },
fc19d559
HW
8434 [ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
8435 .type = HDA_FIXUP_VERBS,
8436 .v.verbs = (const struct hda_verb[]) {
8437 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8438 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8439 { }
8440 },
8441 .chained = true,
c84bfedc 8442 .chain_id = ALC289_FIXUP_ASUS_GA502
fc19d559 8443 },
13468bfa
HW
8444 [ALC274_FIXUP_HP_MIC] = {
8445 .type = HDA_FIXUP_VERBS,
8446 .v.verbs = (const struct hda_verb[]) {
8447 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8448 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8449 { }
8450 },
8451 },
8a8de09c
KY
8452 [ALC274_FIXUP_HP_HEADSET_MIC] = {
8453 .type = HDA_FIXUP_FUNC,
8454 .v.func = alc274_fixup_hp_headset_mic,
8455 .chained = true,
8456 .chain_id = ALC274_FIXUP_HP_MIC
8457 },
622464c8
TI
8458 [ALC274_FIXUP_HP_ENVY_GPIO] = {
8459 .type = HDA_FIXUP_FUNC,
8460 .v.func = alc274_fixup_hp_envy_gpio,
8461 },
ef9ce66f
KY
8462 [ALC256_FIXUP_ASUS_HPE] = {
8463 .type = HDA_FIXUP_VERBS,
8464 .v.verbs = (const struct hda_verb[]) {
8465 /* Set EAPD high */
8466 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8467 { 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
8468 { }
8469 },
8470 .chained = true,
8471 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8472 },
446b8185
KY
8473 [ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
8474 .type = HDA_FIXUP_FUNC,
8475 .v.func = alc_fixup_headset_jack,
8476 .chained = true,
8477 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8478 },
a0ccbc53
KY
8479 [ALC287_FIXUP_HP_GPIO_LED] = {
8480 .type = HDA_FIXUP_FUNC,
8481 .v.func = alc287_fixup_hp_gpio_led,
8482 },
9e885770
KY
8483 [ALC256_FIXUP_HP_HEADSET_MIC] = {
8484 .type = HDA_FIXUP_FUNC,
8485 .v.func = alc274_fixup_hp_headset_mic,
8486 },
92666d45
KY
8487 [ALC236_FIXUP_DELL_AIO_HEADSET_MIC] = {
8488 .type = HDA_FIXUP_FUNC,
8489 .v.func = alc_fixup_no_int_mic,
8490 .chained = true,
8491 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8492 },
34cdf405
CC
8493 [ALC282_FIXUP_ACER_DISABLE_LINEOUT] = {
8494 .type = HDA_FIXUP_PINS,
8495 .v.pins = (const struct hda_pintbl[]) {
8496 { 0x1b, 0x411111f0 },
8497 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8498 { },
8499 },
8500 .chained = true,
8501 .chain_id = ALC269_FIXUP_HEADSET_MODE
8502 },
495dc763
CC
8503 [ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST] = {
8504 .type = HDA_FIXUP_FUNC,
8505 .v.func = alc269_fixup_limit_int_mic_boost,
8506 .chained = true,
8507 .chain_id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
8508 },
d0e18561
CC
8509 [ALC256_FIXUP_ACER_HEADSET_MIC] = {
8510 .type = HDA_FIXUP_PINS,
8511 .v.pins = (const struct hda_pintbl[]) {
8512 { 0x19, 0x02a1113c }, /* use as headset mic, without its own jack detect */
8513 { 0x1a, 0x90a1092f }, /* use as internal mic */
8514 { }
8515 },
8516 .chained = true,
8517 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8518 },
26928ca1
TI
8519 [ALC285_FIXUP_IDEAPAD_S740_COEF] = {
8520 .type = HDA_FIXUP_FUNC,
8521 .v.func = alc285_fixup_ideapad_s740_coef,
8522 .chained = true,
8523 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8524 },
bd15b155
KHF
8525 [ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
8526 .type = HDA_FIXUP_FUNC,
8527 .v.func = alc269_fixup_limit_int_mic_boost,
8528 .chained = true,
8529 .chain_id = ALC285_FIXUP_HP_MUTE_LED,
8530 },
8eedd3a7
TI
8531 [ALC295_FIXUP_ASUS_DACS] = {
8532 .type = HDA_FIXUP_FUNC,
8533 .v.func = alc295_fixup_asus_dacs,
8534 },
5d84b531
TI
8535 [ALC295_FIXUP_HP_OMEN] = {
8536 .type = HDA_FIXUP_PINS,
8537 .v.pins = (const struct hda_pintbl[]) {
8538 { 0x12, 0xb7a60130 },
8539 { 0x13, 0x40000000 },
8540 { 0x14, 0x411111f0 },
8541 { 0x16, 0x411111f0 },
8542 { 0x17, 0x90170110 },
8543 { 0x18, 0x411111f0 },
8544 { 0x19, 0x02a11030 },
8545 { 0x1a, 0x411111f0 },
8546 { 0x1b, 0x04a19030 },
8547 { 0x1d, 0x40600001 },
8548 { 0x1e, 0x411111f0 },
8549 { 0x21, 0x03211020 },
8550 {}
8551 },
8552 .chained = true,
8553 .chain_id = ALC269_FIXUP_HP_LINE1_MIC1_LED,
8554 },
f2be77fe 8555 [ALC285_FIXUP_HP_SPECTRE_X360] = {
434591b2
ED
8556 .type = HDA_FIXUP_FUNC,
8557 .v.func = alc285_fixup_hp_spectre_x360,
f2be77fe 8558 },
d94befbb
DB
8559 [ALC285_FIXUP_HP_SPECTRE_X360_EB1] = {
8560 .type = HDA_FIXUP_FUNC,
8561 .v.func = alc285_fixup_hp_spectre_x360_eb1
8562 },
9ebaef05
HW
8563 [ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = {
8564 .type = HDA_FIXUP_FUNC,
8565 .v.func = alc285_fixup_ideapad_s740_coef,
8566 .chained = true,
8567 .chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
8568 },
29c8f40b
PU
8569 [ALC623_FIXUP_LENOVO_THINKSTATION_P340] = {
8570 .type = HDA_FIXUP_FUNC,
8571 .v.func = alc_fixup_no_shutup,
8572 .chained = true,
8573 .chain_id = ALC283_FIXUP_HEADSET_MIC,
8574 },
57c9e21a
HW
8575 [ALC255_FIXUP_ACER_HEADPHONE_AND_MIC] = {
8576 .type = HDA_FIXUP_PINS,
8577 .v.pins = (const struct hda_pintbl[]) {
8578 { 0x21, 0x03211030 }, /* Change the Headphone location to Left */
8579 { }
8580 },
8581 .chained = true,
8582 .chain_id = ALC255_FIXUP_XIAOMI_HEADSET_MIC
8583 },
8903376d
KHF
8584 [ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
8585 .type = HDA_FIXUP_FUNC,
8586 .v.func = alc269_fixup_limit_int_mic_boost,
8587 .chained = true,
8588 .chain_id = ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
8589 },
8f4c9042
BF
8590 [ALC285_FIXUP_LEGION_Y9000X_SPEAKERS] = {
8591 .type = HDA_FIXUP_FUNC,
8592 .v.func = alc285_fixup_ideapad_s740_coef,
8593 .chained = true,
8594 .chain_id = ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
8595 },
8596 [ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE] = {
8597 .type = HDA_FIXUP_FUNC,
8598 .v.func = alc287_fixup_legion_15imhg05_speakers,
8599 .chained = true,
8600 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8601 },
ad7cc2d4
CB
8602 [ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS] = {
8603 .type = HDA_FIXUP_VERBS,
8604 //.v.verbs = legion_15imhg05_coefs,
8605 .v.verbs = (const struct hda_verb[]) {
8606 // set left speaker Legion 7i.
8607 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8608 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
8609
8610 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8611 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8612 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8613 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
8614 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8615
8616 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8617 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8618 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8619 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8620 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8621
8622 // set right speaker Legion 7i.
8623 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8624 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
8625
8626 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8627 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8628 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8629 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
8630 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8631
8632 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8633 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8634 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8635 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8636 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8637 {}
8638 },
8639 .chained = true,
8640 .chain_id = ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
8641 },
8642 [ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE] = {
8643 .type = HDA_FIXUP_FUNC,
8644 .v.func = alc287_fixup_legion_15imhg05_speakers,
8645 .chained = true,
8646 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8647 },
8648 [ALC287_FIXUP_YOGA7_14ITL_SPEAKERS] = {
8649 .type = HDA_FIXUP_VERBS,
8650 .v.verbs = (const struct hda_verb[]) {
8651 // set left speaker Yoga 7i.
8652 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8653 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
8654
8655 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8656 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8657 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8658 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
8659 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8660
8661 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8662 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8663 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8664 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8665 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8666
8667 // set right speaker Yoga 7i.
8668 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8669 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
8670
8671 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8672 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8673 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8674 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
8675 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8676
8677 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8678 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8679 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8680 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8681 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8682 {}
8683 },
8684 .chained = true,
8685 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8686 },
8687 [ALC287_FIXUP_13S_GEN2_SPEAKERS] = {
8688 .type = HDA_FIXUP_VERBS,
8689 .v.verbs = (const struct hda_verb[]) {
8690 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8691 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
023a062f 8692 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
ad7cc2d4
CB
8693 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8694 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8695 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8696 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8697 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8698 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
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 },
619764cc 8709 [ALC256_FIXUP_SET_COEF_DEFAULTS] = {
dd6dd6e3 8710 .type = HDA_FIXUP_FUNC,
619764cc 8711 .v.func = alc256_fixup_set_coef_defaults,
dd6dd6e3 8712 },
5fc462c3
JC
8713 [ALC245_FIXUP_HP_GPIO_LED] = {
8714 .type = HDA_FIXUP_FUNC,
8715 .v.func = alc245_fixup_hp_gpio_led,
8716 },
1278cc5a
JS
8717 [ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
8718 .type = HDA_FIXUP_PINS,
8719 .v.pins = (const struct hda_pintbl[]) {
8720 { 0x19, 0x03a11120 }, /* use as headset mic, without its own jack detect */
8721 { }
8722 },
8723 .chained = true,
8724 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
8725 },
174a7fb3
WS
8726 [ALC233_FIXUP_NO_AUDIO_JACK] = {
8727 .type = HDA_FIXUP_FUNC,
8728 .v.func = alc233_fixup_no_audio_jack,
8729 },
edca7cc4
WS
8730 [ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME] = {
8731 .type = HDA_FIXUP_FUNC,
8732 .v.func = alc256_fixup_mic_no_presence_and_resume,
8733 .chained = true,
8734 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8735 },
d3dca026
LT
8736 [ALC287_FIXUP_LEGION_16ACHG6] = {
8737 .type = HDA_FIXUP_FUNC,
8738 .v.func = alc287_fixup_legion_16achg6_speakers,
8739 },
ae7abe36
SB
8740 [ALC287_FIXUP_CS35L41_I2C_2] = {
8741 .type = HDA_FIXUP_FUNC,
8742 .v.func = cs35l41_fixup_i2c_two,
8743 },
91502a9a
AS
8744 [ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED] = {
8745 .type = HDA_FIXUP_VERBS,
8746 .v.verbs = (const struct hda_verb[]) {
8747 { 0x20, AC_VERB_SET_COEF_INDEX, 0x19 },
8748 { 0x20, AC_VERB_SET_PROC_COEF, 0x8e11 },
8749 { }
8750 },
8751 .chained = true,
8752 .chain_id = ALC285_FIXUP_HP_MUTE_LED,
8753 },
f1d4e28b
KY
8754};
8755
1d045db9 8756static const struct snd_pci_quirk alc269_fixup_tbl[] = {
a6b92b66 8757 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
693b613d
DH
8758 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
8759 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
aaedfb47 8760 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
7819717b 8761 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
aaedfb47
DH
8762 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
8763 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
02322ac9 8764 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
b1e8972e 8765 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
1a22e775 8766 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
433f894e 8767 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
c8426b27 8768 SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF),
13be30f1 8769 SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK),
705b65f1 8770 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
6e15d126 8771 SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
b9c2fa52 8772 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
495dc763 8773 SND_PCI_QUIRK(0x1025, 0x1094, "Acer Aspire E5-575T", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
c7531e31
CC
8774 SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
8775 SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
13be30f1
CC
8776 SND_PCI_QUIRK(0x1025, 0x1166, "Acer Veriton N4640G", ALC269_FIXUP_LIFEBOOK),
8777 SND_PCI_QUIRK(0x1025, 0x1167, "Acer Veriton N6640G", ALC269_FIXUP_LIFEBOOK),
e2a829b3 8778 SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
8eae7e9b 8779 SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
781c90c0 8780 SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
d0e18561 8781 SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
667a8f73
JHP
8782 SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8783 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8784 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
d0e18561 8785 SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
35171fbf 8786 SND_PCI_QUIRK(0x1025, 0x1300, "Acer SWIFT SF314-56", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
2733cceb 8787 SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
ea5c7eba 8788 SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
cbc05fd6 8789 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
2a5bb694 8790 SND_PCI_QUIRK(0x1025, 0x141f, "Acer Spin SP513-54N", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
0d4867a1 8791 SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
f50a121d 8792 SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
57c9e21a 8793 SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC),
aaedfb47 8794 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
6ed1131f 8795 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
86f799b8 8796 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
cf52103a 8797 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
8b99aba7
TI
8798 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
8799 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
0f4881dc 8800 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
73bdd597
DH
8801 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
8802 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
8803 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
0f4881dc
DH
8804 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
8805 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
98070576 8806 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
4275554d 8807 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
0f4881dc 8808 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
a22aa26f
KY
8809 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8810 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
831bfdf9 8811 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
afecb146 8812 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
3a05d12f 8813 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
8b72415d 8814 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
b734304f
KY
8815 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8816 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
c04017ea
DH
8817 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8818 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8819 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8820 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8821 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
fd06c77e 8822 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
3b43b71f 8823 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
c0ca5ece 8824 SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
709ae62e 8825 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
dd9aa335 8826 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
493de342 8827 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
aa143ad3 8828 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
5f364135 8829 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
40e2c4e5
KY
8830 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
8831 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
f0ba9d69
KY
8832 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
8833 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
ae104a21 8834 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
136824ef 8835 SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
da484d00 8836 SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
c2a7c55a 8837 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
e79c2269 8838 SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
aa143ad3 8839 SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
78def224
KY
8840 SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
8841 SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
92666d45
KY
8842 SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
8843 SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
c1e89523 8844 SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC),
da946920 8845 SND_PCI_QUIRK(0x1028, 0x0a61, "Dell XPS 15 9510", ALC289_FIXUP_DUAL_SPK),
eb676622 8846 SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK),
2b987fe8
CC
8847 SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
8848 SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
a22aa26f
KY
8849 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8850 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
08fb0d0e 8851 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
9f5c6faf 8852 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
8e35cd4a 8853 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
7976eb49 8854 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8a02b164 8855 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8a02b164 8856 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
45461e3b
TI
8857 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8858 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
8859 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8860 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9c5dc3bf
KY
8861 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8862 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8863 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8864 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9c5dc3bf 8865 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9c5dc3bf
KY
8866 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8867 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8868 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8869 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8870 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9c5dc3bf 8871 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
04d5466a 8872 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
45461e3b 8873 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
c60666bd 8874 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd
KY
8875 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8876 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8877 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
45461e3b
TI
8878 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8879 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8880 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8881 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8882 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
9c5dc3bf 8883 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
45461e3b 8884 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
9c5dc3bf 8885 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
45461e3b 8886 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
9c5dc3bf 8887 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
c60666bd 8888 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 8889 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 8890 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 8891 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
45461e3b
TI
8892 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8893 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8894 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8895 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8896 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 8897 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd
KY
8898 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8899 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
45461e3b
TI
8900 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8901 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
8902 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8903 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8a02b164
KY
8904 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8905 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8906 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8907 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
167897f4
JK
8908 SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8909 SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
1c9d9dfd
KY
8910 SND_PCI_QUIRK(0x103c, 0x8077, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
8911 SND_PCI_QUIRK(0x103c, 0x8158, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
563785ed 8912 SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
e549d190 8913 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
bbf8ff6b 8914 SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
aeedad25 8915 SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
167897f4
JK
8916 SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8917 SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
56e40eb6 8918 SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
901be145 8919 SND_PCI_QUIRK(0x103c, 0x841c, "HP Pavilion 15-CK0xx", ALC269_FIXUP_HP_MUTE_LED_MIC3),
190d0381 8920 SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
5d84b531 8921 SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
d33cd42d 8922 SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
f2be77fe 8923 SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
d296a74b 8924 SND_PCI_QUIRK(0x103c, 0x860f, "HP ZBook 15 G6", ALC285_FIXUP_HP_GPIO_AMP_INIT),
0ac05b25 8925 SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
b2c22910 8926 SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
622464c8 8927 SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
15d295b5 8928 SND_PCI_QUIRK(0x103c, 0x8716, "HP Elite Dragonfly G2 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
61d3e874 8929 SND_PCI_QUIRK(0x103c, 0x8720, "HP EliteBook x360 1040 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
a598098c 8930 SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
c058493d 8931 SND_PCI_QUIRK(0x103c, 0x8728, "HP EliteBook 840 G7", ALC285_FIXUP_HP_GPIO_LED),
b2c22910 8932 SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
75b62ab6 8933 SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
05ec7161 8934 SND_PCI_QUIRK(0x103c, 0x8735, "HP ProBook 435 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
56496253 8935 SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
08befca4 8936 SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
431e76c3 8937 SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
24164f43 8938 SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
91bc1568
JS
8939 SND_PCI_QUIRK(0x103c, 0x8780, "HP ZBook Fury 17 G7 Mobile Workstation",
8940 ALC285_FIXUP_HP_GPIO_AMP_INIT),
8941 SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation",
8942 ALC285_FIXUP_HP_GPIO_AMP_INIT),
375f8426 8943 SND_PCI_QUIRK(0x103c, 0x8788, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
48422958 8944 SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
e7d66cf7 8945 SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
2b70b264 8946 SND_PCI_QUIRK(0x103c, 0x87e7, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
fb3acdb2 8947 SND_PCI_QUIRK(0x103c, 0x87f1, "HP ProBook 630 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
417eadfd 8948 SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
a0ccbc53
KY
8949 SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
8950 SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
93ab3eaf 8951 SND_PCI_QUIRK(0x103c, 0x87f6, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
c3bb2b52 8952 SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
d07149ab 8953 SND_PCI_QUIRK(0x103c, 0x8805, "HP ProBook 650 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
dfc2e8ae 8954 SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
d94befbb
DB
8955 SND_PCI_QUIRK(0x103c, 0x8811, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
8956 SND_PCI_QUIRK(0x103c, 0x8812, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
53b861be 8957 SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
c3d2c882 8958 SND_PCI_QUIRK(0x103c, 0x8847, "HP EliteBook x360 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
dfb06401 8959 SND_PCI_QUIRK(0x103c, 0x884b, "HP EliteBook 840 Aero G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
ca688339 8960 SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
8903376d
KHF
8961 SND_PCI_QUIRK(0x103c, 0x8862, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
8962 SND_PCI_QUIRK(0x103c, 0x8863, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
50dbfae9 8963 SND_PCI_QUIRK(0x103c, 0x886d, "HP ZBook Fury 17.3 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
e650c1a9 8964 SND_PCI_QUIRK(0x103c, 0x8870, "HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
bbe183e0 8965 SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
600dd2a7 8966 SND_PCI_QUIRK(0x103c, 0x888d, "HP ZBook Power 15.6 inch G8 Mobile Workstation PC", ALC236_FIXUP_HP_GPIO_LED),
91502a9a 8967 SND_PCI_QUIRK(0x103c, 0x8895, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED),
0e68c4b1 8968 SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
bd15b155 8969 SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
42334fbc 8970 SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED),
08977fe8 8971 SND_PCI_QUIRK(0x103c, 0x89c3, "HP", ALC285_FIXUP_HP_GPIO_LED),
f7ac570d 8972 SND_PCI_QUIRK(0x103c, 0x89ca, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
c1732ede 8973 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
7bba2157 8974 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
3e0d611b 8975 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9cf6533e 8976 SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
c1732ede 8977 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
4eab0ea1 8978 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
3e0d611b 8979 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4eab0ea1 8980 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
3cd0ed63 8981 SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
5cfca596 8982 SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
4eab0ea1
TI
8983 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
8984 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
c1732ede 8985 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
3cd0ed63 8986 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
c1732ede 8987 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
2cede303 8988 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
23870831 8989 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
3e0d611b 8990 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
8eedd3a7 8991 SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
48e01504 8992 SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
739d0959 8993 SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
3cd0ed63 8994 SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
8c8967a7 8995 SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
4963d66b 8996 SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
158ae2f5 8997 SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
4fad4fb9 8998 SND_PCI_QUIRK(0x1043, 0x1970, "ASUS UX550VE", ALC289_FIXUP_ASUS_GA401),
5de3b943 8999 SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE),
8b33a134 9000 SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
7900e817 9001 SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
017f2a10 9002 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
28e8af8a 9003 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
1b94e59d 9004 SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
693b613d 9005 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
615966ad 9006 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
4eab0ea1 9007 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
c1732ede 9008 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
ef9ce66f 9009 SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
4b43d05a 9010 SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
c1b55029 9011 SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
76fae618 9012 SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
293a92c1 9013 SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
94db9cc8 9014 SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
eeed4cd1 9015 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
adabb3ec
TI
9016 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
9017 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
9018 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
9019 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
d240d1dc 9020 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
1d045db9
TI
9021 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
9022 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
9023 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
e9bd7d5c 9024 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
cab561f8
TI
9025 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
9026 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
24519911 9027 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
4df3fd17 9028 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
cc7016ab 9029 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
fdcc968a 9030 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
c656f747 9031 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
2041d564 9032 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
b84e8436 9033 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
c656f747 9034 SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
6fa38ef1 9035 SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
ce2e79b2
PH
9036 SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
9037 SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
0fca97a2 9038 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
a33cc48d 9039 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
14425f1f
MP
9040 SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
9041 SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
f70fff83 9042 SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
8bcea6cb 9043 SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
823ff161 9044 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
568e4e82 9045 SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
c656f747 9046 SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
abaa2274
AA
9047 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
9048 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
8cd65271 9049 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
6ca653e3 9050 SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK),
b5acfe15 9051 SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
745f260b 9052 SND_PCI_QUIRK(0x1558, 0x1325, "Clevo N15[01][CW]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15
PH
9053 SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9054 SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9055 SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9056 SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9057 SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9058 SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9059 SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9060 SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9061 SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9062 SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1278cc5a
JS
9063 SND_PCI_QUIRK(0x1558, 0x5015, "Clevo NH5[58]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9064 SND_PCI_QUIRK(0x1558, 0x5017, "Clevo NH7[79]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15
PH
9065 SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9066 SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9067 SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9068 SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9069 SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1278cc5a
JS
9070 SND_PCI_QUIRK(0x1558, 0x50e1, "Clevo NH5[58]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9071 SND_PCI_QUIRK(0x1558, 0x50e2, "Clevo NH7[79]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15 9072 SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1d5cfca2 9073 SND_PCI_QUIRK(0x1558, 0x50f2, "Clevo NH50E[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15 9074 SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1d5cfca2
PH
9075 SND_PCI_QUIRK(0x1558, 0x50f5, "Clevo NH55EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9076 SND_PCI_QUIRK(0x1558, 0x50f6, "Clevo NH55DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15
PH
9077 SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9078 SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9079 SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9080 SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9081 SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1d5cfca2
PH
9082 SND_PCI_QUIRK(0x1558, 0x70f2, "Clevo NH79EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9083 SND_PCI_QUIRK(0x1558, 0x70f3, "Clevo NH77DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9084 SND_PCI_QUIRK(0x1558, 0x70f4, "Clevo NH77EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9085 SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15
PH
9086 SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9087 SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9088 SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9089 SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9090 SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
745f260b
WS
9091 SND_PCI_QUIRK(0x1558, 0x8550, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9092 SND_PCI_QUIRK(0x1558, 0x8551, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9093 SND_PCI_QUIRK(0x1558, 0x8560, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
9094 SND_PCI_QUIRK(0x1558, 0x8561, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
9095 SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[57][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
b5acfe15
PH
9096 SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9097 SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
edca7cc4 9098 SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME),
b5acfe15
PH
9099 SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9100 SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9101 SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9102 SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1d5cfca2 9103 SND_PCI_QUIRK(0x1558, 0x9600, "Clevo N960K[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
b5acfe15
PH
9104 SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9105 SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
745f260b
WS
9106 SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL5[03]RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9107 SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL50NU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
1d5cfca2
PH
9108 SND_PCI_QUIRK(0x1558, 0xb018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9109 SND_PCI_QUIRK(0x1558, 0xb019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9110 SND_PCI_QUIRK(0x1558, 0xb022, "Clevo NH77D[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9111 SND_PCI_QUIRK(0x1558, 0xc018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9112 SND_PCI_QUIRK(0x1558, 0xc019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9113 SND_PCI_QUIRK(0x1558, 0xc022, "Clevo NH77[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
ca169cc2 9114 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
29c8f40b 9115 SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
1d045db9
TI
9116 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
9117 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
9118 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
9119 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
9120 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
f552ff54 9121 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
b590b38c 9122 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
c8415a48 9123 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
4407be6b 9124 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
108cc108 9125 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
aaedfb47 9126 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
9a811230 9127 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
1c37c223 9128 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
a12137e7 9129 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
59a51a6b 9130 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
6d16941a 9131 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
7c21539c 9132 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
a4a9e082 9133 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
b6903c0e 9134 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
d05ea7da 9135 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
c0278669 9136 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
61fcf8ec
KY
9137 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9138 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
dab38e43 9139 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
c636b95e 9140 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
61fcf8ec
KY
9141 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
9142 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9143 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
e4c07b3b 9144 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
61fcf8ec
KY
9145 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9146 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9147 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
85981dfd 9148 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9774dc21 9149 SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
ca707b3f 9150 SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
446b8185
KY
9151 SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
9152 SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
ae7abe36
SB
9153 SND_PCI_QUIRK(0x17aa, 0x22f1, "Thinkpad", ALC287_FIXUP_CS35L41_I2C_2),
9154 SND_PCI_QUIRK(0x17aa, 0x22f2, "Thinkpad", ALC287_FIXUP_CS35L41_I2C_2),
9155 SND_PCI_QUIRK(0x17aa, 0x22f3, "Thinkpad", ALC287_FIXUP_CS35L41_I2C_2),
3694cb29 9156 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
6ef2f68f 9157 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
f33f79f3 9158 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
bef33e19 9159 SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
e41fc8c5 9160 SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
65811834 9161 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
8da5bbfc 9162 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
2a36c16e 9163 SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
8a6c55d0
AM
9164 SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
9165 SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
e4efa826 9166 SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
2aac550d 9167 SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
f86de9b1 9168 SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940", ALC298_FIXUP_LENOVO_SPK_VOLUME),
2aac550d 9169 SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
8f4c9042 9170 SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
2aac550d 9171 SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
b81e9e5c 9172 SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
c07f2c7b 9173 SND_PCI_QUIRK(0x17aa, 0x383d, "Legion Y9000X 2019", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
9ebaef05 9174 SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
d3dca026 9175 SND_PCI_QUIRK(0x17aa, 0x3847, "Legion 7 16ACHG6", ALC287_FIXUP_LEGION_16ACHG6),
2aac550d 9176 SND_PCI_QUIRK(0x17aa, 0x384a, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
ad7cc2d4
CB
9177 SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
9178 SND_PCI_QUIRK(0x17aa, 0x3853, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
56f27013 9179 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
fedb2245 9180 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
56df90b6 9181 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
f552ff54 9182 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
a4a9e082 9183 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
1bb3e062 9184 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
c497d9f9 9185 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
cd5302c0 9186 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
f2aa1110 9187 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
80b311d3 9188 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
09ea9976 9189 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
037e1197 9190 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
23adc192 9191 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
0f087ee3 9192 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
9cd25743 9193 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
0f087ee3 9194 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
61fcf8ec
KY
9195 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9196 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9197 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
cd5302c0 9198 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
61fcf8ec
KY
9199 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9200 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
1d045db9 9201 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
174a7fb3 9202 SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_NO_AUDIO_JACK),
0fbf21c3 9203 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
f1ec5be1
HC
9204 SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
9205 SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
9206 SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
02b504d9 9207 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
c656f747
TI
9208 SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
9209 SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
619764cc 9210 SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_SET_COEF_DEFAULTS),
fc19d559 9211 SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
b95bc12e 9212 SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
695d1ec3 9213 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
e1c86210 9214 SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
d1ee66c5 9215 SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
e2d2fded 9216 SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
73e7161e 9217 SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
a4297b5d 9218
a7f3eedc 9219#if 0
a4297b5d
TI
9220 /* Below is a quirk table taken from the old code.
9221 * Basically the device should work as is without the fixup table.
9222 * If BIOS doesn't give a proper info, enable the corresponding
9223 * fixup entry.
7d7eb9ea 9224 */
a4297b5d
TI
9225 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
9226 ALC269_FIXUP_AMIC),
9227 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
a4297b5d
TI
9228 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
9229 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
9230 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
9231 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
9232 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
9233 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
9234 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
9235 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
9236 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
9237 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
9238 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
9239 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
9240 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
9241 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
9242 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
9243 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
9244 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
9245 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
9246 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
9247 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
9248 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
9249 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
9250 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
9251 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
9252 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
9253 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
9254 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
9255 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
9256 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
9257 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
9258 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
9259 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
9260 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
9261 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
9262 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
9263 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
9264 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
9265 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
9266#endif
9267 {}
9268};
9269
214eef76
DH
9270static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
9271 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
9272 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
9273 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
9274 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
0fbf21c3 9275 SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
214eef76
DH
9276 {}
9277};
9278
1727a771 9279static const struct hda_model_fixup alc269_fixup_models[] = {
a4297b5d
TI
9280 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
9281 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
6e72aa5f
TI
9282 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
9283 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
9284 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
7c478f03 9285 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
b016951e
TI
9286 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
9287 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
108cc108 9288 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
b590b38c 9289 {.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
9f5c6faf 9290 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
04d5466a 9291 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
e32aa85a
DH
9292 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
9293 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
a26d96c7
TI
9294 {.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
9295 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
be8ef16a 9296 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
0202e99c 9297 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
1c37c223 9298 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
9a811230 9299 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
c636b95e 9300 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
399c01aa 9301 {.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
a26d96c7 9302 {.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
ba90d6a6 9303 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
28d1d6d2 9304 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
a26d96c7
TI
9305 {.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
9306 {.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
9307 {.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
9308 {.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
9309 {.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
9310 {.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
9311 {.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
9312 {.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
9313 {.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
9314 {.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
9315 {.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
9316 {.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
9317 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
9318 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
9319 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
9320 {.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
9321 {.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
9322 {.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
9323 {.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
9324 {.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
9325 {.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
9326 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
9327 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
9328 {.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
9329 {.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
9330 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
9331 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
9332 {.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
9333 {.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
9334 {.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
9335 {.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
9336 {.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
9337 {.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
9338 {.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
9339 {.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
9340 {.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
9341 {.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
9342 {.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
9343 {.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
9344 {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
b3802783 9345 {.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
a26d96c7 9346 {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
c8426b27 9347 {.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"},
a26d96c7
TI
9348 {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
9349 {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
9350 {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
9351 {.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
9352 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
9353 {.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
9354 {.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
9355 {.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
9356 {.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
9357 {.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
9358 {.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
9359 {.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
9360 {.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
9361 {.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
a26d96c7
TI
9362 {.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
9363 {.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
9364 {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
82aa0d7e 9365 {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
a26d96c7 9366 {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
d2cd795c 9367 {.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
a26d96c7
TI
9368 {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
9369 {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
9370 {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
9371 {.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
9372 {.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
9373 {.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
9374 {.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
9375 {.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
9376 {.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
9377 {.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
9378 {.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
9379 {.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
9380 {.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
9381 {.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
9382 {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
9383 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
9384 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
8983eb60
KY
9385 {.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
9386 {.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
e2a829b3 9387 {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
a2ef03fe 9388 {.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
bd9c10bc 9389 {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
23dc9586 9390 {.id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc298-samsung-headphone"},
fc19d559 9391 {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
13468bfa 9392 {.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
c3bb2b52 9393 {.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
5d84b531 9394 {.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
f2be77fe 9395 {.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
d94befbb 9396 {.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"},
9ebaef05 9397 {.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
29c8f40b 9398 {.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
57c9e21a 9399 {.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
aa723946 9400 {.id = ALC285_FIXUP_HP_GPIO_AMP_INIT, .name = "alc285-hp-amp-init"},
1d045db9 9401 {}
6dda9f4a 9402};
cfc5a845 9403#define ALC225_STANDARD_PINS \
cfc5a845 9404 {0x21, 0x04211020}
6dda9f4a 9405
e8191a8e
HW
9406#define ALC256_STANDARD_PINS \
9407 {0x12, 0x90a60140}, \
9408 {0x14, 0x90170110}, \
e8191a8e
HW
9409 {0x21, 0x02211020}
9410
fea185e2 9411#define ALC282_STANDARD_PINS \
11580297 9412 {0x14, 0x90170110}
e1e62b98 9413
fea185e2 9414#define ALC290_STANDARD_PINS \
11580297 9415 {0x12, 0x99a30130}
fea185e2
DH
9416
9417#define ALC292_STANDARD_PINS \
9418 {0x14, 0x90170110}, \
11580297 9419 {0x15, 0x0221401f}
977e6276 9420
3f640970
HW
9421#define ALC295_STANDARD_PINS \
9422 {0x12, 0xb7a60130}, \
9423 {0x14, 0x90170110}, \
3f640970
HW
9424 {0x21, 0x04211020}
9425
703867e2
WS
9426#define ALC298_STANDARD_PINS \
9427 {0x12, 0x90a60130}, \
9428 {0x21, 0x03211020}
9429
e1918938 9430static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
8a328ac1
KY
9431 SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
9432 {0x14, 0x01014020},
9433 {0x17, 0x90170110},
9434 {0x18, 0x02a11030},
9435 {0x19, 0x0181303F},
9436 {0x21, 0x0221102f}),
5824ce8d
CC
9437 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
9438 {0x12, 0x90a601c0},
9439 {0x14, 0x90171120},
9440 {0x21, 0x02211030}),
615966ad
CC
9441 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9442 {0x14, 0x90170110},
9443 {0x1b, 0x90a70130},
9444 {0x21, 0x03211020}),
9445 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9446 {0x1a, 0x90a70130},
9447 {0x1b, 0x90170110},
9448 {0x21, 0x03211020}),
2ae95577 9449 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
cfc5a845 9450 ALC225_STANDARD_PINS,
8a132099 9451 {0x12, 0xb7a60130},
cfc5a845 9452 {0x14, 0x901701a0}),
2ae95577 9453 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
cfc5a845 9454 ALC225_STANDARD_PINS,
8a132099 9455 {0x12, 0xb7a60130},
cfc5a845 9456 {0x14, 0x901701b0}),
8a132099
HW
9457 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9458 ALC225_STANDARD_PINS,
9459 {0x12, 0xb7a60150},
9460 {0x14, 0x901701a0}),
9461 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9462 ALC225_STANDARD_PINS,
9463 {0x12, 0xb7a60150},
9464 {0x14, 0x901701b0}),
9465 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9466 ALC225_STANDARD_PINS,
9467 {0x12, 0xb7a60130},
9468 {0x1b, 0x90170110}),
0ce48e17
KHF
9469 SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9470 {0x1b, 0x01111010},
9471 {0x1e, 0x01451130},
9472 {0x21, 0x02211020}),
986376b6
HW
9473 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
9474 {0x12, 0x90a60140},
9475 {0x14, 0x90170110},
9476 {0x19, 0x02a11030},
9477 {0x21, 0x02211020}),
e41fc8c5
HW
9478 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9479 {0x14, 0x90170110},
9480 {0x19, 0x02a11030},
9481 {0x1a, 0x02a11040},
9482 {0x1b, 0x01014020},
9483 {0x21, 0x0221101f}),
d06fb562
HW
9484 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9485 {0x14, 0x90170110},
9486 {0x19, 0x02a11030},
9487 {0x1a, 0x02a11040},
9488 {0x1b, 0x01011020},
9489 {0x21, 0x0221101f}),
c6b17f10
HW
9490 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9491 {0x14, 0x90170110},
9492 {0x19, 0x02a11020},
9493 {0x1a, 0x02a11030},
9494 {0x21, 0x0221101f}),
92666d45
KY
9495 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
9496 {0x21, 0x02211010}),
9e885770
KY
9497 SND_HDA_PIN_QUIRK(0x10ec0236, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
9498 {0x14, 0x90170110},
9499 {0x19, 0x02a11020},
9500 {0x21, 0x02211030}),
c77900e6 9501 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
c77900e6 9502 {0x14, 0x90170110},
c77900e6 9503 {0x21, 0x02211020}),
86c72d1c
HW
9504 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9505 {0x14, 0x90170130},
9506 {0x21, 0x02211040}),
76c2132e
DH
9507 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9508 {0x12, 0x90a60140},
9509 {0x14, 0x90170110},
76c2132e
DH
9510 {0x21, 0x02211020}),
9511 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9512 {0x12, 0x90a60160},
9513 {0x14, 0x90170120},
76c2132e 9514 {0x21, 0x02211030}),
392c9da2
HW
9515 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9516 {0x14, 0x90170110},
9517 {0x1b, 0x02011020},
9518 {0x21, 0x0221101f}),
6aecd871
HW
9519 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9520 {0x14, 0x90170110},
9521 {0x1b, 0x01011020},
9522 {0x21, 0x0221101f}),
cba59972 9523 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
cba59972 9524 {0x14, 0x90170130},
cba59972 9525 {0x1b, 0x01014020},
cba59972 9526 {0x21, 0x0221103f}),
6aecd871
HW
9527 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9528 {0x14, 0x90170130},
9529 {0x1b, 0x01011020},
9530 {0x21, 0x0221103f}),
59ec4b57
HW
9531 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9532 {0x14, 0x90170130},
9533 {0x1b, 0x02011020},
9534 {0x21, 0x0221103f}),
e9c28e16 9535 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
e9c28e16 9536 {0x14, 0x90170150},
e9c28e16 9537 {0x1b, 0x02011020},
e9c28e16
WS
9538 {0x21, 0x0221105f}),
9539 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
e9c28e16 9540 {0x14, 0x90170110},
e9c28e16 9541 {0x1b, 0x01014020},
e9c28e16 9542 {0x21, 0x0221101f}),
76c2132e
DH
9543 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9544 {0x12, 0x90a60160},
9545 {0x14, 0x90170120},
9546 {0x17, 0x90170140},
76c2132e
DH
9547 {0x21, 0x0321102f}),
9548 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9549 {0x12, 0x90a60160},
9550 {0x14, 0x90170130},
76c2132e
DH
9551 {0x21, 0x02211040}),
9552 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9553 {0x12, 0x90a60160},
9554 {0x14, 0x90170140},
76c2132e
DH
9555 {0x21, 0x02211050}),
9556 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9557 {0x12, 0x90a60170},
9558 {0x14, 0x90170120},
76c2132e
DH
9559 {0x21, 0x02211030}),
9560 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9561 {0x12, 0x90a60170},
9562 {0x14, 0x90170130},
76c2132e 9563 {0x21, 0x02211040}),
0a1f90a9
HW
9564 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9565 {0x12, 0x90a60170},
9566 {0x14, 0x90171130},
9567 {0x21, 0x02211040}),
70658b99 9568 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
70658b99
HW
9569 {0x12, 0x90a60170},
9570 {0x14, 0x90170140},
70658b99 9571 {0x21, 0x02211050}),
9b5a4e39 9572 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9b5a4e39
DH
9573 {0x12, 0x90a60180},
9574 {0x14, 0x90170130},
9b5a4e39 9575 {0x21, 0x02211040}),
f90d83b3
AK
9576 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9577 {0x12, 0x90a60180},
9578 {0x14, 0x90170120},
9579 {0x21, 0x02211030}),
989dbe4a
HW
9580 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9581 {0x1b, 0x01011020},
9582 {0x21, 0x02211010}),
c1732ede
CC
9583 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
9584 {0x14, 0x90170110},
9585 {0x1b, 0x90a70130},
9586 {0x21, 0x04211020}),
9587 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
9588 {0x14, 0x90170110},
9589 {0x1b, 0x90a70130},
9590 {0x21, 0x03211020}),
a806ef1c
CC
9591 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
9592 {0x12, 0x90a60130},
9593 {0x14, 0x90170110},
9594 {0x21, 0x03211020}),
6ac371aa
JHP
9595 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
9596 {0x12, 0x90a60130},
9597 {0x14, 0x90170110},
9598 {0x21, 0x04211020}),
e1037354
JHP
9599 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
9600 {0x1a, 0x90a70130},
9601 {0x1b, 0x90170110},
9602 {0x21, 0x03211020}),
9e885770
KY
9603 SND_HDA_PIN_QUIRK(0x10ec0256, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
9604 {0x14, 0x90170110},
9605 {0x19, 0x02a11020},
9606 {0x21, 0x0221101f}),
8a8de09c
KY
9607 SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
9608 {0x17, 0x90170110},
9609 {0x19, 0x03a11030},
9610 {0x21, 0x03211020}),
cf51eb9d
DH
9611 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
9612 {0x12, 0x90a60130},
cf51eb9d
DH
9613 {0x14, 0x90170110},
9614 {0x15, 0x0421101f},
11580297 9615 {0x1a, 0x04a11020}),
0279661b
HW
9616 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
9617 {0x12, 0x90a60140},
0279661b
HW
9618 {0x14, 0x90170110},
9619 {0x15, 0x0421101f},
0279661b 9620 {0x18, 0x02811030},
0279661b 9621 {0x1a, 0x04a1103f},
11580297 9622 {0x1b, 0x02011020}),
42304474 9623 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9624 ALC282_STANDARD_PINS,
42304474 9625 {0x12, 0x99a30130},
42304474 9626 {0x19, 0x03a11020},
42304474 9627 {0x21, 0x0321101f}),
2c609999 9628 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9629 ALC282_STANDARD_PINS,
2c609999 9630 {0x12, 0x99a30130},
2c609999 9631 {0x19, 0x03a11020},
2c609999
HW
9632 {0x21, 0x03211040}),
9633 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9634 ALC282_STANDARD_PINS,
2c609999 9635 {0x12, 0x99a30130},
2c609999 9636 {0x19, 0x03a11030},
2c609999
HW
9637 {0x21, 0x03211020}),
9638 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9639 ALC282_STANDARD_PINS,
2c609999 9640 {0x12, 0x99a30130},
2c609999 9641 {0x19, 0x04a11020},
2c609999 9642 {0x21, 0x0421101f}),
200afc09 9643 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
aec856d0 9644 ALC282_STANDARD_PINS,
200afc09 9645 {0x12, 0x90a60140},
200afc09 9646 {0x19, 0x04a11030},
200afc09 9647 {0x21, 0x04211020}),
34cdf405
CC
9648 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
9649 ALC282_STANDARD_PINS,
9650 {0x12, 0x90a609c0},
9651 {0x18, 0x03a11830},
9652 {0x19, 0x04a19831},
9653 {0x1a, 0x0481303f},
9654 {0x1b, 0x04211020},
9655 {0x21, 0x0321101f}),
9656 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
9657 ALC282_STANDARD_PINS,
9658 {0x12, 0x90a60940},
9659 {0x18, 0x03a11830},
9660 {0x19, 0x04a19831},
9661 {0x1a, 0x0481303f},
9662 {0x1b, 0x04211020},
9663 {0x21, 0x0321101f}),
76c2132e 9664 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 9665 ALC282_STANDARD_PINS,
76c2132e 9666 {0x12, 0x90a60130},
76c2132e
DH
9667 {0x21, 0x0321101f}),
9668 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9669 {0x12, 0x90a60160},
9670 {0x14, 0x90170120},
76c2132e 9671 {0x21, 0x02211030}),
bc262179 9672 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 9673 ALC282_STANDARD_PINS,
bc262179 9674 {0x12, 0x90a60130},
bc262179 9675 {0x19, 0x03a11020},
bc262179 9676 {0x21, 0x0321101f}),
c8c6ee61 9677 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
266fd994
SL
9678 {0x12, 0x90a60130},
9679 {0x14, 0x90170110},
9680 {0x19, 0x04a11040},
9681 {0x21, 0x04211020}),
9682 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
9683 {0x14, 0x90170110},
9684 {0x19, 0x04a11040},
9685 {0x1d, 0x40600001},
9686 {0x21, 0x04211020}),
9687 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
c4cfcf6f
HW
9688 {0x14, 0x90170110},
9689 {0x19, 0x04a11040},
9690 {0x21, 0x04211020}),
c72b9bfe
HW
9691 SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9692 {0x14, 0x90170110},
9693 {0x17, 0x90170111},
9694 {0x19, 0x03a11030},
9695 {0x21, 0x03211020}),
33aaebd4
CC
9696 SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
9697 {0x12, 0x90a60130},
9698 {0x17, 0x90170110},
9699 {0x21, 0x02211020}),
d44a6864 9700 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
e1e62b98 9701 {0x12, 0x90a60120},
e1e62b98 9702 {0x14, 0x90170110},
e1e62b98 9703 {0x21, 0x0321101f}),
e4442bcf 9704 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9705 ALC290_STANDARD_PINS,
e4442bcf 9706 {0x15, 0x04211040},
e4442bcf 9707 {0x18, 0x90170112},
11580297 9708 {0x1a, 0x04a11020}),
e4442bcf 9709 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9710 ALC290_STANDARD_PINS,
e4442bcf 9711 {0x15, 0x04211040},
e4442bcf 9712 {0x18, 0x90170110},
11580297 9713 {0x1a, 0x04a11020}),
e4442bcf 9714 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9715 ALC290_STANDARD_PINS,
e4442bcf 9716 {0x15, 0x0421101f},
11580297 9717 {0x1a, 0x04a11020}),
e4442bcf 9718 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9719 ALC290_STANDARD_PINS,
e4442bcf 9720 {0x15, 0x04211020},
11580297 9721 {0x1a, 0x04a11040}),
e4442bcf 9722 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9723 ALC290_STANDARD_PINS,
e4442bcf
HW
9724 {0x14, 0x90170110},
9725 {0x15, 0x04211020},
11580297 9726 {0x1a, 0x04a11040}),
e4442bcf 9727 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9728 ALC290_STANDARD_PINS,
e4442bcf
HW
9729 {0x14, 0x90170110},
9730 {0x15, 0x04211020},
11580297 9731 {0x1a, 0x04a11020}),
e4442bcf 9732 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 9733 ALC290_STANDARD_PINS,
e4442bcf
HW
9734 {0x14, 0x90170110},
9735 {0x15, 0x0421101f},
11580297 9736 {0x1a, 0x04a11020}),
e8818fa8 9737 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
aec856d0 9738 ALC292_STANDARD_PINS,
e8818fa8 9739 {0x12, 0x90a60140},
e8818fa8 9740 {0x16, 0x01014020},
11580297 9741 {0x19, 0x01a19030}),
e8818fa8 9742 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
aec856d0 9743 ALC292_STANDARD_PINS,
e8818fa8 9744 {0x12, 0x90a60140},
e8818fa8
HW
9745 {0x16, 0x01014020},
9746 {0x18, 0x02a19031},
11580297 9747 {0x19, 0x01a1903e}),
76c2132e 9748 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
aec856d0 9749 ALC292_STANDARD_PINS,
11580297 9750 {0x12, 0x90a60140}),
76c2132e 9751 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 9752 ALC292_STANDARD_PINS,
76c2132e 9753 {0x13, 0x90a60140},
76c2132e 9754 {0x16, 0x21014020},
11580297 9755 {0x19, 0x21a19030}),
e03fdbde 9756 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 9757 ALC292_STANDARD_PINS,
11580297 9758 {0x13, 0x90a60140}),
eeacd80f
JHP
9759 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_HPE,
9760 {0x17, 0x90170110},
9761 {0x21, 0x04211020}),
d8ae458e
CC
9762 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
9763 {0x14, 0x90170110},
9764 {0x1b, 0x90a70130},
9765 {0x21, 0x04211020}),
8bb37a2a
JHP
9766 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9767 {0x12, 0x90a60130},
9768 {0x17, 0x90170110},
9769 {0x21, 0x03211020}),
0bea4cc8
JHP
9770 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9771 {0x12, 0x90a60130},
9772 {0x17, 0x90170110},
9773 {0x21, 0x04211020}),
3887c26c
TI
9774 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9775 {0x12, 0x90a60130},
9776 {0x17, 0x90170110},
9777 {0x21, 0x03211020}),
9e43342b 9778 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
ad97d667
JHP
9779 {0x12, 0x90a60120},
9780 {0x17, 0x90170110},
9781 {0x21, 0x04211030}),
9782 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
9e43342b
CC
9783 {0x12, 0x90a60130},
9784 {0x17, 0x90170110},
9785 {0x21, 0x03211020}),
9786 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
9787 {0x12, 0x90a60130},
9788 {0x17, 0x90170110},
9789 {0x21, 0x03211020}),
fbc57129 9790 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
0a29c57b
KY
9791 {0x14, 0x90170110},
9792 {0x21, 0x04211020}),
fbc57129
KY
9793 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9794 {0x14, 0x90170110},
9795 {0x21, 0x04211030}),
3f640970 9796 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
f771d5bb
HW
9797 ALC295_STANDARD_PINS,
9798 {0x17, 0x21014020},
9799 {0x18, 0x21a19030}),
9800 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9801 ALC295_STANDARD_PINS,
9802 {0x17, 0x21014040},
9803 {0x18, 0x21a19050}),
3f307834
HW
9804 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9805 ALC295_STANDARD_PINS),
9f502ff5
TI
9806 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
9807 ALC298_STANDARD_PINS,
9808 {0x17, 0x90170110}),
977e6276 9809 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
703867e2
WS
9810 ALC298_STANDARD_PINS,
9811 {0x17, 0x90170140}),
9812 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
9813 ALC298_STANDARD_PINS,
9f502ff5 9814 {0x17, 0x90170150}),
9f1bc2c4
KHF
9815 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
9816 {0x12, 0xb7a60140},
9817 {0x13, 0xb7a60150},
9818 {0x17, 0x90170110},
9819 {0x1a, 0x03011020},
9820 {0x21, 0x03211030}),
54324221
JM
9821 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
9822 {0x12, 0xb7a60140},
9823 {0x17, 0x90170110},
9824 {0x1a, 0x03a11030},
9825 {0x21, 0x03211020}),
fcc6c877
KY
9826 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9827 ALC225_STANDARD_PINS,
9828 {0x12, 0xb7a60130},
fcc6c877 9829 {0x17, 0x90170110}),
573fcbfd
HW
9830 SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
9831 {0x14, 0x01014010},
9832 {0x17, 0x90170120},
9833 {0x18, 0x02a11030},
9834 {0x19, 0x02a1103f},
9835 {0x21, 0x0221101f}),
e1918938
HW
9836 {}
9837};
6dda9f4a 9838
7c0a6939
HW
9839/* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
9840 * more machines, don't need to match all valid pins, just need to match
9841 * all the pins defined in the tbl. Just because of this reason, it is possible
9842 * that a single machine matches multiple tbls, so there is one limitation:
9843 * at most one tbl is allowed to define for the same vendor and same codec
9844 */
9845static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
9846 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9847 {0x19, 0x40000000},
9848 {0x1b, 0x40000000}),
aed8c7f4
HW
9849 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9850 {0x19, 0x40000000},
9851 {0x1a, 0x40000000}),
d64ebdbf
HW
9852 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9853 {0x19, 0x40000000},
9854 {0x1a, 0x40000000}),
5815bdfd
HW
9855 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
9856 {0x19, 0x40000000},
9857 {0x1a, 0x40000000}),
7c0a6939
HW
9858 {}
9859};
9860
546bb678 9861static void alc269_fill_coef(struct hda_codec *codec)
1d045db9 9862{
526af6eb 9863 struct alc_spec *spec = codec->spec;
1d045db9 9864 int val;
ebb83eeb 9865
526af6eb 9866 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
546bb678 9867 return;
526af6eb 9868
1bb7e43e 9869 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
1d045db9
TI
9870 alc_write_coef_idx(codec, 0xf, 0x960b);
9871 alc_write_coef_idx(codec, 0xe, 0x8817);
9872 }
ebb83eeb 9873
1bb7e43e 9874 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
1d045db9
TI
9875 alc_write_coef_idx(codec, 0xf, 0x960b);
9876 alc_write_coef_idx(codec, 0xe, 0x8814);
9877 }
ebb83eeb 9878
1bb7e43e 9879 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
1d045db9 9880 /* Power up output pin */
98b24883 9881 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
1d045db9 9882 }
ebb83eeb 9883
1bb7e43e 9884 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
1d045db9 9885 val = alc_read_coef_idx(codec, 0xd);
f3ee07d8 9886 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
1d045db9
TI
9887 /* Capless ramp up clock control */
9888 alc_write_coef_idx(codec, 0xd, val | (1<<10));
9889 }
9890 val = alc_read_coef_idx(codec, 0x17);
f3ee07d8 9891 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
1d045db9
TI
9892 /* Class D power on reset */
9893 alc_write_coef_idx(codec, 0x17, val | (1<<7));
9894 }
9895 }
ebb83eeb 9896
98b24883
TI
9897 /* HP */
9898 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
1d045db9 9899}
a7f2371f 9900
1d045db9
TI
9901/*
9902 */
1d045db9
TI
9903static int patch_alc269(struct hda_codec *codec)
9904{
9905 struct alc_spec *spec;
3de95173 9906 int err;
f1d4e28b 9907
3de95173 9908 err = alc_alloc_spec(codec, 0x0b);
e16fb6d1 9909 if (err < 0)
3de95173
TI
9910 return err;
9911
9912 spec = codec->spec;
08c189f2 9913 spec->gen.shared_mic_vref_pin = 0x18;
317d9313 9914 codec->power_save_node = 0;
e16fb6d1 9915
225068ab
TI
9916#ifdef CONFIG_PM
9917 codec->patch_ops.suspend = alc269_suspend;
9918 codec->patch_ops.resume = alc269_resume;
9919#endif
c2d6af53
KY
9920 spec->shutup = alc_default_shutup;
9921 spec->init_hook = alc_default_init;
225068ab 9922
7639a06c 9923 switch (codec->core.vendor_id) {
065380f0 9924 case 0x10ec0269:
1d045db9 9925 spec->codec_variant = ALC269_TYPE_ALC269VA;
1bb7e43e
TI
9926 switch (alc_get_coef0(codec) & 0x00f0) {
9927 case 0x0010:
5100cd07
TI
9928 if (codec->bus->pci &&
9929 codec->bus->pci->subsystem_vendor == 0x1025 &&
e16fb6d1 9930 spec->cdefine.platform_type == 1)
20ca0c35 9931 err = alc_codec_rename(codec, "ALC271X");
1d045db9 9932 spec->codec_variant = ALC269_TYPE_ALC269VB;
1bb7e43e
TI
9933 break;
9934 case 0x0020:
5100cd07
TI
9935 if (codec->bus->pci &&
9936 codec->bus->pci->subsystem_vendor == 0x17aa &&
e16fb6d1 9937 codec->bus->pci->subsystem_device == 0x21f3)
20ca0c35 9938 err = alc_codec_rename(codec, "ALC3202");
1d045db9 9939 spec->codec_variant = ALC269_TYPE_ALC269VC;
1bb7e43e 9940 break;
adcc70b2
KY
9941 case 0x0030:
9942 spec->codec_variant = ALC269_TYPE_ALC269VD;
9943 break;
1bb7e43e 9944 default:
1d045db9 9945 alc_fix_pll_init(codec, 0x20, 0x04, 15);
1bb7e43e 9946 }
e16fb6d1
TI
9947 if (err < 0)
9948 goto error;
c2d6af53 9949 spec->shutup = alc269_shutup;
546bb678 9950 spec->init_hook = alc269_fill_coef;
1d045db9 9951 alc269_fill_coef(codec);
065380f0
KY
9952 break;
9953
9954 case 0x10ec0280:
9955 case 0x10ec0290:
9956 spec->codec_variant = ALC269_TYPE_ALC280;
9957 break;
9958 case 0x10ec0282:
065380f0 9959 spec->codec_variant = ALC269_TYPE_ALC282;
7b5c7a02
KY
9960 spec->shutup = alc282_shutup;
9961 spec->init_hook = alc282_init;
065380f0 9962 break;
2af02be7
KY
9963 case 0x10ec0233:
9964 case 0x10ec0283:
9965 spec->codec_variant = ALC269_TYPE_ALC283;
9966 spec->shutup = alc283_shutup;
9967 spec->init_hook = alc283_init;
9968 break;
065380f0
KY
9969 case 0x10ec0284:
9970 case 0x10ec0292:
9971 spec->codec_variant = ALC269_TYPE_ALC284;
9972 break;
161ebf29 9973 case 0x10ec0293:
4731d5de 9974 spec->codec_variant = ALC269_TYPE_ALC293;
161ebf29 9975 break;
7fc7d047 9976 case 0x10ec0286:
7c665932 9977 case 0x10ec0288:
7fc7d047
KY
9978 spec->codec_variant = ALC269_TYPE_ALC286;
9979 break;
506b62c3
KY
9980 case 0x10ec0298:
9981 spec->codec_variant = ALC269_TYPE_ALC298;
9982 break;
ea04a1db 9983 case 0x10ec0235:
1d04c9de
KY
9984 case 0x10ec0255:
9985 spec->codec_variant = ALC269_TYPE_ALC255;
ab3b8e51
KY
9986 spec->shutup = alc256_shutup;
9987 spec->init_hook = alc256_init;
1d04c9de 9988 break;
1948fc06 9989 case 0x10ec0230:
736f20a7 9990 case 0x10ec0236:
4344aec8
KY
9991 case 0x10ec0256:
9992 spec->codec_variant = ALC269_TYPE_ALC256;
4a219ef8
KY
9993 spec->shutup = alc256_shutup;
9994 spec->init_hook = alc256_init;
7d1b6e29 9995 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
4344aec8 9996 break;
f429e7e4
KY
9997 case 0x10ec0257:
9998 spec->codec_variant = ALC269_TYPE_ALC257;
88d42b2b
KY
9999 spec->shutup = alc256_shutup;
10000 spec->init_hook = alc256_init;
f429e7e4
KY
10001 spec->gen.mixer_nid = 0;
10002 break;
0a6f0600 10003 case 0x10ec0215:
7fbdcd83 10004 case 0x10ec0245:
0a6f0600
KY
10005 case 0x10ec0285:
10006 case 0x10ec0289:
10007 spec->codec_variant = ALC269_TYPE_ALC215;
1b6832be
KY
10008 spec->shutup = alc225_shutup;
10009 spec->init_hook = alc225_init;
0a6f0600
KY
10010 spec->gen.mixer_nid = 0;
10011 break;
4231430d 10012 case 0x10ec0225:
7d727869 10013 case 0x10ec0295:
28f1f9b2 10014 case 0x10ec0299:
4231430d 10015 spec->codec_variant = ALC269_TYPE_ALC225;
da911b1f
KY
10016 spec->shutup = alc225_shutup;
10017 spec->init_hook = alc225_init;
c1350bff 10018 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
4231430d 10019 break;
99cee034
KY
10020 case 0x10ec0287:
10021 spec->codec_variant = ALC269_TYPE_ALC287;
10022 spec->shutup = alc225_shutup;
10023 spec->init_hook = alc225_init;
10024 spec->gen.mixer_nid = 0; /* no loopback on ALC287 */
10025 break;
dcd4f0db
KY
10026 case 0x10ec0234:
10027 case 0x10ec0274:
10028 case 0x10ec0294:
10029 spec->codec_variant = ALC269_TYPE_ALC294;
532a7784 10030 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
71683c32 10031 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
693abe11 10032 spec->init_hook = alc294_init;
dcd4f0db 10033 break;
1078bef0
KY
10034 case 0x10ec0300:
10035 spec->codec_variant = ALC269_TYPE_ALC300;
10036 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
dcd4f0db 10037 break;
f0778871
KY
10038 case 0x10ec0623:
10039 spec->codec_variant = ALC269_TYPE_ALC623;
10040 break;
6fbae35a
KY
10041 case 0x10ec0700:
10042 case 0x10ec0701:
10043 case 0x10ec0703:
83629532 10044 case 0x10ec0711:
6fbae35a
KY
10045 spec->codec_variant = ALC269_TYPE_ALC700;
10046 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
2d7fe618 10047 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
693abe11 10048 spec->init_hook = alc294_init;
6fbae35a
KY
10049 break;
10050
1d045db9 10051 }
6dda9f4a 10052
ad60d502 10053 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
97a26570 10054 spec->has_alc5505_dsp = 1;
ad60d502
KY
10055 spec->init_hook = alc5505_dsp_init;
10056 }
10057
c9af753f
TI
10058 alc_pre_init(codec);
10059
efe55732
TI
10060 snd_hda_pick_fixup(codec, alc269_fixup_models,
10061 alc269_fixup_tbl, alc269_fixups);
13d9c6b9
TI
10062 /* FIXME: both TX300 and ROG Strix G17 have the same SSID, and
10063 * the quirk breaks the latter (bko#214101).
10064 * Clear the wrong entry.
10065 */
10066 if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 &&
10067 codec->core.vendor_id == 0x10ec0294) {
10068 codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n");
10069 codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
10070 }
10071
0fc1e447 10072 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
7c0a6939 10073 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
efe55732
TI
10074 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
10075 alc269_fixups);
10076 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
10077
10078 alc_auto_parse_customize_define(codec);
10079
10080 if (has_cdefine_beep(codec))
10081 spec->gen.beep_nid = 0x01;
10082
a4297b5d
TI
10083 /* automatic parse from the BIOS config */
10084 err = alc269_parse_auto_config(codec);
e16fb6d1
TI
10085 if (err < 0)
10086 goto error;
6dda9f4a 10087
fea80fae
TI
10088 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
10089 err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
10090 if (err < 0)
10091 goto error;
10092 }
f1d4e28b 10093
1727a771 10094 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 10095
1d045db9 10096 return 0;
e16fb6d1
TI
10097
10098 error:
10099 alc_free(codec);
10100 return err;
1d045db9 10101}
f1d4e28b 10102
1d045db9
TI
10103/*
10104 * ALC861
10105 */
622e84cd 10106
1d045db9 10107static int alc861_parse_auto_config(struct hda_codec *codec)
6dda9f4a 10108{
1d045db9 10109 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
3e6179b8
TI
10110 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
10111 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
604401a9
TI
10112}
10113
1d045db9
TI
10114/* Pin config fixes */
10115enum {
e652f4c8
TI
10116 ALC861_FIXUP_FSC_AMILO_PI1505,
10117 ALC861_FIXUP_AMP_VREF_0F,
10118 ALC861_FIXUP_NO_JACK_DETECT,
10119 ALC861_FIXUP_ASUS_A6RP,
6ddf0fd1 10120 ALC660_FIXUP_ASUS_W7J,
1d045db9 10121};
7085ec12 10122
31150f23
TI
10123/* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
10124static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
1727a771 10125 const struct hda_fixup *fix, int action)
31150f23
TI
10126{
10127 struct alc_spec *spec = codec->spec;
10128 unsigned int val;
10129
1727a771 10130 if (action != HDA_FIXUP_ACT_INIT)
31150f23 10131 return;
d3f02d60 10132 val = snd_hda_codec_get_pin_target(codec, 0x0f);
31150f23
TI
10133 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
10134 val |= AC_PINCTL_IN_EN;
10135 val |= AC_PINCTL_VREF_50;
cdd03ced 10136 snd_hda_set_pin_ctl(codec, 0x0f, val);
08c189f2 10137 spec->gen.keep_vref_in_automute = 1;
31150f23
TI
10138}
10139
e652f4c8
TI
10140/* suppress the jack-detection */
10141static void alc_fixup_no_jack_detect(struct hda_codec *codec,
1727a771 10142 const struct hda_fixup *fix, int action)
e652f4c8 10143{
1727a771 10144 if (action == HDA_FIXUP_ACT_PRE_PROBE)
e652f4c8 10145 codec->no_jack_detect = 1;
7d7eb9ea 10146}
e652f4c8 10147
1727a771 10148static const struct hda_fixup alc861_fixups[] = {
e652f4c8 10149 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
1727a771
TI
10150 .type = HDA_FIXUP_PINS,
10151 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
10152 { 0x0b, 0x0221101f }, /* HP */
10153 { 0x0f, 0x90170310 }, /* speaker */
10154 { }
10155 }
10156 },
e652f4c8 10157 [ALC861_FIXUP_AMP_VREF_0F] = {
1727a771 10158 .type = HDA_FIXUP_FUNC,
31150f23 10159 .v.func = alc861_fixup_asus_amp_vref_0f,
3b25eb69 10160 },
e652f4c8 10161 [ALC861_FIXUP_NO_JACK_DETECT] = {
1727a771 10162 .type = HDA_FIXUP_FUNC,
e652f4c8
TI
10163 .v.func = alc_fixup_no_jack_detect,
10164 },
10165 [ALC861_FIXUP_ASUS_A6RP] = {
1727a771 10166 .type = HDA_FIXUP_FUNC,
e652f4c8
TI
10167 .v.func = alc861_fixup_asus_amp_vref_0f,
10168 .chained = true,
10169 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
6ddf0fd1
TI
10170 },
10171 [ALC660_FIXUP_ASUS_W7J] = {
10172 .type = HDA_FIXUP_VERBS,
10173 .v.verbs = (const struct hda_verb[]) {
10174 /* ASUS W7J needs a magic pin setup on unused NID 0x10
10175 * for enabling outputs
10176 */
10177 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10178 { }
10179 },
e652f4c8 10180 }
1d045db9 10181};
7085ec12 10182
1d045db9 10183static const struct snd_pci_quirk alc861_fixup_tbl[] = {
6ddf0fd1 10184 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
e7ca237b 10185 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
e652f4c8
TI
10186 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
10187 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
10188 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
defce244 10189 SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F),
e652f4c8 10190 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
1d045db9
TI
10191 {}
10192};
3af9ee6b 10193
1d045db9
TI
10194/*
10195 */
1d045db9 10196static int patch_alc861(struct hda_codec *codec)
7085ec12 10197{
1d045db9 10198 struct alc_spec *spec;
1d045db9 10199 int err;
7085ec12 10200
3de95173
TI
10201 err = alc_alloc_spec(codec, 0x15);
10202 if (err < 0)
10203 return err;
1d045db9 10204
3de95173 10205 spec = codec->spec;
2722b535
TI
10206 if (has_cdefine_beep(codec))
10207 spec->gen.beep_nid = 0x23;
1d045db9 10208
225068ab
TI
10209#ifdef CONFIG_PM
10210 spec->power_hook = alc_power_eapd;
10211#endif
10212
c9af753f
TI
10213 alc_pre_init(codec);
10214
1727a771
TI
10215 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
10216 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
3af9ee6b 10217
cb4e4824
TI
10218 /* automatic parse from the BIOS config */
10219 err = alc861_parse_auto_config(codec);
e16fb6d1
TI
10220 if (err < 0)
10221 goto error;
3af9ee6b 10222
fea80fae
TI
10223 if (!spec->gen.no_analog) {
10224 err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
10225 if (err < 0)
10226 goto error;
10227 }
7085ec12 10228
1727a771 10229 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 10230
1d045db9 10231 return 0;
e16fb6d1
TI
10232
10233 error:
10234 alc_free(codec);
10235 return err;
7085ec12
TI
10236}
10237
1d045db9
TI
10238/*
10239 * ALC861-VD support
10240 *
10241 * Based on ALC882
10242 *
10243 * In addition, an independent DAC
10244 */
1d045db9 10245static int alc861vd_parse_auto_config(struct hda_codec *codec)
bc9f98a9 10246{
1d045db9 10247 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
3e6179b8
TI
10248 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
10249 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
ce764ab2
TI
10250}
10251
1d045db9 10252enum {
8fdcb6fe
TI
10253 ALC660VD_FIX_ASUS_GPIO1,
10254 ALC861VD_FIX_DALLAS,
1d045db9 10255};
ce764ab2 10256
8fdcb6fe
TI
10257/* exclude VREF80 */
10258static void alc861vd_fixup_dallas(struct hda_codec *codec,
1727a771 10259 const struct hda_fixup *fix, int action)
8fdcb6fe 10260{
1727a771 10261 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
b78562b1
TI
10262 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
10263 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
8fdcb6fe
TI
10264 }
10265}
10266
df73d83f
TI
10267/* reset GPIO1 */
10268static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
10269 const struct hda_fixup *fix, int action)
10270{
10271 struct alc_spec *spec = codec->spec;
10272
10273 if (action == HDA_FIXUP_ACT_PRE_PROBE)
10274 spec->gpio_mask |= 0x02;
10275 alc_fixup_gpio(codec, action, 0x01);
10276}
10277
1727a771 10278static const struct hda_fixup alc861vd_fixups[] = {
1d045db9 10279 [ALC660VD_FIX_ASUS_GPIO1] = {
df73d83f
TI
10280 .type = HDA_FIXUP_FUNC,
10281 .v.func = alc660vd_fixup_asus_gpio1,
1d045db9 10282 },
8fdcb6fe 10283 [ALC861VD_FIX_DALLAS] = {
1727a771 10284 .type = HDA_FIXUP_FUNC,
8fdcb6fe
TI
10285 .v.func = alc861vd_fixup_dallas,
10286 },
1d045db9 10287};
ce764ab2 10288
1d045db9 10289static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
8fdcb6fe 10290 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
1d045db9 10291 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
8fdcb6fe 10292 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
1d045db9
TI
10293 {}
10294};
ce764ab2 10295
1d045db9
TI
10296/*
10297 */
1d045db9 10298static int patch_alc861vd(struct hda_codec *codec)
ce764ab2 10299{
1d045db9 10300 struct alc_spec *spec;
cb4e4824 10301 int err;
ce764ab2 10302
3de95173
TI
10303 err = alc_alloc_spec(codec, 0x0b);
10304 if (err < 0)
10305 return err;
1d045db9 10306
3de95173 10307 spec = codec->spec;
2722b535
TI
10308 if (has_cdefine_beep(codec))
10309 spec->gen.beep_nid = 0x23;
1d045db9 10310
225068ab
TI
10311 spec->shutup = alc_eapd_shutup;
10312
c9af753f
TI
10313 alc_pre_init(codec);
10314
1727a771
TI
10315 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
10316 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1d045db9 10317
cb4e4824
TI
10318 /* automatic parse from the BIOS config */
10319 err = alc861vd_parse_auto_config(codec);
e16fb6d1
TI
10320 if (err < 0)
10321 goto error;
ce764ab2 10322
fea80fae
TI
10323 if (!spec->gen.no_analog) {
10324 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10325 if (err < 0)
10326 goto error;
10327 }
1d045db9 10328
1727a771 10329 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 10330
ce764ab2 10331 return 0;
e16fb6d1
TI
10332
10333 error:
10334 alc_free(codec);
10335 return err;
ce764ab2
TI
10336}
10337
1d045db9
TI
10338/*
10339 * ALC662 support
10340 *
10341 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
10342 * configuration. Each pin widget can choose any input DACs and a mixer.
10343 * Each ADC is connected from a mixer of all inputs. This makes possible
10344 * 6-channel independent captures.
10345 *
10346 * In addition, an independent DAC for the multi-playback (not used in this
10347 * driver yet).
10348 */
1d045db9
TI
10349
10350/*
10351 * BIOS auto configuration
10352 */
10353
bc9f98a9
KY
10354static int alc662_parse_auto_config(struct hda_codec *codec)
10355{
4c6d72d1 10356 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
3e6179b8
TI
10357 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
10358 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
10359 const hda_nid_t *ssids;
ee979a14 10360
7639a06c
TI
10361 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
10362 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
10363 codec->core.vendor_id == 0x10ec0671)
3e6179b8 10364 ssids = alc663_ssids;
6227cdce 10365 else
3e6179b8
TI
10366 ssids = alc662_ssids;
10367 return alc_parse_auto_config(codec, alc662_ignore, ssids);
bc9f98a9
KY
10368}
10369
6be7948f 10370static void alc272_fixup_mario(struct hda_codec *codec,
1727a771 10371 const struct hda_fixup *fix, int action)
6fc398cb 10372{
9bb1f06f 10373 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6fc398cb 10374 return;
6be7948f
TB
10375 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
10376 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
10377 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
10378 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
10379 (0 << AC_AMPCAP_MUTE_SHIFT)))
4e76a883 10380 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
6be7948f
TB
10381}
10382
8e383953
TI
10383static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
10384 { .channels = 2,
10385 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
10386 { .channels = 4,
10387 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
10388 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
10389 { }
10390};
10391
10392/* override the 2.1 chmap */
eb9ca3ab 10393static void alc_fixup_bass_chmap(struct hda_codec *codec,
8e383953
TI
10394 const struct hda_fixup *fix, int action)
10395{
10396 if (action == HDA_FIXUP_ACT_BUILD) {
10397 struct alc_spec *spec = codec->spec;
bbbc7e85 10398 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
8e383953
TI
10399 }
10400}
10401
bf68665d
TI
10402/* avoid D3 for keeping GPIO up */
10403static unsigned int gpio_led_power_filter(struct hda_codec *codec,
10404 hda_nid_t nid,
10405 unsigned int power_state)
10406{
10407 struct alc_spec *spec = codec->spec;
d261eec8 10408 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
bf68665d
TI
10409 return AC_PWRST_D0;
10410 return power_state;
10411}
10412
3e887f37
TI
10413static void alc662_fixup_led_gpio1(struct hda_codec *codec,
10414 const struct hda_fixup *fix, int action)
10415{
10416 struct alc_spec *spec = codec->spec;
3e887f37 10417
01e4a275 10418 alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
3e887f37 10419 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
0f32fd19 10420 spec->mute_led_polarity = 1;
bf68665d 10421 codec->power_filter = gpio_led_power_filter;
3e887f37
TI
10422 }
10423}
10424
c6790c8e
KY
10425static void alc662_usi_automute_hook(struct hda_codec *codec,
10426 struct hda_jack_callback *jack)
10427{
10428 struct alc_spec *spec = codec->spec;
10429 int vref;
10430 msleep(200);
10431 snd_hda_gen_hp_automute(codec, jack);
10432
10433 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
10434 msleep(100);
10435 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10436 vref);
10437}
10438
10439static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
10440 const struct hda_fixup *fix, int action)
10441{
10442 struct alc_spec *spec = codec->spec;
10443 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10444 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
10445 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
10446 }
10447}
10448
00066e97
SB
10449static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
10450 struct hda_jack_callback *cb)
10451{
10452 /* surround speakers at 0x1b already get muted automatically when
10453 * headphones are plugged in, but we have to mute/unmute the remaining
10454 * channels manually:
10455 * 0x15 - front left/front right
10456 * 0x18 - front center/ LFE
10457 */
10458 if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
10459 snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
10460 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
10461 } else {
10462 snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
10463 snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
10464 }
10465}
10466
10467static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
10468 const struct hda_fixup *fix, int action)
10469{
10470 /* Pin 0x1b: shared headphones jack and surround speakers */
10471 if (!is_jack_detectable(codec, 0x1b))
10472 return;
10473
10474 switch (action) {
10475 case HDA_FIXUP_ACT_PRE_PROBE:
10476 snd_hda_jack_detect_enable_callback(codec, 0x1b,
10477 alc662_aspire_ethos_mute_speakers);
336820c4
TI
10478 /* subwoofer needs an extra GPIO setting to become audible */
10479 alc_setup_gpio(codec, 0x02);
00066e97
SB
10480 break;
10481 case HDA_FIXUP_ACT_INIT:
10482 /* Make sure to start in a correct state, i.e. if
10483 * headphones have been plugged in before powering up the system
10484 */
10485 alc662_aspire_ethos_mute_speakers(codec, NULL);
10486 break;
10487 }
10488}
10489
5af29028
KY
10490static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
10491 const struct hda_fixup *fix, int action)
10492{
10493 struct alc_spec *spec = codec->spec;
10494
10495 static const struct hda_pintbl pincfgs[] = {
10496 { 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
10497 { 0x1b, 0x0181304f },
10498 { }
10499 };
10500
10501 switch (action) {
10502 case HDA_FIXUP_ACT_PRE_PROBE:
10503 spec->gen.mixer_nid = 0;
10504 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
10505 snd_hda_apply_pincfgs(codec, pincfgs);
10506 break;
10507 case HDA_FIXUP_ACT_INIT:
10508 alc_write_coef_idx(codec, 0x19, 0xa054);
10509 break;
10510 }
10511}
10512
d7f32791
KY
10513static void alc897_hp_automute_hook(struct hda_codec *codec,
10514 struct hda_jack_callback *jack)
10515{
10516 struct alc_spec *spec = codec->spec;
10517 int vref;
10518
10519 snd_hda_gen_hp_automute(codec, jack);
10520 vref = spec->gen.hp_jack_present ? (PIN_HP | AC_PINCTL_VREF_100) : PIN_HP;
10521 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10522 vref);
10523}
10524
10525static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec,
10526 const struct hda_fixup *fix, int action)
10527{
10528 struct alc_spec *spec = codec->spec;
10529 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10530 spec->gen.hp_automute_hook = alc897_hp_automute_hook;
10531 }
10532}
10533
6b0f95c4 10534static const struct coef_fw alc668_coefs[] = {
f3f9185f
KY
10535 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
10536 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
10537 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
10538 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
10539 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
10540 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
10541 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
10542 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
10543 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
10544 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
10545 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
10546 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
10547 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
10548 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
10549 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
10550 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
10551 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
10552 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
10553 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
10554 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
10555 {}
10556};
10557
10558static void alc668_restore_default_value(struct hda_codec *codec)
10559{
10560 alc_process_coef_fw(codec, alc668_coefs);
10561}
10562
6cb3b707 10563enum {
2df03514 10564 ALC662_FIXUP_ASPIRE,
3e887f37 10565 ALC662_FIXUP_LED_GPIO1,
6cb3b707 10566 ALC662_FIXUP_IDEAPAD,
6be7948f 10567 ALC272_FIXUP_MARIO,
f1ec5be1 10568 ALC662_FIXUP_CZC_ET26,
d2ebd479 10569 ALC662_FIXUP_CZC_P10T,
94024cd1 10570 ALC662_FIXUP_SKU_IGNORE,
e59ea3ed 10571 ALC662_FIXUP_HP_RP5800,
53c334ad
TI
10572 ALC662_FIXUP_ASUS_MODE1,
10573 ALC662_FIXUP_ASUS_MODE2,
10574 ALC662_FIXUP_ASUS_MODE3,
10575 ALC662_FIXUP_ASUS_MODE4,
10576 ALC662_FIXUP_ASUS_MODE5,
10577 ALC662_FIXUP_ASUS_MODE6,
10578 ALC662_FIXUP_ASUS_MODE7,
10579 ALC662_FIXUP_ASUS_MODE8,
1565cc35 10580 ALC662_FIXUP_NO_JACK_DETECT,
edfe3bfc 10581 ALC662_FIXUP_ZOTAC_Z68,
125821ae 10582 ALC662_FIXUP_INV_DMIC,
1f8b46cd 10583 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
73bdd597 10584 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
1f8b46cd 10585 ALC662_FIXUP_HEADSET_MODE,
73bdd597 10586 ALC668_FIXUP_HEADSET_MODE,
8e54b4ac 10587 ALC662_FIXUP_BASS_MODE4_CHMAP,
61a75f13 10588 ALC662_FIXUP_BASS_16,
a30c9aaa 10589 ALC662_FIXUP_BASS_1A,
8e54b4ac 10590 ALC662_FIXUP_BASS_CHMAP,
493a52a9 10591 ALC668_FIXUP_AUTO_MUTE,
5e6db669 10592 ALC668_FIXUP_DELL_DISABLE_AAMIX,
033b0a7c 10593 ALC668_FIXUP_DELL_XPS13,
9d4dc584 10594 ALC662_FIXUP_ASUS_Nx50,
fc7438b1 10595 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
3231e205 10596 ALC668_FIXUP_ASUS_Nx51,
5b7c5e1f 10597 ALC668_FIXUP_MIC_COEF,
11ba6111 10598 ALC668_FIXUP_ASUS_G751,
78f4f7c2
KY
10599 ALC891_FIXUP_HEADSET_MODE,
10600 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
9b51fe3e 10601 ALC662_FIXUP_ACER_VERITON,
1a3f0991 10602 ALC892_FIXUP_ASROCK_MOBO,
c6790c8e
KY
10603 ALC662_FIXUP_USI_FUNC,
10604 ALC662_FIXUP_USI_HEADSET_MODE,
ca169cc2 10605 ALC662_FIXUP_LENOVO_MULTI_CODECS,
00066e97 10606 ALC669_FIXUP_ACER_ASPIRE_ETHOS,
00066e97 10607 ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
5af29028 10608 ALC671_FIXUP_HP_HEADSET_MIC2,
d858c706 10609 ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
a124458a 10610 ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
a3fd1a98
HW
10611 ALC668_FIXUP_ASUS_NO_HEADSET_MIC,
10612 ALC668_FIXUP_HEADSET_MIC,
10613 ALC668_FIXUP_MIC_DET_COEF,
d7f32791
KY
10614 ALC897_FIXUP_LENOVO_HEADSET_MIC,
10615 ALC897_FIXUP_HEADSET_MIC_PIN,
6cb3b707
DH
10616};
10617
1727a771 10618static const struct hda_fixup alc662_fixups[] = {
2df03514 10619 [ALC662_FIXUP_ASPIRE] = {
1727a771
TI
10620 .type = HDA_FIXUP_PINS,
10621 .v.pins = (const struct hda_pintbl[]) {
2df03514
DC
10622 { 0x15, 0x99130112 }, /* subwoofer */
10623 { }
10624 }
10625 },
3e887f37
TI
10626 [ALC662_FIXUP_LED_GPIO1] = {
10627 .type = HDA_FIXUP_FUNC,
10628 .v.func = alc662_fixup_led_gpio1,
10629 },
6cb3b707 10630 [ALC662_FIXUP_IDEAPAD] = {
1727a771
TI
10631 .type = HDA_FIXUP_PINS,
10632 .v.pins = (const struct hda_pintbl[]) {
6cb3b707
DH
10633 { 0x17, 0x99130112 }, /* subwoofer */
10634 { }
3e887f37
TI
10635 },
10636 .chained = true,
10637 .chain_id = ALC662_FIXUP_LED_GPIO1,
6cb3b707 10638 },
6be7948f 10639 [ALC272_FIXUP_MARIO] = {
1727a771 10640 .type = HDA_FIXUP_FUNC,
b5bfbc67 10641 .v.func = alc272_fixup_mario,
d2ebd479 10642 },
f1ec5be1
HC
10643 [ALC662_FIXUP_CZC_ET26] = {
10644 .type = HDA_FIXUP_PINS,
10645 .v.pins = (const struct hda_pintbl[]) {
10646 {0x12, 0x403cc000},
10647 {0x14, 0x90170110}, /* speaker */
10648 {0x15, 0x411111f0},
10649 {0x16, 0x411111f0},
10650 {0x18, 0x01a19030}, /* mic */
10651 {0x19, 0x90a7013f}, /* int-mic */
10652 {0x1a, 0x01014020},
10653 {0x1b, 0x0121401f},
10654 {0x1c, 0x411111f0},
10655 {0x1d, 0x411111f0},
10656 {0x1e, 0x40478e35},
10657 {}
10658 },
10659 .chained = true,
10660 .chain_id = ALC662_FIXUP_SKU_IGNORE
10661 },
d2ebd479 10662 [ALC662_FIXUP_CZC_P10T] = {
1727a771 10663 .type = HDA_FIXUP_VERBS,
d2ebd479
AA
10664 .v.verbs = (const struct hda_verb[]) {
10665 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
10666 {}
10667 }
10668 },
94024cd1 10669 [ALC662_FIXUP_SKU_IGNORE] = {
1727a771 10670 .type = HDA_FIXUP_FUNC,
23d30f28 10671 .v.func = alc_fixup_sku_ignore,
c6b35874 10672 },
e59ea3ed 10673 [ALC662_FIXUP_HP_RP5800] = {
1727a771
TI
10674 .type = HDA_FIXUP_PINS,
10675 .v.pins = (const struct hda_pintbl[]) {
e59ea3ed
TI
10676 { 0x14, 0x0221201f }, /* HP out */
10677 { }
10678 },
10679 .chained = true,
10680 .chain_id = ALC662_FIXUP_SKU_IGNORE
10681 },
53c334ad 10682 [ALC662_FIXUP_ASUS_MODE1] = {
1727a771
TI
10683 .type = HDA_FIXUP_PINS,
10684 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
10685 { 0x14, 0x99130110 }, /* speaker */
10686 { 0x18, 0x01a19c20 }, /* mic */
10687 { 0x19, 0x99a3092f }, /* int-mic */
10688 { 0x21, 0x0121401f }, /* HP out */
10689 { }
10690 },
10691 .chained = true,
10692 .chain_id = ALC662_FIXUP_SKU_IGNORE
10693 },
10694 [ALC662_FIXUP_ASUS_MODE2] = {
1727a771
TI
10695 .type = HDA_FIXUP_PINS,
10696 .v.pins = (const struct hda_pintbl[]) {
2996bdba
TI
10697 { 0x14, 0x99130110 }, /* speaker */
10698 { 0x18, 0x01a19820 }, /* mic */
10699 { 0x19, 0x99a3092f }, /* int-mic */
10700 { 0x1b, 0x0121401f }, /* HP out */
10701 { }
10702 },
53c334ad
TI
10703 .chained = true,
10704 .chain_id = ALC662_FIXUP_SKU_IGNORE
10705 },
10706 [ALC662_FIXUP_ASUS_MODE3] = {
1727a771
TI
10707 .type = HDA_FIXUP_PINS,
10708 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
10709 { 0x14, 0x99130110 }, /* speaker */
10710 { 0x15, 0x0121441f }, /* HP */
10711 { 0x18, 0x01a19840 }, /* mic */
10712 { 0x19, 0x99a3094f }, /* int-mic */
10713 { 0x21, 0x01211420 }, /* HP2 */
10714 { }
10715 },
10716 .chained = true,
10717 .chain_id = ALC662_FIXUP_SKU_IGNORE
10718 },
10719 [ALC662_FIXUP_ASUS_MODE4] = {
1727a771
TI
10720 .type = HDA_FIXUP_PINS,
10721 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
10722 { 0x14, 0x99130110 }, /* speaker */
10723 { 0x16, 0x99130111 }, /* speaker */
10724 { 0x18, 0x01a19840 }, /* mic */
10725 { 0x19, 0x99a3094f }, /* int-mic */
10726 { 0x21, 0x0121441f }, /* HP */
10727 { }
10728 },
10729 .chained = true,
10730 .chain_id = ALC662_FIXUP_SKU_IGNORE
10731 },
10732 [ALC662_FIXUP_ASUS_MODE5] = {
1727a771
TI
10733 .type = HDA_FIXUP_PINS,
10734 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
10735 { 0x14, 0x99130110 }, /* speaker */
10736 { 0x15, 0x0121441f }, /* HP */
10737 { 0x16, 0x99130111 }, /* speaker */
10738 { 0x18, 0x01a19840 }, /* mic */
10739 { 0x19, 0x99a3094f }, /* int-mic */
10740 { }
10741 },
10742 .chained = true,
10743 .chain_id = ALC662_FIXUP_SKU_IGNORE
10744 },
10745 [ALC662_FIXUP_ASUS_MODE6] = {
1727a771
TI
10746 .type = HDA_FIXUP_PINS,
10747 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
10748 { 0x14, 0x99130110 }, /* speaker */
10749 { 0x15, 0x01211420 }, /* HP2 */
10750 { 0x18, 0x01a19840 }, /* mic */
10751 { 0x19, 0x99a3094f }, /* int-mic */
10752 { 0x1b, 0x0121441f }, /* HP */
10753 { }
10754 },
10755 .chained = true,
10756 .chain_id = ALC662_FIXUP_SKU_IGNORE
10757 },
10758 [ALC662_FIXUP_ASUS_MODE7] = {
1727a771
TI
10759 .type = HDA_FIXUP_PINS,
10760 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
10761 { 0x14, 0x99130110 }, /* speaker */
10762 { 0x17, 0x99130111 }, /* speaker */
10763 { 0x18, 0x01a19840 }, /* mic */
10764 { 0x19, 0x99a3094f }, /* int-mic */
10765 { 0x1b, 0x01214020 }, /* HP */
10766 { 0x21, 0x0121401f }, /* HP */
10767 { }
10768 },
10769 .chained = true,
10770 .chain_id = ALC662_FIXUP_SKU_IGNORE
10771 },
10772 [ALC662_FIXUP_ASUS_MODE8] = {
1727a771
TI
10773 .type = HDA_FIXUP_PINS,
10774 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
10775 { 0x14, 0x99130110 }, /* speaker */
10776 { 0x12, 0x99a30970 }, /* int-mic */
10777 { 0x15, 0x01214020 }, /* HP */
10778 { 0x17, 0x99130111 }, /* speaker */
10779 { 0x18, 0x01a19840 }, /* mic */
10780 { 0x21, 0x0121401f }, /* HP */
10781 { }
10782 },
10783 .chained = true,
10784 .chain_id = ALC662_FIXUP_SKU_IGNORE
2996bdba 10785 },
1565cc35 10786 [ALC662_FIXUP_NO_JACK_DETECT] = {
1727a771 10787 .type = HDA_FIXUP_FUNC,
1565cc35
TI
10788 .v.func = alc_fixup_no_jack_detect,
10789 },
edfe3bfc 10790 [ALC662_FIXUP_ZOTAC_Z68] = {
1727a771
TI
10791 .type = HDA_FIXUP_PINS,
10792 .v.pins = (const struct hda_pintbl[]) {
edfe3bfc
DH
10793 { 0x1b, 0x02214020 }, /* Front HP */
10794 { }
10795 }
10796 },
125821ae 10797 [ALC662_FIXUP_INV_DMIC] = {
1727a771 10798 .type = HDA_FIXUP_FUNC,
9d36a7dc 10799 .v.func = alc_fixup_inv_dmic,
125821ae 10800 },
033b0a7c
GM
10801 [ALC668_FIXUP_DELL_XPS13] = {
10802 .type = HDA_FIXUP_FUNC,
10803 .v.func = alc_fixup_dell_xps13,
10804 .chained = true,
10805 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
10806 },
5e6db669
GM
10807 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
10808 .type = HDA_FIXUP_FUNC,
10809 .v.func = alc_fixup_disable_aamix,
10810 .chained = true,
10811 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
10812 },
493a52a9
HW
10813 [ALC668_FIXUP_AUTO_MUTE] = {
10814 .type = HDA_FIXUP_FUNC,
10815 .v.func = alc_fixup_auto_mute_via_amp,
10816 .chained = true,
10817 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
10818 },
1f8b46cd
DH
10819 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
10820 .type = HDA_FIXUP_PINS,
10821 .v.pins = (const struct hda_pintbl[]) {
10822 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10823 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
10824 { }
10825 },
10826 .chained = true,
10827 .chain_id = ALC662_FIXUP_HEADSET_MODE
10828 },
10829 [ALC662_FIXUP_HEADSET_MODE] = {
10830 .type = HDA_FIXUP_FUNC,
10831 .v.func = alc_fixup_headset_mode_alc662,
10832 },
73bdd597
DH
10833 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
10834 .type = HDA_FIXUP_PINS,
10835 .v.pins = (const struct hda_pintbl[]) {
10836 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10837 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10838 { }
10839 },
10840 .chained = true,
10841 .chain_id = ALC668_FIXUP_HEADSET_MODE
10842 },
10843 [ALC668_FIXUP_HEADSET_MODE] = {
10844 .type = HDA_FIXUP_FUNC,
10845 .v.func = alc_fixup_headset_mode_alc668,
10846 },
8e54b4ac 10847 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
8e383953 10848 .type = HDA_FIXUP_FUNC,
eb9ca3ab 10849 .v.func = alc_fixup_bass_chmap,
8e383953
TI
10850 .chained = true,
10851 .chain_id = ALC662_FIXUP_ASUS_MODE4
10852 },
61a75f13
DH
10853 [ALC662_FIXUP_BASS_16] = {
10854 .type = HDA_FIXUP_PINS,
10855 .v.pins = (const struct hda_pintbl[]) {
10856 {0x16, 0x80106111}, /* bass speaker */
10857 {}
10858 },
10859 .chained = true,
10860 .chain_id = ALC662_FIXUP_BASS_CHMAP,
10861 },
a30c9aaa
TI
10862 [ALC662_FIXUP_BASS_1A] = {
10863 .type = HDA_FIXUP_PINS,
10864 .v.pins = (const struct hda_pintbl[]) {
10865 {0x1a, 0x80106111}, /* bass speaker */
10866 {}
10867 },
8e54b4ac
DH
10868 .chained = true,
10869 .chain_id = ALC662_FIXUP_BASS_CHMAP,
a30c9aaa 10870 },
8e54b4ac 10871 [ALC662_FIXUP_BASS_CHMAP] = {
a30c9aaa 10872 .type = HDA_FIXUP_FUNC,
eb9ca3ab 10873 .v.func = alc_fixup_bass_chmap,
a30c9aaa 10874 },
9d4dc584
BM
10875 [ALC662_FIXUP_ASUS_Nx50] = {
10876 .type = HDA_FIXUP_FUNC,
10877 .v.func = alc_fixup_auto_mute_via_amp,
10878 .chained = true,
10879 .chain_id = ALC662_FIXUP_BASS_1A
10880 },
fc7438b1
MP
10881 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
10882 .type = HDA_FIXUP_FUNC,
10883 .v.func = alc_fixup_headset_mode_alc668,
10884 .chain_id = ALC662_FIXUP_BASS_CHMAP
10885 },
3231e205
YP
10886 [ALC668_FIXUP_ASUS_Nx51] = {
10887 .type = HDA_FIXUP_PINS,
10888 .v.pins = (const struct hda_pintbl[]) {
fc7438b1
MP
10889 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10890 { 0x1a, 0x90170151 }, /* bass speaker */
10891 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
3231e205
YP
10892 {}
10893 },
10894 .chained = true,
fc7438b1 10895 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
3231e205 10896 },
5b7c5e1f 10897 [ALC668_FIXUP_MIC_COEF] = {
11ba6111
TI
10898 .type = HDA_FIXUP_VERBS,
10899 .v.verbs = (const struct hda_verb[]) {
10900 { 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
10901 { 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
10902 {}
10903 },
10904 },
5b7c5e1f
TI
10905 [ALC668_FIXUP_ASUS_G751] = {
10906 .type = HDA_FIXUP_PINS,
10907 .v.pins = (const struct hda_pintbl[]) {
10908 { 0x16, 0x0421101f }, /* HP */
10909 {}
10910 },
10911 .chained = true,
10912 .chain_id = ALC668_FIXUP_MIC_COEF
10913 },
78f4f7c2
KY
10914 [ALC891_FIXUP_HEADSET_MODE] = {
10915 .type = HDA_FIXUP_FUNC,
10916 .v.func = alc_fixup_headset_mode,
10917 },
10918 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
10919 .type = HDA_FIXUP_PINS,
10920 .v.pins = (const struct hda_pintbl[]) {
10921 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10922 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10923 { }
10924 },
10925 .chained = true,
10926 .chain_id = ALC891_FIXUP_HEADSET_MODE
10927 },
9b51fe3e
SB
10928 [ALC662_FIXUP_ACER_VERITON] = {
10929 .type = HDA_FIXUP_PINS,
10930 .v.pins = (const struct hda_pintbl[]) {
10931 { 0x15, 0x50170120 }, /* no internal speaker */
10932 { }
10933 }
10934 },
1a3f0991
TI
10935 [ALC892_FIXUP_ASROCK_MOBO] = {
10936 .type = HDA_FIXUP_PINS,
10937 .v.pins = (const struct hda_pintbl[]) {
10938 { 0x15, 0x40f000f0 }, /* disabled */
10939 { 0x16, 0x40f000f0 }, /* disabled */
1a3f0991
TI
10940 { }
10941 }
10942 },
c6790c8e
KY
10943 [ALC662_FIXUP_USI_FUNC] = {
10944 .type = HDA_FIXUP_FUNC,
10945 .v.func = alc662_fixup_usi_headset_mic,
10946 },
10947 [ALC662_FIXUP_USI_HEADSET_MODE] = {
10948 .type = HDA_FIXUP_PINS,
10949 .v.pins = (const struct hda_pintbl[]) {
10950 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
10951 { 0x18, 0x01a1903d },
10952 { }
10953 },
10954 .chained = true,
10955 .chain_id = ALC662_FIXUP_USI_FUNC
10956 },
ca169cc2
KY
10957 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
10958 .type = HDA_FIXUP_FUNC,
10959 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
10960 },
00066e97
SB
10961 [ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
10962 .type = HDA_FIXUP_FUNC,
10963 .v.func = alc662_fixup_aspire_ethos_hp,
10964 },
00066e97
SB
10965 [ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
10966 .type = HDA_FIXUP_PINS,
10967 .v.pins = (const struct hda_pintbl[]) {
10968 { 0x15, 0x92130110 }, /* front speakers */
10969 { 0x18, 0x99130111 }, /* center/subwoofer */
10970 { 0x1b, 0x11130012 }, /* surround plus jack for HP */
10971 { }
10972 },
10973 .chained = true,
336820c4 10974 .chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
00066e97 10975 },
5af29028
KY
10976 [ALC671_FIXUP_HP_HEADSET_MIC2] = {
10977 .type = HDA_FIXUP_FUNC,
10978 .v.func = alc671_fixup_hp_headset_mic2,
10979 },
d858c706
JHP
10980 [ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
10981 .type = HDA_FIXUP_PINS,
10982 .v.pins = (const struct hda_pintbl[]) {
10983 { 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
10984 { }
10985 },
10986 .chained = true,
10987 .chain_id = ALC662_FIXUP_USI_FUNC
10988 },
a124458a
JHP
10989 [ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
10990 .type = HDA_FIXUP_PINS,
10991 .v.pins = (const struct hda_pintbl[]) {
10992 { 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
10993 { 0x1b, 0x0221144f },
10994 { }
10995 },
10996 .chained = true,
10997 .chain_id = ALC662_FIXUP_USI_FUNC
10998 },
a3fd1a98
HW
10999 [ALC668_FIXUP_ASUS_NO_HEADSET_MIC] = {
11000 .type = HDA_FIXUP_PINS,
11001 .v.pins = (const struct hda_pintbl[]) {
11002 { 0x1b, 0x04a1112c },
11003 { }
11004 },
11005 .chained = true,
11006 .chain_id = ALC668_FIXUP_HEADSET_MIC
11007 },
11008 [ALC668_FIXUP_HEADSET_MIC] = {
11009 .type = HDA_FIXUP_FUNC,
11010 .v.func = alc269_fixup_headset_mic,
11011 .chained = true,
11012 .chain_id = ALC668_FIXUP_MIC_DET_COEF
11013 },
11014 [ALC668_FIXUP_MIC_DET_COEF] = {
11015 .type = HDA_FIXUP_VERBS,
11016 .v.verbs = (const struct hda_verb[]) {
11017 { 0x20, AC_VERB_SET_COEF_INDEX, 0x15 },
11018 { 0x20, AC_VERB_SET_PROC_COEF, 0x0d60 },
11019 {}
11020 },
11021 },
d7f32791
KY
11022 [ALC897_FIXUP_LENOVO_HEADSET_MIC] = {
11023 .type = HDA_FIXUP_FUNC,
11024 .v.func = alc897_fixup_lenovo_headset_mic,
11025 },
11026 [ALC897_FIXUP_HEADSET_MIC_PIN] = {
11027 .type = HDA_FIXUP_PINS,
11028 .v.pins = (const struct hda_pintbl[]) {
11029 { 0x1a, 0x03a11050 },
11030 { }
11031 },
11032 .chained = true,
11033 .chain_id = ALC897_FIXUP_LENOVO_HEADSET_MIC
11034 },
6cb3b707
DH
11035};
11036
a9111321 11037static const struct snd_pci_quirk alc662_fixup_tbl[] = {
53c334ad 11038 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
d3d3835c 11039 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
02f6ff90 11040 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
a6c47a85 11041 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
94024cd1 11042 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
125821ae 11043 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
1801928e 11044 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
2df03514 11045 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
9edeb110 11046 SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
a124458a 11047 SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
d858c706 11048 SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
73bdd597
DH
11049 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
11050 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
c5d019c3 11051 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
033b0a7c 11052 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
467e1436 11053 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
09d2014f 11054 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
ad8ff99e 11055 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8dc9abb9
KY
11056 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
11057 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
6a98e34b 11058 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
e59ea3ed 11059 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
148ebf54 11060 SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
2da2dc9e 11061 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
83a9efb5 11062 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
9d4dc584 11063 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
11ba6111 11064 SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
9edeb110 11065 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
8e54b4ac 11066 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
61a75f13 11067 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
3231e205
YP
11068 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
11069 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
a3fd1a98 11070 SND_PCI_QUIRK(0x1043, 0x185d, "ASUS G551JW", ALC668_FIXUP_ASUS_NO_HEADSET_MIC),
c7efff92 11071 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
61a75f13 11072 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
8e54b4ac 11073 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
1565cc35 11074 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
53c334ad 11075 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
a0e90acc 11076 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
c6790c8e 11077 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
ca169cc2 11078 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
d7f32791
KY
11079 SND_PCI_QUIRK(0x17aa, 0x32ca, "Lenovo ThinkCentre M80", ALC897_FIXUP_HEADSET_MIC_PIN),
11080 SND_PCI_QUIRK(0x17aa, 0x32cb, "Lenovo ThinkCentre M70", ALC897_FIXUP_HEADSET_MIC_PIN),
11081 SND_PCI_QUIRK(0x17aa, 0x32cf, "Lenovo ThinkCentre M950", ALC897_FIXUP_HEADSET_MIC_PIN),
11082 SND_PCI_QUIRK(0x17aa, 0x32f7, "Lenovo ThinkCentre M90", ALC897_FIXUP_HEADSET_MIC_PIN),
d4118588 11083 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
6cb3b707 11084 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
1a3f0991 11085 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
edfe3bfc 11086 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
9b51fe3e 11087 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
f1ec5be1 11088 SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
d2ebd479 11089 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
53c334ad
TI
11090
11091#if 0
11092 /* Below is a quirk table taken from the old code.
11093 * Basically the device should work as is without the fixup table.
11094 * If BIOS doesn't give a proper info, enable the corresponding
11095 * fixup entry.
7d7eb9ea 11096 */
53c334ad
TI
11097 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
11098 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
11099 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
11100 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
11101 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
11102 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11103 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
11104 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
11105 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
11106 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11107 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
11108 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
11109 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
11110 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
11111 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
11112 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11113 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
11114 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
11115 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11116 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
11117 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
11118 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11119 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
11120 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
11121 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
11122 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11123 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
11124 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
11125 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11126 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
11127 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11128 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11129 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
11130 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
11131 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
11132 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
11133 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
11134 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
11135 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
11136 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11137 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
11138 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
11139 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
11140 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
11141 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
11142 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
11143 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
11144 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
11145 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
11146 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
11147#endif
6cb3b707
DH
11148 {}
11149};
11150
1727a771 11151static const struct hda_model_fixup alc662_fixup_models[] = {
aa3841b5
TI
11152 {.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
11153 {.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
6be7948f 11154 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
aa3841b5 11155 {.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
53c334ad
TI
11156 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
11157 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
11158 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
11159 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
11160 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
11161 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
11162 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
11163 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
aa3841b5 11164 {.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
6e72aa5f 11165 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
aa3841b5 11166 {.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
e32aa85a 11167 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
aa3841b5
TI
11168 {.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
11169 {.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
11170 {.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
11171 {.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
11172 {.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
11173 {.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
11174 {.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
11175 {.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
40c51675 11176 {.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
aa3841b5
TI
11177 {.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
11178 {.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
11179 {.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
11180 {.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
11181 {.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
ba90d6a6 11182 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
00066e97 11183 {.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
6be7948f
TB
11184 {}
11185};
6cb3b707 11186
532895c5 11187static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
78f4f7c2
KY
11188 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
11189 {0x17, 0x02211010},
11190 {0x18, 0x01a19030},
11191 {0x1a, 0x01813040},
11192 {0x21, 0x01014020}),
4b4e0e32
HW
11193 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
11194 {0x16, 0x01813030},
11195 {0x17, 0x02211010},
11196 {0x18, 0x01a19040},
11197 {0x21, 0x01014020}),
1f8b46cd 11198 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
1f8b46cd 11199 {0x14, 0x01014010},
1f8b46cd 11200 {0x18, 0x01a19020},
1f8b46cd 11201 {0x1a, 0x0181302f},
11580297 11202 {0x1b, 0x0221401f}),
76c2132e
DH
11203 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
11204 {0x12, 0x99a30130},
11205 {0x14, 0x90170110},
11206 {0x15, 0x0321101f},
11580297 11207 {0x16, 0x03011020}),
76c2132e
DH
11208 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
11209 {0x12, 0x99a30140},
11210 {0x14, 0x90170110},
11211 {0x15, 0x0321101f},
11580297 11212 {0x16, 0x03011020}),
76c2132e
DH
11213 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
11214 {0x12, 0x99a30150},
11215 {0x14, 0x90170110},
11216 {0x15, 0x0321101f},
11580297 11217 {0x16, 0x03011020}),
76c2132e 11218 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
76c2132e
DH
11219 {0x14, 0x90170110},
11220 {0x15, 0x0321101f},
11580297 11221 {0x16, 0x03011020}),
76c2132e
DH
11222 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
11223 {0x12, 0x90a60130},
11224 {0x14, 0x90170110},
11580297 11225 {0x15, 0x0321101f}),
5af29028
KY
11226 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
11227 {0x14, 0x01014010},
11228 {0x17, 0x90170150},
f2adbae0 11229 {0x19, 0x02a11060},
5af29028
KY
11230 {0x1b, 0x01813030},
11231 {0x21, 0x02211020}),
11232 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
11233 {0x14, 0x01014010},
11234 {0x18, 0x01a19040},
11235 {0x1b, 0x01813030},
11236 {0x21, 0x02211020}),
11237 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
11238 {0x14, 0x01014020},
11239 {0x17, 0x90170110},
11240 {0x18, 0x01a19050},
11241 {0x1b, 0x01813040},
11242 {0x21, 0x02211030}),
532895c5
HW
11243 {}
11244};
11245
1d045db9
TI
11246/*
11247 */
bc9f98a9
KY
11248static int patch_alc662(struct hda_codec *codec)
11249{
11250 struct alc_spec *spec;
3de95173 11251 int err;
bc9f98a9 11252
3de95173
TI
11253 err = alc_alloc_spec(codec, 0x0b);
11254 if (err < 0)
11255 return err;
bc9f98a9 11256
3de95173 11257 spec = codec->spec;
1f0f4b80 11258
225068ab
TI
11259 spec->shutup = alc_eapd_shutup;
11260
53c334ad
TI
11261 /* handle multiple HPs as is */
11262 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
11263
2c3bf9ab
TI
11264 alc_fix_pll_init(codec, 0x20, 0x04, 15);
11265
7639a06c 11266 switch (codec->core.vendor_id) {
f3f9185f
KY
11267 case 0x10ec0668:
11268 spec->init_hook = alc668_restore_default_value;
11269 break;
f3f9185f 11270 }
8663ff75 11271
c9af753f
TI
11272 alc_pre_init(codec);
11273
1727a771 11274 snd_hda_pick_fixup(codec, alc662_fixup_models,
8e5a0509 11275 alc662_fixup_tbl, alc662_fixups);
0fc1e447 11276 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
1727a771 11277 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
8e5a0509
TI
11278
11279 alc_auto_parse_customize_define(codec);
11280
7504b6cd
TI
11281 if (has_cdefine_beep(codec))
11282 spec->gen.beep_nid = 0x01;
11283
1bb7e43e 11284 if ((alc_get_coef0(codec) & (1 << 14)) &&
5100cd07 11285 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
e16fb6d1 11286 spec->cdefine.platform_type == 1) {
6134b1a2
WY
11287 err = alc_codec_rename(codec, "ALC272X");
11288 if (err < 0)
e16fb6d1 11289 goto error;
20ca0c35 11290 }
274693f3 11291
b9c5106c
TI
11292 /* automatic parse from the BIOS config */
11293 err = alc662_parse_auto_config(codec);
e16fb6d1
TI
11294 if (err < 0)
11295 goto error;
bc9f98a9 11296
7504b6cd 11297 if (!spec->gen.no_analog && spec->gen.beep_nid) {
7639a06c 11298 switch (codec->core.vendor_id) {
da00c244 11299 case 0x10ec0662:
fea80fae 11300 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
da00c244
KY
11301 break;
11302 case 0x10ec0272:
11303 case 0x10ec0663:
11304 case 0x10ec0665:
9ad54547 11305 case 0x10ec0668:
fea80fae 11306 err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
da00c244
KY
11307 break;
11308 case 0x10ec0273:
fea80fae 11309 err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
da00c244
KY
11310 break;
11311 }
fea80fae
TI
11312 if (err < 0)
11313 goto error;
cec27c89 11314 }
2134ea4f 11315
1727a771 11316 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 11317
bc9f98a9 11318 return 0;
801f49d3 11319
e16fb6d1
TI
11320 error:
11321 alc_free(codec);
11322 return err;
b478b998
KY
11323}
11324
d1eb57f4
KY
11325/*
11326 * ALC680 support
11327 */
d1eb57f4 11328
d1eb57f4
KY
11329static int alc680_parse_auto_config(struct hda_codec *codec)
11330{
3e6179b8 11331 return alc_parse_auto_config(codec, NULL, NULL);
d1eb57f4
KY
11332}
11333
d1eb57f4 11334/*
d1eb57f4 11335 */
d1eb57f4
KY
11336static int patch_alc680(struct hda_codec *codec)
11337{
d1eb57f4
KY
11338 int err;
11339
1f0f4b80 11340 /* ALC680 has no aa-loopback mixer */
3de95173
TI
11341 err = alc_alloc_spec(codec, 0);
11342 if (err < 0)
11343 return err;
1f0f4b80 11344
1ebec5f2
TI
11345 /* automatic parse from the BIOS config */
11346 err = alc680_parse_auto_config(codec);
11347 if (err < 0) {
11348 alc_free(codec);
11349 return err;
d1eb57f4
KY
11350 }
11351
d1eb57f4
KY
11352 return 0;
11353}
11354
1da177e4
LT
11355/*
11356 * patch entries
11357 */
b9a94a9c 11358static const struct hda_device_id snd_hda_id_realtek[] = {
0a6f0600 11359 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
b9a94a9c 11360 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
2a36c16e 11361 HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
4231430d 11362 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
1948fc06 11363 HDA_CODEC_ENTRY(0x10ec0230, "ALC236", patch_alc269),
b9a94a9c
TI
11364 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
11365 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
dcd4f0db 11366 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
b9a94a9c 11367 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
736f20a7 11368 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
7fbdcd83 11369 HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
b9a94a9c
TI
11370 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
11371 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
f429e7e4 11372 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
b9a94a9c
TI
11373 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
11374 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
11375 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
11376 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
11377 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
11378 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
11379 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
dcd4f0db 11380 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
b9a94a9c
TI
11381 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
11382 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
11383 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
11384 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
11385 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
11386 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
0a6f0600 11387 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
b9a94a9c 11388 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
630e3612 11389 HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
b9a94a9c 11390 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
0a6f0600 11391 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
b9a94a9c
TI
11392 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
11393 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
11394 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
dcd4f0db 11395 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
7d727869 11396 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
b9a94a9c 11397 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
28f1f9b2 11398 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
1078bef0 11399 HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
f0778871 11400 HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
b9a94a9c
TI
11401 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
11402 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
11403 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
11404 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
11405 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
11406 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
11407 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
11408 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
11409 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
11410 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
11411 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
11412 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
11413 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
11414 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
6fbae35a
KY
11415 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
11416 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
11417 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
83629532 11418 HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
78f4f7c2 11419 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
b9a94a9c
TI
11420 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
11421 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
11422 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
11423 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
11424 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
11425 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
11426 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
11427 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
11428 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
11429 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
11430 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
e5782a5d 11431 HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
b9a94a9c
TI
11432 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
11433 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
6d9ffcff 11434 HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
65553b12 11435 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
a535ad57 11436 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
1da177e4
LT
11437 {} /* terminator */
11438};
b9a94a9c 11439MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
1289e9e8
TI
11440
11441MODULE_LICENSE("GPL");
11442MODULE_DESCRIPTION("Realtek HD-audio codec");
11443
d8a766a1 11444static struct hda_codec_driver realtek_driver = {
b9a94a9c 11445 .id = snd_hda_id_realtek,
1289e9e8
TI
11446};
11447
d8a766a1 11448module_hda_codec_driver(realtek_driver);