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