]> git.ipfire.org Git - thirdparty/linux.git/blame - sound/pci/hda/patch_realtek.c
ALSA: hda/realtek: Enable headset mic of ASUS UX581LV with ALC295
[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>
1da177e4 20#include <sound/core.h>
9ad0e496 21#include <sound/jack.h>
be57bfff 22#include <sound/hda_codec.h>
1da177e4 23#include "hda_local.h"
23d30f28 24#include "hda_auto_parser.h"
1835a0f9 25#include "hda_jack.h"
08c189f2 26#include "hda_generic.h"
1da177e4 27
cd63a5ff
TI
28/* keep halting ALC5505 DSP, for power saving */
29#define HALT_REALTEK_ALC5505
30
4a79ba34
TI
31/* extra amp-initialization sequence types */
32enum {
1c76aa5f 33 ALC_INIT_UNDEFINED,
4a79ba34
TI
34 ALC_INIT_NONE,
35 ALC_INIT_DEFAULT,
4a79ba34
TI
36};
37
73bdd597
DH
38enum {
39 ALC_HEADSET_MODE_UNKNOWN,
40 ALC_HEADSET_MODE_UNPLUGGED,
41 ALC_HEADSET_MODE_HEADSET,
42 ALC_HEADSET_MODE_MIC,
43 ALC_HEADSET_MODE_HEADPHONE,
44};
45
46enum {
47 ALC_HEADSET_TYPE_UNKNOWN,
48 ALC_HEADSET_TYPE_CTIA,
49 ALC_HEADSET_TYPE_OMTP,
50};
51
c7b60a89
HW
52enum {
53 ALC_KEY_MICMUTE_INDEX,
54};
55
da00c244
KY
56struct alc_customize_define {
57 unsigned int sku_cfg;
58 unsigned char port_connectivity;
59 unsigned char check_sum;
60 unsigned char customization;
61 unsigned char external_amp;
62 unsigned int enable_pcbeep:1;
63 unsigned int platform_type:1;
64 unsigned int swap:1;
65 unsigned int override:1;
90622917 66 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
da00c244
KY
67};
68
1da177e4 69struct alc_spec {
08c189f2 70 struct hda_gen_spec gen; /* must be at head */
23d30f28 71
1da177e4 72 /* codec parameterization */
da00c244 73 struct alc_customize_define cdefine;
08c189f2 74 unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
834be88d 75
5579cd6f
TI
76 /* GPIO bits */
77 unsigned int gpio_mask;
78 unsigned int gpio_dir;
79 unsigned int gpio_data;
215c850c 80 bool gpio_write_delay; /* add a delay before writing gpio_data */
5579cd6f 81
08fb0d0e
TI
82 /* mute LED for HP laptops, see alc269_fixup_mic_mute_hook() */
83 int mute_led_polarity;
84 hda_nid_t mute_led_nid;
9c5dc3bf 85 hda_nid_t cap_mute_led_nid;
08fb0d0e 86
0f32fd19
TI
87 unsigned int gpio_mute_led_mask;
88 unsigned int gpio_mic_led_mask;
431e76c3
KY
89 unsigned int mute_led_coef_idx;
90 unsigned int mute_led_coefbit_mask;
91 unsigned int mute_led_coefbit_on;
92 unsigned int mute_led_coefbit_off;
93 unsigned int mic_led_coef_idx;
94 unsigned int mic_led_coefbit_mask;
95 unsigned int mic_led_coefbit_on;
96 unsigned int mic_led_coefbit_off;
9f5c6faf 97
73bdd597
DH
98 hda_nid_t headset_mic_pin;
99 hda_nid_t headphone_mic_pin;
100 int current_headset_mode;
101 int current_headset_type;
102
ae6b813a
TI
103 /* hooks */
104 void (*init_hook)(struct hda_codec *codec);
83012a7c 105#ifdef CONFIG_PM
c97259df 106 void (*power_hook)(struct hda_codec *codec);
f5de24b0 107#endif
1c716153 108 void (*shutup)(struct hda_codec *codec);
70a0976b 109 void (*reboot_notify)(struct hda_codec *codec);
d922b51d 110
4a79ba34 111 int init_amp;
d433a678 112 int codec_variant; /* flag for other variants */
97a26570
KY
113 unsigned int has_alc5505_dsp:1;
114 unsigned int no_depop_delay:1;
693abe11 115 unsigned int done_hp_init:1;
c0ca5ece 116 unsigned int no_shutup_pins:1;
d3ba58bb 117 unsigned int ultra_low_power:1;
476c02e0 118 unsigned int has_hs_key:1;
e64f14f4 119
2c3bf9ab
TI
120 /* for PLL fix */
121 hda_nid_t pll_nid;
122 unsigned int pll_coef_idx, pll_coef_bit;
1bb7e43e 123 unsigned int coef0;
33f4acd3 124 struct input_dev *kb_dev;
c7b60a89 125 u8 alc_mute_keycode_map[1];
df694daa
KY
126};
127
f2a227cd
TI
128/*
129 * COEF access helper functions
130 */
131
132static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
133 unsigned int coef_idx)
134{
135 unsigned int val;
136
137 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
138 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
139 return val;
140}
141
142#define alc_read_coef_idx(codec, coef_idx) \
143 alc_read_coefex_idx(codec, 0x20, coef_idx)
144
145static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
146 unsigned int coef_idx, unsigned int coef_val)
147{
148 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
149 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
150}
151
152#define alc_write_coef_idx(codec, coef_idx, coef_val) \
153 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
154
98b24883
TI
155static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
156 unsigned int coef_idx, unsigned int mask,
157 unsigned int bits_set)
158{
159 unsigned int val = alc_read_coefex_idx(codec, nid, coef_idx);
160
161 if (val != -1)
162 alc_write_coefex_idx(codec, nid, coef_idx,
163 (val & ~mask) | bits_set);
164}
165
166#define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
167 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
168
f2a227cd
TI
169/* a special bypass for COEF 0; read the cached value at the second time */
170static unsigned int alc_get_coef0(struct hda_codec *codec)
171{
172 struct alc_spec *spec = codec->spec;
173
174 if (!spec->coef0)
175 spec->coef0 = alc_read_coef_idx(codec, 0);
176 return spec->coef0;
177}
178
54db6c39
TI
179/* coef writes/updates batch */
180struct coef_fw {
181 unsigned char nid;
182 unsigned char idx;
183 unsigned short mask;
184 unsigned short val;
185};
186
187#define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
188 { .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
189#define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
190#define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
191#define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
192
193static void alc_process_coef_fw(struct hda_codec *codec,
194 const struct coef_fw *fw)
195{
196 for (; fw->nid; fw++) {
197 if (fw->mask == (unsigned short)-1)
198 alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
199 else
200 alc_update_coefex_idx(codec, fw->nid, fw->idx,
201 fw->mask, fw->val);
202 }
203}
204
df694daa 205/*
1d045db9 206 * GPIO setup tables, used in initialization
df694daa 207 */
5579cd6f 208
bc9f98a9 209/* Enable GPIO mask and set output */
5579cd6f
TI
210static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
211{
212 struct alc_spec *spec = codec->spec;
bc9f98a9 213
5579cd6f
TI
214 spec->gpio_mask |= mask;
215 spec->gpio_dir |= mask;
216 spec->gpio_data |= mask;
217}
bc9f98a9 218
5579cd6f
TI
219static void alc_write_gpio_data(struct hda_codec *codec)
220{
221 struct alc_spec *spec = codec->spec;
222
223 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
224 spec->gpio_data);
225}
226
aaf312de
TI
227static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
228 bool on)
229{
230 struct alc_spec *spec = codec->spec;
231 unsigned int oldval = spec->gpio_data;
232
233 if (on)
234 spec->gpio_data |= mask;
235 else
236 spec->gpio_data &= ~mask;
237 if (oldval != spec->gpio_data)
238 alc_write_gpio_data(codec);
239}
240
5579cd6f
TI
241static void alc_write_gpio(struct hda_codec *codec)
242{
243 struct alc_spec *spec = codec->spec;
244
245 if (!spec->gpio_mask)
246 return;
247
248 snd_hda_codec_write(codec, codec->core.afg, 0,
249 AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
250 snd_hda_codec_write(codec, codec->core.afg, 0,
251 AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir);
215c850c
TI
252 if (spec->gpio_write_delay)
253 msleep(1);
5579cd6f
TI
254 alc_write_gpio_data(codec);
255}
256
257static void alc_fixup_gpio(struct hda_codec *codec, int action,
258 unsigned int mask)
259{
260 if (action == HDA_FIXUP_ACT_PRE_PROBE)
261 alc_setup_gpio(codec, mask);
262}
263
264static void alc_fixup_gpio1(struct hda_codec *codec,
265 const struct hda_fixup *fix, int action)
266{
267 alc_fixup_gpio(codec, action, 0x01);
268}
269
270static void alc_fixup_gpio2(struct hda_codec *codec,
271 const struct hda_fixup *fix, int action)
272{
273 alc_fixup_gpio(codec, action, 0x02);
274}
275
276static void alc_fixup_gpio3(struct hda_codec *codec,
277 const struct hda_fixup *fix, int action)
278{
279 alc_fixup_gpio(codec, action, 0x03);
280}
bdd148a3 281
ae065f1c
TI
282static void alc_fixup_gpio4(struct hda_codec *codec,
283 const struct hda_fixup *fix, int action)
284{
285 alc_fixup_gpio(codec, action, 0x04);
286}
287
2c3bf9ab
TI
288/*
289 * Fix hardware PLL issue
290 * On some codecs, the analog PLL gating control must be off while
291 * the default value is 1.
292 */
293static void alc_fix_pll(struct hda_codec *codec)
294{
295 struct alc_spec *spec = codec->spec;
2c3bf9ab 296
98b24883
TI
297 if (spec->pll_nid)
298 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
299 1 << spec->pll_coef_bit, 0);
2c3bf9ab
TI
300}
301
302static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
303 unsigned int coef_idx, unsigned int coef_bit)
304{
305 struct alc_spec *spec = codec->spec;
306 spec->pll_nid = nid;
307 spec->pll_coef_idx = coef_idx;
308 spec->pll_coef_bit = coef_bit;
309 alc_fix_pll(codec);
310}
311
cf5a2279 312/* update the master volume per volume-knob's unsol event */
1a4f69d5
TI
313static void alc_update_knob_master(struct hda_codec *codec,
314 struct hda_jack_callback *jack)
cf5a2279
TI
315{
316 unsigned int val;
317 struct snd_kcontrol *kctl;
318 struct snd_ctl_elem_value *uctl;
319
320 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
321 if (!kctl)
322 return;
323 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
324 if (!uctl)
325 return;
2ebab40e 326 val = snd_hda_codec_read(codec, jack->nid, 0,
cf5a2279
TI
327 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
328 val &= HDA_AMP_VOLMASK;
329 uctl->value.integer.value[0] = val;
330 uctl->value.integer.value[1] = val;
331 kctl->put(kctl, uctl);
332 kfree(uctl);
333}
334
29adc4b9 335static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
f21d78e2 336{
29adc4b9
DH
337 /* For some reason, the res given from ALC880 is broken.
338 Here we adjust it properly. */
339 snd_hda_jack_unsol_event(codec, res >> 2);
f21d78e2
TI
340}
341
394c97f8
KY
342/* Change EAPD to verb control */
343static void alc_fill_eapd_coef(struct hda_codec *codec)
344{
345 int coef;
346
347 coef = alc_get_coef0(codec);
348
7639a06c 349 switch (codec->core.vendor_id) {
394c97f8
KY
350 case 0x10ec0262:
351 alc_update_coef_idx(codec, 0x7, 0, 1<<5);
352 break;
353 case 0x10ec0267:
354 case 0x10ec0268:
355 alc_update_coef_idx(codec, 0x7, 0, 1<<13);
356 break;
357 case 0x10ec0269:
358 if ((coef & 0x00f0) == 0x0010)
359 alc_update_coef_idx(codec, 0xd, 0, 1<<14);
360 if ((coef & 0x00f0) == 0x0020)
361 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
362 if ((coef & 0x00f0) == 0x0030)
363 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
364 break;
365 case 0x10ec0280:
366 case 0x10ec0284:
367 case 0x10ec0290:
368 case 0x10ec0292:
369 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
370 break;
4231430d 371 case 0x10ec0225:
44be77c5
TI
372 case 0x10ec0295:
373 case 0x10ec0299:
374 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
375 /* fallthrough */
376 case 0x10ec0215:
394c97f8 377 case 0x10ec0233:
ea04a1db 378 case 0x10ec0235:
c4473744 379 case 0x10ec0236:
7fbdcd83 380 case 0x10ec0245:
394c97f8 381 case 0x10ec0255:
c4473744 382 case 0x10ec0256:
f429e7e4 383 case 0x10ec0257:
394c97f8
KY
384 case 0x10ec0282:
385 case 0x10ec0283:
386 case 0x10ec0286:
387 case 0x10ec0288:
0a6f0600 388 case 0x10ec0285:
506b62c3 389 case 0x10ec0298:
0a6f0600 390 case 0x10ec0289:
1078bef0 391 case 0x10ec0300:
394c97f8
KY
392 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
393 break;
3aabf94c
KY
394 case 0x10ec0275:
395 alc_update_coef_idx(codec, 0xe, 0, 1<<0);
396 break;
394c97f8
KY
397 case 0x10ec0293:
398 alc_update_coef_idx(codec, 0xa, 1<<13, 0);
399 break;
dcd4f0db
KY
400 case 0x10ec0234:
401 case 0x10ec0274:
402 case 0x10ec0294:
6fbae35a
KY
403 case 0x10ec0700:
404 case 0x10ec0701:
405 case 0x10ec0703:
83629532 406 case 0x10ec0711:
dcd4f0db
KY
407 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
408 break;
394c97f8
KY
409 case 0x10ec0662:
410 if ((coef & 0x00f0) == 0x0030)
411 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
412 break;
413 case 0x10ec0272:
414 case 0x10ec0273:
415 case 0x10ec0663:
416 case 0x10ec0665:
417 case 0x10ec0670:
418 case 0x10ec0671:
419 case 0x10ec0672:
420 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
421 break;
9194a1eb 422 case 0x10ec0222:
f0778871
KY
423 case 0x10ec0623:
424 alc_update_coef_idx(codec, 0x19, 1<<13, 0);
425 break;
394c97f8
KY
426 case 0x10ec0668:
427 alc_update_coef_idx(codec, 0x7, 3<<13, 0);
428 break;
429 case 0x10ec0867:
430 alc_update_coef_idx(codec, 0x4, 1<<10, 0);
431 break;
432 case 0x10ec0888:
433 if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
434 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
435 break;
436 case 0x10ec0892:
437 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
438 break;
439 case 0x10ec0899:
440 case 0x10ec0900:
6d9ffcff 441 case 0x10ec0b00:
65553b12 442 case 0x10ec1168:
a535ad57 443 case 0x10ec1220:
394c97f8
KY
444 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
445 break;
446 }
447}
448
f9423e7a
KY
449/* additional initialization for ALC888 variants */
450static void alc888_coef_init(struct hda_codec *codec)
451{
1df8874b
KY
452 switch (alc_get_coef0(codec) & 0x00f0) {
453 /* alc888-VA */
454 case 0x00:
455 /* alc888-VB */
456 case 0x10:
457 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
458 break;
459 }
87a8c370
JK
460}
461
3fb4a508
TI
462/* turn on/off EAPD control (only if available) */
463static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
464{
465 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
466 return;
467 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
468 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
469 on ? 2 : 0);
470}
471
691f1fcc
TI
472/* turn on/off EAPD controls of the codec */
473static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
474{
475 /* We currently only handle front, HP */
caf3c043 476 static const hda_nid_t pins[] = {
af95b414 477 0x0f, 0x10, 0x14, 0x15, 0x17, 0
39fa84e9 478 };
caf3c043 479 const hda_nid_t *p;
39fa84e9
TI
480 for (p = pins; *p; p++)
481 set_eapd(codec, *p, on);
691f1fcc
TI
482}
483
dad3197d
KY
484static int find_ext_mic_pin(struct hda_codec *codec);
485
486static void alc_headset_mic_no_shutup(struct hda_codec *codec)
487{
488 const struct hda_pincfg *pin;
489 int mic_pin = find_ext_mic_pin(codec);
490 int i;
491
492 /* don't shut up pins when unloading the driver; otherwise it breaks
493 * the default pin setup at the next load of the driver
494 */
495 if (codec->bus->shutdown)
496 return;
497
498 snd_array_for_each(&codec->init_pins, i, pin) {
499 /* use read here for syncing after issuing each verb */
500 if (pin->nid != mic_pin)
501 snd_hda_codec_read(codec, pin->nid, 0,
502 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
503 }
504
505 codec->pins_shutup = 1;
506}
507
c0ca5ece
TI
508static void alc_shutup_pins(struct hda_codec *codec)
509{
510 struct alc_spec *spec = codec->spec;
511
dad3197d 512 switch (codec->core.vendor_id) {
66c5d718 513 case 0x10ec0283:
dad3197d
KY
514 case 0x10ec0286:
515 case 0x10ec0288:
516 case 0x10ec0298:
517 alc_headset_mic_no_shutup(codec);
518 break;
519 default:
520 if (!spec->no_shutup_pins)
521 snd_hda_shutup_pins(codec);
522 break;
523 }
c0ca5ece
TI
524}
525
1c716153 526/* generic shutup callback;
4ce8e6a5 527 * just turning off EAPD and a little pause for avoiding pop-noise
1c716153
TI
528 */
529static void alc_eapd_shutup(struct hda_codec *codec)
530{
97a26570
KY
531 struct alc_spec *spec = codec->spec;
532
1c716153 533 alc_auto_setup_eapd(codec, false);
97a26570
KY
534 if (!spec->no_depop_delay)
535 msleep(200);
c0ca5ece 536 alc_shutup_pins(codec);
1c716153
TI
537}
538
1d045db9 539/* generic EAPD initialization */
4a79ba34 540static void alc_auto_init_amp(struct hda_codec *codec, int type)
bc9f98a9 541{
39fa84e9 542 alc_auto_setup_eapd(codec, true);
5579cd6f 543 alc_write_gpio(codec);
4a79ba34 544 switch (type) {
4a79ba34 545 case ALC_INIT_DEFAULT:
7639a06c 546 switch (codec->core.vendor_id) {
c9b58006 547 case 0x10ec0260:
98b24883 548 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
c9b58006 549 break;
c9b58006
KY
550 case 0x10ec0880:
551 case 0x10ec0882:
552 case 0x10ec0883:
553 case 0x10ec0885:
1df8874b 554 alc_update_coef_idx(codec, 7, 0, 0x2030);
c9b58006 555 break;
f9423e7a 556 case 0x10ec0888:
4a79ba34 557 alc888_coef_init(codec);
f9423e7a 558 break;
bc9f98a9 559 }
4a79ba34
TI
560 break;
561 }
562}
563
35a39f98
TI
564/* get a primary headphone pin if available */
565static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
566{
567 if (spec->gen.autocfg.hp_pins[0])
568 return spec->gen.autocfg.hp_pins[0];
569 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
570 return spec->gen.autocfg.line_out_pins[0];
571 return 0;
572}
08c189f2 573
1d045db9 574/*
08c189f2 575 * Realtek SSID verification
1d045db9 576 */
42cf0d01 577
08c189f2
TI
578/* Could be any non-zero and even value. When used as fixup, tells
579 * the driver to ignore any present sku defines.
580 */
581#define ALC_FIXUP_SKU_IGNORE (2)
1a1455de 582
08c189f2
TI
583static void alc_fixup_sku_ignore(struct hda_codec *codec,
584 const struct hda_fixup *fix, int action)
1a1455de 585{
1a1455de 586 struct alc_spec *spec = codec->spec;
08c189f2
TI
587 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
588 spec->cdefine.fixup = 1;
589 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
1a1455de 590 }
1a1455de
TI
591}
592
b5c6611f
ML
593static void alc_fixup_no_depop_delay(struct hda_codec *codec,
594 const struct hda_fixup *fix, int action)
595{
596 struct alc_spec *spec = codec->spec;
597
84d2dc3e 598 if (action == HDA_FIXUP_ACT_PROBE) {
b5c6611f 599 spec->no_depop_delay = 1;
84d2dc3e
ML
600 codec->depop_delay = 0;
601 }
b5c6611f
ML
602}
603
08c189f2 604static int alc_auto_parse_customize_define(struct hda_codec *codec)
4a79ba34 605{
08c189f2
TI
606 unsigned int ass, tmp, i;
607 unsigned nid = 0;
4a79ba34
TI
608 struct alc_spec *spec = codec->spec;
609
08c189f2 610 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
4a79ba34 611
08c189f2
TI
612 if (spec->cdefine.fixup) {
613 ass = spec->cdefine.sku_cfg;
614 if (ass == ALC_FIXUP_SKU_IGNORE)
615 return -1;
616 goto do_sku;
bb35febd
TI
617 }
618
5100cd07
TI
619 if (!codec->bus->pci)
620 return -1;
7639a06c 621 ass = codec->core.subsystem_id & 0xffff;
08c189f2
TI
622 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
623 goto do_sku;
4a79ba34 624
08c189f2 625 nid = 0x1d;
7639a06c 626 if (codec->core.vendor_id == 0x10ec0260)
08c189f2
TI
627 nid = 0x17;
628 ass = snd_hda_codec_get_pincfg(codec, nid);
42cf0d01 629
08c189f2 630 if (!(ass & 1)) {
4e76a883 631 codec_info(codec, "%s: SKU not ready 0x%08x\n",
7639a06c 632 codec->core.chip_name, ass);
08c189f2 633 return -1;
42cf0d01
DH
634 }
635
08c189f2
TI
636 /* check sum */
637 tmp = 0;
638 for (i = 1; i < 16; i++) {
639 if ((ass >> i) & 1)
640 tmp++;
ae8a60a5 641 }
08c189f2
TI
642 if (((ass >> 16) & 0xf) != tmp)
643 return -1;
ae8a60a5 644
da00c244
KY
645 spec->cdefine.port_connectivity = ass >> 30;
646 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
647 spec->cdefine.check_sum = (ass >> 16) & 0xf;
648 spec->cdefine.customization = ass >> 8;
649do_sku:
650 spec->cdefine.sku_cfg = ass;
651 spec->cdefine.external_amp = (ass & 0x38) >> 3;
652 spec->cdefine.platform_type = (ass & 0x4) >> 2;
653 spec->cdefine.swap = (ass & 0x2) >> 1;
654 spec->cdefine.override = ass & 0x1;
655
4e76a883 656 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
da00c244 657 nid, spec->cdefine.sku_cfg);
4e76a883 658 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
da00c244 659 spec->cdefine.port_connectivity);
4e76a883
TI
660 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
661 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
662 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
663 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
664 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
665 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
666 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
da00c244
KY
667
668 return 0;
669}
670
08c189f2
TI
671/* return the position of NID in the list, or -1 if not found */
672static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
673{
674 int i;
675 for (i = 0; i < nums; i++)
676 if (list[i] == nid)
677 return i;
678 return -1;
679}
1d045db9 680/* return true if the given NID is found in the list */
3af9ee6b
TI
681static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
682{
21268961 683 return find_idx_in_nid_list(nid, list, nums) >= 0;
3af9ee6b
TI
684}
685
4a79ba34
TI
686/* check subsystem ID and set up device-specific initialization;
687 * return 1 if initialized, 0 if invalid SSID
688 */
689/* 32-bit subsystem ID for BIOS loading in HD Audio codec.
690 * 31 ~ 16 : Manufacture ID
691 * 15 ~ 8 : SKU ID
692 * 7 ~ 0 : Assembly ID
693 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
694 */
58c57cfa 695static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
4a79ba34
TI
696{
697 unsigned int ass, tmp, i;
698 unsigned nid;
699 struct alc_spec *spec = codec->spec;
700
90622917
DH
701 if (spec->cdefine.fixup) {
702 ass = spec->cdefine.sku_cfg;
703 if (ass == ALC_FIXUP_SKU_IGNORE)
704 return 0;
705 goto do_sku;
706 }
707
7639a06c 708 ass = codec->core.subsystem_id & 0xffff;
5100cd07
TI
709 if (codec->bus->pci &&
710 ass != codec->bus->pci->subsystem_device && (ass & 1))
4a79ba34
TI
711 goto do_sku;
712
713 /* invalid SSID, check the special NID pin defcfg instead */
714 /*
def319f9 715 * 31~30 : port connectivity
4a79ba34
TI
716 * 29~21 : reserve
717 * 20 : PCBEEP input
718 * 19~16 : Check sum (15:1)
719 * 15~1 : Custom
720 * 0 : override
721 */
722 nid = 0x1d;
7639a06c 723 if (codec->core.vendor_id == 0x10ec0260)
4a79ba34
TI
724 nid = 0x17;
725 ass = snd_hda_codec_get_pincfg(codec, nid);
4e76a883
TI
726 codec_dbg(codec,
727 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
cb6605c1 728 ass, nid);
6227cdce 729 if (!(ass & 1))
4a79ba34
TI
730 return 0;
731 if ((ass >> 30) != 1) /* no physical connection */
732 return 0;
733
734 /* check sum */
735 tmp = 0;
736 for (i = 1; i < 16; i++) {
737 if ((ass >> i) & 1)
738 tmp++;
739 }
740 if (((ass >> 16) & 0xf) != tmp)
741 return 0;
742do_sku:
4e76a883 743 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
7639a06c 744 ass & 0xffff, codec->core.vendor_id);
4a79ba34
TI
745 /*
746 * 0 : override
747 * 1 : Swap Jack
748 * 2 : 0 --> Desktop, 1 --> Laptop
749 * 3~5 : External Amplifier control
750 * 7~6 : Reserved
751 */
752 tmp = (ass & 0x38) >> 3; /* external Amp control */
1c76aa5f
TI
753 if (spec->init_amp == ALC_INIT_UNDEFINED) {
754 switch (tmp) {
755 case 1:
5579cd6f 756 alc_setup_gpio(codec, 0x01);
1c76aa5f
TI
757 break;
758 case 3:
5579cd6f 759 alc_setup_gpio(codec, 0x02);
1c76aa5f
TI
760 break;
761 case 7:
5579cd6f 762 alc_setup_gpio(codec, 0x03);
1c76aa5f
TI
763 break;
764 case 5:
765 default:
766 spec->init_amp = ALC_INIT_DEFAULT;
767 break;
768 }
bc9f98a9 769 }
ea1fb29a 770
8c427226 771 /* is laptop or Desktop and enable the function "Mute internal speaker
c9b58006
KY
772 * when the external headphone out jack is plugged"
773 */
8c427226 774 if (!(ass & 0x8000))
4a79ba34 775 return 1;
c9b58006
KY
776 /*
777 * 10~8 : Jack location
778 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
779 * 14~13: Resvered
780 * 15 : 1 --> enable the function "Mute internal speaker
781 * when the external headphone out jack is plugged"
782 */
35a39f98 783 if (!alc_get_hp_pin(spec)) {
01d4825d 784 hda_nid_t nid;
c9b58006 785 tmp = (ass >> 11) & 0x3; /* HP to chassis */
58c57cfa 786 nid = ports[tmp];
08c189f2
TI
787 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
788 spec->gen.autocfg.line_outs))
3af9ee6b 789 return 1;
08c189f2 790 spec->gen.autocfg.hp_pins[0] = nid;
c9b58006 791 }
4a79ba34
TI
792 return 1;
793}
ea1fb29a 794
3e6179b8
TI
795/* Check the validity of ALC subsystem-id
796 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
797static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
4a79ba34 798{
58c57cfa 799 if (!alc_subsystem_id(codec, ports)) {
4a79ba34 800 struct alc_spec *spec = codec->spec;
67791202
TI
801 if (spec->init_amp == ALC_INIT_UNDEFINED) {
802 codec_dbg(codec,
803 "realtek: Enable default setup for auto mode as fallback\n");
804 spec->init_amp = ALC_INIT_DEFAULT;
805 }
4a79ba34 806 }
21268961 807}
1a1455de 808
1d045db9 809/*
ef8ef5fb 810 */
f9e336f6 811
9d36a7dc
DH
812static void alc_fixup_inv_dmic(struct hda_codec *codec,
813 const struct hda_fixup *fix, int action)
125821ae
TI
814{
815 struct alc_spec *spec = codec->spec;
668d1e96 816
9d36a7dc 817 spec->gen.inv_dmic_split = 1;
6e72aa5f
TI
818}
819
e9edcee0 820
08c189f2 821static int alc_build_controls(struct hda_codec *codec)
1d045db9 822{
a5cb463a 823 int err;
e9427969 824
08c189f2
TI
825 err = snd_hda_gen_build_controls(codec);
826 if (err < 0)
827 return err;
1da177e4 828
1727a771 829 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
1c4a54b4 830 return 0;
a361d84b
KY
831}
832
a361d84b 833
df694daa 834/*
08c189f2 835 * Common callbacks
df694daa 836 */
a361d84b 837
c9af753f
TI
838static void alc_pre_init(struct hda_codec *codec)
839{
840 alc_fill_eapd_coef(codec);
841}
842
aeac1a0d
KY
843#define is_s3_resume(codec) \
844 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
c9af753f
TI
845#define is_s4_resume(codec) \
846 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
847
08c189f2 848static int alc_init(struct hda_codec *codec)
1d045db9
TI
849{
850 struct alc_spec *spec = codec->spec;
a361d84b 851
c9af753f
TI
852 /* hibernation resume needs the full chip initialization */
853 if (is_s4_resume(codec))
854 alc_pre_init(codec);
855
08c189f2
TI
856 if (spec->init_hook)
857 spec->init_hook(codec);
a361d84b 858
89781d08 859 spec->gen.skip_verbs = 1; /* applied in below */
607ca3bd 860 snd_hda_gen_init(codec);
08c189f2
TI
861 alc_fix_pll(codec);
862 alc_auto_init_amp(codec, spec->init_amp);
89781d08 863 snd_hda_apply_verbs(codec); /* apply verbs here after own init */
3abf2f36 864
1727a771 865 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
a361d84b 866
1d045db9
TI
867 return 0;
868}
a361d84b 869
08c189f2 870static inline void alc_shutup(struct hda_codec *codec)
1d045db9
TI
871{
872 struct alc_spec *spec = codec->spec;
a361d84b 873
c7273bd6
TI
874 if (!snd_hda_get_bool_hint(codec, "shutup"))
875 return; /* disabled explicitly by hints */
876
08c189f2
TI
877 if (spec && spec->shutup)
878 spec->shutup(codec);
9bfb2844 879 else
c0ca5ece 880 alc_shutup_pins(codec);
1d045db9
TI
881}
882
70a0976b
TI
883static void alc_reboot_notify(struct hda_codec *codec)
884{
885 struct alc_spec *spec = codec->spec;
886
887 if (spec && spec->reboot_notify)
888 spec->reboot_notify(codec);
889 else
890 alc_shutup(codec);
891}
892
8a02c0cc 893#define alc_free snd_hda_gen_free
2134ea4f 894
08c189f2
TI
895#ifdef CONFIG_PM
896static void alc_power_eapd(struct hda_codec *codec)
1d045db9 897{
08c189f2 898 alc_auto_setup_eapd(codec, false);
1d045db9 899}
2134ea4f 900
08c189f2 901static int alc_suspend(struct hda_codec *codec)
1d045db9
TI
902{
903 struct alc_spec *spec = codec->spec;
08c189f2
TI
904 alc_shutup(codec);
905 if (spec && spec->power_hook)
906 spec->power_hook(codec);
a361d84b
KY
907 return 0;
908}
08c189f2 909#endif
a361d84b 910
08c189f2
TI
911#ifdef CONFIG_PM
912static int alc_resume(struct hda_codec *codec)
1d045db9 913{
97a26570
KY
914 struct alc_spec *spec = codec->spec;
915
916 if (!spec->no_depop_delay)
917 msleep(150); /* to avoid pop noise */
08c189f2 918 codec->patch_ops.init(codec);
1a462be5 919 snd_hda_regmap_sync(codec);
08c189f2
TI
920 hda_call_check_power_status(codec, 0x01);
921 return 0;
1d045db9 922}
08c189f2 923#endif
f6a92248 924
1d045db9 925/*
1d045db9 926 */
08c189f2
TI
927static const struct hda_codec_ops alc_patch_ops = {
928 .build_controls = alc_build_controls,
929 .build_pcms = snd_hda_gen_build_pcms,
930 .init = alc_init,
931 .free = alc_free,
932 .unsol_event = snd_hda_jack_unsol_event,
933#ifdef CONFIG_PM
934 .resume = alc_resume,
08c189f2 935 .suspend = alc_suspend,
fce52a3b 936 .check_power_status = snd_hda_gen_check_power_status,
08c189f2 937#endif
70a0976b 938 .reboot_notify = alc_reboot_notify,
08c189f2 939};
f6a92248 940
f53281e6 941
ded255be 942#define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
e01bf509 943
e4770629 944/*
4b016931 945 * Rename codecs appropriately from COEF value or subvendor id
e4770629 946 */
08c189f2
TI
947struct alc_codec_rename_table {
948 unsigned int vendor_id;
949 unsigned short coef_mask;
950 unsigned short coef_bits;
951 const char *name;
952};
84898e87 953
4b016931
KY
954struct alc_codec_rename_pci_table {
955 unsigned int codec_vendor_id;
956 unsigned short pci_subvendor;
957 unsigned short pci_subdevice;
958 const char *name;
959};
960
6b0f95c4 961static const struct alc_codec_rename_table rename_tbl[] = {
e6e5f7ad 962 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
08c189f2
TI
963 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
964 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
965 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
966 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
967 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
968 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
969 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
970 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
e6e5f7ad 971 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
08c189f2
TI
972 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
973 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
974 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
975 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
976 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
977 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
978 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
979 { } /* terminator */
980};
84898e87 981
6b0f95c4 982static const struct alc_codec_rename_pci_table rename_pci_tbl[] = {
4b016931
KY
983 { 0x10ec0280, 0x1028, 0, "ALC3220" },
984 { 0x10ec0282, 0x1028, 0, "ALC3221" },
985 { 0x10ec0283, 0x1028, 0, "ALC3223" },
193177de 986 { 0x10ec0288, 0x1028, 0, "ALC3263" },
4b016931 987 { 0x10ec0292, 0x1028, 0, "ALC3226" },
193177de 988 { 0x10ec0293, 0x1028, 0, "ALC3235" },
4b016931
KY
989 { 0x10ec0255, 0x1028, 0, "ALC3234" },
990 { 0x10ec0668, 0x1028, 0, "ALC3661" },
e6e5f7ad
KY
991 { 0x10ec0275, 0x1028, 0, "ALC3260" },
992 { 0x10ec0899, 0x1028, 0, "ALC3861" },
2c674fac 993 { 0x10ec0298, 0x1028, 0, "ALC3266" },
736f20a7 994 { 0x10ec0236, 0x1028, 0, "ALC3204" },
82324502 995 { 0x10ec0256, 0x1028, 0, "ALC3246" },
4231430d 996 { 0x10ec0225, 0x1028, 0, "ALC3253" },
7d727869 997 { 0x10ec0295, 0x1028, 0, "ALC3254" },
28f1f9b2 998 { 0x10ec0299, 0x1028, 0, "ALC3271" },
e6e5f7ad
KY
999 { 0x10ec0670, 0x1025, 0, "ALC669X" },
1000 { 0x10ec0676, 0x1025, 0, "ALC679X" },
1001 { 0x10ec0282, 0x1043, 0, "ALC3229" },
1002 { 0x10ec0233, 0x1043, 0, "ALC3236" },
1003 { 0x10ec0280, 0x103c, 0, "ALC3228" },
1004 { 0x10ec0282, 0x103c, 0, "ALC3227" },
1005 { 0x10ec0286, 0x103c, 0, "ALC3242" },
1006 { 0x10ec0290, 0x103c, 0, "ALC3241" },
1007 { 0x10ec0668, 0x103c, 0, "ALC3662" },
1008 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
1009 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
4b016931
KY
1010 { } /* terminator */
1011};
1012
08c189f2 1013static int alc_codec_rename_from_preset(struct hda_codec *codec)
1d045db9 1014{
08c189f2 1015 const struct alc_codec_rename_table *p;
4b016931 1016 const struct alc_codec_rename_pci_table *q;
60db6b53 1017
08c189f2 1018 for (p = rename_tbl; p->vendor_id; p++) {
7639a06c 1019 if (p->vendor_id != codec->core.vendor_id)
08c189f2
TI
1020 continue;
1021 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
1022 return alc_codec_rename(codec, p->name);
1d045db9 1023 }
4b016931 1024
5100cd07
TI
1025 if (!codec->bus->pci)
1026 return 0;
4b016931 1027 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
7639a06c 1028 if (q->codec_vendor_id != codec->core.vendor_id)
4b016931
KY
1029 continue;
1030 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1031 continue;
1032 if (!q->pci_subdevice ||
1033 q->pci_subdevice == codec->bus->pci->subsystem_device)
1034 return alc_codec_rename(codec, q->name);
1035 }
1036
08c189f2 1037 return 0;
1d045db9 1038}
f53281e6 1039
e4770629 1040
1d045db9
TI
1041/*
1042 * Digital-beep handlers
1043 */
1044#ifdef CONFIG_SND_HDA_INPUT_BEEP
fea80fae
TI
1045
1046/* additional beep mixers; private_value will be overwritten */
1047static const struct snd_kcontrol_new alc_beep_mixer[] = {
1048 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1049 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1050};
1051
1052/* set up and create beep controls */
1053static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1054 int idx, int dir)
1055{
1056 struct snd_kcontrol_new *knew;
1057 unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1058 int i;
1059
1060 for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1061 knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1062 &alc_beep_mixer[i]);
1063 if (!knew)
1064 return -ENOMEM;
1065 knew->private_value = beep_amp;
1066 }
1067 return 0;
1068}
84898e87 1069
1d045db9 1070static const struct snd_pci_quirk beep_white_list[] = {
7110005e 1071 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
a4b7f21d 1072 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
1d045db9 1073 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
8554ee40 1074 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
1d045db9
TI
1075 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1076 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1077 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
78f8baf1 1078 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
1d045db9 1079 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
051c78af
TI
1080 /* blacklist -- no beep available */
1081 SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
1082 SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
1d045db9 1083 {}
fe3eb0a7
KY
1084};
1085
1d045db9
TI
1086static inline int has_cdefine_beep(struct hda_codec *codec)
1087{
1088 struct alc_spec *spec = codec->spec;
1089 const struct snd_pci_quirk *q;
1090 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list);
1091 if (q)
1092 return q->value;
1093 return spec->cdefine.enable_pcbeep;
1094}
1095#else
fea80fae 1096#define set_beep_amp(spec, nid, idx, dir) 0
1d045db9
TI
1097#define has_cdefine_beep(codec) 0
1098#endif
84898e87 1099
1d045db9
TI
1100/* parse the BIOS configuration and set up the alc_spec */
1101/* return 1 if successful, 0 if the proper config is not found,
1102 * or a negative error code
1103 */
3e6179b8
TI
1104static int alc_parse_auto_config(struct hda_codec *codec,
1105 const hda_nid_t *ignore_nids,
1106 const hda_nid_t *ssid_nids)
1d045db9
TI
1107{
1108 struct alc_spec *spec = codec->spec;
08c189f2 1109 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
1d045db9 1110 int err;
26f5df26 1111
53c334ad
TI
1112 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1113 spec->parse_flags);
1d045db9
TI
1114 if (err < 0)
1115 return err;
3e6179b8
TI
1116
1117 if (ssid_nids)
1118 alc_ssid_check(codec, ssid_nids);
64154835 1119
08c189f2
TI
1120 err = snd_hda_gen_parse_auto_config(codec, cfg);
1121 if (err < 0)
1122 return err;
070cff4c 1123
1d045db9 1124 return 1;
60db6b53 1125}
f6a92248 1126
3de95173
TI
1127/* common preparation job for alc_spec */
1128static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1129{
1130 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1131 int err;
1132
1133 if (!spec)
1134 return -ENOMEM;
1135 codec->spec = spec;
08c189f2
TI
1136 snd_hda_gen_spec_init(&spec->gen);
1137 spec->gen.mixer_nid = mixer_nid;
1138 spec->gen.own_eapd_ctl = 1;
1098b7c2 1139 codec->single_adc_amp = 1;
08c189f2
TI
1140 /* FIXME: do we need this for all Realtek codec models? */
1141 codec->spdif_status_reset = 1;
225068ab 1142 codec->patch_ops = alc_patch_ops;
3de95173
TI
1143
1144 err = alc_codec_rename_from_preset(codec);
1145 if (err < 0) {
1146 kfree(spec);
1147 return err;
1148 }
1149 return 0;
1150}
1151
3e6179b8
TI
1152static int alc880_parse_auto_config(struct hda_codec *codec)
1153{
1154 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
7d7eb9ea 1155 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3e6179b8
TI
1156 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1157}
1158
ee3b2969
TI
1159/*
1160 * ALC880 fix-ups
1161 */
1162enum {
411225a0 1163 ALC880_FIXUP_GPIO1,
ee3b2969
TI
1164 ALC880_FIXUP_GPIO2,
1165 ALC880_FIXUP_MEDION_RIM,
dc6af52d 1166 ALC880_FIXUP_LG,
db8a38e5 1167 ALC880_FIXUP_LG_LW25,
f02aab5d 1168 ALC880_FIXUP_W810,
27e917f8 1169 ALC880_FIXUP_EAPD_COEF,
b9368f5c 1170 ALC880_FIXUP_TCL_S700,
cf5a2279
TI
1171 ALC880_FIXUP_VOL_KNOB,
1172 ALC880_FIXUP_FUJITSU,
ba533818 1173 ALC880_FIXUP_F1734,
817de92f 1174 ALC880_FIXUP_UNIWILL,
967b88c4 1175 ALC880_FIXUP_UNIWILL_DIG,
96e225f6 1176 ALC880_FIXUP_Z71V,
487a588d 1177 ALC880_FIXUP_ASUS_W5A,
67b6ec31
TI
1178 ALC880_FIXUP_3ST_BASE,
1179 ALC880_FIXUP_3ST,
1180 ALC880_FIXUP_3ST_DIG,
1181 ALC880_FIXUP_5ST_BASE,
1182 ALC880_FIXUP_5ST,
1183 ALC880_FIXUP_5ST_DIG,
1184 ALC880_FIXUP_6ST_BASE,
1185 ALC880_FIXUP_6ST,
1186 ALC880_FIXUP_6ST_DIG,
5397145f 1187 ALC880_FIXUP_6ST_AUTOMUTE,
ee3b2969
TI
1188};
1189
cf5a2279
TI
1190/* enable the volume-knob widget support on NID 0x21 */
1191static void alc880_fixup_vol_knob(struct hda_codec *codec,
1727a771 1192 const struct hda_fixup *fix, int action)
cf5a2279 1193{
1727a771 1194 if (action == HDA_FIXUP_ACT_PROBE)
62f949bf
TI
1195 snd_hda_jack_detect_enable_callback(codec, 0x21,
1196 alc_update_knob_master);
cf5a2279
TI
1197}
1198
1727a771 1199static const struct hda_fixup alc880_fixups[] = {
411225a0 1200 [ALC880_FIXUP_GPIO1] = {
5579cd6f
TI
1201 .type = HDA_FIXUP_FUNC,
1202 .v.func = alc_fixup_gpio1,
411225a0 1203 },
ee3b2969 1204 [ALC880_FIXUP_GPIO2] = {
5579cd6f
TI
1205 .type = HDA_FIXUP_FUNC,
1206 .v.func = alc_fixup_gpio2,
ee3b2969
TI
1207 },
1208 [ALC880_FIXUP_MEDION_RIM] = {
1727a771 1209 .type = HDA_FIXUP_VERBS,
ee3b2969
TI
1210 .v.verbs = (const struct hda_verb[]) {
1211 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1212 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1213 { }
1214 },
1215 .chained = true,
1216 .chain_id = ALC880_FIXUP_GPIO2,
1217 },
dc6af52d 1218 [ALC880_FIXUP_LG] = {
1727a771
TI
1219 .type = HDA_FIXUP_PINS,
1220 .v.pins = (const struct hda_pintbl[]) {
dc6af52d
TI
1221 /* disable bogus unused pins */
1222 { 0x16, 0x411111f0 },
1223 { 0x18, 0x411111f0 },
1224 { 0x1a, 0x411111f0 },
1225 { }
1226 }
1227 },
db8a38e5
TI
1228 [ALC880_FIXUP_LG_LW25] = {
1229 .type = HDA_FIXUP_PINS,
1230 .v.pins = (const struct hda_pintbl[]) {
1231 { 0x1a, 0x0181344f }, /* line-in */
1232 { 0x1b, 0x0321403f }, /* headphone */
1233 { }
1234 }
1235 },
f02aab5d 1236 [ALC880_FIXUP_W810] = {
1727a771
TI
1237 .type = HDA_FIXUP_PINS,
1238 .v.pins = (const struct hda_pintbl[]) {
f02aab5d
TI
1239 /* disable bogus unused pins */
1240 { 0x17, 0x411111f0 },
1241 { }
1242 },
1243 .chained = true,
1244 .chain_id = ALC880_FIXUP_GPIO2,
1245 },
27e917f8 1246 [ALC880_FIXUP_EAPD_COEF] = {
1727a771 1247 .type = HDA_FIXUP_VERBS,
27e917f8
TI
1248 .v.verbs = (const struct hda_verb[]) {
1249 /* change to EAPD mode */
1250 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1251 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1252 {}
1253 },
1254 },
b9368f5c 1255 [ALC880_FIXUP_TCL_S700] = {
1727a771 1256 .type = HDA_FIXUP_VERBS,
b9368f5c
TI
1257 .v.verbs = (const struct hda_verb[]) {
1258 /* change to EAPD mode */
1259 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1260 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1261 {}
1262 },
1263 .chained = true,
1264 .chain_id = ALC880_FIXUP_GPIO2,
1265 },
cf5a2279 1266 [ALC880_FIXUP_VOL_KNOB] = {
1727a771 1267 .type = HDA_FIXUP_FUNC,
cf5a2279
TI
1268 .v.func = alc880_fixup_vol_knob,
1269 },
1270 [ALC880_FIXUP_FUJITSU] = {
1271 /* override all pins as BIOS on old Amilo is broken */
1727a771
TI
1272 .type = HDA_FIXUP_PINS,
1273 .v.pins = (const struct hda_pintbl[]) {
bb148bde 1274 { 0x14, 0x0121401f }, /* HP */
cf5a2279
TI
1275 { 0x15, 0x99030120 }, /* speaker */
1276 { 0x16, 0x99030130 }, /* bass speaker */
1277 { 0x17, 0x411111f0 }, /* N/A */
1278 { 0x18, 0x411111f0 }, /* N/A */
1279 { 0x19, 0x01a19950 }, /* mic-in */
1280 { 0x1a, 0x411111f0 }, /* N/A */
1281 { 0x1b, 0x411111f0 }, /* N/A */
1282 { 0x1c, 0x411111f0 }, /* N/A */
1283 { 0x1d, 0x411111f0 }, /* N/A */
1284 { 0x1e, 0x01454140 }, /* SPDIF out */
1285 { }
1286 },
1287 .chained = true,
1288 .chain_id = ALC880_FIXUP_VOL_KNOB,
1289 },
ba533818
TI
1290 [ALC880_FIXUP_F1734] = {
1291 /* almost compatible with FUJITSU, but no bass and SPDIF */
1727a771
TI
1292 .type = HDA_FIXUP_PINS,
1293 .v.pins = (const struct hda_pintbl[]) {
bb148bde 1294 { 0x14, 0x0121401f }, /* HP */
ba533818
TI
1295 { 0x15, 0x99030120 }, /* speaker */
1296 { 0x16, 0x411111f0 }, /* N/A */
1297 { 0x17, 0x411111f0 }, /* N/A */
1298 { 0x18, 0x411111f0 }, /* N/A */
1299 { 0x19, 0x01a19950 }, /* mic-in */
1300 { 0x1a, 0x411111f0 }, /* N/A */
1301 { 0x1b, 0x411111f0 }, /* N/A */
1302 { 0x1c, 0x411111f0 }, /* N/A */
1303 { 0x1d, 0x411111f0 }, /* N/A */
1304 { 0x1e, 0x411111f0 }, /* N/A */
1305 { }
1306 },
1307 .chained = true,
1308 .chain_id = ALC880_FIXUP_VOL_KNOB,
1309 },
817de92f
TI
1310 [ALC880_FIXUP_UNIWILL] = {
1311 /* need to fix HP and speaker pins to be parsed correctly */
1727a771
TI
1312 .type = HDA_FIXUP_PINS,
1313 .v.pins = (const struct hda_pintbl[]) {
817de92f
TI
1314 { 0x14, 0x0121411f }, /* HP */
1315 { 0x15, 0x99030120 }, /* speaker */
1316 { 0x16, 0x99030130 }, /* bass speaker */
1317 { }
1318 },
1319 },
967b88c4 1320 [ALC880_FIXUP_UNIWILL_DIG] = {
1727a771
TI
1321 .type = HDA_FIXUP_PINS,
1322 .v.pins = (const struct hda_pintbl[]) {
967b88c4
TI
1323 /* disable bogus unused pins */
1324 { 0x17, 0x411111f0 },
1325 { 0x19, 0x411111f0 },
1326 { 0x1b, 0x411111f0 },
1327 { 0x1f, 0x411111f0 },
1328 { }
1329 }
1330 },
96e225f6 1331 [ALC880_FIXUP_Z71V] = {
1727a771
TI
1332 .type = HDA_FIXUP_PINS,
1333 .v.pins = (const struct hda_pintbl[]) {
96e225f6
TI
1334 /* set up the whole pins as BIOS is utterly broken */
1335 { 0x14, 0x99030120 }, /* speaker */
1336 { 0x15, 0x0121411f }, /* HP */
1337 { 0x16, 0x411111f0 }, /* N/A */
1338 { 0x17, 0x411111f0 }, /* N/A */
1339 { 0x18, 0x01a19950 }, /* mic-in */
1340 { 0x19, 0x411111f0 }, /* N/A */
1341 { 0x1a, 0x01813031 }, /* line-in */
1342 { 0x1b, 0x411111f0 }, /* N/A */
1343 { 0x1c, 0x411111f0 }, /* N/A */
1344 { 0x1d, 0x411111f0 }, /* N/A */
1345 { 0x1e, 0x0144111e }, /* SPDIF */
1346 { }
1347 }
1348 },
487a588d
TI
1349 [ALC880_FIXUP_ASUS_W5A] = {
1350 .type = HDA_FIXUP_PINS,
1351 .v.pins = (const struct hda_pintbl[]) {
1352 /* set up the whole pins as BIOS is utterly broken */
1353 { 0x14, 0x0121411f }, /* HP */
1354 { 0x15, 0x411111f0 }, /* N/A */
1355 { 0x16, 0x411111f0 }, /* N/A */
1356 { 0x17, 0x411111f0 }, /* N/A */
1357 { 0x18, 0x90a60160 }, /* mic */
1358 { 0x19, 0x411111f0 }, /* N/A */
1359 { 0x1a, 0x411111f0 }, /* N/A */
1360 { 0x1b, 0x411111f0 }, /* N/A */
1361 { 0x1c, 0x411111f0 }, /* N/A */
1362 { 0x1d, 0x411111f0 }, /* N/A */
1363 { 0x1e, 0xb743111e }, /* SPDIF out */
1364 { }
1365 },
1366 .chained = true,
1367 .chain_id = ALC880_FIXUP_GPIO1,
1368 },
67b6ec31 1369 [ALC880_FIXUP_3ST_BASE] = {
1727a771
TI
1370 .type = HDA_FIXUP_PINS,
1371 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1372 { 0x14, 0x01014010 }, /* line-out */
1373 { 0x15, 0x411111f0 }, /* N/A */
1374 { 0x16, 0x411111f0 }, /* N/A */
1375 { 0x17, 0x411111f0 }, /* N/A */
1376 { 0x18, 0x01a19c30 }, /* mic-in */
1377 { 0x19, 0x0121411f }, /* HP */
1378 { 0x1a, 0x01813031 }, /* line-in */
1379 { 0x1b, 0x02a19c40 }, /* front-mic */
1380 { 0x1c, 0x411111f0 }, /* N/A */
1381 { 0x1d, 0x411111f0 }, /* N/A */
1382 /* 0x1e is filled in below */
1383 { 0x1f, 0x411111f0 }, /* N/A */
1384 { }
1385 }
1386 },
1387 [ALC880_FIXUP_3ST] = {
1727a771
TI
1388 .type = HDA_FIXUP_PINS,
1389 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1390 { 0x1e, 0x411111f0 }, /* N/A */
1391 { }
1392 },
1393 .chained = true,
1394 .chain_id = ALC880_FIXUP_3ST_BASE,
1395 },
1396 [ALC880_FIXUP_3ST_DIG] = {
1727a771
TI
1397 .type = HDA_FIXUP_PINS,
1398 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1399 { 0x1e, 0x0144111e }, /* SPDIF */
1400 { }
1401 },
1402 .chained = true,
1403 .chain_id = ALC880_FIXUP_3ST_BASE,
1404 },
1405 [ALC880_FIXUP_5ST_BASE] = {
1727a771
TI
1406 .type = HDA_FIXUP_PINS,
1407 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1408 { 0x14, 0x01014010 }, /* front */
1409 { 0x15, 0x411111f0 }, /* N/A */
1410 { 0x16, 0x01011411 }, /* CLFE */
1411 { 0x17, 0x01016412 }, /* surr */
1412 { 0x18, 0x01a19c30 }, /* mic-in */
1413 { 0x19, 0x0121411f }, /* HP */
1414 { 0x1a, 0x01813031 }, /* line-in */
1415 { 0x1b, 0x02a19c40 }, /* front-mic */
1416 { 0x1c, 0x411111f0 }, /* N/A */
1417 { 0x1d, 0x411111f0 }, /* N/A */
1418 /* 0x1e is filled in below */
1419 { 0x1f, 0x411111f0 }, /* N/A */
1420 { }
1421 }
1422 },
1423 [ALC880_FIXUP_5ST] = {
1727a771
TI
1424 .type = HDA_FIXUP_PINS,
1425 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1426 { 0x1e, 0x411111f0 }, /* N/A */
1427 { }
1428 },
1429 .chained = true,
1430 .chain_id = ALC880_FIXUP_5ST_BASE,
1431 },
1432 [ALC880_FIXUP_5ST_DIG] = {
1727a771
TI
1433 .type = HDA_FIXUP_PINS,
1434 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1435 { 0x1e, 0x0144111e }, /* SPDIF */
1436 { }
1437 },
1438 .chained = true,
1439 .chain_id = ALC880_FIXUP_5ST_BASE,
1440 },
1441 [ALC880_FIXUP_6ST_BASE] = {
1727a771
TI
1442 .type = HDA_FIXUP_PINS,
1443 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1444 { 0x14, 0x01014010 }, /* front */
1445 { 0x15, 0x01016412 }, /* surr */
1446 { 0x16, 0x01011411 }, /* CLFE */
1447 { 0x17, 0x01012414 }, /* side */
1448 { 0x18, 0x01a19c30 }, /* mic-in */
1449 { 0x19, 0x02a19c40 }, /* front-mic */
1450 { 0x1a, 0x01813031 }, /* line-in */
1451 { 0x1b, 0x0121411f }, /* HP */
1452 { 0x1c, 0x411111f0 }, /* N/A */
1453 { 0x1d, 0x411111f0 }, /* N/A */
1454 /* 0x1e is filled in below */
1455 { 0x1f, 0x411111f0 }, /* N/A */
1456 { }
1457 }
1458 },
1459 [ALC880_FIXUP_6ST] = {
1727a771
TI
1460 .type = HDA_FIXUP_PINS,
1461 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1462 { 0x1e, 0x411111f0 }, /* N/A */
1463 { }
1464 },
1465 .chained = true,
1466 .chain_id = ALC880_FIXUP_6ST_BASE,
1467 },
1468 [ALC880_FIXUP_6ST_DIG] = {
1727a771
TI
1469 .type = HDA_FIXUP_PINS,
1470 .v.pins = (const struct hda_pintbl[]) {
67b6ec31
TI
1471 { 0x1e, 0x0144111e }, /* SPDIF */
1472 { }
1473 },
1474 .chained = true,
1475 .chain_id = ALC880_FIXUP_6ST_BASE,
1476 },
5397145f
TI
1477 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1478 .type = HDA_FIXUP_PINS,
1479 .v.pins = (const struct hda_pintbl[]) {
1480 { 0x1b, 0x0121401f }, /* HP with jack detect */
1481 { }
1482 },
1483 .chained_before = true,
1484 .chain_id = ALC880_FIXUP_6ST_BASE,
1485 },
ee3b2969
TI
1486};
1487
1488static const struct snd_pci_quirk alc880_fixup_tbl[] = {
f02aab5d 1489 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
487a588d 1490 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
96e225f6 1491 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
29e3fdcc 1492 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
6538de03 1493 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
29e3fdcc 1494 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
27e917f8 1495 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
967b88c4 1496 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
ba533818 1497 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
817de92f 1498 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
7833c7e8 1499 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
f02aab5d 1500 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
ee3b2969 1501 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
5397145f 1502 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
a161574e 1503 SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
cf5a2279 1504 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
ba533818 1505 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
cf5a2279 1506 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
dc6af52d
TI
1507 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1508 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1509 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
db8a38e5 1510 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
b9368f5c 1511 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
67b6ec31
TI
1512
1513 /* Below is the copied entries from alc880_quirks.c.
1514 * It's not quite sure whether BIOS sets the correct pin-config table
1515 * on these machines, thus they are kept to be compatible with
1516 * the old static quirks. Once when it's confirmed to work without
1517 * these overrides, it'd be better to remove.
1518 */
1519 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1520 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1521 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1522 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1523 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1524 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1525 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1526 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1527 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1528 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1529 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1530 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1531 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1532 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1533 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1534 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1535 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1536 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1537 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1538 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1539 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1540 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1541 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1542 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1543 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1544 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1545 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1546 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1547 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1548 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1549 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1550 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1551 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1552 /* default Intel */
1553 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1554 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1555 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1556 {}
1557};
1558
1727a771 1559static const struct hda_model_fixup alc880_fixup_models[] = {
67b6ec31
TI
1560 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1561 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1562 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1563 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1564 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1565 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
5397145f 1566 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
ee3b2969
TI
1567 {}
1568};
1569
1570
1d045db9
TI
1571/*
1572 * OK, here we have finally the patch for ALC880
1573 */
1d045db9 1574static int patch_alc880(struct hda_codec *codec)
60db6b53 1575{
1d045db9 1576 struct alc_spec *spec;
1d045db9 1577 int err;
f6a92248 1578
3de95173
TI
1579 err = alc_alloc_spec(codec, 0x0b);
1580 if (err < 0)
1581 return err;
64154835 1582
3de95173 1583 spec = codec->spec;
08c189f2 1584 spec->gen.need_dac_fix = 1;
7504b6cd 1585 spec->gen.beep_nid = 0x01;
f53281e6 1586
225068ab
TI
1587 codec->patch_ops.unsol_event = alc880_unsol_event;
1588
c9af753f
TI
1589 alc_pre_init(codec);
1590
1727a771 1591 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
67b6ec31 1592 alc880_fixups);
1727a771 1593 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
ee3b2969 1594
67b6ec31
TI
1595 /* automatic parse from the BIOS config */
1596 err = alc880_parse_auto_config(codec);
1597 if (err < 0)
1598 goto error;
fe3eb0a7 1599
fea80fae
TI
1600 if (!spec->gen.no_analog) {
1601 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1602 if (err < 0)
1603 goto error;
1604 }
f53281e6 1605
1727a771 1606 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 1607
1d045db9 1608 return 0;
e16fb6d1
TI
1609
1610 error:
1611 alc_free(codec);
1612 return err;
226b1ec8
KY
1613}
1614
1d045db9 1615
60db6b53 1616/*
1d045db9 1617 * ALC260 support
60db6b53 1618 */
1d045db9 1619static int alc260_parse_auto_config(struct hda_codec *codec)
f6a92248 1620{
1d045db9 1621 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
3e6179b8
TI
1622 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1623 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
f6a92248
KY
1624}
1625
1d045db9
TI
1626/*
1627 * Pin config fixes
1628 */
1629enum {
ca8f0424
TI
1630 ALC260_FIXUP_HP_DC5750,
1631 ALC260_FIXUP_HP_PIN_0F,
1632 ALC260_FIXUP_COEF,
15317ab2 1633 ALC260_FIXUP_GPIO1,
20f7d928
TI
1634 ALC260_FIXUP_GPIO1_TOGGLE,
1635 ALC260_FIXUP_REPLACER,
0a1c4fa2 1636 ALC260_FIXUP_HP_B1900,
118cb4a4 1637 ALC260_FIXUP_KN1,
39aedee7 1638 ALC260_FIXUP_FSC_S7020,
5ebd3bbd 1639 ALC260_FIXUP_FSC_S7020_JWSE,
d08c5ef2 1640 ALC260_FIXUP_VAIO_PINS,
1d045db9
TI
1641};
1642
20f7d928
TI
1643static void alc260_gpio1_automute(struct hda_codec *codec)
1644{
1645 struct alc_spec *spec = codec->spec;
aaf312de
TI
1646
1647 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
20f7d928
TI
1648}
1649
1650static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1727a771 1651 const struct hda_fixup *fix, int action)
20f7d928
TI
1652{
1653 struct alc_spec *spec = codec->spec;
1727a771 1654 if (action == HDA_FIXUP_ACT_PROBE) {
20f7d928
TI
1655 /* although the machine has only one output pin, we need to
1656 * toggle GPIO1 according to the jack state
1657 */
08c189f2
TI
1658 spec->gen.automute_hook = alc260_gpio1_automute;
1659 spec->gen.detect_hp = 1;
1660 spec->gen.automute_speaker = 1;
1661 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
62f949bf 1662 snd_hda_jack_detect_enable_callback(codec, 0x0f,
08c189f2 1663 snd_hda_gen_hp_automute);
5579cd6f 1664 alc_setup_gpio(codec, 0x01);
20f7d928
TI
1665 }
1666}
1667
118cb4a4 1668static void alc260_fixup_kn1(struct hda_codec *codec,
1727a771 1669 const struct hda_fixup *fix, int action)
118cb4a4
TI
1670{
1671 struct alc_spec *spec = codec->spec;
1727a771 1672 static const struct hda_pintbl pincfgs[] = {
118cb4a4
TI
1673 { 0x0f, 0x02214000 }, /* HP/speaker */
1674 { 0x12, 0x90a60160 }, /* int mic */
1675 { 0x13, 0x02a19000 }, /* ext mic */
1676 { 0x18, 0x01446000 }, /* SPDIF out */
1677 /* disable bogus I/O pins */
1678 { 0x10, 0x411111f0 },
1679 { 0x11, 0x411111f0 },
1680 { 0x14, 0x411111f0 },
1681 { 0x15, 0x411111f0 },
1682 { 0x16, 0x411111f0 },
1683 { 0x17, 0x411111f0 },
1684 { 0x19, 0x411111f0 },
1685 { }
1686 };
1687
1688 switch (action) {
1727a771
TI
1689 case HDA_FIXUP_ACT_PRE_PROBE:
1690 snd_hda_apply_pincfgs(codec, pincfgs);
118cb4a4
TI
1691 spec->init_amp = ALC_INIT_NONE;
1692 break;
1693 }
1694}
1695
39aedee7
TI
1696static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1697 const struct hda_fixup *fix, int action)
1698{
1699 struct alc_spec *spec = codec->spec;
1c76aa5f 1700 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5ebd3bbd
TI
1701 spec->init_amp = ALC_INIT_NONE;
1702}
39aedee7 1703
5ebd3bbd
TI
1704static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1705 const struct hda_fixup *fix, int action)
1706{
1707 struct alc_spec *spec = codec->spec;
1708 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
f811c3cf 1709 spec->gen.add_jack_modes = 1;
5ebd3bbd 1710 spec->gen.hp_mic = 1;
e6e0ee50 1711 }
39aedee7
TI
1712}
1713
1727a771 1714static const struct hda_fixup alc260_fixups[] = {
ca8f0424 1715 [ALC260_FIXUP_HP_DC5750] = {
1727a771
TI
1716 .type = HDA_FIXUP_PINS,
1717 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
1718 { 0x11, 0x90130110 }, /* speaker */
1719 { }
1720 }
1721 },
ca8f0424 1722 [ALC260_FIXUP_HP_PIN_0F] = {
1727a771
TI
1723 .type = HDA_FIXUP_PINS,
1724 .v.pins = (const struct hda_pintbl[]) {
ca8f0424
TI
1725 { 0x0f, 0x01214000 }, /* HP */
1726 { }
1727 }
1728 },
1729 [ALC260_FIXUP_COEF] = {
1727a771 1730 .type = HDA_FIXUP_VERBS,
ca8f0424 1731 .v.verbs = (const struct hda_verb[]) {
e30cf2d2
RM
1732 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1733 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
ca8f0424
TI
1734 { }
1735 },
ca8f0424 1736 },
15317ab2 1737 [ALC260_FIXUP_GPIO1] = {
5579cd6f
TI
1738 .type = HDA_FIXUP_FUNC,
1739 .v.func = alc_fixup_gpio1,
15317ab2 1740 },
20f7d928 1741 [ALC260_FIXUP_GPIO1_TOGGLE] = {
1727a771 1742 .type = HDA_FIXUP_FUNC,
20f7d928
TI
1743 .v.func = alc260_fixup_gpio1_toggle,
1744 .chained = true,
1745 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1746 },
1747 [ALC260_FIXUP_REPLACER] = {
1727a771 1748 .type = HDA_FIXUP_VERBS,
20f7d928 1749 .v.verbs = (const struct hda_verb[]) {
192a98e2
TI
1750 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1751 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
20f7d928
TI
1752 { }
1753 },
1754 .chained = true,
1755 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1756 },
0a1c4fa2 1757 [ALC260_FIXUP_HP_B1900] = {
1727a771 1758 .type = HDA_FIXUP_FUNC,
0a1c4fa2
TI
1759 .v.func = alc260_fixup_gpio1_toggle,
1760 .chained = true,
1761 .chain_id = ALC260_FIXUP_COEF,
118cb4a4
TI
1762 },
1763 [ALC260_FIXUP_KN1] = {
1727a771 1764 .type = HDA_FIXUP_FUNC,
118cb4a4
TI
1765 .v.func = alc260_fixup_kn1,
1766 },
39aedee7
TI
1767 [ALC260_FIXUP_FSC_S7020] = {
1768 .type = HDA_FIXUP_FUNC,
1769 .v.func = alc260_fixup_fsc_s7020,
1770 },
5ebd3bbd
TI
1771 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1772 .type = HDA_FIXUP_FUNC,
1773 .v.func = alc260_fixup_fsc_s7020_jwse,
1774 .chained = true,
1775 .chain_id = ALC260_FIXUP_FSC_S7020,
1776 },
d08c5ef2
TI
1777 [ALC260_FIXUP_VAIO_PINS] = {
1778 .type = HDA_FIXUP_PINS,
1779 .v.pins = (const struct hda_pintbl[]) {
1780 /* Pin configs are missing completely on some VAIOs */
1781 { 0x0f, 0x01211020 },
1782 { 0x10, 0x0001003f },
1783 { 0x11, 0x411111f0 },
1784 { 0x12, 0x01a15930 },
1785 { 0x13, 0x411111f0 },
1786 { 0x14, 0x411111f0 },
1787 { 0x15, 0x411111f0 },
1788 { 0x16, 0x411111f0 },
1789 { 0x17, 0x411111f0 },
1790 { 0x18, 0x411111f0 },
1791 { 0x19, 0x411111f0 },
1792 { }
1793 }
1794 },
1d045db9
TI
1795};
1796
1797static const struct snd_pci_quirk alc260_fixup_tbl[] = {
15317ab2 1798 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
ca8f0424 1799 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
15317ab2 1800 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
ca8f0424 1801 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
0a1c4fa2 1802 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
d08c5ef2 1803 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
0f5a5b85 1804 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
39aedee7 1805 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
b1f58085 1806 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
118cb4a4 1807 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
20f7d928 1808 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
ca8f0424 1809 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
1d045db9
TI
1810 {}
1811};
1812
5ebd3bbd
TI
1813static const struct hda_model_fixup alc260_fixup_models[] = {
1814 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1815 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1816 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1817 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1818 {}
1819};
1820
1d045db9
TI
1821/*
1822 */
1d045db9 1823static int patch_alc260(struct hda_codec *codec)
977ddd6b 1824{
1d045db9 1825 struct alc_spec *spec;
c3c2c9e7 1826 int err;
1d045db9 1827
3de95173
TI
1828 err = alc_alloc_spec(codec, 0x07);
1829 if (err < 0)
1830 return err;
1d045db9 1831
3de95173 1832 spec = codec->spec;
ea46c3c8
TI
1833 /* as quite a few machines require HP amp for speaker outputs,
1834 * it's easier to enable it unconditionally; even if it's unneeded,
1835 * it's almost harmless.
1836 */
1837 spec->gen.prefer_hp_amp = 1;
7504b6cd 1838 spec->gen.beep_nid = 0x01;
1d045db9 1839
225068ab
TI
1840 spec->shutup = alc_eapd_shutup;
1841
c9af753f
TI
1842 alc_pre_init(codec);
1843
5ebd3bbd
TI
1844 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1845 alc260_fixups);
1727a771 1846 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
977ddd6b 1847
c3c2c9e7
TI
1848 /* automatic parse from the BIOS config */
1849 err = alc260_parse_auto_config(codec);
1850 if (err < 0)
1851 goto error;
977ddd6b 1852
fea80fae
TI
1853 if (!spec->gen.no_analog) {
1854 err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1855 if (err < 0)
1856 goto error;
1857 }
977ddd6b 1858
1727a771 1859 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 1860
1d045db9 1861 return 0;
e16fb6d1
TI
1862
1863 error:
1864 alc_free(codec);
1865 return err;
6981d184
TI
1866}
1867
1d045db9
TI
1868
1869/*
1870 * ALC882/883/885/888/889 support
1871 *
1872 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1873 * configuration. Each pin widget can choose any input DACs and a mixer.
1874 * Each ADC is connected from a mixer of all inputs. This makes possible
1875 * 6-channel independent captures.
1876 *
1877 * In addition, an independent DAC for the multi-playback (not used in this
1878 * driver yet).
1879 */
1d045db9
TI
1880
1881/*
1882 * Pin config fixes
1883 */
ff818c24 1884enum {
5c0ebfbe
TI
1885 ALC882_FIXUP_ABIT_AW9D_MAX,
1886 ALC882_FIXUP_LENOVO_Y530,
1887 ALC882_FIXUP_PB_M5210,
1888 ALC882_FIXUP_ACER_ASPIRE_7736,
1889 ALC882_FIXUP_ASUS_W90V,
8f239214 1890 ALC889_FIXUP_CD,
b2c53e20 1891 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
5c0ebfbe 1892 ALC889_FIXUP_VAIO_TT,
0e7cc2e7 1893 ALC888_FIXUP_EEE1601,
177943a3 1894 ALC882_FIXUP_EAPD,
7a6069bf 1895 ALC883_FIXUP_EAPD,
8812c4f9 1896 ALC883_FIXUP_ACER_EAPD,
1a97b7f2
TI
1897 ALC882_FIXUP_GPIO1,
1898 ALC882_FIXUP_GPIO2,
eb844d51 1899 ALC882_FIXUP_GPIO3,
68ef0561
TI
1900 ALC889_FIXUP_COEF,
1901 ALC882_FIXUP_ASUS_W2JC,
c3e837bb
TI
1902 ALC882_FIXUP_ACER_ASPIRE_4930G,
1903 ALC882_FIXUP_ACER_ASPIRE_8930G,
1904 ALC882_FIXUP_ASPIRE_8930G_VERBS,
5671087f 1905 ALC885_FIXUP_MACPRO_GPIO,
02a237b2 1906 ALC889_FIXUP_DAC_ROUTE,
1a97b7f2
TI
1907 ALC889_FIXUP_MBP_VREF,
1908 ALC889_FIXUP_IMAC91_VREF,
e7729a41 1909 ALC889_FIXUP_MBA11_VREF,
0756f09c 1910 ALC889_FIXUP_MBA21_VREF,
c20f31ec 1911 ALC889_FIXUP_MP11_VREF,
9f660a1c 1912 ALC889_FIXUP_MP41_VREF,
6e72aa5f 1913 ALC882_FIXUP_INV_DMIC,
e427c237 1914 ALC882_FIXUP_NO_PRIMARY_HP,
1f0bbf03 1915 ALC887_FIXUP_ASUS_BASS,
eb9ca3ab 1916 ALC887_FIXUP_BASS_CHMAP,
7beb3a6e 1917 ALC1220_FIXUP_GB_DUAL_CODECS,
0202f5cd 1918 ALC1220_FIXUP_CLEVO_P950,
80690a27
RS
1919 ALC1220_FIXUP_CLEVO_PB51ED,
1920 ALC1220_FIXUP_CLEVO_PB51ED_PINS,
ff818c24
TI
1921};
1922
68ef0561 1923static void alc889_fixup_coef(struct hda_codec *codec,
1727a771 1924 const struct hda_fixup *fix, int action)
68ef0561 1925{
1727a771 1926 if (action != HDA_FIXUP_ACT_INIT)
68ef0561 1927 return;
1df8874b 1928 alc_update_coef_idx(codec, 7, 0, 0x2030);
68ef0561
TI
1929}
1930
5671087f
TI
1931/* set up GPIO at initialization */
1932static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
1727a771 1933 const struct hda_fixup *fix, int action)
5671087f 1934{
215c850c
TI
1935 struct alc_spec *spec = codec->spec;
1936
1937 spec->gpio_write_delay = true;
1938 alc_fixup_gpio3(codec, fix, action);
5671087f
TI
1939}
1940
02a237b2
TI
1941/* Fix the connection of some pins for ALC889:
1942 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
1943 * work correctly (bko#42740)
1944 */
1945static void alc889_fixup_dac_route(struct hda_codec *codec,
1727a771 1946 const struct hda_fixup *fix, int action)
02a237b2 1947{
1727a771 1948 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
ef8d60fb 1949 /* fake the connections during parsing the tree */
caf3c043
MM
1950 static const hda_nid_t conn1[] = { 0x0c, 0x0d };
1951 static const hda_nid_t conn2[] = { 0x0e, 0x0f };
1952 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
1953 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
1954 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
1955 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
1727a771 1956 } else if (action == HDA_FIXUP_ACT_PROBE) {
ef8d60fb 1957 /* restore the connections */
caf3c043
MM
1958 static const hda_nid_t conn[] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
1959 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
1960 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
1961 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
1962 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
02a237b2
TI
1963 }
1964}
1965
1a97b7f2
TI
1966/* Set VREF on HP pin */
1967static void alc889_fixup_mbp_vref(struct hda_codec *codec,
1727a771 1968 const struct hda_fixup *fix, int action)
1a97b7f2 1969{
caf3c043 1970 static const hda_nid_t nids[] = { 0x14, 0x15, 0x19 };
1a97b7f2 1971 struct alc_spec *spec = codec->spec;
1a97b7f2
TI
1972 int i;
1973
1727a771 1974 if (action != HDA_FIXUP_ACT_INIT)
1a97b7f2
TI
1975 return;
1976 for (i = 0; i < ARRAY_SIZE(nids); i++) {
1977 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
1978 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
1979 continue;
d3f02d60 1980 val = snd_hda_codec_get_pin_target(codec, nids[i]);
1a97b7f2 1981 val |= AC_PINCTL_VREF_80;
cdd03ced 1982 snd_hda_set_pin_ctl(codec, nids[i], val);
08c189f2 1983 spec->gen.keep_vref_in_automute = 1;
1a97b7f2
TI
1984 break;
1985 }
1986}
1987
0756f09c
TI
1988static void alc889_fixup_mac_pins(struct hda_codec *codec,
1989 const hda_nid_t *nids, int num_nids)
1a97b7f2
TI
1990{
1991 struct alc_spec *spec = codec->spec;
1a97b7f2
TI
1992 int i;
1993
0756f09c 1994 for (i = 0; i < num_nids; i++) {
1a97b7f2 1995 unsigned int val;
d3f02d60 1996 val = snd_hda_codec_get_pin_target(codec, nids[i]);
1a97b7f2 1997 val |= AC_PINCTL_VREF_50;
cdd03ced 1998 snd_hda_set_pin_ctl(codec, nids[i], val);
1a97b7f2 1999 }
08c189f2 2000 spec->gen.keep_vref_in_automute = 1;
1a97b7f2
TI
2001}
2002
0756f09c
TI
2003/* Set VREF on speaker pins on imac91 */
2004static void alc889_fixup_imac91_vref(struct hda_codec *codec,
2005 const struct hda_fixup *fix, int action)
2006{
caf3c043 2007 static const hda_nid_t nids[] = { 0x18, 0x1a };
0756f09c
TI
2008
2009 if (action == HDA_FIXUP_ACT_INIT)
2010 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2011}
2012
e7729a41
AV
2013/* Set VREF on speaker pins on mba11 */
2014static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2015 const struct hda_fixup *fix, int action)
2016{
caf3c043 2017 static const hda_nid_t nids[] = { 0x18 };
e7729a41
AV
2018
2019 if (action == HDA_FIXUP_ACT_INIT)
2020 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2021}
2022
0756f09c
TI
2023/* Set VREF on speaker pins on mba21 */
2024static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2025 const struct hda_fixup *fix, int action)
2026{
caf3c043 2027 static const hda_nid_t nids[] = { 0x18, 0x19 };
0756f09c
TI
2028
2029 if (action == HDA_FIXUP_ACT_INIT)
2030 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2031}
2032
e427c237 2033/* Don't take HP output as primary
d9111496
FLVC
2034 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2035 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
e427c237
TI
2036 */
2037static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
1727a771 2038 const struct hda_fixup *fix, int action)
e427c237
TI
2039{
2040 struct alc_spec *spec = codec->spec;
da96fb5b 2041 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
08c189f2 2042 spec->gen.no_primary_hp = 1;
da96fb5b
TI
2043 spec->gen.no_multi_io = 1;
2044 }
e427c237
TI
2045}
2046
eb9ca3ab
TI
2047static void alc_fixup_bass_chmap(struct hda_codec *codec,
2048 const struct hda_fixup *fix, int action);
2049
7beb3a6e
TI
2050/* For dual-codec configuration, we need to disable some features to avoid
2051 * conflicts of kctls and PCM streams
2052 */
2053static void alc_fixup_dual_codecs(struct hda_codec *codec,
2054 const struct hda_fixup *fix, int action)
2055{
2056 struct alc_spec *spec = codec->spec;
2057
2058 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2059 return;
2060 /* disable vmaster */
2061 spec->gen.suppress_vmaster = 1;
2062 /* auto-mute and auto-mic switch don't work with multiple codecs */
2063 spec->gen.suppress_auto_mute = 1;
2064 spec->gen.suppress_auto_mic = 1;
2065 /* disable aamix as well */
2066 spec->gen.mixer_nid = 0;
2067 /* add location prefix to avoid conflicts */
2068 codec->force_pin_prefix = 1;
2069}
2070
2071static void rename_ctl(struct hda_codec *codec, const char *oldname,
2072 const char *newname)
2073{
2074 struct snd_kcontrol *kctl;
2075
2076 kctl = snd_hda_find_mixer_ctl(codec, oldname);
2077 if (kctl)
2078 strcpy(kctl->id.name, newname);
2079}
2080
2081static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2082 const struct hda_fixup *fix,
2083 int action)
2084{
2085 alc_fixup_dual_codecs(codec, fix, action);
2086 switch (action) {
2087 case HDA_FIXUP_ACT_PRE_PROBE:
2088 /* override card longname to provide a unique UCM profile */
2089 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2090 break;
2091 case HDA_FIXUP_ACT_BUILD:
2092 /* rename Capture controls depending on the codec */
2093 rename_ctl(codec, "Capture Volume",
2094 codec->addr == 0 ?
2095 "Rear-Panel Capture Volume" :
2096 "Front-Panel Capture Volume");
2097 rename_ctl(codec, "Capture Switch",
2098 codec->addr == 0 ?
2099 "Rear-Panel Capture Switch" :
2100 "Front-Panel Capture Switch");
2101 break;
2102 }
2103}
2104
0202f5cd
P
2105static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2106 const struct hda_fixup *fix,
2107 int action)
2108{
caf3c043 2109 static const hda_nid_t conn1[] = { 0x0c };
0202f5cd
P
2110
2111 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2112 return;
2113
2114 alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2115 /* We therefore want to make sure 0x14 (front headphone) and
2116 * 0x1b (speakers) use the stereo DAC 0x02
2117 */
caf3c043
MM
2118 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2119 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
0202f5cd
P
2120}
2121
7f665b1c
JS
2122static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2123 const struct hda_fixup *fix, int action);
2124
80690a27 2125static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
7f665b1c
JS
2126 const struct hda_fixup *fix,
2127 int action)
2128{
2129 alc1220_fixup_clevo_p950(codec, fix, action);
2130 alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2131}
2132
1727a771 2133static const struct hda_fixup alc882_fixups[] = {
5c0ebfbe 2134 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
1727a771
TI
2135 .type = HDA_FIXUP_PINS,
2136 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
2137 { 0x15, 0x01080104 }, /* side */
2138 { 0x16, 0x01011012 }, /* rear */
2139 { 0x17, 0x01016011 }, /* clfe */
2785591a 2140 { }
145a902b
DH
2141 }
2142 },
5c0ebfbe 2143 [ALC882_FIXUP_LENOVO_Y530] = {
1727a771
TI
2144 .type = HDA_FIXUP_PINS,
2145 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
2146 { 0x15, 0x99130112 }, /* rear int speakers */
2147 { 0x16, 0x99130111 }, /* subwoofer */
ac612407
DH
2148 { }
2149 }
2150 },
5c0ebfbe 2151 [ALC882_FIXUP_PB_M5210] = {
fd108215
TI
2152 .type = HDA_FIXUP_PINCTLS,
2153 .v.pins = (const struct hda_pintbl[]) {
2154 { 0x19, PIN_VREF50 },
357f915e
KY
2155 {}
2156 }
2157 },
5c0ebfbe 2158 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
1727a771 2159 .type = HDA_FIXUP_FUNC,
23d30f28 2160 .v.func = alc_fixup_sku_ignore,
6981d184 2161 },
5c0ebfbe 2162 [ALC882_FIXUP_ASUS_W90V] = {
1727a771
TI
2163 .type = HDA_FIXUP_PINS,
2164 .v.pins = (const struct hda_pintbl[]) {
5cdf745e
TI
2165 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
2166 { }
2167 }
2168 },
8f239214 2169 [ALC889_FIXUP_CD] = {
1727a771
TI
2170 .type = HDA_FIXUP_PINS,
2171 .v.pins = (const struct hda_pintbl[]) {
8f239214
MB
2172 { 0x1c, 0x993301f0 }, /* CD */
2173 { }
2174 }
2175 },
b2c53e20
DH
2176 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2177 .type = HDA_FIXUP_PINS,
2178 .v.pins = (const struct hda_pintbl[]) {
2179 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2180 { }
2181 },
2182 .chained = true,
2183 .chain_id = ALC889_FIXUP_CD,
2184 },
5c0ebfbe 2185 [ALC889_FIXUP_VAIO_TT] = {
1727a771
TI
2186 .type = HDA_FIXUP_PINS,
2187 .v.pins = (const struct hda_pintbl[]) {
5c0ebfbe
TI
2188 { 0x17, 0x90170111 }, /* hidden surround speaker */
2189 { }
2190 }
2191 },
0e7cc2e7 2192 [ALC888_FIXUP_EEE1601] = {
1727a771 2193 .type = HDA_FIXUP_VERBS,
0e7cc2e7
TI
2194 .v.verbs = (const struct hda_verb[]) {
2195 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2196 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
2197 { }
2198 }
177943a3
TI
2199 },
2200 [ALC882_FIXUP_EAPD] = {
1727a771 2201 .type = HDA_FIXUP_VERBS,
177943a3
TI
2202 .v.verbs = (const struct hda_verb[]) {
2203 /* change to EAPD mode */
2204 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2205 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2206 { }
2207 }
2208 },
7a6069bf 2209 [ALC883_FIXUP_EAPD] = {
1727a771 2210 .type = HDA_FIXUP_VERBS,
7a6069bf
TI
2211 .v.verbs = (const struct hda_verb[]) {
2212 /* change to EAPD mode */
2213 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2214 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2215 { }
2216 }
2217 },
8812c4f9 2218 [ALC883_FIXUP_ACER_EAPD] = {
1727a771 2219 .type = HDA_FIXUP_VERBS,
8812c4f9
TI
2220 .v.verbs = (const struct hda_verb[]) {
2221 /* eanable EAPD on Acer laptops */
2222 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2223 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2224 { }
2225 }
2226 },
1a97b7f2 2227 [ALC882_FIXUP_GPIO1] = {
5579cd6f
TI
2228 .type = HDA_FIXUP_FUNC,
2229 .v.func = alc_fixup_gpio1,
1a97b7f2
TI
2230 },
2231 [ALC882_FIXUP_GPIO2] = {
5579cd6f
TI
2232 .type = HDA_FIXUP_FUNC,
2233 .v.func = alc_fixup_gpio2,
1a97b7f2 2234 },
eb844d51 2235 [ALC882_FIXUP_GPIO3] = {
5579cd6f
TI
2236 .type = HDA_FIXUP_FUNC,
2237 .v.func = alc_fixup_gpio3,
eb844d51 2238 },
68ef0561 2239 [ALC882_FIXUP_ASUS_W2JC] = {
5579cd6f
TI
2240 .type = HDA_FIXUP_FUNC,
2241 .v.func = alc_fixup_gpio1,
68ef0561
TI
2242 .chained = true,
2243 .chain_id = ALC882_FIXUP_EAPD,
2244 },
2245 [ALC889_FIXUP_COEF] = {
1727a771 2246 .type = HDA_FIXUP_FUNC,
68ef0561
TI
2247 .v.func = alc889_fixup_coef,
2248 },
c3e837bb 2249 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
1727a771
TI
2250 .type = HDA_FIXUP_PINS,
2251 .v.pins = (const struct hda_pintbl[]) {
c3e837bb
TI
2252 { 0x16, 0x99130111 }, /* CLFE speaker */
2253 { 0x17, 0x99130112 }, /* surround speaker */
2254 { }
038d4fef
TI
2255 },
2256 .chained = true,
2257 .chain_id = ALC882_FIXUP_GPIO1,
c3e837bb
TI
2258 },
2259 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
1727a771
TI
2260 .type = HDA_FIXUP_PINS,
2261 .v.pins = (const struct hda_pintbl[]) {
c3e837bb
TI
2262 { 0x16, 0x99130111 }, /* CLFE speaker */
2263 { 0x1b, 0x99130112 }, /* surround speaker */
2264 { }
2265 },
2266 .chained = true,
2267 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2268 },
2269 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2270 /* additional init verbs for Acer Aspire 8930G */
1727a771 2271 .type = HDA_FIXUP_VERBS,
c3e837bb
TI
2272 .v.verbs = (const struct hda_verb[]) {
2273 /* Enable all DACs */
2274 /* DAC DISABLE/MUTE 1? */
2275 /* setting bits 1-5 disables DAC nids 0x02-0x06
2276 * apparently. Init=0x38 */
2277 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2278 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2279 /* DAC DISABLE/MUTE 2? */
2280 /* some bit here disables the other DACs.
2281 * Init=0x4900 */
2282 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2283 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2284 /* DMIC fix
2285 * This laptop has a stereo digital microphone.
2286 * The mics are only 1cm apart which makes the stereo
2287 * useless. However, either the mic or the ALC889
2288 * makes the signal become a difference/sum signal
2289 * instead of standard stereo, which is annoying.
2290 * So instead we flip this bit which makes the
2291 * codec replicate the sum signal to both channels,
2292 * turning it into a normal mono mic.
2293 */
2294 /* DMIC_CONTROL? Init value = 0x0001 */
2295 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2296 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2297 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2298 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2299 { }
038d4fef
TI
2300 },
2301 .chained = true,
2302 .chain_id = ALC882_FIXUP_GPIO1,
c3e837bb 2303 },
5671087f 2304 [ALC885_FIXUP_MACPRO_GPIO] = {
1727a771 2305 .type = HDA_FIXUP_FUNC,
5671087f
TI
2306 .v.func = alc885_fixup_macpro_gpio,
2307 },
02a237b2 2308 [ALC889_FIXUP_DAC_ROUTE] = {
1727a771 2309 .type = HDA_FIXUP_FUNC,
02a237b2
TI
2310 .v.func = alc889_fixup_dac_route,
2311 },
1a97b7f2 2312 [ALC889_FIXUP_MBP_VREF] = {
1727a771 2313 .type = HDA_FIXUP_FUNC,
1a97b7f2
TI
2314 .v.func = alc889_fixup_mbp_vref,
2315 .chained = true,
2316 .chain_id = ALC882_FIXUP_GPIO1,
2317 },
2318 [ALC889_FIXUP_IMAC91_VREF] = {
1727a771 2319 .type = HDA_FIXUP_FUNC,
1a97b7f2
TI
2320 .v.func = alc889_fixup_imac91_vref,
2321 .chained = true,
2322 .chain_id = ALC882_FIXUP_GPIO1,
2323 },
e7729a41
AV
2324 [ALC889_FIXUP_MBA11_VREF] = {
2325 .type = HDA_FIXUP_FUNC,
2326 .v.func = alc889_fixup_mba11_vref,
2327 .chained = true,
2328 .chain_id = ALC889_FIXUP_MBP_VREF,
2329 },
0756f09c
TI
2330 [ALC889_FIXUP_MBA21_VREF] = {
2331 .type = HDA_FIXUP_FUNC,
2332 .v.func = alc889_fixup_mba21_vref,
2333 .chained = true,
2334 .chain_id = ALC889_FIXUP_MBP_VREF,
2335 },
c20f31ec
TI
2336 [ALC889_FIXUP_MP11_VREF] = {
2337 .type = HDA_FIXUP_FUNC,
2338 .v.func = alc889_fixup_mba11_vref,
2339 .chained = true,
2340 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2341 },
9f660a1c
MK
2342 [ALC889_FIXUP_MP41_VREF] = {
2343 .type = HDA_FIXUP_FUNC,
2344 .v.func = alc889_fixup_mbp_vref,
2345 .chained = true,
2346 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2347 },
6e72aa5f 2348 [ALC882_FIXUP_INV_DMIC] = {
1727a771 2349 .type = HDA_FIXUP_FUNC,
9d36a7dc 2350 .v.func = alc_fixup_inv_dmic,
6e72aa5f 2351 },
e427c237 2352 [ALC882_FIXUP_NO_PRIMARY_HP] = {
1727a771 2353 .type = HDA_FIXUP_FUNC,
e427c237
TI
2354 .v.func = alc882_fixup_no_primary_hp,
2355 },
1f0bbf03
TI
2356 [ALC887_FIXUP_ASUS_BASS] = {
2357 .type = HDA_FIXUP_PINS,
2358 .v.pins = (const struct hda_pintbl[]) {
2359 {0x16, 0x99130130}, /* bass speaker */
2360 {}
2361 },
eb9ca3ab
TI
2362 .chained = true,
2363 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2364 },
2365 [ALC887_FIXUP_BASS_CHMAP] = {
2366 .type = HDA_FIXUP_FUNC,
2367 .v.func = alc_fixup_bass_chmap,
1f0bbf03 2368 },
7beb3a6e
TI
2369 [ALC1220_FIXUP_GB_DUAL_CODECS] = {
2370 .type = HDA_FIXUP_FUNC,
2371 .v.func = alc1220_fixup_gb_dual_codecs,
2372 },
0202f5cd
P
2373 [ALC1220_FIXUP_CLEVO_P950] = {
2374 .type = HDA_FIXUP_FUNC,
2375 .v.func = alc1220_fixup_clevo_p950,
2376 },
80690a27 2377 [ALC1220_FIXUP_CLEVO_PB51ED] = {
7f665b1c 2378 .type = HDA_FIXUP_FUNC,
80690a27 2379 .v.func = alc1220_fixup_clevo_pb51ed,
7f665b1c 2380 },
80690a27 2381 [ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
7f665b1c
JS
2382 .type = HDA_FIXUP_PINS,
2383 .v.pins = (const struct hda_pintbl[]) {
2384 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2385 {}
2386 },
2387 .chained = true,
80690a27 2388 .chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
7f665b1c 2389 },
ff818c24
TI
2390};
2391
1d045db9 2392static const struct snd_pci_quirk alc882_fixup_tbl[] = {
8812c4f9
TI
2393 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2394 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
b5d724b1 2395 SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
8812c4f9
TI
2396 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2397 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2398 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2399 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
c3e837bb
TI
2400 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2401 ALC882_FIXUP_ACER_ASPIRE_4930G),
2402 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2403 ALC882_FIXUP_ACER_ASPIRE_4930G),
2404 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2405 ALC882_FIXUP_ACER_ASPIRE_8930G),
2406 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2407 ALC882_FIXUP_ACER_ASPIRE_8930G),
2408 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2409 ALC882_FIXUP_ACER_ASPIRE_4930G),
2410 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2411 ALC882_FIXUP_ACER_ASPIRE_4930G),
2412 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2413 ALC882_FIXUP_ACER_ASPIRE_4930G),
5c0ebfbe 2414 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
f5c53d89
TI
2415 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2416 ALC882_FIXUP_ACER_ASPIRE_4930G),
02a237b2 2417 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
fe97da1f 2418 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
ac9b1cdd 2419 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
177943a3 2420 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
5c0ebfbe 2421 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
68ef0561 2422 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
0e7cc2e7 2423 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
1f0bbf03 2424 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
85bcf96c 2425 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
ac9b1cdd 2426 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
e427c237 2427 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
3f3c3714 2428 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
12e31a78 2429 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
c44d9b11 2430 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
5671087f
TI
2431
2432 /* All Apple entries are in codec SSIDs */
1a97b7f2
TI
2433 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2434 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2435 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
c20f31ec 2436 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
5671087f
TI
2437 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2438 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
1a97b7f2
TI
2439 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2440 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
5671087f 2441 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
e7729a41 2442 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
0756f09c 2443 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
1a97b7f2
TI
2444 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2445 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
5671087f 2446 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
1a97b7f2
TI
2447 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2448 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2449 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
9f660a1c 2450 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
05193639 2451 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
1a97b7f2
TI
2452 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2453 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
649ccd08 2454 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
5671087f 2455
7a6069bf 2456 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
b2c53e20 2457 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
7beb3a6e 2458 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
0d45e86d 2459 SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_CLEVO_P950),
a655e2b1 2460 SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
1d3aa4a5 2461 SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
7dafba37 2462 SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
cc5049ae 2463 SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
d2c3b14e 2464 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
63691587 2465 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
d2c3b14e 2466 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
5c0ebfbe 2467 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
0202f5cd 2468 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
f3d737b6 2469 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2f0d520a 2470 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
503d90b3
RS
2471 SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2472 SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
2473 SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2474 SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
7a6069bf
TI
2475 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2476 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
ac9b1cdd 2477 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
68ef0561 2478 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
ff818c24
TI
2479 {}
2480};
2481
1727a771 2482static const struct hda_model_fixup alc882_fixup_models[] = {
772c2917
TI
2483 {.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2484 {.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2485 {.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2486 {.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2487 {.id = ALC889_FIXUP_CD, .name = "cd"},
2488 {.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2489 {.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2490 {.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2491 {.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2492 {.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2493 {.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2494 {.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2495 {.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2496 {.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2497 {.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
912093bc
TI
2498 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2499 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2500 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
772c2917
TI
2501 {.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2502 {.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2503 {.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2504 {.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2505 {.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2506 {.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2507 {.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2508 {.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
6e72aa5f 2509 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
e427c237 2510 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
772c2917 2511 {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
ba90d6a6 2512 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
772c2917 2513 {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
912093bc
TI
2514 {}
2515};
2516
f6a92248 2517/*
1d045db9 2518 * BIOS auto configuration
f6a92248 2519 */
1d045db9
TI
2520/* almost identical with ALC880 parser... */
2521static int alc882_parse_auto_config(struct hda_codec *codec)
2522{
1d045db9 2523 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
3e6179b8
TI
2524 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2525 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
1d045db9 2526}
b896b4eb 2527
1d045db9
TI
2528/*
2529 */
1d045db9 2530static int patch_alc882(struct hda_codec *codec)
f6a92248
KY
2531{
2532 struct alc_spec *spec;
1a97b7f2 2533 int err;
f6a92248 2534
3de95173
TI
2535 err = alc_alloc_spec(codec, 0x0b);
2536 if (err < 0)
2537 return err;
f6a92248 2538
3de95173 2539 spec = codec->spec;
1f0f4b80 2540
7639a06c 2541 switch (codec->core.vendor_id) {
1d045db9
TI
2542 case 0x10ec0882:
2543 case 0x10ec0885:
acf08081 2544 case 0x10ec0900:
6d9ffcff 2545 case 0x10ec0b00:
a535ad57 2546 case 0x10ec1220:
1d045db9
TI
2547 break;
2548 default:
2549 /* ALC883 and variants */
2550 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2551 break;
c793bec5 2552 }
977ddd6b 2553
c9af753f
TI
2554 alc_pre_init(codec);
2555
1727a771 2556 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
912093bc 2557 alc882_fixups);
1727a771 2558 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
ff818c24 2559
1d045db9
TI
2560 alc_auto_parse_customize_define(codec);
2561
7504b6cd
TI
2562 if (has_cdefine_beep(codec))
2563 spec->gen.beep_nid = 0x01;
2564
1a97b7f2
TI
2565 /* automatic parse from the BIOS config */
2566 err = alc882_parse_auto_config(codec);
2567 if (err < 0)
2568 goto error;
f6a92248 2569
fea80fae
TI
2570 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2571 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2572 if (err < 0)
2573 goto error;
2574 }
f6a92248 2575
1727a771 2576 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 2577
f6a92248 2578 return 0;
e16fb6d1
TI
2579
2580 error:
2581 alc_free(codec);
2582 return err;
f6a92248
KY
2583}
2584
df694daa 2585
df694daa 2586/*
1d045db9 2587 * ALC262 support
df694daa 2588 */
1d045db9 2589static int alc262_parse_auto_config(struct hda_codec *codec)
df694daa 2590{
1d045db9 2591 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
3e6179b8
TI
2592 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2593 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
df694daa
KY
2594}
2595
df694daa 2596/*
1d045db9 2597 * Pin config fixes
df694daa 2598 */
cfc9b06f 2599enum {
ea4e7af1 2600 ALC262_FIXUP_FSC_H270,
7513e6da 2601 ALC262_FIXUP_FSC_S7110,
ea4e7af1
TI
2602 ALC262_FIXUP_HP_Z200,
2603 ALC262_FIXUP_TYAN,
c470150c 2604 ALC262_FIXUP_LENOVO_3000,
b42590b8
TI
2605 ALC262_FIXUP_BENQ,
2606 ALC262_FIXUP_BENQ_T31,
6e72aa5f 2607 ALC262_FIXUP_INV_DMIC,
b5c6611f 2608 ALC262_FIXUP_INTEL_BAYLEYBAY,
cfc9b06f
TI
2609};
2610
1727a771 2611static const struct hda_fixup alc262_fixups[] = {
ea4e7af1 2612 [ALC262_FIXUP_FSC_H270] = {
1727a771
TI
2613 .type = HDA_FIXUP_PINS,
2614 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
2615 { 0x14, 0x99130110 }, /* speaker */
2616 { 0x15, 0x0221142f }, /* front HP */
2617 { 0x1b, 0x0121141f }, /* rear HP */
2618 { }
2619 }
2620 },
7513e6da
TI
2621 [ALC262_FIXUP_FSC_S7110] = {
2622 .type = HDA_FIXUP_PINS,
2623 .v.pins = (const struct hda_pintbl[]) {
2624 { 0x15, 0x90170110 }, /* speaker */
2625 { }
2626 },
2627 .chained = true,
2628 .chain_id = ALC262_FIXUP_BENQ,
2629 },
ea4e7af1 2630 [ALC262_FIXUP_HP_Z200] = {
1727a771
TI
2631 .type = HDA_FIXUP_PINS,
2632 .v.pins = (const struct hda_pintbl[]) {
1d045db9 2633 { 0x16, 0x99130120 }, /* internal speaker */
73413b12
TI
2634 { }
2635 }
cfc9b06f 2636 },
ea4e7af1 2637 [ALC262_FIXUP_TYAN] = {
1727a771
TI
2638 .type = HDA_FIXUP_PINS,
2639 .v.pins = (const struct hda_pintbl[]) {
ea4e7af1
TI
2640 { 0x14, 0x1993e1f0 }, /* int AUX */
2641 { }
2642 }
2643 },
c470150c 2644 [ALC262_FIXUP_LENOVO_3000] = {
fd108215
TI
2645 .type = HDA_FIXUP_PINCTLS,
2646 .v.pins = (const struct hda_pintbl[]) {
2647 { 0x19, PIN_VREF50 },
b42590b8
TI
2648 {}
2649 },
2650 .chained = true,
2651 .chain_id = ALC262_FIXUP_BENQ,
2652 },
2653 [ALC262_FIXUP_BENQ] = {
1727a771 2654 .type = HDA_FIXUP_VERBS,
b42590b8 2655 .v.verbs = (const struct hda_verb[]) {
c470150c
TI
2656 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2657 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2658 {}
2659 }
2660 },
b42590b8 2661 [ALC262_FIXUP_BENQ_T31] = {
1727a771 2662 .type = HDA_FIXUP_VERBS,
b42590b8
TI
2663 .v.verbs = (const struct hda_verb[]) {
2664 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2665 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2666 {}
2667 }
2668 },
6e72aa5f 2669 [ALC262_FIXUP_INV_DMIC] = {
1727a771 2670 .type = HDA_FIXUP_FUNC,
9d36a7dc 2671 .v.func = alc_fixup_inv_dmic,
6e72aa5f 2672 },
b5c6611f
ML
2673 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2674 .type = HDA_FIXUP_FUNC,
2675 .v.func = alc_fixup_no_depop_delay,
2676 },
cfc9b06f
TI
2677};
2678
1d045db9 2679static const struct snd_pci_quirk alc262_fixup_tbl[] = {
ea4e7af1 2680 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
7513e6da 2681 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
3dcd3be3 2682 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
ea4e7af1 2683 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
275ec0cb 2684 SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
ea4e7af1 2685 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
c470150c 2686 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
b42590b8
TI
2687 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2688 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
b5c6611f 2689 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
cfc9b06f
TI
2690 {}
2691};
df694daa 2692
1727a771 2693static const struct hda_model_fixup alc262_fixup_models[] = {
6e72aa5f 2694 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
e43c44d6
TI
2695 {.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2696 {.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2697 {.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2698 {.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2699 {.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2700 {.id = ALC262_FIXUP_BENQ, .name = "benq"},
2701 {.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2702 {.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
6e72aa5f
TI
2703 {}
2704};
1d045db9 2705
1d045db9
TI
2706/*
2707 */
1d045db9 2708static int patch_alc262(struct hda_codec *codec)
df694daa
KY
2709{
2710 struct alc_spec *spec;
df694daa
KY
2711 int err;
2712
3de95173
TI
2713 err = alc_alloc_spec(codec, 0x0b);
2714 if (err < 0)
2715 return err;
df694daa 2716
3de95173 2717 spec = codec->spec;
08c189f2 2718 spec->gen.shared_mic_vref_pin = 0x18;
1d045db9 2719
225068ab
TI
2720 spec->shutup = alc_eapd_shutup;
2721
1d045db9
TI
2722#if 0
2723 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2724 * under-run
2725 */
98b24883 2726 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
1d045db9 2727#endif
1d045db9
TI
2728 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2729
c9af753f
TI
2730 alc_pre_init(codec);
2731
1727a771 2732 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
6e72aa5f 2733 alc262_fixups);
1727a771 2734 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
9c7f852e 2735
af741c15
TI
2736 alc_auto_parse_customize_define(codec);
2737
7504b6cd
TI
2738 if (has_cdefine_beep(codec))
2739 spec->gen.beep_nid = 0x01;
2740
42399f7a
TI
2741 /* automatic parse from the BIOS config */
2742 err = alc262_parse_auto_config(codec);
2743 if (err < 0)
2744 goto error;
df694daa 2745
fea80fae
TI
2746 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2747 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2748 if (err < 0)
2749 goto error;
2750 }
2134ea4f 2751
1727a771 2752 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 2753
1da177e4 2754 return 0;
e16fb6d1
TI
2755
2756 error:
2757 alc_free(codec);
2758 return err;
1da177e4
LT
2759}
2760
f32610ed 2761/*
1d045db9 2762 * ALC268
f32610ed 2763 */
1d045db9 2764/* bind Beep switches of both NID 0x0f and 0x10 */
a717777d
TI
2765static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2766 struct snd_ctl_elem_value *ucontrol)
2767{
2768 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2769 unsigned long pval;
2770 int err;
2771
2772 mutex_lock(&codec->control_mutex);
2773 pval = kcontrol->private_value;
2774 kcontrol->private_value = (pval & ~0xff) | 0x0f;
2775 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2776 if (err >= 0) {
2777 kcontrol->private_value = (pval & ~0xff) | 0x10;
2778 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2779 }
2780 kcontrol->private_value = pval;
2781 mutex_unlock(&codec->control_mutex);
2782 return err;
2783}
f32610ed 2784
1d045db9
TI
2785static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2786 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
a717777d
TI
2787 {
2788 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2789 .name = "Beep Playback Switch",
2790 .subdevice = HDA_SUBDEV_AMP_FLAG,
2791 .info = snd_hda_mixer_amp_switch_info,
2792 .get = snd_hda_mixer_amp_switch_get,
2793 .put = alc268_beep_switch_put,
2794 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
2795 },
f32610ed
JS
2796};
2797
1d045db9
TI
2798/* set PCBEEP vol = 0, mute connections */
2799static const struct hda_verb alc268_beep_init_verbs[] = {
2800 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2801 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2802 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2803 { }
f32610ed
JS
2804};
2805
6e72aa5f
TI
2806enum {
2807 ALC268_FIXUP_INV_DMIC,
cb766404 2808 ALC268_FIXUP_HP_EAPD,
24eff328 2809 ALC268_FIXUP_SPDIF,
6e72aa5f
TI
2810};
2811
1727a771 2812static const struct hda_fixup alc268_fixups[] = {
6e72aa5f 2813 [ALC268_FIXUP_INV_DMIC] = {
1727a771 2814 .type = HDA_FIXUP_FUNC,
9d36a7dc 2815 .v.func = alc_fixup_inv_dmic,
6e72aa5f 2816 },
cb766404 2817 [ALC268_FIXUP_HP_EAPD] = {
1727a771 2818 .type = HDA_FIXUP_VERBS,
cb766404
TI
2819 .v.verbs = (const struct hda_verb[]) {
2820 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
2821 {}
2822 }
2823 },
24eff328
TI
2824 [ALC268_FIXUP_SPDIF] = {
2825 .type = HDA_FIXUP_PINS,
2826 .v.pins = (const struct hda_pintbl[]) {
2827 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
2828 {}
2829 }
2830 },
6e72aa5f
TI
2831};
2832
1727a771 2833static const struct hda_model_fixup alc268_fixup_models[] = {
6e72aa5f 2834 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
cb766404 2835 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
03bf11c9 2836 {.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
cb766404
TI
2837 {}
2838};
2839
2840static const struct snd_pci_quirk alc268_fixup_tbl[] = {
24eff328 2841 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
fcd8f3b1 2842 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
cb766404
TI
2843 /* below is codec SSID since multiple Toshiba laptops have the
2844 * same PCI SSID 1179:ff00
2845 */
2846 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
6e72aa5f
TI
2847 {}
2848};
2849
f32610ed
JS
2850/*
2851 * BIOS auto configuration
2852 */
1d045db9 2853static int alc268_parse_auto_config(struct hda_codec *codec)
f32610ed 2854{
3e6179b8 2855 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
7504b6cd 2856 return alc_parse_auto_config(codec, NULL, alc268_ssids);
f32610ed
JS
2857}
2858
1d045db9
TI
2859/*
2860 */
1d045db9 2861static int patch_alc268(struct hda_codec *codec)
f32610ed
JS
2862{
2863 struct alc_spec *spec;
a5cb463a 2864 int i, err;
f32610ed 2865
1d045db9 2866 /* ALC268 has no aa-loopback mixer */
3de95173
TI
2867 err = alc_alloc_spec(codec, 0);
2868 if (err < 0)
2869 return err;
2870
2871 spec = codec->spec;
2722b535
TI
2872 if (has_cdefine_beep(codec))
2873 spec->gen.beep_nid = 0x01;
1f0f4b80 2874
225068ab
TI
2875 spec->shutup = alc_eapd_shutup;
2876
c9af753f
TI
2877 alc_pre_init(codec);
2878
1727a771
TI
2879 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
2880 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
6e72aa5f 2881
6ebb8053
TI
2882 /* automatic parse from the BIOS config */
2883 err = alc268_parse_auto_config(codec);
e16fb6d1
TI
2884 if (err < 0)
2885 goto error;
f32610ed 2886
7504b6cd
TI
2887 if (err > 0 && !spec->gen.no_analog &&
2888 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
a5cb463a
TI
2889 for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
2890 if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
2891 &alc268_beep_mixer[i])) {
2892 err = -ENOMEM;
2893 goto error;
2894 }
2895 }
7504b6cd 2896 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
1d045db9
TI
2897 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
2898 /* override the amp caps for beep generator */
2899 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
2900 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
2901 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
2902 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
2903 (0 << AC_AMPCAP_MUTE_SHIFT));
2f893286
KY
2904 }
2905
1727a771 2906 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
6e72aa5f 2907
f32610ed 2908 return 0;
e16fb6d1
TI
2909
2910 error:
2911 alc_free(codec);
2912 return err;
f32610ed
JS
2913}
2914
bc9f98a9 2915/*
1d045db9 2916 * ALC269
bc9f98a9 2917 */
08c189f2 2918
1d045db9 2919static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
1d045db9 2920 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
bc9f98a9
KY
2921};
2922
1d045db9 2923static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
1d045db9 2924 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
bc9f98a9 2925};
291702f0 2926
1d045db9
TI
2927/* different alc269-variants */
2928enum {
2929 ALC269_TYPE_ALC269VA,
2930 ALC269_TYPE_ALC269VB,
2931 ALC269_TYPE_ALC269VC,
adcc70b2 2932 ALC269_TYPE_ALC269VD,
065380f0
KY
2933 ALC269_TYPE_ALC280,
2934 ALC269_TYPE_ALC282,
2af02be7 2935 ALC269_TYPE_ALC283,
065380f0 2936 ALC269_TYPE_ALC284,
4731d5de 2937 ALC269_TYPE_ALC293,
7fc7d047 2938 ALC269_TYPE_ALC286,
506b62c3 2939 ALC269_TYPE_ALC298,
1d04c9de 2940 ALC269_TYPE_ALC255,
4344aec8 2941 ALC269_TYPE_ALC256,
f429e7e4 2942 ALC269_TYPE_ALC257,
0a6f0600 2943 ALC269_TYPE_ALC215,
4231430d 2944 ALC269_TYPE_ALC225,
dcd4f0db 2945 ALC269_TYPE_ALC294,
1078bef0 2946 ALC269_TYPE_ALC300,
f0778871 2947 ALC269_TYPE_ALC623,
6fbae35a 2948 ALC269_TYPE_ALC700,
bc9f98a9
KY
2949};
2950
2951/*
1d045db9 2952 * BIOS auto configuration
bc9f98a9 2953 */
1d045db9
TI
2954static int alc269_parse_auto_config(struct hda_codec *codec)
2955{
1d045db9 2956 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
3e6179b8
TI
2957 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
2958 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2959 struct alc_spec *spec = codec->spec;
adcc70b2
KY
2960 const hda_nid_t *ssids;
2961
2962 switch (spec->codec_variant) {
2963 case ALC269_TYPE_ALC269VA:
2964 case ALC269_TYPE_ALC269VC:
065380f0
KY
2965 case ALC269_TYPE_ALC280:
2966 case ALC269_TYPE_ALC284:
4731d5de 2967 case ALC269_TYPE_ALC293:
adcc70b2
KY
2968 ssids = alc269va_ssids;
2969 break;
2970 case ALC269_TYPE_ALC269VB:
2971 case ALC269_TYPE_ALC269VD:
065380f0 2972 case ALC269_TYPE_ALC282:
2af02be7 2973 case ALC269_TYPE_ALC283:
7fc7d047 2974 case ALC269_TYPE_ALC286:
506b62c3 2975 case ALC269_TYPE_ALC298:
1d04c9de 2976 case ALC269_TYPE_ALC255:
4344aec8 2977 case ALC269_TYPE_ALC256:
f429e7e4 2978 case ALC269_TYPE_ALC257:
0a6f0600 2979 case ALC269_TYPE_ALC215:
4231430d 2980 case ALC269_TYPE_ALC225:
dcd4f0db 2981 case ALC269_TYPE_ALC294:
1078bef0 2982 case ALC269_TYPE_ALC300:
f0778871 2983 case ALC269_TYPE_ALC623:
6fbae35a 2984 case ALC269_TYPE_ALC700:
adcc70b2
KY
2985 ssids = alc269_ssids;
2986 break;
2987 default:
2988 ssids = alc269_ssids;
2989 break;
2990 }
bc9f98a9 2991
3e6179b8 2992 return alc_parse_auto_config(codec, alc269_ignore, ssids);
1d045db9 2993}
bc9f98a9 2994
476c02e0
HW
2995static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
2996 { SND_JACK_BTN_0, KEY_PLAYPAUSE },
2997 { SND_JACK_BTN_1, KEY_VOICECOMMAND },
2998 { SND_JACK_BTN_2, KEY_VOLUMEUP },
2999 { SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3000 {}
3001};
3002
3003static void alc_headset_btn_callback(struct hda_codec *codec,
3004 struct hda_jack_callback *jack)
3005{
3006 int report = 0;
3007
3008 if (jack->unsol_res & (7 << 13))
3009 report |= SND_JACK_BTN_0;
3010
3011 if (jack->unsol_res & (1 << 16 | 3 << 8))
3012 report |= SND_JACK_BTN_1;
3013
3014 /* Volume up key */
3015 if (jack->unsol_res & (7 << 23))
3016 report |= SND_JACK_BTN_2;
3017
3018 /* Volume down key */
3019 if (jack->unsol_res & (7 << 10))
3020 report |= SND_JACK_BTN_3;
3021
3022 jack->jack->button_state = report;
3023}
3024
3025static void alc_disable_headset_jack_key(struct hda_codec *codec)
3026{
3027 struct alc_spec *spec = codec->spec;
3028
3029 if (!spec->has_hs_key)
3030 return;
3031
3032 switch (codec->core.vendor_id) {
3033 case 0x10ec0215:
3034 case 0x10ec0225:
3035 case 0x10ec0285:
3036 case 0x10ec0295:
3037 case 0x10ec0289:
3038 case 0x10ec0299:
3039 alc_write_coef_idx(codec, 0x48, 0x0);
3040 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3041 alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3042 break;
3043 case 0x10ec0236:
3044 case 0x10ec0256:
3045 alc_write_coef_idx(codec, 0x48, 0x0);
3046 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3047 break;
3048 }
3049}
3050
3051static void alc_enable_headset_jack_key(struct hda_codec *codec)
3052{
3053 struct alc_spec *spec = codec->spec;
3054
3055 if (!spec->has_hs_key)
3056 return;
3057
3058 switch (codec->core.vendor_id) {
3059 case 0x10ec0215:
3060 case 0x10ec0225:
3061 case 0x10ec0285:
3062 case 0x10ec0295:
3063 case 0x10ec0289:
3064 case 0x10ec0299:
3065 alc_write_coef_idx(codec, 0x48, 0xd011);
3066 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3067 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3068 break;
3069 case 0x10ec0236:
3070 case 0x10ec0256:
3071 alc_write_coef_idx(codec, 0x48, 0xd011);
3072 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3073 break;
3074 }
3075}
3076
3077static void alc_fixup_headset_jack(struct hda_codec *codec,
3078 const struct hda_fixup *fix, int action)
3079{
3080 struct alc_spec *spec = codec->spec;
3081
3082 switch (action) {
3083 case HDA_FIXUP_ACT_PRE_PROBE:
3084 spec->has_hs_key = 1;
3085 snd_hda_jack_detect_enable_callback(codec, 0x55,
3086 alc_headset_btn_callback);
3087 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack", false,
3088 SND_JACK_HEADSET, alc_headset_btn_keymap);
3089 break;
3090 case HDA_FIXUP_ACT_INIT:
3091 alc_enable_headset_jack_key(codec);
3092 break;
3093 }
3094}
3095
1387e2d1 3096static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
1d045db9 3097{
98b24883 3098 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
1d045db9 3099}
291702f0 3100
1d045db9
TI
3101static void alc269_shutup(struct hda_codec *codec)
3102{
adcc70b2
KY
3103 struct alc_spec *spec = codec->spec;
3104
1387e2d1
KY
3105 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3106 alc269vb_toggle_power_output(codec, 0);
3107 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3108 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
1d045db9
TI
3109 msleep(150);
3110 }
c0ca5ece 3111 alc_shutup_pins(codec);
1d045db9 3112}
291702f0 3113
6b0f95c4 3114static const struct coef_fw alc282_coefs[] = {
54db6c39 3115 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
32fa7e49 3116 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
54db6c39
TI
3117 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3118 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3119 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3120 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3121 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3122 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3123 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3124 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3125 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3126 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3127 WRITE_COEF(0x34, 0xa0c0), /* ANC */
3128 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3129 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3130 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3131 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3132 WRITE_COEF(0x63, 0x2902), /* PLL */
3133 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3134 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3135 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3136 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3137 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3138 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3139 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3140 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3141 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3142 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3143 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3144 {}
3145};
3146
cb149cb3
KY
3147static void alc282_restore_default_value(struct hda_codec *codec)
3148{
54db6c39 3149 alc_process_coef_fw(codec, alc282_coefs);
cb149cb3
KY
3150}
3151
7b5c7a02
KY
3152static void alc282_init(struct hda_codec *codec)
3153{
3154 struct alc_spec *spec = codec->spec;
35a39f98 3155 hda_nid_t hp_pin = alc_get_hp_pin(spec);
7b5c7a02
KY
3156 bool hp_pin_sense;
3157 int coef78;
3158
cb149cb3
KY
3159 alc282_restore_default_value(codec);
3160
7b5c7a02
KY
3161 if (!hp_pin)
3162 return;
3163 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3164 coef78 = alc_read_coef_idx(codec, 0x78);
3165
3166 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3167 /* Headphone capless set to high power mode */
3168 alc_write_coef_idx(codec, 0x78, 0x9004);
3169
3170 if (hp_pin_sense)
3171 msleep(2);
3172
3173 snd_hda_codec_write(codec, hp_pin, 0,
3174 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3175
3176 if (hp_pin_sense)
3177 msleep(85);
3178
3179 snd_hda_codec_write(codec, hp_pin, 0,
3180 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3181
3182 if (hp_pin_sense)
3183 msleep(100);
3184
3185 /* Headphone capless set to normal mode */
3186 alc_write_coef_idx(codec, 0x78, coef78);
3187}
3188
3189static void alc282_shutup(struct hda_codec *codec)
3190{
3191 struct alc_spec *spec = codec->spec;
35a39f98 3192 hda_nid_t hp_pin = alc_get_hp_pin(spec);
7b5c7a02
KY
3193 bool hp_pin_sense;
3194 int coef78;
3195
3196 if (!hp_pin) {
3197 alc269_shutup(codec);
3198 return;
3199 }
3200
3201 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3202 coef78 = alc_read_coef_idx(codec, 0x78);
3203 alc_write_coef_idx(codec, 0x78, 0x9004);
3204
3205 if (hp_pin_sense)
3206 msleep(2);
3207
3208 snd_hda_codec_write(codec, hp_pin, 0,
3209 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3210
3211 if (hp_pin_sense)
3212 msleep(85);
3213
c0ca5ece
TI
3214 if (!spec->no_shutup_pins)
3215 snd_hda_codec_write(codec, hp_pin, 0,
3216 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
7b5c7a02
KY
3217
3218 if (hp_pin_sense)
3219 msleep(100);
3220
3221 alc_auto_setup_eapd(codec, false);
c0ca5ece 3222 alc_shutup_pins(codec);
7b5c7a02
KY
3223 alc_write_coef_idx(codec, 0x78, coef78);
3224}
3225
6b0f95c4 3226static const struct coef_fw alc283_coefs[] = {
54db6c39 3227 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
56779864 3228 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
54db6c39
TI
3229 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3230 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3231 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3232 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3233 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3234 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3235 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3236 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3237 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3238 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3239 WRITE_COEF(0x22, 0xa0c0), /* ANC */
3240 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3241 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3242 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3243 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3244 WRITE_COEF(0x2e, 0x2902), /* PLL */
3245 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3246 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3247 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3248 WRITE_COEF(0x36, 0x0), /* capless control 5 */
3249 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3250 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3251 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3252 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3253 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3254 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3255 WRITE_COEF(0x49, 0x0), /* test mode */
3256 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3257 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3258 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
56779864 3259 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
54db6c39
TI
3260 {}
3261};
3262
6bd55b04
KY
3263static void alc283_restore_default_value(struct hda_codec *codec)
3264{
54db6c39 3265 alc_process_coef_fw(codec, alc283_coefs);
6bd55b04
KY
3266}
3267
2af02be7
KY
3268static void alc283_init(struct hda_codec *codec)
3269{
3270 struct alc_spec *spec = codec->spec;
35a39f98 3271 hda_nid_t hp_pin = alc_get_hp_pin(spec);
2af02be7 3272 bool hp_pin_sense;
2af02be7 3273
6bd55b04
KY
3274 alc283_restore_default_value(codec);
3275
2af02be7
KY
3276 if (!hp_pin)
3277 return;
a59d7199
KY
3278
3279 msleep(30);
2af02be7
KY
3280 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3281
3282 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3283 /* Headphone capless set to high power mode */
3284 alc_write_coef_idx(codec, 0x43, 0x9004);
3285
3286 snd_hda_codec_write(codec, hp_pin, 0,
3287 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3288
3289 if (hp_pin_sense)
3290 msleep(85);
3291
3292 snd_hda_codec_write(codec, hp_pin, 0,
3293 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3294
3295 if (hp_pin_sense)
3296 msleep(85);
3297 /* Index 0x46 Combo jack auto switch control 2 */
3298 /* 3k pull low control for Headset jack. */
98b24883 3299 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
2af02be7
KY
3300 /* Headphone capless set to normal mode */
3301 alc_write_coef_idx(codec, 0x43, 0x9614);
3302}
3303
3304static void alc283_shutup(struct hda_codec *codec)
3305{
3306 struct alc_spec *spec = codec->spec;
35a39f98 3307 hda_nid_t hp_pin = alc_get_hp_pin(spec);
2af02be7 3308 bool hp_pin_sense;
2af02be7
KY
3309
3310 if (!hp_pin) {
3311 alc269_shutup(codec);
3312 return;
3313 }
3314
3315 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3316
3317 alc_write_coef_idx(codec, 0x43, 0x9004);
3318
b450b17c
HP
3319 /*depop hp during suspend*/
3320 alc_write_coef_idx(codec, 0x06, 0x2100);
3321
2af02be7
KY
3322 snd_hda_codec_write(codec, hp_pin, 0,
3323 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3324
3325 if (hp_pin_sense)
88011c09 3326 msleep(100);
2af02be7 3327
c0ca5ece
TI
3328 if (!spec->no_shutup_pins)
3329 snd_hda_codec_write(codec, hp_pin, 0,
3330 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
2af02be7 3331
98b24883 3332 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
2af02be7
KY
3333
3334 if (hp_pin_sense)
88011c09 3335 msleep(100);
0435b3ff 3336 alc_auto_setup_eapd(codec, false);
c0ca5ece 3337 alc_shutup_pins(codec);
2af02be7
KY
3338 alc_write_coef_idx(codec, 0x43, 0x9614);
3339}
3340
4a219ef8
KY
3341static void alc256_init(struct hda_codec *codec)
3342{
3343 struct alc_spec *spec = codec->spec;
35a39f98 3344 hda_nid_t hp_pin = alc_get_hp_pin(spec);
4a219ef8
KY
3345 bool hp_pin_sense;
3346
3347 if (!hp_pin)
6447c962 3348 hp_pin = 0x21;
4a219ef8
KY
3349
3350 msleep(30);
3351
3352 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3353
3354 if (hp_pin_sense)
3355 msleep(2);
3356
3357 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
6447c962
KY
3358 if (spec->ultra_low_power) {
3359 alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3360 alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3361 alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3362 alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3363 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3364 msleep(30);
3365 }
4a219ef8
KY
3366
3367 snd_hda_codec_write(codec, hp_pin, 0,
3368 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3369
6447c962 3370 if (hp_pin_sense || spec->ultra_low_power)
4a219ef8
KY
3371 msleep(85);
3372
3373 snd_hda_codec_write(codec, hp_pin, 0,
3374 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3375
6447c962 3376 if (hp_pin_sense || spec->ultra_low_power)
4a219ef8
KY
3377 msleep(100);
3378
3379 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3380 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
88d42b2b
KY
3381 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3382 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
c4473744
TH
3383 /*
3384 * Expose headphone mic (or possibly Line In on some machines) instead
3385 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3386 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3387 * this register.
3388 */
3389 alc_write_coef_idx(codec, 0x36, 0x5757);
4a219ef8
KY
3390}
3391
3392static void alc256_shutup(struct hda_codec *codec)
3393{
3394 struct alc_spec *spec = codec->spec;
35a39f98 3395 hda_nid_t hp_pin = alc_get_hp_pin(spec);
4a219ef8
KY
3396 bool hp_pin_sense;
3397
6447c962
KY
3398 if (!hp_pin)
3399 hp_pin = 0x21;
4a219ef8
KY
3400
3401 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3402
3403 if (hp_pin_sense)
3404 msleep(2);
3405
3406 snd_hda_codec_write(codec, hp_pin, 0,
3407 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3408
6447c962 3409 if (hp_pin_sense || spec->ultra_low_power)
4a219ef8
KY
3410 msleep(85);
3411
1c9609e3
TI
3412 /* 3k pull low control for Headset jack. */
3413 /* NOTE: call this before clearing the pin, otherwise codec stalls */
3414 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3415
c0ca5ece
TI
3416 if (!spec->no_shutup_pins)
3417 snd_hda_codec_write(codec, hp_pin, 0,
3418 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4a219ef8 3419
6447c962 3420 if (hp_pin_sense || spec->ultra_low_power)
4a219ef8
KY
3421 msleep(100);
3422
3423 alc_auto_setup_eapd(codec, false);
c0ca5ece 3424 alc_shutup_pins(codec);
6447c962
KY
3425 if (spec->ultra_low_power) {
3426 msleep(50);
3427 alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3428 alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3429 alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3430 alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3431 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3432 msleep(30);
3433 }
4a219ef8
KY
3434}
3435
da911b1f
KY
3436static void alc225_init(struct hda_codec *codec)
3437{
3438 struct alc_spec *spec = codec->spec;
35a39f98 3439 hda_nid_t hp_pin = alc_get_hp_pin(spec);
da911b1f
KY
3440 bool hp1_pin_sense, hp2_pin_sense;
3441
3442 if (!hp_pin)
d3ba58bb 3443 hp_pin = 0x21;
da911b1f
KY
3444 msleep(30);
3445
3446 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3447 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3448
3449 if (hp1_pin_sense || hp2_pin_sense)
3450 msleep(2);
3451
3452 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
d3ba58bb
KY
3453 if (spec->ultra_low_power) {
3454 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3455 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3456 alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3457 msleep(30);
3458 }
da911b1f 3459
d3ba58bb 3460 if (hp1_pin_sense || spec->ultra_low_power)
da911b1f
KY
3461 snd_hda_codec_write(codec, hp_pin, 0,
3462 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3463 if (hp2_pin_sense)
3464 snd_hda_codec_write(codec, 0x16, 0,
3465 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3466
d3ba58bb 3467 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
da911b1f
KY
3468 msleep(85);
3469
d3ba58bb 3470 if (hp1_pin_sense || spec->ultra_low_power)
da911b1f
KY
3471 snd_hda_codec_write(codec, hp_pin, 0,
3472 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3473 if (hp2_pin_sense)
3474 snd_hda_codec_write(codec, 0x16, 0,
3475 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3476
d3ba58bb 3477 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
da911b1f
KY
3478 msleep(100);
3479
3480 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3481 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3482}
3483
3484static void alc225_shutup(struct hda_codec *codec)
3485{
3486 struct alc_spec *spec = codec->spec;
35a39f98 3487 hda_nid_t hp_pin = alc_get_hp_pin(spec);
da911b1f
KY
3488 bool hp1_pin_sense, hp2_pin_sense;
3489
d3ba58bb
KY
3490 if (!hp_pin)
3491 hp_pin = 0x21;
476c02e0
HW
3492
3493 alc_disable_headset_jack_key(codec);
da911b1f
KY
3494 /* 3k pull low control for Headset jack. */
3495 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3496
3497 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3498 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3499
3500 if (hp1_pin_sense || hp2_pin_sense)
3501 msleep(2);
3502
d3ba58bb 3503 if (hp1_pin_sense || spec->ultra_low_power)
da911b1f
KY
3504 snd_hda_codec_write(codec, hp_pin, 0,
3505 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3506 if (hp2_pin_sense)
3507 snd_hda_codec_write(codec, 0x16, 0,
3508 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3509
d3ba58bb 3510 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
da911b1f
KY
3511 msleep(85);
3512
d3ba58bb 3513 if (hp1_pin_sense || spec->ultra_low_power)
da911b1f
KY
3514 snd_hda_codec_write(codec, hp_pin, 0,
3515 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3516 if (hp2_pin_sense)
3517 snd_hda_codec_write(codec, 0x16, 0,
3518 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3519
d3ba58bb 3520 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
da911b1f
KY
3521 msleep(100);
3522
3523 alc_auto_setup_eapd(codec, false);
c0ca5ece 3524 alc_shutup_pins(codec);
d3ba58bb
KY
3525 if (spec->ultra_low_power) {
3526 msleep(50);
3527 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3528 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3529 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3530 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3531 msleep(30);
3532 }
476c02e0
HW
3533
3534 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3535 alc_enable_headset_jack_key(codec);
da911b1f
KY
3536}
3537
c2d6af53
KY
3538static void alc_default_init(struct hda_codec *codec)
3539{
3540 struct alc_spec *spec = codec->spec;
35a39f98 3541 hda_nid_t hp_pin = alc_get_hp_pin(spec);
c2d6af53
KY
3542 bool hp_pin_sense;
3543
3544 if (!hp_pin)
3545 return;
3546
3547 msleep(30);
3548
3549 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3550
3551 if (hp_pin_sense)
3552 msleep(2);
3553
3554 snd_hda_codec_write(codec, hp_pin, 0,
3555 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3556
3557 if (hp_pin_sense)
3558 msleep(85);
3559
3560 snd_hda_codec_write(codec, hp_pin, 0,
3561 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3562
3563 if (hp_pin_sense)
3564 msleep(100);
3565}
3566
3567static void alc_default_shutup(struct hda_codec *codec)
3568{
3569 struct alc_spec *spec = codec->spec;
35a39f98 3570 hda_nid_t hp_pin = alc_get_hp_pin(spec);
c2d6af53
KY
3571 bool hp_pin_sense;
3572
3573 if (!hp_pin) {
3574 alc269_shutup(codec);
3575 return;
3576 }
3577
3578 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3579
3580 if (hp_pin_sense)
3581 msleep(2);
3582
3583 snd_hda_codec_write(codec, hp_pin, 0,
3584 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3585
3586 if (hp_pin_sense)
3587 msleep(85);
3588
c0ca5ece
TI
3589 if (!spec->no_shutup_pins)
3590 snd_hda_codec_write(codec, hp_pin, 0,
3591 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
c2d6af53
KY
3592
3593 if (hp_pin_sense)
3594 msleep(100);
3595
3596 alc_auto_setup_eapd(codec, false);
c0ca5ece 3597 alc_shutup_pins(codec);
c2d6af53
KY
3598}
3599
693abe11
KY
3600static void alc294_hp_init(struct hda_codec *codec)
3601{
3602 struct alc_spec *spec = codec->spec;
35a39f98 3603 hda_nid_t hp_pin = alc_get_hp_pin(spec);
693abe11
KY
3604 int i, val;
3605
3606 if (!hp_pin)
3607 return;
3608
3609 snd_hda_codec_write(codec, hp_pin, 0,
3610 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3611
3612 msleep(100);
3613
c0ca5ece
TI
3614 if (!spec->no_shutup_pins)
3615 snd_hda_codec_write(codec, hp_pin, 0,
3616 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
693abe11
KY
3617
3618 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3619 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3620
3621 /* Wait for depop procedure finish */
3622 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3623 for (i = 0; i < 20 && val & 0x0080; i++) {
3624 msleep(50);
3625 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3626 }
3627 /* Set HP depop to auto mode */
3628 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3629 msleep(50);
3630}
3631
3632static void alc294_init(struct hda_codec *codec)
3633{
3634 struct alc_spec *spec = codec->spec;
3635
f6ef4e0e
TI
3636 /* required only at boot or S4 resume time */
3637 if (!spec->done_hp_init ||
3638 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
693abe11
KY
3639 alc294_hp_init(codec);
3640 spec->done_hp_init = true;
3641 }
3642 alc_default_init(codec);
3643}
3644
ad60d502
KY
3645static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3646 unsigned int val)
3647{
3648 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3649 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3650 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3651}
3652
3653static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3654{
3655 unsigned int val;
3656
3657 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3658 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3659 & 0xffff;
3660 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3661 << 16;
3662 return val;
3663}
3664
3665static void alc5505_dsp_halt(struct hda_codec *codec)
3666{
3667 unsigned int val;
3668
3669 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3670 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3671 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3672 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3673 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3674 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3675 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3676 val = alc5505_coef_get(codec, 0x6220);
3677 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3678}
3679
3680static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3681{
3682 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3683 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3684 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3685 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3686 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3687 alc5505_coef_set(codec, 0x880c, 0x00000004);
3688}
3689
3690static void alc5505_dsp_init(struct hda_codec *codec)
3691{
3692 unsigned int val;
3693
3694 alc5505_dsp_halt(codec);
3695 alc5505_dsp_back_from_halt(codec);
3696 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3697 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3698 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3699 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3700 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3701 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3702 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3703 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3704 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3705 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3706 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3707 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3708 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3709
3710 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3711 if (val <= 3)
3712 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3713 else
3714 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3715
3716 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3717 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3718 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3719 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3720 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3721 alc5505_coef_set(codec, 0x880c, 0x00000003);
3722 alc5505_coef_set(codec, 0x880c, 0x00000010);
cd63a5ff
TI
3723
3724#ifdef HALT_REALTEK_ALC5505
3725 alc5505_dsp_halt(codec);
3726#endif
ad60d502
KY
3727}
3728
cd63a5ff 3729#ifdef HALT_REALTEK_ALC5505
8a71821f
PLB
3730#define alc5505_dsp_suspend(codec) do { } while (0) /* NOP */
3731#define alc5505_dsp_resume(codec) do { } while (0) /* NOP */
cd63a5ff
TI
3732#else
3733#define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
3734#define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
3735#endif
3736
2a43952a 3737#ifdef CONFIG_PM
ad60d502
KY
3738static int alc269_suspend(struct hda_codec *codec)
3739{
3740 struct alc_spec *spec = codec->spec;
3741
3742 if (spec->has_alc5505_dsp)
cd63a5ff 3743 alc5505_dsp_suspend(codec);
ad60d502
KY
3744 return alc_suspend(codec);
3745}
3746
1d045db9
TI
3747static int alc269_resume(struct hda_codec *codec)
3748{
adcc70b2
KY
3749 struct alc_spec *spec = codec->spec;
3750
1387e2d1
KY
3751 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3752 alc269vb_toggle_power_output(codec, 0);
3753 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
adcc70b2 3754 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
1d045db9
TI
3755 msleep(150);
3756 }
8c427226 3757
1d045db9 3758 codec->patch_ops.init(codec);
f1d4e28b 3759
1387e2d1
KY
3760 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3761 alc269vb_toggle_power_output(codec, 1);
3762 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
adcc70b2 3763 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
1d045db9
TI
3764 msleep(200);
3765 }
f1d4e28b 3766
1a462be5 3767 snd_hda_regmap_sync(codec);
1d045db9 3768 hda_call_check_power_status(codec, 0x01);
f475371a
HW
3769
3770 /* on some machine, the BIOS will clear the codec gpio data when enter
3771 * suspend, and won't restore the data after resume, so we restore it
3772 * in the driver.
3773 */
d261eec8
TI
3774 if (spec->gpio_data)
3775 alc_write_gpio_data(codec);
f475371a 3776
ad60d502 3777 if (spec->has_alc5505_dsp)
cd63a5ff 3778 alc5505_dsp_resume(codec);
c5177c86 3779
1d045db9
TI
3780 return 0;
3781}
2a43952a 3782#endif /* CONFIG_PM */
f1d4e28b 3783
108cc108 3784static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
1727a771 3785 const struct hda_fixup *fix, int action)
108cc108
DH
3786{
3787 struct alc_spec *spec = codec->spec;
3788
1727a771 3789 if (action == HDA_FIXUP_ACT_PRE_PROBE)
108cc108
DH
3790 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
3791}
3792
fdcc968a
JMG
3793static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
3794 const struct hda_fixup *fix,
3795 int action)
3796{
3797 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
3798 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
3799
3800 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
3801 snd_hda_codec_set_pincfg(codec, 0x19,
3802 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
3803 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
3804}
3805
1d045db9 3806static void alc269_fixup_hweq(struct hda_codec *codec,
1727a771 3807 const struct hda_fixup *fix, int action)
1d045db9 3808{
98b24883
TI
3809 if (action == HDA_FIXUP_ACT_INIT)
3810 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
1d045db9 3811}
f1d4e28b 3812
7c478f03
DH
3813static void alc269_fixup_headset_mic(struct hda_codec *codec,
3814 const struct hda_fixup *fix, int action)
3815{
3816 struct alc_spec *spec = codec->spec;
3817
3818 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3819 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3820}
3821
1d045db9 3822static void alc271_fixup_dmic(struct hda_codec *codec,
1727a771 3823 const struct hda_fixup *fix, int action)
1d045db9
TI
3824{
3825 static const struct hda_verb verbs[] = {
3826 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
3827 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
3828 {}
3829 };
3830 unsigned int cfg;
f1d4e28b 3831
7639a06c
TI
3832 if (strcmp(codec->core.chip_name, "ALC271X") &&
3833 strcmp(codec->core.chip_name, "ALC269VB"))
1d045db9
TI
3834 return;
3835 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
3836 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
3837 snd_hda_sequence_write(codec, verbs);
3838}
f1d4e28b 3839
017f2a10 3840static void alc269_fixup_pcm_44k(struct hda_codec *codec,
1727a771 3841 const struct hda_fixup *fix, int action)
017f2a10
TI
3842{
3843 struct alc_spec *spec = codec->spec;
3844
1727a771 3845 if (action != HDA_FIXUP_ACT_PROBE)
017f2a10
TI
3846 return;
3847
3848 /* Due to a hardware problem on Lenovo Ideadpad, we need to
3849 * fix the sample rate of analog I/O to 44.1kHz
3850 */
08c189f2
TI
3851 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
3852 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
017f2a10
TI
3853}
3854
adabb3ec 3855static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
1727a771 3856 const struct hda_fixup *fix, int action)
adabb3ec 3857{
adabb3ec
TI
3858 /* The digital-mic unit sends PDM (differential signal) instead of
3859 * the standard PCM, thus you can't record a valid mono stream as is.
3860 * Below is a workaround specific to ALC269 to control the dmic
3861 * signal source as mono.
3862 */
98b24883
TI
3863 if (action == HDA_FIXUP_ACT_INIT)
3864 alc_update_coef_idx(codec, 0x07, 0, 0x80);
adabb3ec
TI
3865}
3866
24519911
TI
3867static void alc269_quanta_automute(struct hda_codec *codec)
3868{
08c189f2 3869 snd_hda_gen_update_outputs(codec);
24519911 3870
1687ccc8
TI
3871 alc_write_coef_idx(codec, 0x0c, 0x680);
3872 alc_write_coef_idx(codec, 0x0c, 0x480);
24519911
TI
3873}
3874
3875static void alc269_fixup_quanta_mute(struct hda_codec *codec,
1727a771 3876 const struct hda_fixup *fix, int action)
24519911
TI
3877{
3878 struct alc_spec *spec = codec->spec;
1727a771 3879 if (action != HDA_FIXUP_ACT_PROBE)
24519911 3880 return;
08c189f2 3881 spec->gen.automute_hook = alc269_quanta_automute;
24519911
TI
3882}
3883
d240d1dc 3884static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
1a4f69d5 3885 struct hda_jack_callback *jack)
d240d1dc
DH
3886{
3887 struct alc_spec *spec = codec->spec;
3888 int vref;
3889 msleep(200);
3890 snd_hda_gen_hp_automute(codec, jack);
3891
3892 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
3893 msleep(100);
3894 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3895 vref);
3896 msleep(500);
3897 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3898 vref);
3899}
3900
a2ef03fe
TE
3901/*
3902 * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
3903 */
3904struct hda_alc298_mbxinit {
3905 unsigned char value_0x23;
3906 unsigned char value_0x25;
3907};
3908
3909static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
3910 const struct hda_alc298_mbxinit *initval,
3911 bool first)
3912{
3913 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
3914 alc_write_coef_idx(codec, 0x26, 0xb000);
3915
3916 if (first)
3917 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
3918
3919 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
3920 alc_write_coef_idx(codec, 0x26, 0xf000);
3921 alc_write_coef_idx(codec, 0x23, initval->value_0x23);
3922
3923 if (initval->value_0x23 != 0x1e)
3924 alc_write_coef_idx(codec, 0x25, initval->value_0x25);
3925
3926 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
3927 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
3928}
3929
3930static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
3931 const struct hda_fixup *fix,
3932 int action)
3933{
3934 /* Initialization magic */
3935 static const struct hda_alc298_mbxinit dac_init[] = {
3936 {0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
3937 {0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
3938 {0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
3939 {0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
3940 {0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
3941 {0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
3942 {0x2f, 0x00},
3943 {0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
3944 {0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
3945 {0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
3946 {}
3947 };
3948 const struct hda_alc298_mbxinit *seq;
3949
3950 if (action != HDA_FIXUP_ACT_INIT)
3951 return;
3952
3953 /* Start */
3954 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
3955 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
3956 alc_write_coef_idx(codec, 0x26, 0xf000);
3957 alc_write_coef_idx(codec, 0x22, 0x31);
3958 alc_write_coef_idx(codec, 0x23, 0x0b);
3959 alc_write_coef_idx(codec, 0x25, 0x00);
3960 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
3961 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
3962
3963 for (seq = dac_init; seq->value_0x23; seq++)
3964 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
3965}
3966
d240d1dc
DH
3967static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
3968 const struct hda_fixup *fix, int action)
3969{
3970 struct alc_spec *spec = codec->spec;
3971 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3972 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3973 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
3974 }
3975}
3976
3977
08fb0d0e
TI
3978/* update mute-LED according to the speaker mute state via mic VREF pin */
3979static void alc269_fixup_mic_mute_hook(void *private_data, int enabled)
6d3cd5d4
DH
3980{
3981 struct hda_codec *codec = private_data;
08fb0d0e
TI
3982 struct alc_spec *spec = codec->spec;
3983 unsigned int pinval;
3984
3985 if (spec->mute_led_polarity)
3986 enabled = !enabled;
415d555e
TI
3987 pinval = snd_hda_codec_get_pin_target(codec, spec->mute_led_nid);
3988 pinval &= ~AC_PINCTL_VREFEN;
3989 pinval |= enabled ? AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80;
e40bdb03
TI
3990 if (spec->mute_led_nid) {
3991 /* temporarily power up/down for setting VREF */
3992 snd_hda_power_up_pm(codec);
08fb0d0e 3993 snd_hda_set_pin_ctl_cache(codec, spec->mute_led_nid, pinval);
e40bdb03
TI
3994 snd_hda_power_down_pm(codec);
3995 }
6d3cd5d4
DH
3996}
3997
d5b6b65e
DH
3998/* Make sure the led works even in runtime suspend */
3999static unsigned int led_power_filter(struct hda_codec *codec,
4000 hda_nid_t nid,
4001 unsigned int power_state)
4002{
4003 struct alc_spec *spec = codec->spec;
4004
50dd9050
HW
4005 if (power_state != AC_PWRST_D3 || nid == 0 ||
4006 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
d5b6b65e
DH
4007 return power_state;
4008
4009 /* Set pin ctl again, it might have just been set to 0 */
4010 snd_hda_set_pin_ctl(codec, nid,
4011 snd_hda_codec_get_pin_target(codec, nid));
4012
cffd3966 4013 return snd_hda_gen_path_power_filter(codec, nid, power_state);
d5b6b65e
DH
4014}
4015
08fb0d0e
TI
4016static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4017 const struct hda_fixup *fix, int action)
6d3cd5d4
DH
4018{
4019 struct alc_spec *spec = codec->spec;
08fb0d0e
TI
4020 const struct dmi_device *dev = NULL;
4021
4022 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4023 return;
4024
4025 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4026 int pol, pin;
4027 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4028 continue;
4029 if (pin < 0x0a || pin >= 0x10)
4030 break;
4031 spec->mute_led_polarity = pol;
4032 spec->mute_led_nid = pin - 0x0a + 0x18;
4033 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
fd25a97a 4034 spec->gen.vmaster_mute_enum = 1;
d5b6b65e 4035 codec->power_filter = led_power_filter;
4e76a883
TI
4036 codec_dbg(codec,
4037 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
08fb0d0e 4038 spec->mute_led_polarity);
6d3cd5d4
DH
4039 break;
4040 }
4041}
4042
85c467dc
TI
4043static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4044 const struct hda_fixup *fix,
4045 int action, hda_nid_t pin)
d06ac143
DH
4046{
4047 struct alc_spec *spec = codec->spec;
85c467dc 4048
d06ac143
DH
4049 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4050 spec->mute_led_polarity = 0;
85c467dc 4051 spec->mute_led_nid = pin;
d06ac143
DH
4052 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
4053 spec->gen.vmaster_mute_enum = 1;
d5b6b65e 4054 codec->power_filter = led_power_filter;
d06ac143
DH
4055 }
4056}
4057
85c467dc
TI
4058static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4059 const struct hda_fixup *fix, int action)
4060{
4061 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4062}
4063
08fb0d0e
TI
4064static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4065 const struct hda_fixup *fix, int action)
420b0feb 4066{
85c467dc 4067 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
420b0feb
TI
4068}
4069
7f783bd5
TB
4070static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4071 const struct hda_fixup *fix, int action)
4072{
85c467dc 4073 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
7f783bd5
TB
4074}
4075
0f32fd19
TI
4076/* update LED status via GPIO */
4077static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
4078 bool enabled)
9f5c6faf 4079{
9f5c6faf 4080 struct alc_spec *spec = codec->spec;
9f5c6faf 4081
0f32fd19
TI
4082 if (spec->mute_led_polarity)
4083 enabled = !enabled;
d261eec8 4084 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
9f5c6faf
TI
4085}
4086
0f32fd19
TI
4087/* turn on/off mute LED via GPIO per vmaster hook */
4088static void alc_fixup_gpio_mute_hook(void *private_data, int enabled)
9f5c6faf 4089{
0f32fd19 4090 struct hda_codec *codec = private_data;
9f5c6faf 4091 struct alc_spec *spec = codec->spec;
9f5c6faf 4092
0f32fd19
TI
4093 alc_update_gpio_led(codec, spec->gpio_mute_led_mask, enabled);
4094}
9f5c6faf 4095
0f32fd19 4096/* turn on/off mic-mute LED via GPIO per capture hook */
d03abeca 4097static void alc_gpio_micmute_update(struct hda_codec *codec)
0f32fd19
TI
4098{
4099 struct alc_spec *spec = codec->spec;
4100
d03abeca
TI
4101 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
4102 spec->gen.micmute_led.led_value);
9f5c6faf
TI
4103}
4104
01e4a275
TI
4105/* setup mute and mic-mute GPIO bits, add hooks appropriately */
4106static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4107 int action,
4108 unsigned int mute_mask,
4109 unsigned int micmute_mask)
9f5c6faf
TI
4110{
4111 struct alc_spec *spec = codec->spec;
9f5c6faf 4112
01e4a275
TI
4113 alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4114
4115 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4116 return;
4117 if (mute_mask) {
4118 spec->gpio_mute_led_mask = mute_mask;
0f32fd19 4119 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
01e4a275
TI
4120 }
4121 if (micmute_mask) {
4122 spec->gpio_mic_led_mask = micmute_mask;
d03abeca 4123 snd_hda_gen_add_micmute_led(codec, alc_gpio_micmute_update);
9f5c6faf
TI
4124 }
4125}
4126
01e4a275 4127static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
eaa8e5ef
KY
4128 const struct hda_fixup *fix, int action)
4129{
01e4a275
TI
4130 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4131}
eaa8e5ef 4132
f5a88b0a
KHF
4133static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4134 const struct hda_fixup *fix, int action)
4135{
4136 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x00);
4137}
4138
01e4a275
TI
4139static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4140 const struct hda_fixup *fix, int action)
4141{
4142 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
9f5c6faf
TI
4143}
4144
9c5dc3bf 4145/* turn on/off mic-mute LED per capture hook */
d03abeca 4146static void alc_cap_micmute_update(struct hda_codec *codec)
9c5dc3bf
KY
4147{
4148 struct alc_spec *spec = codec->spec;
d03abeca 4149 unsigned int pinval;
9c5dc3bf 4150
d03abeca
TI
4151 if (!spec->cap_mute_led_nid)
4152 return;
fc1fad93 4153 pinval = snd_hda_codec_get_pin_target(codec, spec->cap_mute_led_nid);
9c5dc3bf 4154 pinval &= ~AC_PINCTL_VREFEN;
d03abeca
TI
4155 if (spec->gen.micmute_led.led_value)
4156 pinval |= AC_PINCTL_VREF_80;
9c5dc3bf 4157 else
d03abeca
TI
4158 pinval |= AC_PINCTL_VREF_HIZ;
4159 snd_hda_set_pin_ctl_cache(codec, spec->cap_mute_led_nid, pinval);
9c5dc3bf
KY
4160}
4161
4162static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4163 const struct hda_fixup *fix, int action)
4164{
4165 struct alc_spec *spec = codec->spec;
9c5dc3bf 4166
01e4a275 4167 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
9c5dc3bf 4168 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
01e4a275
TI
4169 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4170 * enable headphone amp
4171 */
4172 spec->gpio_mask |= 0x10;
4173 spec->gpio_dir |= 0x10;
9c5dc3bf 4174 spec->cap_mute_led_nid = 0x18;
d03abeca 4175 snd_hda_gen_add_micmute_led(codec, alc_cap_micmute_update);
50dd9050 4176 codec->power_filter = led_power_filter;
9c5dc3bf
KY
4177 }
4178}
4179
7a5255f1
DH
4180static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4181 const struct hda_fixup *fix, int action)
4182{
7a5255f1 4183 struct alc_spec *spec = codec->spec;
7a5255f1 4184
01e4a275 4185 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
7a5255f1 4186 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
7a5255f1 4187 spec->cap_mute_led_nid = 0x18;
d03abeca 4188 snd_hda_gen_add_micmute_led(codec, alc_cap_micmute_update);
7a5255f1
DH
4189 codec->power_filter = led_power_filter;
4190 }
4191}
4192
431e76c3
KY
4193/* update mute-LED according to the speaker mute state via COEF bit */
4194static void alc_fixup_mute_led_coefbit_hook(void *private_data, int enabled)
4195{
4196 struct hda_codec *codec = private_data;
4197 struct alc_spec *spec = codec->spec;
4198
4199 if (spec->mute_led_polarity)
4200 enabled = !enabled;
4201
4202 /* temporarily power up/down for setting COEF bit */
4203 enabled ? alc_update_coef_idx(codec, spec->mute_led_coef_idx,
4204 spec->mute_led_coefbit_mask, spec->mute_led_coefbit_off) :
4205 alc_update_coef_idx(codec, spec->mute_led_coef_idx,
4206 spec->mute_led_coefbit_mask, spec->mute_led_coefbit_on);
4207}
4208
4209static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4210 const struct hda_fixup *fix,
4211 int action)
4212{
4213 struct alc_spec *spec = codec->spec;
4214
4215 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4216 spec->mute_led_polarity = 0;
4217 spec->mute_led_coef_idx = 0x0b;
4218 spec->mute_led_coefbit_mask = 1<<3;
4219 spec->mute_led_coefbit_on = 1<<3;
4220 spec->mute_led_coefbit_off = 0;
4221 spec->gen.vmaster_mute.hook = alc_fixup_mute_led_coefbit_hook;
4222 spec->gen.vmaster_mute_enum = 1;
4223 }
4224}
4225
24164f43
KY
4226static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4227 const struct hda_fixup *fix,
4228 int action)
4229{
4230 struct alc_spec *spec = codec->spec;
4231
4232 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4233 spec->mute_led_polarity = 0;
4234 spec->mute_led_coef_idx = 0x34;
4235 spec->mute_led_coefbit_mask = 1<<5;
4236 spec->mute_led_coefbit_on = 0;
4237 spec->mute_led_coefbit_off = 1<<5;
4238 spec->gen.vmaster_mute.hook = alc_fixup_mute_led_coefbit_hook;
4239 spec->gen.vmaster_mute_enum = 1;
4240 }
4241}
4242
431e76c3
KY
4243/* turn on/off mic-mute LED per capture hook by coef bit */
4244static void alc_hp_cap_micmute_update(struct hda_codec *codec)
4245{
4246 struct alc_spec *spec = codec->spec;
4247
4248 if (spec->gen.micmute_led.led_value)
4249 alc_update_coef_idx(codec, spec->mic_led_coef_idx,
4250 spec->mic_led_coefbit_mask, spec->mic_led_coefbit_on);
4251 else
4252 alc_update_coef_idx(codec, spec->mic_led_coef_idx,
4253 spec->mic_led_coefbit_mask, spec->mic_led_coefbit_off);
4254}
4255
4256static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4257 const struct hda_fixup *fix, int action)
4258{
4259 struct alc_spec *spec = codec->spec;
4260
4261 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4262 spec->mic_led_coef_idx = 0x19;
4263 spec->mic_led_coefbit_mask = 1<<13;
4264 spec->mic_led_coefbit_on = 1<<13;
4265 spec->mic_led_coefbit_off = 0;
4266 snd_hda_gen_add_micmute_led(codec, alc_hp_cap_micmute_update);
4267 }
4268}
4269
24164f43
KY
4270static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4271 const struct hda_fixup *fix, int action)
4272{
4273 struct alc_spec *spec = codec->spec;
4274
4275 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4276 spec->mic_led_coef_idx = 0x35;
4277 spec->mic_led_coefbit_mask = 3<<2;
4278 spec->mic_led_coefbit_on = 2<<2;
4279 spec->mic_led_coefbit_off = 1<<2;
4280 snd_hda_gen_add_micmute_led(codec, alc_hp_cap_micmute_update);
4281 }
4282}
4283
431e76c3
KY
4284static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4285 const struct hda_fixup *fix, int action)
4286{
4287 alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4288 alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4289}
4290
24164f43
KY
4291static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4292 const struct hda_fixup *fix, int action)
4293{
4294 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4295 alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4296}
4297
6a30abaa 4298#if IS_REACHABLE(CONFIG_INPUT)
33f4acd3
DH
4299static void gpio2_mic_hotkey_event(struct hda_codec *codec,
4300 struct hda_jack_callback *event)
4301{
4302 struct alc_spec *spec = codec->spec;
4303
4304 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
4305 send both key on and key off event for every interrupt. */
c7b60a89 4306 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
33f4acd3 4307 input_sync(spec->kb_dev);
c7b60a89 4308 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
33f4acd3
DH
4309 input_sync(spec->kb_dev);
4310}
33f4acd3 4311
3694cb29
K
4312static int alc_register_micmute_input_device(struct hda_codec *codec)
4313{
4314 struct alc_spec *spec = codec->spec;
c7b60a89 4315 int i;
3694cb29
K
4316
4317 spec->kb_dev = input_allocate_device();
4318 if (!spec->kb_dev) {
4319 codec_err(codec, "Out of memory (input_allocate_device)\n");
4320 return -ENOMEM;
4321 }
c7b60a89
HW
4322
4323 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
4324
3694cb29
K
4325 spec->kb_dev->name = "Microphone Mute Button";
4326 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
c7b60a89
HW
4327 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
4328 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
4329 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
4330 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
4331 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
3694cb29
K
4332
4333 if (input_register_device(spec->kb_dev)) {
4334 codec_err(codec, "input_register_device failed\n");
4335 input_free_device(spec->kb_dev);
4336 spec->kb_dev = NULL;
4337 return -ENOMEM;
4338 }
4339
4340 return 0;
4341}
4342
01e4a275
TI
4343/* GPIO1 = set according to SKU external amp
4344 * GPIO2 = mic mute hotkey
4345 * GPIO3 = mute LED
4346 * GPIO4 = mic mute LED
4347 */
33f4acd3
DH
4348static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4349 const struct hda_fixup *fix, int action)
4350{
33f4acd3
DH
4351 struct alc_spec *spec = codec->spec;
4352
01e4a275 4353 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
33f4acd3 4354 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1c76aa5f 4355 spec->init_amp = ALC_INIT_DEFAULT;
3694cb29 4356 if (alc_register_micmute_input_device(codec) != 0)
33f4acd3 4357 return;
33f4acd3 4358
01e4a275
TI
4359 spec->gpio_mask |= 0x06;
4360 spec->gpio_dir |= 0x02;
4361 spec->gpio_data |= 0x02;
7639a06c 4362 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
33f4acd3 4363 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
7639a06c 4364 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
33f4acd3 4365 gpio2_mic_hotkey_event);
33f4acd3
DH
4366 return;
4367 }
4368
4369 if (!spec->kb_dev)
4370 return;
4371
4372 switch (action) {
33f4acd3
DH
4373 case HDA_FIXUP_ACT_FREE:
4374 input_unregister_device(spec->kb_dev);
33f4acd3
DH
4375 spec->kb_dev = NULL;
4376 }
33f4acd3
DH
4377}
4378
01e4a275
TI
4379/* Line2 = mic mute hotkey
4380 * GPIO2 = mic mute LED
4381 */
3694cb29
K
4382static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4383 const struct hda_fixup *fix, int action)
4384{
3694cb29
K
4385 struct alc_spec *spec = codec->spec;
4386
01e4a275 4387 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
3694cb29 4388 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1c76aa5f 4389 spec->init_amp = ALC_INIT_DEFAULT;
3694cb29
K
4390 if (alc_register_micmute_input_device(codec) != 0)
4391 return;
4392
3694cb29
K
4393 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4394 gpio2_mic_hotkey_event);
3694cb29
K
4395 return;
4396 }
4397
4398 if (!spec->kb_dev)
4399 return;
4400
4401 switch (action) {
3694cb29
K
4402 case HDA_FIXUP_ACT_FREE:
4403 input_unregister_device(spec->kb_dev);
4404 spec->kb_dev = NULL;
4405 }
4406}
c469652b
TI
4407#else /* INPUT */
4408#define alc280_fixup_hp_gpio2_mic_hotkey NULL
4409#define alc233_fixup_lenovo_line2_mic_hotkey NULL
4410#endif /* INPUT */
3694cb29 4411
9c5dc3bf
KY
4412static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4413 const struct hda_fixup *fix, int action)
4414{
4415 struct alc_spec *spec = codec->spec;
4416
1bce62a6 4417 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
9c5dc3bf 4418 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
9c5dc3bf 4419 spec->cap_mute_led_nid = 0x18;
d03abeca 4420 snd_hda_gen_add_micmute_led(codec, alc_cap_micmute_update);
9c5dc3bf
KY
4421 }
4422}
4423
6b0f95c4 4424static const struct coef_fw alc225_pre_hsmode[] = {
5a36767a
KY
4425 UPDATE_COEF(0x4a, 1<<8, 0),
4426 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4427 UPDATE_COEF(0x63, 3<<14, 3<<14),
4428 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4429 UPDATE_COEF(0x4a, 3<<10, 3<<10),
4430 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4431 UPDATE_COEF(0x4a, 3<<10, 0),
4432 {}
4433};
4434
73bdd597
DH
4435static void alc_headset_mode_unplugged(struct hda_codec *codec)
4436{
6b0f95c4 4437 static const struct coef_fw coef0255[] = {
717f43d8 4438 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
54db6c39
TI
4439 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4440 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4441 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4442 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4443 {}
4444 };
6b0f95c4 4445 static const struct coef_fw coef0256[] = {
e69e7e03 4446 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
717f43d8
KY
4447 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4448 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4449 WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
4450 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
e69e7e03
KY
4451 {}
4452 };
6b0f95c4 4453 static const struct coef_fw coef0233[] = {
54db6c39
TI
4454 WRITE_COEF(0x1b, 0x0c0b),
4455 WRITE_COEF(0x45, 0xc429),
4456 UPDATE_COEF(0x35, 0x4000, 0),
4457 WRITE_COEF(0x06, 0x2104),
4458 WRITE_COEF(0x1a, 0x0001),
4459 WRITE_COEF(0x26, 0x0004),
4460 WRITE_COEF(0x32, 0x42a3),
4461 {}
4462 };
6b0f95c4 4463 static const struct coef_fw coef0288[] = {
f3b70332
KY
4464 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4465 UPDATE_COEF(0x50, 0x2000, 0x2000),
4466 UPDATE_COEF(0x56, 0x0006, 0x0006),
4467 UPDATE_COEF(0x66, 0x0008, 0),
4468 UPDATE_COEF(0x67, 0x2000, 0),
4469 {}
4470 };
6b0f95c4 4471 static const struct coef_fw coef0298[] = {
89542936
KY
4472 UPDATE_COEF(0x19, 0x1300, 0x0300),
4473 {}
4474 };
6b0f95c4 4475 static const struct coef_fw coef0292[] = {
54db6c39
TI
4476 WRITE_COEF(0x76, 0x000e),
4477 WRITE_COEF(0x6c, 0x2400),
4478 WRITE_COEF(0x18, 0x7308),
4479 WRITE_COEF(0x6b, 0xc429),
4480 {}
4481 };
6b0f95c4 4482 static const struct coef_fw coef0293[] = {
54db6c39
TI
4483 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
4484 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
4485 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
4486 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
4487 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
4488 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4489 {}
4490 };
6b0f95c4 4491 static const struct coef_fw coef0668[] = {
54db6c39
TI
4492 WRITE_COEF(0x15, 0x0d40),
4493 WRITE_COEF(0xb7, 0x802b),
4494 {}
4495 };
6b0f95c4 4496 static const struct coef_fw coef0225[] = {
5a36767a 4497 UPDATE_COEF(0x63, 3<<14, 0),
4cc9b9d6
KY
4498 {}
4499 };
6b0f95c4 4500 static const struct coef_fw coef0274[] = {
71683c32
KY
4501 UPDATE_COEF(0x4a, 0x0100, 0),
4502 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
4503 UPDATE_COEF(0x6b, 0xf000, 0x5000),
4504 UPDATE_COEF(0x4a, 0x0010, 0),
4505 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
4506 WRITE_COEF(0x45, 0x5289),
4507 UPDATE_COEF(0x4a, 0x0c00, 0),
4508 {}
4509 };
54db6c39 4510
7639a06c 4511 switch (codec->core.vendor_id) {
9a22a8f5 4512 case 0x10ec0255:
e69e7e03
KY
4513 alc_process_coef_fw(codec, coef0255);
4514 break;
736f20a7 4515 case 0x10ec0236:
7081adf3 4516 case 0x10ec0256:
e69e7e03 4517 alc_process_coef_fw(codec, coef0256);
9a22a8f5 4518 break;
71683c32
KY
4519 case 0x10ec0234:
4520 case 0x10ec0274:
4521 case 0x10ec0294:
4522 alc_process_coef_fw(codec, coef0274);
4523 break;
13fd08a3 4524 case 0x10ec0233:
73bdd597 4525 case 0x10ec0283:
54db6c39 4526 alc_process_coef_fw(codec, coef0233);
73bdd597 4527 break;
f3b70332
KY
4528 case 0x10ec0286:
4529 case 0x10ec0288:
89542936
KY
4530 alc_process_coef_fw(codec, coef0288);
4531 break;
1a5bc8d9 4532 case 0x10ec0298:
89542936 4533 alc_process_coef_fw(codec, coef0298);
f3b70332
KY
4534 alc_process_coef_fw(codec, coef0288);
4535 break;
73bdd597 4536 case 0x10ec0292:
54db6c39 4537 alc_process_coef_fw(codec, coef0292);
73bdd597 4538 break;
a22aa26f 4539 case 0x10ec0293:
54db6c39 4540 alc_process_coef_fw(codec, coef0293);
a22aa26f 4541 break;
73bdd597 4542 case 0x10ec0668:
54db6c39 4543 alc_process_coef_fw(codec, coef0668);
73bdd597 4544 break;
c2b691ee 4545 case 0x10ec0215:
4cc9b9d6 4546 case 0x10ec0225:
c2b691ee 4547 case 0x10ec0285:
7d727869 4548 case 0x10ec0295:
c2b691ee 4549 case 0x10ec0289:
28f1f9b2 4550 case 0x10ec0299:
4d4b0c52 4551 alc_process_coef_fw(codec, alc225_pre_hsmode);
4cc9b9d6
KY
4552 alc_process_coef_fw(codec, coef0225);
4553 break;
78f4f7c2
KY
4554 case 0x10ec0867:
4555 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4556 break;
73bdd597 4557 }
4e76a883 4558 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
73bdd597
DH
4559}
4560
4561
4562static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
4563 hda_nid_t mic_pin)
4564{
6b0f95c4 4565 static const struct coef_fw coef0255[] = {
54db6c39
TI
4566 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
4567 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4568 {}
4569 };
6b0f95c4 4570 static const struct coef_fw coef0256[] = {
717f43d8
KY
4571 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
4572 WRITE_COEFEX(0x57, 0x03, 0x09a3),
4573 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4574 {}
4575 };
6b0f95c4 4576 static const struct coef_fw coef0233[] = {
54db6c39
TI
4577 UPDATE_COEF(0x35, 0, 1<<14),
4578 WRITE_COEF(0x06, 0x2100),
4579 WRITE_COEF(0x1a, 0x0021),
4580 WRITE_COEF(0x26, 0x008c),
4581 {}
4582 };
6b0f95c4 4583 static const struct coef_fw coef0288[] = {
89542936 4584 UPDATE_COEF(0x4f, 0x00c0, 0),
f3b70332
KY
4585 UPDATE_COEF(0x50, 0x2000, 0),
4586 UPDATE_COEF(0x56, 0x0006, 0),
4587 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4588 UPDATE_COEF(0x66, 0x0008, 0x0008),
4589 UPDATE_COEF(0x67, 0x2000, 0x2000),
4590 {}
4591 };
6b0f95c4 4592 static const struct coef_fw coef0292[] = {
54db6c39
TI
4593 WRITE_COEF(0x19, 0xa208),
4594 WRITE_COEF(0x2e, 0xacf0),
4595 {}
4596 };
6b0f95c4 4597 static const struct coef_fw coef0293[] = {
54db6c39
TI
4598 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
4599 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
4600 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4601 {}
4602 };
6b0f95c4 4603 static const struct coef_fw coef0688[] = {
54db6c39
TI
4604 WRITE_COEF(0xb7, 0x802b),
4605 WRITE_COEF(0xb5, 0x1040),
4606 UPDATE_COEF(0xc3, 0, 1<<12),
4607 {}
4608 };
6b0f95c4 4609 static const struct coef_fw coef0225[] = {
4cc9b9d6
KY
4610 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
4611 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4612 UPDATE_COEF(0x63, 3<<14, 0),
4613 {}
4614 };
6b0f95c4 4615 static const struct coef_fw coef0274[] = {
71683c32
KY
4616 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
4617 UPDATE_COEF(0x4a, 0x0010, 0),
4618 UPDATE_COEF(0x6b, 0xf000, 0),
4619 {}
4620 };
54db6c39 4621
7639a06c 4622 switch (codec->core.vendor_id) {
9a22a8f5
KY
4623 case 0x10ec0255:
4624 alc_write_coef_idx(codec, 0x45, 0xc489);
4625 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 4626 alc_process_coef_fw(codec, coef0255);
9a22a8f5
KY
4627 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4628 break;
717f43d8
KY
4629 case 0x10ec0236:
4630 case 0x10ec0256:
4631 alc_write_coef_idx(codec, 0x45, 0xc489);
4632 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4633 alc_process_coef_fw(codec, coef0256);
4634 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4635 break;
71683c32
KY
4636 case 0x10ec0234:
4637 case 0x10ec0274:
4638 case 0x10ec0294:
4639 alc_write_coef_idx(codec, 0x45, 0x4689);
4640 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4641 alc_process_coef_fw(codec, coef0274);
4642 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4643 break;
13fd08a3 4644 case 0x10ec0233:
73bdd597
DH
4645 case 0x10ec0283:
4646 alc_write_coef_idx(codec, 0x45, 0xc429);
4647 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 4648 alc_process_coef_fw(codec, coef0233);
73bdd597
DH
4649 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4650 break;
f3b70332
KY
4651 case 0x10ec0286:
4652 case 0x10ec0288:
1a5bc8d9 4653 case 0x10ec0298:
f3b70332
KY
4654 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4655 alc_process_coef_fw(codec, coef0288);
4656 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4657 break;
73bdd597
DH
4658 case 0x10ec0292:
4659 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 4660 alc_process_coef_fw(codec, coef0292);
73bdd597 4661 break;
a22aa26f
KY
4662 case 0x10ec0293:
4663 /* Set to TRS mode */
4664 alc_write_coef_idx(codec, 0x45, 0xc429);
4665 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 4666 alc_process_coef_fw(codec, coef0293);
a22aa26f
KY
4667 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4668 break;
78f4f7c2
KY
4669 case 0x10ec0867:
4670 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
4671 /* fallthru */
9eb5d0e6 4672 case 0x10ec0221:
1f8b46cd
DH
4673 case 0x10ec0662:
4674 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4675 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4676 break;
73bdd597
DH
4677 case 0x10ec0668:
4678 alc_write_coef_idx(codec, 0x11, 0x0001);
4679 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 4680 alc_process_coef_fw(codec, coef0688);
73bdd597
DH
4681 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4682 break;
c2b691ee 4683 case 0x10ec0215:
4cc9b9d6 4684 case 0x10ec0225:
c2b691ee 4685 case 0x10ec0285:
7d727869 4686 case 0x10ec0295:
c2b691ee 4687 case 0x10ec0289:
28f1f9b2 4688 case 0x10ec0299:
5a36767a 4689 alc_process_coef_fw(codec, alc225_pre_hsmode);
4cc9b9d6
KY
4690 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
4691 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4692 alc_process_coef_fw(codec, coef0225);
4693 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4694 break;
73bdd597 4695 }
4e76a883 4696 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
73bdd597
DH
4697}
4698
4699static void alc_headset_mode_default(struct hda_codec *codec)
4700{
6b0f95c4 4701 static const struct coef_fw coef0225[] = {
5a36767a
KY
4702 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
4703 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
4704 UPDATE_COEF(0x49, 3<<8, 0<<8),
4705 UPDATE_COEF(0x4a, 3<<4, 3<<4),
4706 UPDATE_COEF(0x63, 3<<14, 0),
4707 UPDATE_COEF(0x67, 0xf000, 0x3000),
2ae95577
DH
4708 {}
4709 };
6b0f95c4 4710 static const struct coef_fw coef0255[] = {
54db6c39
TI
4711 WRITE_COEF(0x45, 0xc089),
4712 WRITE_COEF(0x45, 0xc489),
4713 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4714 WRITE_COEF(0x49, 0x0049),
4715 {}
4716 };
6b0f95c4 4717 static const struct coef_fw coef0256[] = {
717f43d8
KY
4718 WRITE_COEF(0x45, 0xc489),
4719 WRITE_COEFEX(0x57, 0x03, 0x0da3),
4720 WRITE_COEF(0x49, 0x0049),
4721 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4722 WRITE_COEF(0x06, 0x6100),
4723 {}
4724 };
6b0f95c4 4725 static const struct coef_fw coef0233[] = {
54db6c39
TI
4726 WRITE_COEF(0x06, 0x2100),
4727 WRITE_COEF(0x32, 0x4ea3),
4728 {}
4729 };
6b0f95c4 4730 static const struct coef_fw coef0288[] = {
f3b70332
KY
4731 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
4732 UPDATE_COEF(0x50, 0x2000, 0x2000),
4733 UPDATE_COEF(0x56, 0x0006, 0x0006),
4734 UPDATE_COEF(0x66, 0x0008, 0),
4735 UPDATE_COEF(0x67, 0x2000, 0),
4736 {}
4737 };
6b0f95c4 4738 static const struct coef_fw coef0292[] = {
54db6c39
TI
4739 WRITE_COEF(0x76, 0x000e),
4740 WRITE_COEF(0x6c, 0x2400),
4741 WRITE_COEF(0x6b, 0xc429),
4742 WRITE_COEF(0x18, 0x7308),
4743 {}
4744 };
6b0f95c4 4745 static const struct coef_fw coef0293[] = {
54db6c39
TI
4746 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4747 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
4748 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4749 {}
4750 };
6b0f95c4 4751 static const struct coef_fw coef0688[] = {
54db6c39
TI
4752 WRITE_COEF(0x11, 0x0041),
4753 WRITE_COEF(0x15, 0x0d40),
4754 WRITE_COEF(0xb7, 0x802b),
4755 {}
4756 };
6b0f95c4 4757 static const struct coef_fw coef0274[] = {
71683c32
KY
4758 WRITE_COEF(0x45, 0x4289),
4759 UPDATE_COEF(0x4a, 0x0010, 0x0010),
4760 UPDATE_COEF(0x6b, 0x0f00, 0),
4761 UPDATE_COEF(0x49, 0x0300, 0x0300),
4762 {}
4763 };
54db6c39 4764
7639a06c 4765 switch (codec->core.vendor_id) {
c2b691ee 4766 case 0x10ec0215:
2ae95577 4767 case 0x10ec0225:
c2b691ee 4768 case 0x10ec0285:
7d727869 4769 case 0x10ec0295:
c2b691ee 4770 case 0x10ec0289:
28f1f9b2 4771 case 0x10ec0299:
5a36767a 4772 alc_process_coef_fw(codec, alc225_pre_hsmode);
2ae95577
DH
4773 alc_process_coef_fw(codec, coef0225);
4774 break;
9a22a8f5 4775 case 0x10ec0255:
54db6c39 4776 alc_process_coef_fw(codec, coef0255);
9a22a8f5 4777 break;
717f43d8
KY
4778 case 0x10ec0236:
4779 case 0x10ec0256:
4780 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
4781 alc_write_coef_idx(codec, 0x45, 0xc089);
4782 msleep(50);
4783 alc_process_coef_fw(codec, coef0256);
4784 break;
71683c32
KY
4785 case 0x10ec0234:
4786 case 0x10ec0274:
4787 case 0x10ec0294:
4788 alc_process_coef_fw(codec, coef0274);
4789 break;
13fd08a3 4790 case 0x10ec0233:
73bdd597 4791 case 0x10ec0283:
54db6c39 4792 alc_process_coef_fw(codec, coef0233);
73bdd597 4793 break;
f3b70332
KY
4794 case 0x10ec0286:
4795 case 0x10ec0288:
1a5bc8d9 4796 case 0x10ec0298:
f3b70332
KY
4797 alc_process_coef_fw(codec, coef0288);
4798 break;
73bdd597 4799 case 0x10ec0292:
54db6c39 4800 alc_process_coef_fw(codec, coef0292);
73bdd597 4801 break;
a22aa26f 4802 case 0x10ec0293:
54db6c39 4803 alc_process_coef_fw(codec, coef0293);
a22aa26f 4804 break;
73bdd597 4805 case 0x10ec0668:
54db6c39 4806 alc_process_coef_fw(codec, coef0688);
73bdd597 4807 break;
78f4f7c2
KY
4808 case 0x10ec0867:
4809 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4810 break;
73bdd597 4811 }
4e76a883 4812 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
73bdd597
DH
4813}
4814
4815/* Iphone type */
4816static void alc_headset_mode_ctia(struct hda_codec *codec)
4817{
89542936
KY
4818 int val;
4819
6b0f95c4 4820 static const struct coef_fw coef0255[] = {
54db6c39
TI
4821 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
4822 WRITE_COEF(0x1b, 0x0c2b),
4823 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4824 {}
4825 };
6b0f95c4 4826 static const struct coef_fw coef0256[] = {
e69e7e03 4827 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
717f43d8 4828 WRITE_COEF(0x1b, 0x0e6b),
e69e7e03
KY
4829 {}
4830 };
6b0f95c4 4831 static const struct coef_fw coef0233[] = {
54db6c39
TI
4832 WRITE_COEF(0x45, 0xd429),
4833 WRITE_COEF(0x1b, 0x0c2b),
4834 WRITE_COEF(0x32, 0x4ea3),
4835 {}
4836 };
6b0f95c4 4837 static const struct coef_fw coef0288[] = {
f3b70332
KY
4838 UPDATE_COEF(0x50, 0x2000, 0x2000),
4839 UPDATE_COEF(0x56, 0x0006, 0x0006),
4840 UPDATE_COEF(0x66, 0x0008, 0),
4841 UPDATE_COEF(0x67, 0x2000, 0),
4842 {}
4843 };
6b0f95c4 4844 static const struct coef_fw coef0292[] = {
54db6c39
TI
4845 WRITE_COEF(0x6b, 0xd429),
4846 WRITE_COEF(0x76, 0x0008),
4847 WRITE_COEF(0x18, 0x7388),
4848 {}
4849 };
6b0f95c4 4850 static const struct coef_fw coef0293[] = {
54db6c39
TI
4851 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
4852 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
4853 {}
4854 };
6b0f95c4 4855 static const struct coef_fw coef0688[] = {
54db6c39
TI
4856 WRITE_COEF(0x11, 0x0001),
4857 WRITE_COEF(0x15, 0x0d60),
4858 WRITE_COEF(0xc3, 0x0000),
4859 {}
4860 };
6b0f95c4 4861 static const struct coef_fw coef0225_1[] = {
4cc9b9d6 4862 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5a36767a
KY
4863 UPDATE_COEF(0x63, 3<<14, 2<<14),
4864 {}
4865 };
6b0f95c4 4866 static const struct coef_fw coef0225_2[] = {
5a36767a
KY
4867 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
4868 UPDATE_COEF(0x63, 3<<14, 1<<14),
4cc9b9d6
KY
4869 {}
4870 };
54db6c39 4871
7639a06c 4872 switch (codec->core.vendor_id) {
9a22a8f5 4873 case 0x10ec0255:
54db6c39 4874 alc_process_coef_fw(codec, coef0255);
9a22a8f5 4875 break;
736f20a7 4876 case 0x10ec0236:
e69e7e03
KY
4877 case 0x10ec0256:
4878 alc_process_coef_fw(codec, coef0256);
4879 break;
71683c32
KY
4880 case 0x10ec0234:
4881 case 0x10ec0274:
4882 case 0x10ec0294:
4883 alc_write_coef_idx(codec, 0x45, 0xd689);
4884 break;
13fd08a3 4885 case 0x10ec0233:
73bdd597 4886 case 0x10ec0283:
54db6c39 4887 alc_process_coef_fw(codec, coef0233);
73bdd597 4888 break;
1a5bc8d9 4889 case 0x10ec0298:
89542936
KY
4890 val = alc_read_coef_idx(codec, 0x50);
4891 if (val & (1 << 12)) {
4892 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
4893 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4894 msleep(300);
4895 } else {
4896 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
4897 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4898 msleep(300);
4899 }
4900 break;
f3b70332
KY
4901 case 0x10ec0286:
4902 case 0x10ec0288:
4903 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4904 msleep(300);
4905 alc_process_coef_fw(codec, coef0288);
4906 break;
73bdd597 4907 case 0x10ec0292:
54db6c39 4908 alc_process_coef_fw(codec, coef0292);
73bdd597 4909 break;
a22aa26f 4910 case 0x10ec0293:
54db6c39 4911 alc_process_coef_fw(codec, coef0293);
a22aa26f 4912 break;
73bdd597 4913 case 0x10ec0668:
54db6c39 4914 alc_process_coef_fw(codec, coef0688);
73bdd597 4915 break;
c2b691ee 4916 case 0x10ec0215:
4cc9b9d6 4917 case 0x10ec0225:
c2b691ee 4918 case 0x10ec0285:
7d727869 4919 case 0x10ec0295:
c2b691ee 4920 case 0x10ec0289:
28f1f9b2 4921 case 0x10ec0299:
5a36767a
KY
4922 val = alc_read_coef_idx(codec, 0x45);
4923 if (val & (1 << 9))
4924 alc_process_coef_fw(codec, coef0225_2);
4925 else
4926 alc_process_coef_fw(codec, coef0225_1);
4cc9b9d6 4927 break;
78f4f7c2
KY
4928 case 0x10ec0867:
4929 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4930 break;
73bdd597 4931 }
4e76a883 4932 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
73bdd597
DH
4933}
4934
4935/* Nokia type */
4936static void alc_headset_mode_omtp(struct hda_codec *codec)
4937{
6b0f95c4 4938 static const struct coef_fw coef0255[] = {
54db6c39
TI
4939 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
4940 WRITE_COEF(0x1b, 0x0c2b),
4941 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4942 {}
4943 };
6b0f95c4 4944 static const struct coef_fw coef0256[] = {
e69e7e03 4945 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
717f43d8 4946 WRITE_COEF(0x1b, 0x0e6b),
e69e7e03
KY
4947 {}
4948 };
6b0f95c4 4949 static const struct coef_fw coef0233[] = {
54db6c39
TI
4950 WRITE_COEF(0x45, 0xe429),
4951 WRITE_COEF(0x1b, 0x0c2b),
4952 WRITE_COEF(0x32, 0x4ea3),
4953 {}
4954 };
6b0f95c4 4955 static const struct coef_fw coef0288[] = {
f3b70332
KY
4956 UPDATE_COEF(0x50, 0x2000, 0x2000),
4957 UPDATE_COEF(0x56, 0x0006, 0x0006),
4958 UPDATE_COEF(0x66, 0x0008, 0),
4959 UPDATE_COEF(0x67, 0x2000, 0),
4960 {}
4961 };
6b0f95c4 4962 static const struct coef_fw coef0292[] = {
54db6c39
TI
4963 WRITE_COEF(0x6b, 0xe429),
4964 WRITE_COEF(0x76, 0x0008),
4965 WRITE_COEF(0x18, 0x7388),
4966 {}
4967 };
6b0f95c4 4968 static const struct coef_fw coef0293[] = {
54db6c39
TI
4969 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
4970 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
4971 {}
4972 };
6b0f95c4 4973 static const struct coef_fw coef0688[] = {
54db6c39
TI
4974 WRITE_COEF(0x11, 0x0001),
4975 WRITE_COEF(0x15, 0x0d50),
4976 WRITE_COEF(0xc3, 0x0000),
4977 {}
4978 };
6b0f95c4 4979 static const struct coef_fw coef0225[] = {
4cc9b9d6 4980 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
5a36767a 4981 UPDATE_COEF(0x63, 3<<14, 2<<14),
4cc9b9d6
KY
4982 {}
4983 };
54db6c39 4984
7639a06c 4985 switch (codec->core.vendor_id) {
9a22a8f5 4986 case 0x10ec0255:
54db6c39 4987 alc_process_coef_fw(codec, coef0255);
9a22a8f5 4988 break;
736f20a7 4989 case 0x10ec0236:
e69e7e03
KY
4990 case 0x10ec0256:
4991 alc_process_coef_fw(codec, coef0256);
4992 break;
71683c32
KY
4993 case 0x10ec0234:
4994 case 0x10ec0274:
4995 case 0x10ec0294:
4996 alc_write_coef_idx(codec, 0x45, 0xe689);
4997 break;
13fd08a3 4998 case 0x10ec0233:
73bdd597 4999 case 0x10ec0283:
54db6c39 5000 alc_process_coef_fw(codec, coef0233);
73bdd597 5001 break;
1a5bc8d9
KY
5002 case 0x10ec0298:
5003 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
89542936
KY
5004 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5005 msleep(300);
5006 break;
f3b70332
KY
5007 case 0x10ec0286:
5008 case 0x10ec0288:
5009 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5010 msleep(300);
5011 alc_process_coef_fw(codec, coef0288);
5012 break;
73bdd597 5013 case 0x10ec0292:
54db6c39 5014 alc_process_coef_fw(codec, coef0292);
73bdd597 5015 break;
a22aa26f 5016 case 0x10ec0293:
54db6c39 5017 alc_process_coef_fw(codec, coef0293);
a22aa26f 5018 break;
73bdd597 5019 case 0x10ec0668:
54db6c39 5020 alc_process_coef_fw(codec, coef0688);
73bdd597 5021 break;
c2b691ee 5022 case 0x10ec0215:
4cc9b9d6 5023 case 0x10ec0225:
c2b691ee 5024 case 0x10ec0285:
7d727869 5025 case 0x10ec0295:
c2b691ee 5026 case 0x10ec0289:
28f1f9b2 5027 case 0x10ec0299:
4cc9b9d6
KY
5028 alc_process_coef_fw(codec, coef0225);
5029 break;
73bdd597 5030 }
4e76a883 5031 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
73bdd597
DH
5032}
5033
5034static void alc_determine_headset_type(struct hda_codec *codec)
5035{
5036 int val;
5037 bool is_ctia = false;
5038 struct alc_spec *spec = codec->spec;
6b0f95c4 5039 static const struct coef_fw coef0255[] = {
54db6c39
TI
5040 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5041 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5042 conteol) */
5043 {}
5044 };
6b0f95c4 5045 static const struct coef_fw coef0288[] = {
f3b70332
KY
5046 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5047 {}
5048 };
6b0f95c4 5049 static const struct coef_fw coef0298[] = {
89542936
KY
5050 UPDATE_COEF(0x50, 0x2000, 0x2000),
5051 UPDATE_COEF(0x56, 0x0006, 0x0006),
5052 UPDATE_COEF(0x66, 0x0008, 0),
5053 UPDATE_COEF(0x67, 0x2000, 0),
5054 UPDATE_COEF(0x19, 0x1300, 0x1300),
5055 {}
5056 };
6b0f95c4 5057 static const struct coef_fw coef0293[] = {
54db6c39
TI
5058 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5059 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5060 {}
5061 };
6b0f95c4 5062 static const struct coef_fw coef0688[] = {
54db6c39
TI
5063 WRITE_COEF(0x11, 0x0001),
5064 WRITE_COEF(0xb7, 0x802b),
5065 WRITE_COEF(0x15, 0x0d60),
5066 WRITE_COEF(0xc3, 0x0c00),
5067 {}
5068 };
6b0f95c4 5069 static const struct coef_fw coef0274[] = {
71683c32
KY
5070 UPDATE_COEF(0x4a, 0x0010, 0),
5071 UPDATE_COEF(0x4a, 0x8000, 0),
5072 WRITE_COEF(0x45, 0xd289),
5073 UPDATE_COEF(0x49, 0x0300, 0x0300),
5074 {}
5075 };
73bdd597 5076
7639a06c 5077 switch (codec->core.vendor_id) {
9a22a8f5 5078 case 0x10ec0255:
717f43d8
KY
5079 alc_process_coef_fw(codec, coef0255);
5080 msleep(300);
5081 val = alc_read_coef_idx(codec, 0x46);
5082 is_ctia = (val & 0x0070) == 0x0070;
5083 break;
5084 case 0x10ec0236:
7081adf3 5085 case 0x10ec0256:
717f43d8
KY
5086 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5087 alc_write_coef_idx(codec, 0x06, 0x6104);
5088 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5089
5090 snd_hda_codec_write(codec, 0x21, 0,
5091 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5092 msleep(80);
5093 snd_hda_codec_write(codec, 0x21, 0,
5094 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5095
54db6c39 5096 alc_process_coef_fw(codec, coef0255);
9a22a8f5
KY
5097 msleep(300);
5098 val = alc_read_coef_idx(codec, 0x46);
5099 is_ctia = (val & 0x0070) == 0x0070;
717f43d8
KY
5100
5101 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5102 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5103
5104 snd_hda_codec_write(codec, 0x21, 0,
5105 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5106 msleep(80);
5107 snd_hda_codec_write(codec, 0x21, 0,
5108 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
9a22a8f5 5109 break;
71683c32
KY
5110 case 0x10ec0234:
5111 case 0x10ec0274:
5112 case 0x10ec0294:
5113 alc_process_coef_fw(codec, coef0274);
5114 msleep(80);
5115 val = alc_read_coef_idx(codec, 0x46);
5116 is_ctia = (val & 0x00f0) == 0x00f0;
5117 break;
13fd08a3 5118 case 0x10ec0233:
73bdd597
DH
5119 case 0x10ec0283:
5120 alc_write_coef_idx(codec, 0x45, 0xd029);
5121 msleep(300);
5122 val = alc_read_coef_idx(codec, 0x46);
5123 is_ctia = (val & 0x0070) == 0x0070;
5124 break;
1a5bc8d9 5125 case 0x10ec0298:
89542936
KY
5126 snd_hda_codec_write(codec, 0x21, 0,
5127 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5128 msleep(100);
5129 snd_hda_codec_write(codec, 0x21, 0,
5130 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5131 msleep(200);
5132
5133 val = alc_read_coef_idx(codec, 0x50);
5134 if (val & (1 << 12)) {
5135 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5136 alc_process_coef_fw(codec, coef0288);
5137 msleep(350);
5138 val = alc_read_coef_idx(codec, 0x50);
5139 is_ctia = (val & 0x0070) == 0x0070;
5140 } else {
5141 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5142 alc_process_coef_fw(codec, coef0288);
5143 msleep(350);
5144 val = alc_read_coef_idx(codec, 0x50);
5145 is_ctia = (val & 0x0070) == 0x0070;
5146 }
5147 alc_process_coef_fw(codec, coef0298);
5148 snd_hda_codec_write(codec, 0x21, 0,
5149 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5150 msleep(75);
5151 snd_hda_codec_write(codec, 0x21, 0,
5152 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5153 break;
f3b70332
KY
5154 case 0x10ec0286:
5155 case 0x10ec0288:
5156 alc_process_coef_fw(codec, coef0288);
5157 msleep(350);
5158 val = alc_read_coef_idx(codec, 0x50);
5159 is_ctia = (val & 0x0070) == 0x0070;
5160 break;
73bdd597
DH
5161 case 0x10ec0292:
5162 alc_write_coef_idx(codec, 0x6b, 0xd429);
5163 msleep(300);
5164 val = alc_read_coef_idx(codec, 0x6c);
5165 is_ctia = (val & 0x001c) == 0x001c;
5166 break;
a22aa26f 5167 case 0x10ec0293:
54db6c39 5168 alc_process_coef_fw(codec, coef0293);
a22aa26f
KY
5169 msleep(300);
5170 val = alc_read_coef_idx(codec, 0x46);
5171 is_ctia = (val & 0x0070) == 0x0070;
5172 break;
73bdd597 5173 case 0x10ec0668:
54db6c39 5174 alc_process_coef_fw(codec, coef0688);
73bdd597
DH
5175 msleep(300);
5176 val = alc_read_coef_idx(codec, 0xbe);
5177 is_ctia = (val & 0x1c02) == 0x1c02;
5178 break;
c2b691ee 5179 case 0x10ec0215:
4cc9b9d6 5180 case 0x10ec0225:
c2b691ee 5181 case 0x10ec0285:
7d727869 5182 case 0x10ec0295:
c2b691ee 5183 case 0x10ec0289:
28f1f9b2 5184 case 0x10ec0299:
da911b1f
KY
5185 snd_hda_codec_write(codec, 0x21, 0,
5186 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5187 msleep(80);
5188 snd_hda_codec_write(codec, 0x21, 0,
5189 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5190
5a36767a
KY
5191 alc_process_coef_fw(codec, alc225_pre_hsmode);
5192 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5193 val = alc_read_coef_idx(codec, 0x45);
5194 if (val & (1 << 9)) {
5195 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5196 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5197 msleep(800);
5198 val = alc_read_coef_idx(codec, 0x46);
5199 is_ctia = (val & 0x00f0) == 0x00f0;
5200 } else {
5201 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5202 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5203 msleep(800);
5204 val = alc_read_coef_idx(codec, 0x46);
5205 is_ctia = (val & 0x00f0) == 0x00f0;
5206 }
5207 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
5208 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
5209 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
da911b1f
KY
5210
5211 snd_hda_codec_write(codec, 0x21, 0,
5212 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5213 msleep(80);
5214 snd_hda_codec_write(codec, 0x21, 0,
5215 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
4cc9b9d6 5216 break;
78f4f7c2
KY
5217 case 0x10ec0867:
5218 is_ctia = true;
5219 break;
73bdd597
DH
5220 }
5221
4e76a883 5222 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
73bdd597
DH
5223 is_ctia ? "yes" : "no");
5224 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
5225}
5226
5227static void alc_update_headset_mode(struct hda_codec *codec)
5228{
5229 struct alc_spec *spec = codec->spec;
5230
5231 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
35a39f98 5232 hda_nid_t hp_pin = alc_get_hp_pin(spec);
73bdd597
DH
5233
5234 int new_headset_mode;
5235
5236 if (!snd_hda_jack_detect(codec, hp_pin))
5237 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
5238 else if (mux_pin == spec->headset_mic_pin)
5239 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
5240 else if (mux_pin == spec->headphone_mic_pin)
5241 new_headset_mode = ALC_HEADSET_MODE_MIC;
5242 else
5243 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
5244
5959a6bc
DH
5245 if (new_headset_mode == spec->current_headset_mode) {
5246 snd_hda_gen_update_outputs(codec);
73bdd597 5247 return;
5959a6bc 5248 }
73bdd597
DH
5249
5250 switch (new_headset_mode) {
5251 case ALC_HEADSET_MODE_UNPLUGGED:
5252 alc_headset_mode_unplugged(codec);
aeac1a0d
KY
5253 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5254 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
73bdd597
DH
5255 spec->gen.hp_jack_present = false;
5256 break;
5257 case ALC_HEADSET_MODE_HEADSET:
5258 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
5259 alc_determine_headset_type(codec);
5260 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
5261 alc_headset_mode_ctia(codec);
5262 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
5263 alc_headset_mode_omtp(codec);
5264 spec->gen.hp_jack_present = true;
5265 break;
5266 case ALC_HEADSET_MODE_MIC:
5267 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
5268 spec->gen.hp_jack_present = false;
5269 break;
5270 case ALC_HEADSET_MODE_HEADPHONE:
5271 alc_headset_mode_default(codec);
5272 spec->gen.hp_jack_present = true;
5273 break;
5274 }
5275 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
5276 snd_hda_set_pin_ctl_cache(codec, hp_pin,
5277 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
1f8b46cd 5278 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
73bdd597
DH
5279 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
5280 PIN_VREFHIZ);
5281 }
5282 spec->current_headset_mode = new_headset_mode;
5283
5284 snd_hda_gen_update_outputs(codec);
5285}
5286
5287static void alc_update_headset_mode_hook(struct hda_codec *codec,
7fe30711
TI
5288 struct snd_kcontrol *kcontrol,
5289 struct snd_ctl_elem_value *ucontrol)
73bdd597
DH
5290{
5291 alc_update_headset_mode(codec);
5292}
5293
1a4f69d5
TI
5294static void alc_update_headset_jack_cb(struct hda_codec *codec,
5295 struct hda_jack_callback *jack)
73bdd597 5296{
73bdd597
DH
5297 snd_hda_gen_hp_automute(codec, jack);
5298}
5299
5300static void alc_probe_headset_mode(struct hda_codec *codec)
5301{
5302 int i;
5303 struct alc_spec *spec = codec->spec;
5304 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5305
5306 /* Find mic pins */
5307 for (i = 0; i < cfg->num_inputs; i++) {
5308 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
5309 spec->headset_mic_pin = cfg->inputs[i].pin;
5310 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
5311 spec->headphone_mic_pin = cfg->inputs[i].pin;
5312 }
5313
0bed2aa3 5314 WARN_ON(spec->gen.cap_sync_hook);
73bdd597
DH
5315 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
5316 spec->gen.automute_hook = alc_update_headset_mode;
5317 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
5318}
5319
5320static void alc_fixup_headset_mode(struct hda_codec *codec,
5321 const struct hda_fixup *fix, int action)
5322{
5323 struct alc_spec *spec = codec->spec;
5324
5325 switch (action) {
5326 case HDA_FIXUP_ACT_PRE_PROBE:
5327 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
5328 break;
5329 case HDA_FIXUP_ACT_PROBE:
5330 alc_probe_headset_mode(codec);
5331 break;
5332 case HDA_FIXUP_ACT_INIT:
aeac1a0d
KY
5333 if (is_s3_resume(codec) || is_s4_resume(codec)) {
5334 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5335 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5336 }
73bdd597
DH
5337 alc_update_headset_mode(codec);
5338 break;
5339 }
5340}
5341
5342static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
5343 const struct hda_fixup *fix, int action)
5344{
5345 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5346 struct alc_spec *spec = codec->spec;
5347 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5348 }
5349 else
5350 alc_fixup_headset_mode(codec, fix, action);
5351}
5352
31278997
KY
5353static void alc255_set_default_jack_type(struct hda_codec *codec)
5354{
5355 /* Set to iphone type */
6b0f95c4 5356 static const struct coef_fw alc255fw[] = {
54db6c39
TI
5357 WRITE_COEF(0x1b, 0x880b),
5358 WRITE_COEF(0x45, 0xd089),
5359 WRITE_COEF(0x1b, 0x080b),
5360 WRITE_COEF(0x46, 0x0004),
5361 WRITE_COEF(0x1b, 0x0c0b),
5362 {}
5363 };
6b0f95c4 5364 static const struct coef_fw alc256fw[] = {
e69e7e03
KY
5365 WRITE_COEF(0x1b, 0x884b),
5366 WRITE_COEF(0x45, 0xd089),
5367 WRITE_COEF(0x1b, 0x084b),
5368 WRITE_COEF(0x46, 0x0004),
5369 WRITE_COEF(0x1b, 0x0c4b),
5370 {}
5371 };
5372 switch (codec->core.vendor_id) {
5373 case 0x10ec0255:
5374 alc_process_coef_fw(codec, alc255fw);
5375 break;
736f20a7 5376 case 0x10ec0236:
e69e7e03
KY
5377 case 0x10ec0256:
5378 alc_process_coef_fw(codec, alc256fw);
5379 break;
5380 }
31278997
KY
5381 msleep(30);
5382}
5383
9a22a8f5
KY
5384static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
5385 const struct hda_fixup *fix, int action)
5386{
5387 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
31278997 5388 alc255_set_default_jack_type(codec);
9a22a8f5
KY
5389 }
5390 alc_fixup_headset_mode(codec, fix, action);
5391}
5392
31278997
KY
5393static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
5394 const struct hda_fixup *fix, int action)
5395{
5396 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5397 struct alc_spec *spec = codec->spec;
5398 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5399 alc255_set_default_jack_type(codec);
5400 }
5401 else
5402 alc_fixup_headset_mode(codec, fix, action);
5403}
5404
e1e62b98
KY
5405static void alc288_update_headset_jack_cb(struct hda_codec *codec,
5406 struct hda_jack_callback *jack)
5407{
5408 struct alc_spec *spec = codec->spec;
e1e62b98
KY
5409
5410 alc_update_headset_jack_cb(codec, jack);
5411 /* Headset Mic enable or disable, only for Dell Dino */
d44a6864 5412 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
e1e62b98
KY
5413}
5414
5415static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5416 const struct hda_fixup *fix, int action)
5417{
5418 alc_fixup_headset_mode(codec, fix, action);
5419 if (action == HDA_FIXUP_ACT_PROBE) {
5420 struct alc_spec *spec = codec->spec;
d44a6864
TI
5421 /* toggled via hp_automute_hook */
5422 spec->gpio_mask |= 0x40;
5423 spec->gpio_dir |= 0x40;
e1e62b98
KY
5424 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
5425 }
5426}
5427
493a52a9
HW
5428static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5429 const struct hda_fixup *fix, int action)
5430{
5431 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5432 struct alc_spec *spec = codec->spec;
5433 spec->gen.auto_mute_via_amp = 1;
5434 }
5435}
5436
9b745ab8
TI
5437static void alc_fixup_no_shutup(struct hda_codec *codec,
5438 const struct hda_fixup *fix, int action)
5439{
efe55732 5440 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
9b745ab8 5441 struct alc_spec *spec = codec->spec;
c0ca5ece 5442 spec->no_shutup_pins = 1;
9b745ab8
TI
5443 }
5444}
5445
5e6db669
GM
5446static void alc_fixup_disable_aamix(struct hda_codec *codec,
5447 const struct hda_fixup *fix, int action)
5448{
5449 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5450 struct alc_spec *spec = codec->spec;
5451 /* Disable AA-loopback as it causes white noise */
5452 spec->gen.mixer_nid = 0;
5453 }
5454}
5455
7f57d803
TI
5456/* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
5457static void alc_fixup_tpt440_dock(struct hda_codec *codec,
5458 const struct hda_fixup *fix, int action)
5459{
5460 static const struct hda_pintbl pincfgs[] = {
5461 { 0x16, 0x21211010 }, /* dock headphone */
5462 { 0x19, 0x21a11010 }, /* dock mic */
5463 { }
5464 };
5465 struct alc_spec *spec = codec->spec;
5466
5467 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
871b9066 5468 spec->reboot_notify = snd_hda_gen_reboot_notify; /* reduce noise */
7f57d803
TI
5469 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5470 codec->power_save_node = 0; /* avoid click noises */
5471 snd_hda_apply_pincfgs(codec, pincfgs);
5472 }
5473}
5474
61fcf8ec
KY
5475static void alc_fixup_tpt470_dock(struct hda_codec *codec,
5476 const struct hda_fixup *fix, int action)
5477{
5478 static const struct hda_pintbl pincfgs[] = {
5479 { 0x17, 0x21211010 }, /* dock headphone */
5480 { 0x19, 0x21a11010 }, /* dock mic */
5481 { }
5482 };
54947cd6
TI
5483 /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
5484 * the speaker output becomes too low by some reason on Thinkpads with
5485 * ALC298 codec
5486 */
caf3c043 5487 static const hda_nid_t preferred_pairs[] = {
54947cd6
TI
5488 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
5489 0
5490 };
61fcf8ec
KY
5491 struct alc_spec *spec = codec->spec;
5492
5493 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
54947cd6 5494 spec->gen.preferred_dacs = preferred_pairs;
61fcf8ec 5495 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
71db96dd
TI
5496 snd_hda_apply_pincfgs(codec, pincfgs);
5497 } else if (action == HDA_FIXUP_ACT_INIT) {
61fcf8ec
KY
5498 /* Enable DOCK device */
5499 snd_hda_codec_write(codec, 0x17, 0,
5500 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5501 /* Enable DOCK device */
5502 snd_hda_codec_write(codec, 0x19, 0,
5503 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
61fcf8ec
KY
5504 }
5505}
5506
9476d369 5507static void alc_shutup_dell_xps13(struct hda_codec *codec)
033b0a7c
GM
5508{
5509 struct alc_spec *spec = codec->spec;
35a39f98 5510 int hp_pin = alc_get_hp_pin(spec);
033b0a7c 5511
9476d369
GM
5512 /* Prevent pop noises when headphones are plugged in */
5513 snd_hda_codec_write(codec, hp_pin, 0,
5514 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5515 msleep(20);
033b0a7c
GM
5516}
5517
5518static void alc_fixup_dell_xps13(struct hda_codec *codec,
5519 const struct hda_fixup *fix, int action)
5520{
3e1b0c4a
TI
5521 struct alc_spec *spec = codec->spec;
5522 struct hda_input_mux *imux = &spec->gen.input_mux;
5523 int i;
f38663ab 5524
3e1b0c4a
TI
5525 switch (action) {
5526 case HDA_FIXUP_ACT_PRE_PROBE:
5527 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
5528 * it causes a click noise at start up
5529 */
5530 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
efe55732 5531 spec->shutup = alc_shutup_dell_xps13;
3e1b0c4a
TI
5532 break;
5533 case HDA_FIXUP_ACT_PROBE:
f38663ab
GM
5534 /* Make the internal mic the default input source. */
5535 for (i = 0; i < imux->num_items; i++) {
5536 if (spec->gen.imux_pins[i] == 0x12) {
5537 spec->gen.cur_mux[0] = i;
5538 break;
5539 }
5540 }
3e1b0c4a 5541 break;
033b0a7c
GM
5542 }
5543}
5544
1f8b46cd
DH
5545static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
5546 const struct hda_fixup *fix, int action)
5547{
5548 struct alc_spec *spec = codec->spec;
5549
5550 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5551 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5552 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
b40eda64
DH
5553
5554 /* Disable boost for mic-in permanently. (This code is only called
5555 from quirks that guarantee that the headphone is at NID 0x1b.) */
5556 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
5557 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
1f8b46cd
DH
5558 } else
5559 alc_fixup_headset_mode(codec, fix, action);
5560}
5561
73bdd597
DH
5562static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
5563 const struct hda_fixup *fix, int action)
5564{
5565 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
73bdd597 5566 alc_write_coef_idx(codec, 0xc4, 0x8000);
98b24883 5567 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
73bdd597
DH
5568 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
5569 }
5570 alc_fixup_headset_mode(codec, fix, action);
5571}
5572
bde7bc60
CCC
5573/* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
5574static int find_ext_mic_pin(struct hda_codec *codec)
5575{
5576 struct alc_spec *spec = codec->spec;
5577 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5578 hda_nid_t nid;
5579 unsigned int defcfg;
5580 int i;
5581
5582 for (i = 0; i < cfg->num_inputs; i++) {
5583 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5584 continue;
5585 nid = cfg->inputs[i].pin;
5586 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5587 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
5588 continue;
5589 return nid;
5590 }
5591
5592 return 0;
5593}
5594
08a978db 5595static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
1727a771 5596 const struct hda_fixup *fix,
08a978db
DR
5597 int action)
5598{
5599 struct alc_spec *spec = codec->spec;
5600
0db75790 5601 if (action == HDA_FIXUP_ACT_PROBE) {
bde7bc60 5602 int mic_pin = find_ext_mic_pin(codec);
35a39f98 5603 int hp_pin = alc_get_hp_pin(spec);
bde7bc60
CCC
5604
5605 if (snd_BUG_ON(!mic_pin || !hp_pin))
0db75790 5606 return;
bde7bc60 5607 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
0db75790 5608 }
08a978db 5609}
693b613d 5610
3e0d611b
DH
5611static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
5612 const struct hda_fixup *fix,
5613 int action)
5614{
5615 struct alc_spec *spec = codec->spec;
5616 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5617 int i;
5618
5619 /* The mic boosts on level 2 and 3 are too noisy
5620 on the internal mic input.
5621 Therefore limit the boost to 0 or 1. */
5622
5623 if (action != HDA_FIXUP_ACT_PROBE)
5624 return;
5625
5626 for (i = 0; i < cfg->num_inputs; i++) {
5627 hda_nid_t nid = cfg->inputs[i].pin;
5628 unsigned int defcfg;
5629 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5630 continue;
5631 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5632 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
5633 continue;
5634
5635 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
5636 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
5637 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
5638 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
5639 (0 << AC_AMPCAP_MUTE_SHIFT));
5640 }
5641}
5642
cd217a63 5643static void alc283_hp_automute_hook(struct hda_codec *codec,
1a4f69d5 5644 struct hda_jack_callback *jack)
cd217a63
KY
5645{
5646 struct alc_spec *spec = codec->spec;
5647 int vref;
5648
5649 msleep(200);
5650 snd_hda_gen_hp_automute(codec, jack);
5651
5652 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
5653
5654 msleep(600);
5655 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5656 vref);
5657}
5658
cd217a63
KY
5659static void alc283_fixup_chromebook(struct hda_codec *codec,
5660 const struct hda_fixup *fix, int action)
5661{
5662 struct alc_spec *spec = codec->spec;
cd217a63
KY
5663
5664 switch (action) {
5665 case HDA_FIXUP_ACT_PRE_PROBE:
0202e99c 5666 snd_hda_override_wcaps(codec, 0x03, 0);
d2e92709
TI
5667 /* Disable AA-loopback as it causes white noise */
5668 spec->gen.mixer_nid = 0;
38070219 5669 break;
0202e99c 5670 case HDA_FIXUP_ACT_INIT:
de9481cb
KY
5671 /* MIC2-VREF control */
5672 /* Set to manual mode */
98b24883 5673 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
0202e99c 5674 /* Enable Line1 input control by verb */
98b24883 5675 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
0202e99c
KY
5676 break;
5677 }
5678}
5679
5680static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
5681 const struct hda_fixup *fix, int action)
5682{
5683 struct alc_spec *spec = codec->spec;
0202e99c
KY
5684
5685 switch (action) {
5686 case HDA_FIXUP_ACT_PRE_PROBE:
cd217a63 5687 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
38070219
KY
5688 break;
5689 case HDA_FIXUP_ACT_INIT:
cd217a63
KY
5690 /* MIC2-VREF control */
5691 /* Set to manual mode */
98b24883 5692 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
cd217a63
KY
5693 break;
5694 }
5695}
5696
7bba2157
TI
5697/* mute tablet speaker pin (0x14) via dock plugging in addition */
5698static void asus_tx300_automute(struct hda_codec *codec)
5699{
5700 struct alc_spec *spec = codec->spec;
5701 snd_hda_gen_update_outputs(codec);
5702 if (snd_hda_jack_detect(codec, 0x1b))
5703 spec->gen.mute_bits |= (1ULL << 0x14);
5704}
5705
5706static void alc282_fixup_asus_tx300(struct hda_codec *codec,
5707 const struct hda_fixup *fix, int action)
5708{
5709 struct alc_spec *spec = codec->spec;
7bba2157
TI
5710 static const struct hda_pintbl dock_pins[] = {
5711 { 0x1b, 0x21114000 }, /* dock speaker pin */
5712 {}
5713 };
7bba2157
TI
5714
5715 switch (action) {
5716 case HDA_FIXUP_ACT_PRE_PROBE:
1c76aa5f 5717 spec->init_amp = ALC_INIT_DEFAULT;
ae065f1c
TI
5718 /* TX300 needs to set up GPIO2 for the speaker amp */
5719 alc_setup_gpio(codec, 0x04);
7bba2157
TI
5720 snd_hda_apply_pincfgs(codec, dock_pins);
5721 spec->gen.auto_mute_via_amp = 1;
5722 spec->gen.automute_hook = asus_tx300_automute;
5723 snd_hda_jack_detect_enable_callback(codec, 0x1b,
7bba2157
TI
5724 snd_hda_gen_hp_automute);
5725 break;
5579cd6f
TI
5726 case HDA_FIXUP_ACT_PROBE:
5727 spec->init_amp = ALC_INIT_DEFAULT;
5728 break;
7bba2157
TI
5729 case HDA_FIXUP_ACT_BUILD:
5730 /* this is a bit tricky; give more sane names for the main
5731 * (tablet) speaker and the dock speaker, respectively
5732 */
56798e6b
TI
5733 rename_ctl(codec, "Speaker Playback Switch",
5734 "Dock Speaker Playback Switch");
5735 rename_ctl(codec, "Bass Speaker Playback Switch",
5736 "Speaker Playback Switch");
7bba2157
TI
5737 break;
5738 }
5739}
5740
338cae56
DH
5741static void alc290_fixup_mono_speakers(struct hda_codec *codec,
5742 const struct hda_fixup *fix, int action)
5743{
0f4881dc
DH
5744 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5745 /* DAC node 0x03 is giving mono output. We therefore want to
5746 make sure 0x14 (front speaker) and 0x15 (headphones) use the
5747 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
caf3c043
MM
5748 static const hda_nid_t conn1[] = { 0x0c };
5749 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
5750 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
0f4881dc 5751 }
338cae56
DH
5752}
5753
dd9aa335
HW
5754static void alc298_fixup_speaker_volume(struct hda_codec *codec,
5755 const struct hda_fixup *fix, int action)
5756{
5757 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5758 /* The speaker is routed to the Node 0x06 by a mistake, as a result
5759 we can't adjust the speaker's volume since this node does not has
5760 Amp-out capability. we change the speaker's route to:
5761 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
5762 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
5763 speaker's volume now. */
5764
caf3c043
MM
5765 static const hda_nid_t conn1[] = { 0x0c };
5766 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
dd9aa335
HW
5767 }
5768}
5769
e312a869
TI
5770/* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
5771static void alc295_fixup_disable_dac3(struct hda_codec *codec,
5772 const struct hda_fixup *fix, int action)
5773{
5774 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
caf3c043
MM
5775 static const hda_nid_t conn[] = { 0x02, 0x03 };
5776 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
e312a869
TI
5777 }
5778}
5779
d2cd795c
JK
5780/* force NID 0x17 (Bass Speaker) to DAC1 to share it with the main speaker */
5781static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
5782 const struct hda_fixup *fix, int action)
5783{
5784 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
caf3c043
MM
5785 static const hda_nid_t conn[] = { 0x02 };
5786 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
d2cd795c
JK
5787 }
5788}
5789
98973f2f
KP
5790/* Hook to update amp GPIO4 for automute */
5791static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
5792 struct hda_jack_callback *jack)
5793{
5794 struct alc_spec *spec = codec->spec;
5795
5796 snd_hda_gen_hp_automute(codec, jack);
5797 /* mute_led_polarity is set to 0, so we pass inverted value here */
5798 alc_update_gpio_led(codec, 0x10, !spec->gen.hp_jack_present);
5799}
5800
5801/* Manage GPIOs for HP EliteBook Folio 9480m.
5802 *
5803 * GPIO4 is the headphone amplifier power control
5804 * GPIO3 is the audio output mute indicator LED
5805 */
5806
5807static void alc280_fixup_hp_9480m(struct hda_codec *codec,
5808 const struct hda_fixup *fix,
5809 int action)
5810{
5811 struct alc_spec *spec = codec->spec;
98973f2f 5812
01e4a275 5813 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
98973f2f 5814 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
01e4a275
TI
5815 /* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
5816 spec->gpio_mask |= 0x10;
5817 spec->gpio_dir |= 0x10;
98973f2f 5818 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
98973f2f
KP
5819 }
5820}
5821
ae065f1c
TI
5822static void alc275_fixup_gpio4_off(struct hda_codec *codec,
5823 const struct hda_fixup *fix,
5824 int action)
5825{
5826 struct alc_spec *spec = codec->spec;
5827
5828 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5829 spec->gpio_mask |= 0x04;
5830 spec->gpio_dir |= 0x04;
5831 /* set data bit low */
5832 }
5833}
5834
ca169cc2
KY
5835static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
5836 const struct hda_fixup *fix,
5837 int action)
5838{
5839 alc_fixup_dual_codecs(codec, fix, action);
5840 switch (action) {
5841 case HDA_FIXUP_ACT_PRE_PROBE:
5842 /* override card longname to provide a unique UCM profile */
5843 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
5844 break;
5845 case HDA_FIXUP_ACT_BUILD:
5846 /* rename Capture controls depending on the codec */
5847 rename_ctl(codec, "Capture Volume",
5848 codec->addr == 0 ?
5849 "Rear-Panel Capture Volume" :
5850 "Front-Panel Capture Volume");
5851 rename_ctl(codec, "Capture Switch",
5852 codec->addr == 0 ?
5853 "Rear-Panel Capture Switch" :
5854 "Front-Panel Capture Switch");
5855 break;
5856 }
5857}
5858
52e4e368
KHF
5859static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
5860 const struct hda_fixup *fix, int action)
5861{
5862 if (action != HDA_FIXUP_ACT_PRE_PROBE)
5863 return;
5864
5865 codec->power_save_node = 1;
5866}
5867
92266651
KY
5868/* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
5869static void alc274_fixup_bind_dacs(struct hda_codec *codec,
5870 const struct hda_fixup *fix, int action)
5871{
5872 struct alc_spec *spec = codec->spec;
caf3c043 5873 static const hda_nid_t preferred_pairs[] = {
92266651
KY
5874 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
5875 0
5876 };
5877
5878 if (action != HDA_FIXUP_ACT_PRE_PROBE)
5879 return;
5880
5881 spec->gen.preferred_dacs = preferred_pairs;
0700d3d1
KY
5882 spec->gen.auto_mute_via_amp = 1;
5883 codec->power_save_node = 0;
92266651
KY
5884}
5885
c4cfcf6f
HW
5886/* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */
5887static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
5888 const struct hda_fixup *fix, int action)
5889{
5890 if (action != HDA_FIXUP_ACT_PRE_PROBE)
5891 return;
5892
5893 snd_hda_override_wcaps(codec, 0x03, 0);
5894}
5895
8983eb60
KY
5896static void alc295_fixup_chromebook(struct hda_codec *codec,
5897 const struct hda_fixup *fix, int action)
5898{
d3ba58bb
KY
5899 struct alc_spec *spec = codec->spec;
5900
8983eb60 5901 switch (action) {
d3ba58bb
KY
5902 case HDA_FIXUP_ACT_PRE_PROBE:
5903 spec->ultra_low_power = true;
5904 break;
8983eb60
KY
5905 case HDA_FIXUP_ACT_INIT:
5906 switch (codec->core.vendor_id) {
5907 case 0x10ec0295:
5908 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
5909 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
5910 break;
5911 case 0x10ec0236:
5912 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
5913 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
5914 break;
5915 }
5916 break;
5917 }
5918}
5919
d1dd4211
KY
5920static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
5921 const struct hda_fixup *fix, int action)
5922{
5923 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5924 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
5925}
5926
b317b032
TI
5927/* for hda_fixup_thinkpad_acpi() */
5928#include "thinkpad_helper.c"
b67ae3f1 5929
d5a6cabf
TI
5930static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
5931 const struct hda_fixup *fix, int action)
5932{
5933 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
5934 hda_fixup_thinkpad_acpi(codec, fix, action);
5935}
5936
bbf8ff6b
TB
5937/* for alc295_fixup_hp_top_speakers */
5938#include "hp_x360_helper.c"
5939
1d045db9
TI
5940enum {
5941 ALC269_FIXUP_SONY_VAIO,
5942 ALC275_FIXUP_SONY_VAIO_GPIO2,
5943 ALC269_FIXUP_DELL_M101Z,
5944 ALC269_FIXUP_SKU_IGNORE,
5945 ALC269_FIXUP_ASUS_G73JW,
5946 ALC269_FIXUP_LENOVO_EAPD,
5947 ALC275_FIXUP_SONY_HWEQ,
e9bd7d5c 5948 ALC275_FIXUP_SONY_DISABLE_AAMIX,
1d045db9 5949 ALC271_FIXUP_DMIC,
017f2a10 5950 ALC269_FIXUP_PCM_44K,
adabb3ec 5951 ALC269_FIXUP_STEREO_DMIC,
7c478f03 5952 ALC269_FIXUP_HEADSET_MIC,
24519911
TI
5953 ALC269_FIXUP_QUANTA_MUTE,
5954 ALC269_FIXUP_LIFEBOOK,
2041d564 5955 ALC269_FIXUP_LIFEBOOK_EXTMIC,
cc7016ab 5956 ALC269_FIXUP_LIFEBOOK_HP_PIN,
4df3fd17 5957 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
fdcc968a 5958 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
a4297b5d
TI
5959 ALC269_FIXUP_AMIC,
5960 ALC269_FIXUP_DMIC,
5961 ALC269VB_FIXUP_AMIC,
5962 ALC269VB_FIXUP_DMIC,
08fb0d0e 5963 ALC269_FIXUP_HP_MUTE_LED,
d06ac143 5964 ALC269_FIXUP_HP_MUTE_LED_MIC1,
08fb0d0e 5965 ALC269_FIXUP_HP_MUTE_LED_MIC2,
7f783bd5 5966 ALC269_FIXUP_HP_MUTE_LED_MIC3,
9f5c6faf 5967 ALC269_FIXUP_HP_GPIO_LED,
9c5dc3bf
KY
5968 ALC269_FIXUP_HP_GPIO_MIC1_LED,
5969 ALC269_FIXUP_HP_LINE1_MIC1_LED,
693b613d 5970 ALC269_FIXUP_INV_DMIC,
108cc108 5971 ALC269_FIXUP_LENOVO_DOCK,
9b745ab8 5972 ALC269_FIXUP_NO_SHUTUP,
88cfcf86 5973 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
108cc108 5974 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
73bdd597
DH
5975 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
5976 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
338cae56 5977 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
fcc6c877 5978 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
73bdd597
DH
5979 ALC269_FIXUP_HEADSET_MODE,
5980 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
7819717b 5981 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
d240d1dc
DH
5982 ALC269_FIXUP_ASUS_X101_FUNC,
5983 ALC269_FIXUP_ASUS_X101_VERB,
5984 ALC269_FIXUP_ASUS_X101,
08a978db
DR
5985 ALC271_FIXUP_AMIC_MIC2,
5986 ALC271_FIXUP_HP_GATE_MIC_JACK,
b1e8972e 5987 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
42397004 5988 ALC269_FIXUP_ACER_AC700,
3e0d611b 5989 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
2cede303 5990 ALC269VB_FIXUP_ASUS_ZENBOOK,
23870831 5991 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
8e35cd4a 5992 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
02b504d9 5993 ALC269VB_FIXUP_ORDISSIMO_EVE2,
cd217a63 5994 ALC283_FIXUP_CHROME_BOOK,
0202e99c 5995 ALC283_FIXUP_SENSE_COMBO_JACK,
7bba2157 5996 ALC282_FIXUP_ASUS_TX300,
1bb3e062 5997 ALC283_FIXUP_INT_MIC,
338cae56 5998 ALC290_FIXUP_MONO_SPEAKERS,
0f4881dc
DH
5999 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6000 ALC290_FIXUP_SUBWOOFER,
6001 ALC290_FIXUP_SUBWOOFER_HSJACK,
b67ae3f1 6002 ALC269_FIXUP_THINKPAD_ACPI,
56f27013 6003 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
5824ce8d 6004 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
615966ad 6005 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9a22a8f5 6006 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
31278997 6007 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
9a22a8f5 6008 ALC255_FIXUP_HEADSET_MODE,
31278997 6009 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
a22aa26f 6010 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
1c37c223 6011 ALC292_FIXUP_TPT440_DOCK,
9a811230 6012 ALC292_FIXUP_TPT440,
abaa2274 6013 ALC283_FIXUP_HEADSET_MIC,
b3802783 6014 ALC255_FIXUP_MIC_MUTE_LED,
1a22e775 6015 ALC282_FIXUP_ASPIRE_V5_PINS,
7a5255f1 6016 ALC280_FIXUP_HP_GPIO4,
eaa8e5ef 6017 ALC286_FIXUP_HP_GPIO_LED,
33f4acd3 6018 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
b4b33f9d 6019 ALC280_FIXUP_HP_DOCK_PINS,
04d5466a 6020 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
98973f2f 6021 ALC280_FIXUP_HP_9480M,
e1e62b98
KY
6022 ALC288_FIXUP_DELL_HEADSET_MODE,
6023 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
831bfdf9
HW
6024 ALC288_FIXUP_DELL_XPS_13,
6025 ALC288_FIXUP_DISABLE_AAMIX,
5fab5829 6026 ALC292_FIXUP_DELL_E7X_AAMIX,
8b99aba7
TI
6027 ALC292_FIXUP_DELL_E7X,
6028 ALC292_FIXUP_DISABLE_AAMIX,
c04017ea 6029 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
54324221 6030 ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
977e6276 6031 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
2f726aec 6032 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
6ed1131f 6033 ALC275_FIXUP_DELL_XPS,
23adc192 6034 ALC293_FIXUP_LENOVO_SPK_NOISE,
3694cb29 6035 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
3b43b71f 6036 ALC255_FIXUP_DELL_SPK_NOISE,
d1dd4211 6037 ALC225_FIXUP_DISABLE_MIC_VREF,
2ae95577 6038 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
e312a869 6039 ALC295_FIXUP_DISABLE_DAC3,
d2cd795c 6040 ALC285_FIXUP_SPEAKER2_TO_DAC1,
f883982d 6041 ALC280_FIXUP_HP_HEADSET_MIC,
e549d190 6042 ALC221_FIXUP_HP_FRONT_MIC,
c636b95e 6043 ALC292_FIXUP_TPT460,
dd9aa335 6044 ALC298_FIXUP_SPK_VOLUME,
fd06c77e 6045 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
823ff161 6046 ALC269_FIXUP_ATIV_BOOK_8,
9eb5d0e6 6047 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
c1732ede
CC
6048 ALC256_FIXUP_ASUS_HEADSET_MODE,
6049 ALC256_FIXUP_ASUS_MIC,
eeed4cd1 6050 ALC256_FIXUP_ASUS_AIO_GPIO2,
216d7aeb
CC
6051 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
6052 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
ca169cc2 6053 ALC233_FIXUP_LENOVO_MULTI_CODECS,
ea5c7eba 6054 ALC233_FIXUP_ACER_HEADSET_MIC,
f33f79f3 6055 ALC294_FIXUP_LENOVO_MIC_LOCATION,
5f364135 6056 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
52e4e368 6057 ALC225_FIXUP_S3_POP_NOISE,
b84e8436 6058 ALC700_FIXUP_INTEL_REFERENCE,
92266651
KY
6059 ALC274_FIXUP_DELL_BIND_DACS,
6060 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
61fcf8ec 6061 ALC298_FIXUP_TPT470_DOCK,
ae104a21 6062 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
f0ba9d69 6063 ALC255_FIXUP_DELL_HEADSET_MIC,
0fbf21c3 6064 ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
a2ef03fe 6065 ALC298_FIXUP_HUAWEI_MBX_STEREO,
bbf8ff6b 6066 ALC295_FIXUP_HP_X360,
8a328ac1 6067 ALC221_FIXUP_HP_HEADSET_MIC,
c4cfcf6f 6068 ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
e8ed64b0 6069 ALC295_FIXUP_HP_AUTO_MUTE,
33aaebd4 6070 ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
d8ae458e 6071 ALC294_FIXUP_ASUS_MIC,
4e051106
JHP
6072 ALC294_FIXUP_ASUS_HEADSET_MIC,
6073 ALC294_FIXUP_ASUS_SPK,
89e3a568 6074 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
c8c6ee61 6075 ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
cbc05fd6 6076 ALC255_FIXUP_ACER_HEADSET_MIC,
10f5b1b8 6077 ALC295_FIXUP_CHROME_BOOK,
8983eb60 6078 ALC225_FIXUP_HEADSET_JACK,
136824ef
KY
6079 ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
6080 ALC225_FIXUP_WYSE_AUTO_MUTE,
6081 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
667a8f73 6082 ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
8c8967a7 6083 ALC256_FIXUP_ASUS_HEADSET_MIC,
e1037354 6084 ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
e2a829b3 6085 ALC299_FIXUP_PREDATOR_SPK,
bd9c10bc 6086 ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
e79c2269
KY
6087 ALC289_FIXUP_DELL_SPK2,
6088 ALC289_FIXUP_DUAL_SPK,
48e01504
CC
6089 ALC294_FIXUP_SPK2_TO_DAC1,
6090 ALC294_FIXUP_ASUS_DUAL_SPK,
76f7dec0 6091 ALC285_FIXUP_THINKPAD_HEADSET_JACK,
8b33a134 6092 ALC294_FIXUP_ASUS_HPE,
f5a88b0a 6093 ALC285_FIXUP_HP_GPIO_LED,
431e76c3 6094 ALC285_FIXUP_HP_MUTE_LED,
24164f43 6095 ALC236_FIXUP_HP_MUTE_LED,
14425f1f 6096 ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
9e43342b 6097 ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
f1d4e28b
KY
6098};
6099
1727a771 6100static const struct hda_fixup alc269_fixups[] = {
1d045db9 6101 [ALC269_FIXUP_SONY_VAIO] = {
fd108215
TI
6102 .type = HDA_FIXUP_PINCTLS,
6103 .v.pins = (const struct hda_pintbl[]) {
6104 {0x19, PIN_VREFGRD},
1d045db9
TI
6105 {}
6106 }
f1d4e28b 6107 },
1d045db9 6108 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
ae065f1c
TI
6109 .type = HDA_FIXUP_FUNC,
6110 .v.func = alc275_fixup_gpio4_off,
1d045db9
TI
6111 .chained = true,
6112 .chain_id = ALC269_FIXUP_SONY_VAIO
6113 },
6114 [ALC269_FIXUP_DELL_M101Z] = {
1727a771 6115 .type = HDA_FIXUP_VERBS,
1d045db9
TI
6116 .v.verbs = (const struct hda_verb[]) {
6117 /* Enables internal speaker */
6118 {0x20, AC_VERB_SET_COEF_INDEX, 13},
6119 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
6120 {}
6121 }
6122 },
6123 [ALC269_FIXUP_SKU_IGNORE] = {
1727a771 6124 .type = HDA_FIXUP_FUNC,
23d30f28 6125 .v.func = alc_fixup_sku_ignore,
1d045db9
TI
6126 },
6127 [ALC269_FIXUP_ASUS_G73JW] = {
1727a771
TI
6128 .type = HDA_FIXUP_PINS,
6129 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
6130 { 0x17, 0x99130111 }, /* subwoofer */
6131 { }
6132 }
6133 },
6134 [ALC269_FIXUP_LENOVO_EAPD] = {
1727a771 6135 .type = HDA_FIXUP_VERBS,
1d045db9
TI
6136 .v.verbs = (const struct hda_verb[]) {
6137 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
6138 {}
6139 }
6140 },
6141 [ALC275_FIXUP_SONY_HWEQ] = {
1727a771 6142 .type = HDA_FIXUP_FUNC,
1d045db9
TI
6143 .v.func = alc269_fixup_hweq,
6144 .chained = true,
6145 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
6146 },
e9bd7d5c
TI
6147 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
6148 .type = HDA_FIXUP_FUNC,
6149 .v.func = alc_fixup_disable_aamix,
6150 .chained = true,
6151 .chain_id = ALC269_FIXUP_SONY_VAIO
6152 },
1d045db9 6153 [ALC271_FIXUP_DMIC] = {
1727a771 6154 .type = HDA_FIXUP_FUNC,
1d045db9 6155 .v.func = alc271_fixup_dmic,
f1d4e28b 6156 },
017f2a10 6157 [ALC269_FIXUP_PCM_44K] = {
1727a771 6158 .type = HDA_FIXUP_FUNC,
017f2a10 6159 .v.func = alc269_fixup_pcm_44k,
012e7eb1
DH
6160 .chained = true,
6161 .chain_id = ALC269_FIXUP_QUANTA_MUTE
017f2a10 6162 },
adabb3ec 6163 [ALC269_FIXUP_STEREO_DMIC] = {
1727a771 6164 .type = HDA_FIXUP_FUNC,
adabb3ec
TI
6165 .v.func = alc269_fixup_stereo_dmic,
6166 },
7c478f03
DH
6167 [ALC269_FIXUP_HEADSET_MIC] = {
6168 .type = HDA_FIXUP_FUNC,
6169 .v.func = alc269_fixup_headset_mic,
6170 },
24519911 6171 [ALC269_FIXUP_QUANTA_MUTE] = {
1727a771 6172 .type = HDA_FIXUP_FUNC,
24519911
TI
6173 .v.func = alc269_fixup_quanta_mute,
6174 },
6175 [ALC269_FIXUP_LIFEBOOK] = {
1727a771
TI
6176 .type = HDA_FIXUP_PINS,
6177 .v.pins = (const struct hda_pintbl[]) {
24519911
TI
6178 { 0x1a, 0x2101103f }, /* dock line-out */
6179 { 0x1b, 0x23a11040 }, /* dock mic-in */
6180 { }
6181 },
6182 .chained = true,
6183 .chain_id = ALC269_FIXUP_QUANTA_MUTE
6184 },
2041d564
DH
6185 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
6186 .type = HDA_FIXUP_PINS,
6187 .v.pins = (const struct hda_pintbl[]) {
6188 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
6189 { }
6190 },
6191 },
cc7016ab
TI
6192 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
6193 .type = HDA_FIXUP_PINS,
6194 .v.pins = (const struct hda_pintbl[]) {
6195 { 0x21, 0x0221102f }, /* HP out */
6196 { }
6197 },
6198 },
4df3fd17
TI
6199 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
6200 .type = HDA_FIXUP_FUNC,
6201 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
6202 },
fdcc968a
JMG
6203 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
6204 .type = HDA_FIXUP_FUNC,
6205 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
6206 },
a4297b5d 6207 [ALC269_FIXUP_AMIC] = {
1727a771
TI
6208 .type = HDA_FIXUP_PINS,
6209 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
6210 { 0x14, 0x99130110 }, /* speaker */
6211 { 0x15, 0x0121401f }, /* HP out */
6212 { 0x18, 0x01a19c20 }, /* mic */
6213 { 0x19, 0x99a3092f }, /* int-mic */
6214 { }
6215 },
6216 },
6217 [ALC269_FIXUP_DMIC] = {
1727a771
TI
6218 .type = HDA_FIXUP_PINS,
6219 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
6220 { 0x12, 0x99a3092f }, /* int-mic */
6221 { 0x14, 0x99130110 }, /* speaker */
6222 { 0x15, 0x0121401f }, /* HP out */
6223 { 0x18, 0x01a19c20 }, /* mic */
6224 { }
6225 },
6226 },
6227 [ALC269VB_FIXUP_AMIC] = {
1727a771
TI
6228 .type = HDA_FIXUP_PINS,
6229 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
6230 { 0x14, 0x99130110 }, /* speaker */
6231 { 0x18, 0x01a19c20 }, /* mic */
6232 { 0x19, 0x99a3092f }, /* int-mic */
6233 { 0x21, 0x0121401f }, /* HP out */
6234 { }
6235 },
6236 },
2267ea97 6237 [ALC269VB_FIXUP_DMIC] = {
1727a771
TI
6238 .type = HDA_FIXUP_PINS,
6239 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
6240 { 0x12, 0x99a3092f }, /* int-mic */
6241 { 0x14, 0x99130110 }, /* speaker */
6242 { 0x18, 0x01a19c20 }, /* mic */
6243 { 0x21, 0x0121401f }, /* HP out */
6244 { }
6245 },
6246 },
08fb0d0e 6247 [ALC269_FIXUP_HP_MUTE_LED] = {
1727a771 6248 .type = HDA_FIXUP_FUNC,
08fb0d0e 6249 .v.func = alc269_fixup_hp_mute_led,
6d3cd5d4 6250 },
d06ac143
DH
6251 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
6252 .type = HDA_FIXUP_FUNC,
6253 .v.func = alc269_fixup_hp_mute_led_mic1,
6254 },
08fb0d0e 6255 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
1727a771 6256 .type = HDA_FIXUP_FUNC,
08fb0d0e 6257 .v.func = alc269_fixup_hp_mute_led_mic2,
420b0feb 6258 },
7f783bd5
TB
6259 [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
6260 .type = HDA_FIXUP_FUNC,
6261 .v.func = alc269_fixup_hp_mute_led_mic3,
e8ed64b0
GKK
6262 .chained = true,
6263 .chain_id = ALC295_FIXUP_HP_AUTO_MUTE
7f783bd5 6264 },
9f5c6faf
TI
6265 [ALC269_FIXUP_HP_GPIO_LED] = {
6266 .type = HDA_FIXUP_FUNC,
6267 .v.func = alc269_fixup_hp_gpio_led,
6268 },
9c5dc3bf
KY
6269 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
6270 .type = HDA_FIXUP_FUNC,
6271 .v.func = alc269_fixup_hp_gpio_mic1_led,
6272 },
6273 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
6274 .type = HDA_FIXUP_FUNC,
6275 .v.func = alc269_fixup_hp_line1_mic1_led,
6276 },
693b613d 6277 [ALC269_FIXUP_INV_DMIC] = {
1727a771 6278 .type = HDA_FIXUP_FUNC,
9d36a7dc 6279 .v.func = alc_fixup_inv_dmic,
693b613d 6280 },
9b745ab8
TI
6281 [ALC269_FIXUP_NO_SHUTUP] = {
6282 .type = HDA_FIXUP_FUNC,
6283 .v.func = alc_fixup_no_shutup,
6284 },
108cc108 6285 [ALC269_FIXUP_LENOVO_DOCK] = {
1727a771
TI
6286 .type = HDA_FIXUP_PINS,
6287 .v.pins = (const struct hda_pintbl[]) {
108cc108
DH
6288 { 0x19, 0x23a11040 }, /* dock mic */
6289 { 0x1b, 0x2121103f }, /* dock headphone */
6290 { }
6291 },
6292 .chained = true,
6293 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
6294 },
6295 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
1727a771 6296 .type = HDA_FIXUP_FUNC,
108cc108 6297 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
52129000
DH
6298 .chained = true,
6299 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
108cc108 6300 },
73bdd597
DH
6301 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6302 .type = HDA_FIXUP_PINS,
6303 .v.pins = (const struct hda_pintbl[]) {
6304 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6305 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6306 { }
6307 },
6308 .chained = true,
6309 .chain_id = ALC269_FIXUP_HEADSET_MODE
6310 },
6311 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
6312 .type = HDA_FIXUP_PINS,
6313 .v.pins = (const struct hda_pintbl[]) {
6314 { 0x16, 0x21014020 }, /* dock line out */
6315 { 0x19, 0x21a19030 }, /* dock mic */
6316 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6317 { }
6318 },
6319 .chained = true,
6320 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6321 },
338cae56
DH
6322 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
6323 .type = HDA_FIXUP_PINS,
6324 .v.pins = (const struct hda_pintbl[]) {
6325 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6326 { }
6327 },
6328 .chained = true,
6329 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6330 },
fcc6c877
KY
6331 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
6332 .type = HDA_FIXUP_PINS,
6333 .v.pins = (const struct hda_pintbl[]) {
6334 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6335 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6336 { }
6337 },
6338 .chained = true,
6339 .chain_id = ALC269_FIXUP_HEADSET_MODE
6340 },
73bdd597
DH
6341 [ALC269_FIXUP_HEADSET_MODE] = {
6342 .type = HDA_FIXUP_FUNC,
6343 .v.func = alc_fixup_headset_mode,
6676f308 6344 .chained = true,
b3802783 6345 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
73bdd597
DH
6346 },
6347 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
6348 .type = HDA_FIXUP_FUNC,
6349 .v.func = alc_fixup_headset_mode_no_hp_mic,
6350 },
7819717b
TI
6351 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
6352 .type = HDA_FIXUP_PINS,
6353 .v.pins = (const struct hda_pintbl[]) {
6354 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
6355 { }
6356 },
6357 .chained = true,
6358 .chain_id = ALC269_FIXUP_HEADSET_MODE,
6359 },
88cfcf86
DH
6360 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
6361 .type = HDA_FIXUP_PINS,
6362 .v.pins = (const struct hda_pintbl[]) {
6363 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6364 { }
6365 },
fbc78ad6
DH
6366 .chained = true,
6367 .chain_id = ALC269_FIXUP_HEADSET_MIC
88cfcf86 6368 },
0fbf21c3 6369 [ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
8ac51bbc
AB
6370 .type = HDA_FIXUP_PINS,
6371 .v.pins = (const struct hda_pintbl[]) {
6372 {0x12, 0x90a60130},
6373 {0x13, 0x40000000},
6374 {0x14, 0x90170110},
6375 {0x18, 0x411111f0},
6376 {0x19, 0x04a11040},
6377 {0x1a, 0x411111f0},
6378 {0x1b, 0x90170112},
6379 {0x1d, 0x40759a05},
6380 {0x1e, 0x411111f0},
6381 {0x21, 0x04211020},
6382 { }
6383 },
e2744fd7
AB
6384 .chained = true,
6385 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
8ac51bbc 6386 },
a2ef03fe
TE
6387 [ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
6388 .type = HDA_FIXUP_FUNC,
6389 .v.func = alc298_fixup_huawei_mbx_stereo,
6390 .chained = true,
6391 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
6392 },
d240d1dc
DH
6393 [ALC269_FIXUP_ASUS_X101_FUNC] = {
6394 .type = HDA_FIXUP_FUNC,
6395 .v.func = alc269_fixup_x101_headset_mic,
6396 },
6397 [ALC269_FIXUP_ASUS_X101_VERB] = {
6398 .type = HDA_FIXUP_VERBS,
6399 .v.verbs = (const struct hda_verb[]) {
6400 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6401 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
6402 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
6403 { }
6404 },
6405 .chained = true,
6406 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
6407 },
6408 [ALC269_FIXUP_ASUS_X101] = {
6409 .type = HDA_FIXUP_PINS,
6410 .v.pins = (const struct hda_pintbl[]) {
6411 { 0x18, 0x04a1182c }, /* Headset mic */
6412 { }
6413 },
6414 .chained = true,
6415 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
6416 },
08a978db 6417 [ALC271_FIXUP_AMIC_MIC2] = {
1727a771
TI
6418 .type = HDA_FIXUP_PINS,
6419 .v.pins = (const struct hda_pintbl[]) {
08a978db
DR
6420 { 0x14, 0x99130110 }, /* speaker */
6421 { 0x19, 0x01a19c20 }, /* mic */
6422 { 0x1b, 0x99a7012f }, /* int-mic */
6423 { 0x21, 0x0121401f }, /* HP out */
6424 { }
6425 },
6426 },
6427 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
1727a771 6428 .type = HDA_FIXUP_FUNC,
08a978db
DR
6429 .v.func = alc271_hp_gate_mic_jack,
6430 .chained = true,
6431 .chain_id = ALC271_FIXUP_AMIC_MIC2,
6432 },
b1e8972e
OR
6433 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
6434 .type = HDA_FIXUP_FUNC,
6435 .v.func = alc269_fixup_limit_int_mic_boost,
6436 .chained = true,
6437 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
6438 },
42397004
DR
6439 [ALC269_FIXUP_ACER_AC700] = {
6440 .type = HDA_FIXUP_PINS,
6441 .v.pins = (const struct hda_pintbl[]) {
6442 { 0x12, 0x99a3092f }, /* int-mic */
6443 { 0x14, 0x99130110 }, /* speaker */
6444 { 0x18, 0x03a11c20 }, /* mic */
6445 { 0x1e, 0x0346101e }, /* SPDIF1 */
6446 { 0x21, 0x0321101f }, /* HP out */
6447 { }
6448 },
6449 .chained = true,
6450 .chain_id = ALC271_FIXUP_DMIC,
6451 },
3e0d611b
DH
6452 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
6453 .type = HDA_FIXUP_FUNC,
6454 .v.func = alc269_fixup_limit_int_mic_boost,
2793769f
DH
6455 .chained = true,
6456 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
3e0d611b 6457 },
2cede303
OR
6458 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
6459 .type = HDA_FIXUP_FUNC,
6460 .v.func = alc269_fixup_limit_int_mic_boost,
6461 .chained = true,
6462 .chain_id = ALC269VB_FIXUP_DMIC,
6463 },
23870831
TI
6464 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
6465 .type = HDA_FIXUP_VERBS,
6466 .v.verbs = (const struct hda_verb[]) {
6467 /* class-D output amp +5dB */
6468 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
6469 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
6470 {}
6471 },
6472 .chained = true,
6473 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
6474 },
8e35cd4a
DH
6475 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
6476 .type = HDA_FIXUP_FUNC,
6477 .v.func = alc269_fixup_limit_int_mic_boost,
6478 .chained = true,
6479 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
6480 },
02b504d9
AA
6481 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
6482 .type = HDA_FIXUP_PINS,
6483 .v.pins = (const struct hda_pintbl[]) {
6484 { 0x12, 0x99a3092f }, /* int-mic */
6485 { 0x18, 0x03a11d20 }, /* mic */
6486 { 0x19, 0x411111f0 }, /* Unused bogus pin */
6487 { }
6488 },
6489 },
cd217a63
KY
6490 [ALC283_FIXUP_CHROME_BOOK] = {
6491 .type = HDA_FIXUP_FUNC,
6492 .v.func = alc283_fixup_chromebook,
6493 },
0202e99c
KY
6494 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
6495 .type = HDA_FIXUP_FUNC,
6496 .v.func = alc283_fixup_sense_combo_jack,
6497 .chained = true,
6498 .chain_id = ALC283_FIXUP_CHROME_BOOK,
6499 },
7bba2157
TI
6500 [ALC282_FIXUP_ASUS_TX300] = {
6501 .type = HDA_FIXUP_FUNC,
6502 .v.func = alc282_fixup_asus_tx300,
6503 },
1bb3e062
KY
6504 [ALC283_FIXUP_INT_MIC] = {
6505 .type = HDA_FIXUP_VERBS,
6506 .v.verbs = (const struct hda_verb[]) {
6507 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
6508 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
6509 { }
6510 },
6511 .chained = true,
6512 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
6513 },
0f4881dc
DH
6514 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
6515 .type = HDA_FIXUP_PINS,
6516 .v.pins = (const struct hda_pintbl[]) {
6517 { 0x17, 0x90170112 }, /* subwoofer */
6518 { }
6519 },
6520 .chained = true,
6521 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6522 },
6523 [ALC290_FIXUP_SUBWOOFER] = {
6524 .type = HDA_FIXUP_PINS,
6525 .v.pins = (const struct hda_pintbl[]) {
6526 { 0x17, 0x90170112 }, /* subwoofer */
6527 { }
6528 },
6529 .chained = true,
6530 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
6531 },
338cae56
DH
6532 [ALC290_FIXUP_MONO_SPEAKERS] = {
6533 .type = HDA_FIXUP_FUNC,
6534 .v.func = alc290_fixup_mono_speakers,
0f4881dc
DH
6535 },
6536 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
6537 .type = HDA_FIXUP_FUNC,
6538 .v.func = alc290_fixup_mono_speakers,
338cae56
DH
6539 .chained = true,
6540 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
6541 },
b67ae3f1
DH
6542 [ALC269_FIXUP_THINKPAD_ACPI] = {
6543 .type = HDA_FIXUP_FUNC,
d5a6cabf 6544 .v.func = alc_fixup_thinkpad_acpi,
09da111a
TI
6545 .chained = true,
6546 .chain_id = ALC269_FIXUP_SKU_IGNORE,
b67ae3f1 6547 },
56f27013
DH
6548 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
6549 .type = HDA_FIXUP_FUNC,
6550 .v.func = alc_fixup_inv_dmic,
6551 .chained = true,
6552 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
6553 },
5824ce8d 6554 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
17d30460
HW
6555 .type = HDA_FIXUP_PINS,
6556 .v.pins = (const struct hda_pintbl[]) {
6557 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6558 { }
5824ce8d
CC
6559 },
6560 .chained = true,
17d30460 6561 .chain_id = ALC255_FIXUP_HEADSET_MODE
5824ce8d 6562 },
615966ad
CC
6563 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
6564 .type = HDA_FIXUP_PINS,
6565 .v.pins = (const struct hda_pintbl[]) {
6566 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6567 { }
6568 },
6569 .chained = true,
6570 .chain_id = ALC255_FIXUP_HEADSET_MODE
6571 },
9a22a8f5
KY
6572 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6573 .type = HDA_FIXUP_PINS,
6574 .v.pins = (const struct hda_pintbl[]) {
6575 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6576 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6577 { }
6578 },
6579 .chained = true,
6580 .chain_id = ALC255_FIXUP_HEADSET_MODE
6581 },
31278997
KY
6582 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
6583 .type = HDA_FIXUP_PINS,
6584 .v.pins = (const struct hda_pintbl[]) {
6585 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6586 { }
6587 },
6588 .chained = true,
6589 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
6590 },
9a22a8f5
KY
6591 [ALC255_FIXUP_HEADSET_MODE] = {
6592 .type = HDA_FIXUP_FUNC,
6593 .v.func = alc_fixup_headset_mode_alc255,
4a83d42a 6594 .chained = true,
b3802783 6595 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
9a22a8f5 6596 },
31278997
KY
6597 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
6598 .type = HDA_FIXUP_FUNC,
6599 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
6600 },
a22aa26f
KY
6601 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6602 .type = HDA_FIXUP_PINS,
6603 .v.pins = (const struct hda_pintbl[]) {
6604 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6605 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6606 { }
6607 },
6608 .chained = true,
6609 .chain_id = ALC269_FIXUP_HEADSET_MODE
6610 },
1c37c223 6611 [ALC292_FIXUP_TPT440_DOCK] = {
ec56af67 6612 .type = HDA_FIXUP_FUNC,
7f57d803 6613 .v.func = alc_fixup_tpt440_dock,
1c37c223
TI
6614 .chained = true,
6615 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
6616 },
9a811230
TI
6617 [ALC292_FIXUP_TPT440] = {
6618 .type = HDA_FIXUP_FUNC,
157f0b7f 6619 .v.func = alc_fixup_disable_aamix,
9a811230
TI
6620 .chained = true,
6621 .chain_id = ALC292_FIXUP_TPT440_DOCK,
6622 },
abaa2274 6623 [ALC283_FIXUP_HEADSET_MIC] = {
9dc12862
DD
6624 .type = HDA_FIXUP_PINS,
6625 .v.pins = (const struct hda_pintbl[]) {
6626 { 0x19, 0x04a110f0 },
6627 { },
6628 },
6629 },
b3802783 6630 [ALC255_FIXUP_MIC_MUTE_LED] = {
00ef9940 6631 .type = HDA_FIXUP_FUNC,
b3802783 6632 .v.func = snd_hda_gen_fixup_micmute_led,
00ef9940 6633 },
1a22e775
TI
6634 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
6635 .type = HDA_FIXUP_PINS,
6636 .v.pins = (const struct hda_pintbl[]) {
6637 { 0x12, 0x90a60130 },
6638 { 0x14, 0x90170110 },
6639 { 0x17, 0x40000008 },
6640 { 0x18, 0x411111f0 },
0420694d 6641 { 0x19, 0x01a1913c },
1a22e775
TI
6642 { 0x1a, 0x411111f0 },
6643 { 0x1b, 0x411111f0 },
6644 { 0x1d, 0x40f89b2d },
6645 { 0x1e, 0x411111f0 },
6646 { 0x21, 0x0321101f },
6647 { },
6648 },
6649 },
7a5255f1
DH
6650 [ALC280_FIXUP_HP_GPIO4] = {
6651 .type = HDA_FIXUP_FUNC,
6652 .v.func = alc280_fixup_hp_gpio4,
6653 },
eaa8e5ef
KY
6654 [ALC286_FIXUP_HP_GPIO_LED] = {
6655 .type = HDA_FIXUP_FUNC,
6656 .v.func = alc286_fixup_hp_gpio_led,
6657 },
33f4acd3
DH
6658 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
6659 .type = HDA_FIXUP_FUNC,
6660 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
6661 },
b4b33f9d
TC
6662 [ALC280_FIXUP_HP_DOCK_PINS] = {
6663 .type = HDA_FIXUP_PINS,
6664 .v.pins = (const struct hda_pintbl[]) {
6665 { 0x1b, 0x21011020 }, /* line-out */
6666 { 0x1a, 0x01a1903c }, /* headset mic */
6667 { 0x18, 0x2181103f }, /* line-in */
6668 { },
6669 },
6670 .chained = true,
6671 .chain_id = ALC280_FIXUP_HP_GPIO4
6672 },
04d5466a
JK
6673 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
6674 .type = HDA_FIXUP_PINS,
6675 .v.pins = (const struct hda_pintbl[]) {
6676 { 0x1b, 0x21011020 }, /* line-out */
6677 { 0x18, 0x2181103f }, /* line-in */
6678 { },
6679 },
6680 .chained = true,
6681 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
6682 },
98973f2f
KP
6683 [ALC280_FIXUP_HP_9480M] = {
6684 .type = HDA_FIXUP_FUNC,
6685 .v.func = alc280_fixup_hp_9480m,
6686 },
e1e62b98
KY
6687 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
6688 .type = HDA_FIXUP_FUNC,
6689 .v.func = alc_fixup_headset_mode_dell_alc288,
6690 .chained = true,
b3802783 6691 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
e1e62b98
KY
6692 },
6693 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6694 .type = HDA_FIXUP_PINS,
6695 .v.pins = (const struct hda_pintbl[]) {
6696 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6697 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6698 { }
6699 },
6700 .chained = true,
6701 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
6702 },
831bfdf9
HW
6703 [ALC288_FIXUP_DISABLE_AAMIX] = {
6704 .type = HDA_FIXUP_FUNC,
6705 .v.func = alc_fixup_disable_aamix,
6706 .chained = true,
d44a6864 6707 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
831bfdf9
HW
6708 },
6709 [ALC288_FIXUP_DELL_XPS_13] = {
6710 .type = HDA_FIXUP_FUNC,
6711 .v.func = alc_fixup_dell_xps13,
6712 .chained = true,
6713 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
6714 },
8b99aba7
TI
6715 [ALC292_FIXUP_DISABLE_AAMIX] = {
6716 .type = HDA_FIXUP_FUNC,
6717 .v.func = alc_fixup_disable_aamix,
831bfdf9
HW
6718 .chained = true,
6719 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
8b99aba7 6720 },
c04017ea
DH
6721 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
6722 .type = HDA_FIXUP_FUNC,
6723 .v.func = alc_fixup_disable_aamix,
6724 .chained = true,
6725 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
6726 },
5fab5829 6727 [ALC292_FIXUP_DELL_E7X_AAMIX] = {
8b99aba7
TI
6728 .type = HDA_FIXUP_FUNC,
6729 .v.func = alc_fixup_dell_xps13,
6730 .chained = true,
6731 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
6732 },
5fab5829
TI
6733 [ALC292_FIXUP_DELL_E7X] = {
6734 .type = HDA_FIXUP_FUNC,
6735 .v.func = snd_hda_gen_fixup_micmute_led,
6736 /* micmute fixup must be applied at last */
6737 .chained_before = true,
6738 .chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
6739 },
54324221
JM
6740 [ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
6741 .type = HDA_FIXUP_PINS,
6742 .v.pins = (const struct hda_pintbl[]) {
6743 { 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
6744 { }
6745 },
6746 .chained_before = true,
6747 .chain_id = ALC269_FIXUP_HEADSET_MODE,
6748 },
977e6276
KY
6749 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6750 .type = HDA_FIXUP_PINS,
6751 .v.pins = (const struct hda_pintbl[]) {
6752 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6753 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6754 { }
6755 },
6756 .chained = true,
6757 .chain_id = ALC269_FIXUP_HEADSET_MODE
6758 },
2f726aec
HW
6759 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
6760 .type = HDA_FIXUP_PINS,
6761 .v.pins = (const struct hda_pintbl[]) {
6762 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6763 { }
6764 },
6765 .chained = true,
6766 .chain_id = ALC269_FIXUP_HEADSET_MODE
6767 },
6ed1131f
KY
6768 [ALC275_FIXUP_DELL_XPS] = {
6769 .type = HDA_FIXUP_VERBS,
6770 .v.verbs = (const struct hda_verb[]) {
6771 /* Enables internal speaker */
6772 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
6773 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
6774 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
6775 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
6776 {}
6777 }
6778 },
23adc192
HW
6779 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
6780 .type = HDA_FIXUP_FUNC,
6781 .v.func = alc_fixup_disable_aamix,
6782 .chained = true,
6783 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
6784 },
3694cb29
K
6785 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
6786 .type = HDA_FIXUP_FUNC,
6787 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
6788 },
3b43b71f
KHF
6789 [ALC255_FIXUP_DELL_SPK_NOISE] = {
6790 .type = HDA_FIXUP_FUNC,
6791 .v.func = alc_fixup_disable_aamix,
6792 .chained = true,
6793 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6794 },
d1dd4211
KY
6795 [ALC225_FIXUP_DISABLE_MIC_VREF] = {
6796 .type = HDA_FIXUP_FUNC,
6797 .v.func = alc_fixup_disable_mic_vref,
6798 .chained = true,
6799 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
6800 },
2ae95577
DH
6801 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6802 .type = HDA_FIXUP_VERBS,
6803 .v.verbs = (const struct hda_verb[]) {
6804 /* Disable pass-through path for FRONT 14h */
6805 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
6806 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
6807 {}
6808 },
6809 .chained = true,
d1dd4211 6810 .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
2ae95577 6811 },
f883982d
TI
6812 [ALC280_FIXUP_HP_HEADSET_MIC] = {
6813 .type = HDA_FIXUP_FUNC,
6814 .v.func = alc_fixup_disable_aamix,
6815 .chained = true,
6816 .chain_id = ALC269_FIXUP_HEADSET_MIC,
6817 },
e549d190
HW
6818 [ALC221_FIXUP_HP_FRONT_MIC] = {
6819 .type = HDA_FIXUP_PINS,
6820 .v.pins = (const struct hda_pintbl[]) {
6821 { 0x19, 0x02a19020 }, /* Front Mic */
6822 { }
6823 },
6824 },
c636b95e
SE
6825 [ALC292_FIXUP_TPT460] = {
6826 .type = HDA_FIXUP_FUNC,
6827 .v.func = alc_fixup_tpt440_dock,
6828 .chained = true,
6829 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
6830 },
dd9aa335
HW
6831 [ALC298_FIXUP_SPK_VOLUME] = {
6832 .type = HDA_FIXUP_FUNC,
6833 .v.func = alc298_fixup_speaker_volume,
59ec4b57 6834 .chained = true,
2f726aec 6835 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
dd9aa335 6836 },
e312a869
TI
6837 [ALC295_FIXUP_DISABLE_DAC3] = {
6838 .type = HDA_FIXUP_FUNC,
6839 .v.func = alc295_fixup_disable_dac3,
6840 },
d2cd795c
JK
6841 [ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
6842 .type = HDA_FIXUP_FUNC,
6843 .v.func = alc285_fixup_speaker2_to_dac1,
c37c0ab0
HW
6844 .chained = true,
6845 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
d2cd795c 6846 },
fd06c77e
KHF
6847 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
6848 .type = HDA_FIXUP_PINS,
6849 .v.pins = (const struct hda_pintbl[]) {
6850 { 0x1b, 0x90170151 },
6851 { }
6852 },
6853 .chained = true,
6854 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6855 },
823ff161
GM
6856 [ALC269_FIXUP_ATIV_BOOK_8] = {
6857 .type = HDA_FIXUP_FUNC,
6858 .v.func = alc_fixup_auto_mute_via_amp,
6859 .chained = true,
6860 .chain_id = ALC269_FIXUP_NO_SHUTUP
6861 },
9eb5d0e6
KY
6862 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
6863 .type = HDA_FIXUP_PINS,
6864 .v.pins = (const struct hda_pintbl[]) {
6865 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6866 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6867 { }
6868 },
6869 .chained = true,
6870 .chain_id = ALC269_FIXUP_HEADSET_MODE
6871 },
c1732ede
CC
6872 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
6873 .type = HDA_FIXUP_FUNC,
6874 .v.func = alc_fixup_headset_mode,
6875 },
6876 [ALC256_FIXUP_ASUS_MIC] = {
6877 .type = HDA_FIXUP_PINS,
6878 .v.pins = (const struct hda_pintbl[]) {
6879 { 0x13, 0x90a60160 }, /* use as internal mic */
6880 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
6881 { }
6882 },
6883 .chained = true,
6884 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
6885 },
eeed4cd1 6886 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
ae065f1c
TI
6887 .type = HDA_FIXUP_FUNC,
6888 /* Set up GPIO2 for the speaker amp */
6889 .v.func = alc_fixup_gpio4,
eeed4cd1 6890 },
216d7aeb
CC
6891 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
6892 .type = HDA_FIXUP_PINS,
6893 .v.pins = (const struct hda_pintbl[]) {
6894 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6895 { }
6896 },
6897 .chained = true,
6898 .chain_id = ALC269_FIXUP_HEADSET_MIC
6899 },
6900 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
6901 .type = HDA_FIXUP_VERBS,
6902 .v.verbs = (const struct hda_verb[]) {
6903 /* Enables internal speaker */
6904 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
6905 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
6906 {}
6907 },
6908 .chained = true,
6909 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
6910 },
ca169cc2
KY
6911 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
6912 .type = HDA_FIXUP_FUNC,
6913 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
6914 },
ea5c7eba
JHP
6915 [ALC233_FIXUP_ACER_HEADSET_MIC] = {
6916 .type = HDA_FIXUP_VERBS,
6917 .v.verbs = (const struct hda_verb[]) {
6918 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
6919 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
6920 { }
6921 },
6922 .chained = true,
6923 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
6924 },
f33f79f3
HW
6925 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
6926 .type = HDA_FIXUP_PINS,
6927 .v.pins = (const struct hda_pintbl[]) {
6928 /* Change the mic location from front to right, otherwise there are
6929 two front mics with the same name, pulseaudio can't handle them.
6930 This is just a temporary workaround, after applying this fixup,
6931 there will be one "Front Mic" and one "Mic" in this machine.
6932 */
6933 { 0x1a, 0x04a19040 },
6934 { }
6935 },
6936 },
5f364135
KY
6937 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
6938 .type = HDA_FIXUP_PINS,
6939 .v.pins = (const struct hda_pintbl[]) {
6940 { 0x16, 0x0101102f }, /* Rear Headset HP */
6941 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
6942 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
6943 { 0x1b, 0x02011020 },
6944 { }
6945 },
6946 .chained = true,
52e4e368
KHF
6947 .chain_id = ALC225_FIXUP_S3_POP_NOISE
6948 },
6949 [ALC225_FIXUP_S3_POP_NOISE] = {
6950 .type = HDA_FIXUP_FUNC,
6951 .v.func = alc225_fixup_s3_pop_noise,
6952 .chained = true,
5f364135
KY
6953 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6954 },
b84e8436
PH
6955 [ALC700_FIXUP_INTEL_REFERENCE] = {
6956 .type = HDA_FIXUP_VERBS,
6957 .v.verbs = (const struct hda_verb[]) {
6958 /* Enables internal speaker */
6959 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
6960 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
6961 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
6962 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
6963 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
6964 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
6965 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
6966 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
6967 {}
6968 }
6969 },
92266651
KY
6970 [ALC274_FIXUP_DELL_BIND_DACS] = {
6971 .type = HDA_FIXUP_FUNC,
6972 .v.func = alc274_fixup_bind_dacs,
6973 .chained = true,
6974 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
6975 },
6976 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
6977 .type = HDA_FIXUP_PINS,
6978 .v.pins = (const struct hda_pintbl[]) {
6979 { 0x1b, 0x0401102f },
6980 { }
6981 },
6982 .chained = true,
6983 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
6984 },
61fcf8ec
KY
6985 [ALC298_FIXUP_TPT470_DOCK] = {
6986 .type = HDA_FIXUP_FUNC,
6987 .v.func = alc_fixup_tpt470_dock,
6988 .chained = true,
6989 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
6990 },
ae104a21
KY
6991 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
6992 .type = HDA_FIXUP_PINS,
6993 .v.pins = (const struct hda_pintbl[]) {
6994 { 0x14, 0x0201101f },
6995 { }
6996 },
6997 .chained = true,
6998 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6999 },
f0ba9d69
KY
7000 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
7001 .type = HDA_FIXUP_PINS,
7002 .v.pins = (const struct hda_pintbl[]) {
7003 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7004 { }
7005 },
3ce0d5aa
HW
7006 .chained = true,
7007 .chain_id = ALC269_FIXUP_HEADSET_MIC
f0ba9d69 7008 },
bbf8ff6b
TB
7009 [ALC295_FIXUP_HP_X360] = {
7010 .type = HDA_FIXUP_FUNC,
7011 .v.func = alc295_fixup_hp_top_speakers,
7012 .chained = true,
7013 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
8a328ac1
KY
7014 },
7015 [ALC221_FIXUP_HP_HEADSET_MIC] = {
7016 .type = HDA_FIXUP_PINS,
7017 .v.pins = (const struct hda_pintbl[]) {
7018 { 0x19, 0x0181313f},
7019 { }
7020 },
7021 .chained = true,
7022 .chain_id = ALC269_FIXUP_HEADSET_MIC
7023 },
c4cfcf6f
HW
7024 [ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
7025 .type = HDA_FIXUP_FUNC,
7026 .v.func = alc285_fixup_invalidate_dacs,
6ba189c5
HW
7027 .chained = true,
7028 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
c4cfcf6f 7029 },
e8ed64b0
GKK
7030 [ALC295_FIXUP_HP_AUTO_MUTE] = {
7031 .type = HDA_FIXUP_FUNC,
7032 .v.func = alc_fixup_auto_mute_via_amp,
7033 },
33aaebd4
CC
7034 [ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
7035 .type = HDA_FIXUP_PINS,
7036 .v.pins = (const struct hda_pintbl[]) {
7037 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7038 { }
7039 },
7040 .chained = true,
7041 .chain_id = ALC269_FIXUP_HEADSET_MIC
7042 },
d8ae458e
CC
7043 [ALC294_FIXUP_ASUS_MIC] = {
7044 .type = HDA_FIXUP_PINS,
7045 .v.pins = (const struct hda_pintbl[]) {
7046 { 0x13, 0x90a60160 }, /* use as internal mic */
7047 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7048 { }
7049 },
7050 .chained = true,
7051 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7052 },
4e051106
JHP
7053 [ALC294_FIXUP_ASUS_HEADSET_MIC] = {
7054 .type = HDA_FIXUP_PINS,
7055 .v.pins = (const struct hda_pintbl[]) {
82b01149 7056 { 0x19, 0x01a1103c }, /* use as headset mic */
4e051106
JHP
7057 { }
7058 },
7059 .chained = true,
7060 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7061 },
7062 [ALC294_FIXUP_ASUS_SPK] = {
7063 .type = HDA_FIXUP_VERBS,
7064 .v.verbs = (const struct hda_verb[]) {
7065 /* Set EAPD high */
7066 { 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
7067 { 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
7068 { }
7069 },
7070 .chained = true,
7071 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7072 },
c8a9afa6 7073 [ALC295_FIXUP_CHROME_BOOK] = {
e854747d 7074 .type = HDA_FIXUP_FUNC,
c8a9afa6 7075 .v.func = alc295_fixup_chromebook,
8983eb60
KY
7076 .chained = true,
7077 .chain_id = ALC225_FIXUP_HEADSET_JACK
7078 },
7079 [ALC225_FIXUP_HEADSET_JACK] = {
7080 .type = HDA_FIXUP_FUNC,
7081 .v.func = alc_fixup_headset_jack,
e854747d 7082 },
89e3a568
JS
7083 [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
7084 .type = HDA_FIXUP_PINS,
7085 .v.pins = (const struct hda_pintbl[]) {
7086 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7087 { }
7088 },
7089 .chained = true,
7090 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7091 },
c8c6ee61
HW
7092 [ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
7093 .type = HDA_FIXUP_VERBS,
7094 .v.verbs = (const struct hda_verb[]) {
7095 /* Disable PCBEEP-IN passthrough */
7096 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7097 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7098 { }
7099 },
7100 .chained = true,
7101 .chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
7102 },
cbc05fd6
JHP
7103 [ALC255_FIXUP_ACER_HEADSET_MIC] = {
7104 .type = HDA_FIXUP_PINS,
7105 .v.pins = (const struct hda_pintbl[]) {
7106 { 0x19, 0x03a11130 },
7107 { 0x1a, 0x90a60140 }, /* use as internal mic */
7108 { }
7109 },
7110 .chained = true,
7111 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
7112 },
136824ef
KY
7113 [ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
7114 .type = HDA_FIXUP_PINS,
7115 .v.pins = (const struct hda_pintbl[]) {
7116 { 0x16, 0x01011020 }, /* Rear Line out */
7117 { 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
7118 { }
7119 },
7120 .chained = true,
7121 .chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
7122 },
7123 [ALC225_FIXUP_WYSE_AUTO_MUTE] = {
7124 .type = HDA_FIXUP_FUNC,
7125 .v.func = alc_fixup_auto_mute_via_amp,
7126 .chained = true,
7127 .chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
7128 },
7129 [ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
7130 .type = HDA_FIXUP_FUNC,
7131 .v.func = alc_fixup_disable_mic_vref,
7132 .chained = true,
7133 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7134 },
667a8f73
JHP
7135 [ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
7136 .type = HDA_FIXUP_VERBS,
7137 .v.verbs = (const struct hda_verb[]) {
7138 { 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
7139 { 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
7140 { }
7141 },
7142 .chained = true,
7143 .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
7144 },
8c8967a7
DD
7145 [ALC256_FIXUP_ASUS_HEADSET_MIC] = {
7146 .type = HDA_FIXUP_PINS,
7147 .v.pins = (const struct hda_pintbl[]) {
7148 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
7149 { }
7150 },
7151 .chained = true,
7152 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7153 },
e1037354
JHP
7154 [ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7155 .type = HDA_FIXUP_PINS,
7156 .v.pins = (const struct hda_pintbl[]) {
7157 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7158 { }
7159 },
7160 .chained = true,
7161 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7162 },
e2a829b3
BR
7163 [ALC299_FIXUP_PREDATOR_SPK] = {
7164 .type = HDA_FIXUP_PINS,
7165 .v.pins = (const struct hda_pintbl[]) {
7166 { 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
7167 { }
7168 }
7169 },
bd9c10bc 7170 [ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
60083f9e
JHP
7171 .type = HDA_FIXUP_PINS,
7172 .v.pins = (const struct hda_pintbl[]) {
bd9c10bc
JMG
7173 { 0x19, 0x04a11040 },
7174 { 0x21, 0x04211020 },
60083f9e
JHP
7175 { }
7176 },
7177 .chained = true,
bd9c10bc 7178 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
60083f9e 7179 },
e79c2269 7180 [ALC289_FIXUP_DELL_SPK2] = {
bd9c10bc
JMG
7181 .type = HDA_FIXUP_PINS,
7182 .v.pins = (const struct hda_pintbl[]) {
e79c2269 7183 { 0x17, 0x90170130 }, /* bass spk */
bd9c10bc
JMG
7184 { }
7185 },
7186 .chained = true,
e79c2269 7187 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
bd9c10bc 7188 },
e79c2269
KY
7189 [ALC289_FIXUP_DUAL_SPK] = {
7190 .type = HDA_FIXUP_FUNC,
7191 .v.func = alc285_fixup_speaker2_to_dac1,
7192 .chained = true,
7193 .chain_id = ALC289_FIXUP_DELL_SPK2
7194 },
48e01504
CC
7195 [ALC294_FIXUP_SPK2_TO_DAC1] = {
7196 .type = HDA_FIXUP_FUNC,
7197 .v.func = alc285_fixup_speaker2_to_dac1,
7198 .chained = true,
7199 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7200 },
7201 [ALC294_FIXUP_ASUS_DUAL_SPK] = {
436e2550
JHP
7202 .type = HDA_FIXUP_FUNC,
7203 /* The GPIO must be pulled to initialize the AMP */
7204 .v.func = alc_fixup_gpio4,
7205 .chained = true,
48e01504 7206 .chain_id = ALC294_FIXUP_SPK2_TO_DAC1
436e2550 7207 },
76f7dec0
KY
7208 [ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
7209 .type = HDA_FIXUP_FUNC,
7210 .v.func = alc_fixup_headset_jack,
7211 .chained = true,
7212 .chain_id = ALC285_FIXUP_SPEAKER2_TO_DAC1
7213 },
8b33a134
JHP
7214 [ALC294_FIXUP_ASUS_HPE] = {
7215 .type = HDA_FIXUP_VERBS,
7216 .v.verbs = (const struct hda_verb[]) {
7217 /* Set EAPD high */
7218 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7219 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
7220 { }
7221 },
7222 .chained = true,
7223 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7224 },
f5a88b0a
KHF
7225 [ALC285_FIXUP_HP_GPIO_LED] = {
7226 .type = HDA_FIXUP_FUNC,
7227 .v.func = alc285_fixup_hp_gpio_led,
7228 },
431e76c3
KY
7229 [ALC285_FIXUP_HP_MUTE_LED] = {
7230 .type = HDA_FIXUP_FUNC,
7231 .v.func = alc285_fixup_hp_mute_led,
7232 },
24164f43
KY
7233 [ALC236_FIXUP_HP_MUTE_LED] = {
7234 .type = HDA_FIXUP_FUNC,
7235 .v.func = alc236_fixup_hp_mute_led,
7236 },
14425f1f
MP
7237 [ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
7238 .type = HDA_FIXUP_VERBS,
7239 .v.verbs = (const struct hda_verb[]) {
7240 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
7241 { }
7242 },
7243 },
9e43342b
CC
7244 [ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7245 .type = HDA_FIXUP_PINS,
7246 .v.pins = (const struct hda_pintbl[]) {
7247 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7248 { }
7249 },
7250 .chained = true,
7251 .chain_id = ALC269_FIXUP_HEADSET_MODE
7252 },
f1d4e28b
KY
7253};
7254
1d045db9 7255static const struct snd_pci_quirk alc269_fixup_tbl[] = {
a6b92b66 7256 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
693b613d
DH
7257 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
7258 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
aaedfb47 7259 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
7819717b
TI
7260 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
7261 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
aaedfb47
DH
7262 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
7263 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
02322ac9 7264 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
b1e8972e 7265 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
1a22e775 7266 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
705b65f1 7267 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
b9c2fa52 7268 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
c7531e31
CC
7269 SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
7270 SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
e2a829b3 7271 SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
667a8f73
JHP
7272 SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
7273 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
7274 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
2733cceb 7275 SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
ea5c7eba 7276 SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
cbc05fd6 7277 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
aaedfb47 7278 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
6ed1131f 7279 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
86f799b8 7280 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
cf52103a 7281 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
8b99aba7
TI
7282 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
7283 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
0f4881dc 7284 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
73bdd597
DH
7285 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
7286 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
7287 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
0f4881dc
DH
7288 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
7289 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
98070576 7290 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
4275554d 7291 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
0f4881dc 7292 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
a22aa26f
KY
7293 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
7294 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
831bfdf9 7295 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
afecb146 7296 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
3a05d12f 7297 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
8b72415d 7298 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
b734304f
KY
7299 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
7300 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
c04017ea
DH
7301 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
7302 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
7303 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
7304 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
7305 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
fd06c77e 7306 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
3b43b71f 7307 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
c0ca5ece 7308 SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
709ae62e 7309 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
dd9aa335 7310 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
e312a869 7311 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
493de342 7312 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
5f364135 7313 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
40e2c4e5
KY
7314 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
7315 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
f0ba9d69
KY
7316 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
7317 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
ae104a21 7318 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
136824ef 7319 SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
da484d00 7320 SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
c2a7c55a 7321 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
e79c2269
KY
7322 SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
7323 SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
78def224
KY
7324 SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
7325 SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
a22aa26f
KY
7326 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
7327 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
08fb0d0e 7328 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
9f5c6faf 7329 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
8e35cd4a 7330 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
33f4acd3 7331 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
c60666bd 7332 /* ALC282 */
7976eb49 7333 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8a02b164 7334 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8a02b164 7335 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9c5dc3bf
KY
7336 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
7337 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
7338 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
7339 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9c5dc3bf 7340 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
c60666bd 7341 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd
KY
7342 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7343 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8a02b164 7344 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
eaa8e5ef 7345 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
b4b33f9d 7346 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
3271cb22 7347 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
c60666bd 7348 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd
KY
7349 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7350 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7351 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 7352 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
98973f2f 7353 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
9c5dc3bf
KY
7354 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7355 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
c60666bd 7356 /* ALC290 */
9c5dc3bf 7357 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9c5dc3bf 7358 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9c5dc3bf 7359 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9c5dc3bf
KY
7360 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7361 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7362 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7363 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7364 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9c5dc3bf 7365 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
04d5466a 7366 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
c60666bd 7367 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd
KY
7368 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7369 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7370 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9c5dc3bf
KY
7371 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7372 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9c5dc3bf 7373 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
c60666bd 7374 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 7375 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 7376 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd
KY
7377 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7378 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd
KY
7379 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7380 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 7381 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8a02b164
KY
7382 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7383 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7384 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7385 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
f883982d 7386 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
167897f4
JK
7387 SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
7388 SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
563785ed 7389 SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
e549d190 7390 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
bbf8ff6b 7391 SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
167897f4
JK
7392 SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
7393 SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
56e40eb6 7394 SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
190d0381 7395 SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
d33cd42d 7396 SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
f5a88b0a 7397 SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_LED),
431e76c3 7398 SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
24164f43 7399 SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
c1732ede 7400 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
7bba2157 7401 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
3e0d611b 7402 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9cf6533e 7403 SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
c1732ede 7404 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
4eab0ea1 7405 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
3e0d611b 7406 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4eab0ea1
TI
7407 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
7408 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
7409 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
c1732ede
CC
7410 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
7411 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
7412 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
2cede303 7413 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
23870831 7414 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
3e0d611b 7415 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
48e01504 7416 SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
8c8967a7 7417 SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
4963d66b 7418 SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
8b33a134 7419 SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
7900e817 7420 SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
017f2a10 7421 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
28e8af8a 7422 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
693b613d 7423 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
615966ad 7424 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
4eab0ea1 7425 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
c1732ede 7426 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
eeed4cd1 7427 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
adabb3ec
TI
7428 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
7429 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
7430 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
7431 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
d240d1dc 7432 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
f88abaa0 7433 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
88cfcf86 7434 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
1d045db9
TI
7435 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
7436 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
7437 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
e9bd7d5c 7438 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
24519911 7439 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
4df3fd17 7440 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
cc7016ab 7441 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
88776f36 7442 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
fdcc968a 7443 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
2041d564 7444 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
b84e8436 7445 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
0fca97a2 7446 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
a33cc48d 7447 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
14425f1f
MP
7448 SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
7449 SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
823ff161 7450 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
abaa2274
AA
7451 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
7452 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
8cd65271 7453 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
89e3a568 7454 SND_PCI_QUIRK(0x1558, 0x1325, "System76 Darter Pro (darp5)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
80a5052d 7455 SND_PCI_QUIRK(0x1558, 0x8550, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
891afcf2
JS
7456 SND_PCI_QUIRK(0x1558, 0x8551, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7457 SND_PCI_QUIRK(0x1558, 0x8560, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
7458 SND_PCI_QUIRK(0x1558, 0x8561, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
ca169cc2 7459 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
ef0b3203 7460 SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
1d045db9
TI
7461 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
7462 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
7463 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
7464 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
7465 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
707fba3f 7466 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK),
c8415a48 7467 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
84f98fdf 7468 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
4407be6b 7469 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
108cc108 7470 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
aaedfb47 7471 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
9a811230 7472 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
1c37c223 7473 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
a12137e7 7474 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
59a51a6b 7475 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
6d16941a 7476 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
7c21539c 7477 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
a4a9e082 7478 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
b6903c0e 7479 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
d05ea7da 7480 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
c0278669 7481 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
61fcf8ec
KY
7482 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7483 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
dab38e43 7484 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
c636b95e 7485 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
61fcf8ec
KY
7486 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
7487 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7488 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
e4c07b3b 7489 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
61fcf8ec
KY
7490 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7491 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7492 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
85981dfd 7493 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
76f7dec0
KY
7494 SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Yoga 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
7495 SND_PCI_QUIRK(0x17aa, 0x2293, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
ca707b3f 7496 SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
3694cb29 7497 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
6ef2f68f 7498 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
f33f79f3 7499 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
bef33e19 7500 SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
e41fc8c5 7501 SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
65811834 7502 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
8da5bbfc 7503 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
2a36c16e 7504 SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
8a6c55d0
AM
7505 SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
7506 SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
56f27013 7507 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
fedb2245 7508 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
56df90b6 7509 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
a4a9e082 7510 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
1bb3e062 7511 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
c497d9f9 7512 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
cd5302c0 7513 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
f2aa1110 7514 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
80b311d3 7515 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
09ea9976 7516 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
037e1197 7517 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
23adc192 7518 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
0f087ee3 7519 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
9cd25743 7520 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
0f087ee3 7521 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
61fcf8ec
KY
7522 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7523 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7524 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
cd5302c0 7525 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
61fcf8ec
KY
7526 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7527 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
012e7eb1 7528 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
1d045db9 7529 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
0fbf21c3 7530 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
02b504d9 7531 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
695d1ec3 7532 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
bd9c10bc 7533 SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
a4297b5d 7534
a7f3eedc 7535#if 0
a4297b5d
TI
7536 /* Below is a quirk table taken from the old code.
7537 * Basically the device should work as is without the fixup table.
7538 * If BIOS doesn't give a proper info, enable the corresponding
7539 * fixup entry.
7d7eb9ea 7540 */
a4297b5d
TI
7541 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
7542 ALC269_FIXUP_AMIC),
7543 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
a4297b5d
TI
7544 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
7545 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
7546 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
7547 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
7548 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
7549 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
7550 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
7551 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
7552 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
7553 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
7554 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
7555 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
7556 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
7557 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
7558 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
7559 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
7560 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
7561 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
7562 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
7563 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
7564 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
7565 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
7566 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
7567 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
7568 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
7569 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
7570 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
7571 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
7572 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
7573 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
7574 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
7575 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
7576 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
7577 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
7578 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
7579 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
7580 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
7581 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
7582#endif
7583 {}
7584};
7585
214eef76
DH
7586static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
7587 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
7588 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
7589 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
7590 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
0fbf21c3 7591 SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
214eef76
DH
7592 {}
7593};
7594
1727a771 7595static const struct hda_model_fixup alc269_fixup_models[] = {
a4297b5d
TI
7596 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
7597 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
6e72aa5f
TI
7598 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
7599 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
7600 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
7c478f03 7601 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
b016951e
TI
7602 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
7603 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
108cc108 7604 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
9f5c6faf 7605 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
04d5466a 7606 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
e32aa85a
DH
7607 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
7608 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
a26d96c7
TI
7609 {.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
7610 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
be8ef16a 7611 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
0202e99c 7612 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
1c37c223 7613 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
9a811230 7614 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
c636b95e 7615 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
a26d96c7 7616 {.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
ba90d6a6 7617 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
28d1d6d2 7618 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
a26d96c7
TI
7619 {.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
7620 {.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
7621 {.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
7622 {.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
7623 {.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
7624 {.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
7625 {.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
7626 {.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
7627 {.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
7628 {.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
7629 {.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
7630 {.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
7631 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
7632 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
7633 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
7634 {.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
7635 {.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
7636 {.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
7637 {.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
7638 {.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
7639 {.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
7640 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
7641 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
7642 {.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
7643 {.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
7644 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
7645 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
7646 {.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
7647 {.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
7648 {.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
7649 {.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
7650 {.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
7651 {.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
7652 {.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
7653 {.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
7654 {.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
7655 {.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
7656 {.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
7657 {.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
7658 {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
b3802783 7659 {.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
a26d96c7
TI
7660 {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
7661 {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
7662 {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
7663 {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
7664 {.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
7665 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
7666 {.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
7667 {.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
7668 {.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
7669 {.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
7670 {.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
7671 {.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
7672 {.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
7673 {.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
7674 {.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
a26d96c7
TI
7675 {.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
7676 {.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
7677 {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
82aa0d7e 7678 {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
a26d96c7 7679 {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
d2cd795c 7680 {.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
a26d96c7
TI
7681 {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
7682 {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
7683 {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
7684 {.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
7685 {.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
7686 {.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
7687 {.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
7688 {.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
7689 {.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
7690 {.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
7691 {.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
7692 {.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
7693 {.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
7694 {.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
7695 {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
7696 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
7697 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
8983eb60
KY
7698 {.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
7699 {.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
e2a829b3 7700 {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
a2ef03fe 7701 {.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
bd9c10bc 7702 {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
1d045db9 7703 {}
6dda9f4a 7704};
cfc5a845 7705#define ALC225_STANDARD_PINS \
cfc5a845 7706 {0x21, 0x04211020}
6dda9f4a 7707
e8191a8e
HW
7708#define ALC256_STANDARD_PINS \
7709 {0x12, 0x90a60140}, \
7710 {0x14, 0x90170110}, \
e8191a8e
HW
7711 {0x21, 0x02211020}
7712
fea185e2 7713#define ALC282_STANDARD_PINS \
11580297 7714 {0x14, 0x90170110}
e1e62b98 7715
fea185e2 7716#define ALC290_STANDARD_PINS \
11580297 7717 {0x12, 0x99a30130}
fea185e2
DH
7718
7719#define ALC292_STANDARD_PINS \
7720 {0x14, 0x90170110}, \
11580297 7721 {0x15, 0x0221401f}
977e6276 7722
3f640970
HW
7723#define ALC295_STANDARD_PINS \
7724 {0x12, 0xb7a60130}, \
7725 {0x14, 0x90170110}, \
3f640970
HW
7726 {0x21, 0x04211020}
7727
703867e2
WS
7728#define ALC298_STANDARD_PINS \
7729 {0x12, 0x90a60130}, \
7730 {0x21, 0x03211020}
7731
e1918938 7732static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
8a328ac1
KY
7733 SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
7734 {0x14, 0x01014020},
7735 {0x17, 0x90170110},
7736 {0x18, 0x02a11030},
7737 {0x19, 0x0181303F},
7738 {0x21, 0x0221102f}),
5824ce8d
CC
7739 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
7740 {0x12, 0x90a601c0},
7741 {0x14, 0x90171120},
7742 {0x21, 0x02211030}),
615966ad
CC
7743 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
7744 {0x14, 0x90170110},
7745 {0x1b, 0x90a70130},
7746 {0x21, 0x03211020}),
7747 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
7748 {0x1a, 0x90a70130},
7749 {0x1b, 0x90170110},
7750 {0x21, 0x03211020}),
2ae95577 7751 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
cfc5a845 7752 ALC225_STANDARD_PINS,
8a132099 7753 {0x12, 0xb7a60130},
cfc5a845 7754 {0x14, 0x901701a0}),
2ae95577 7755 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
cfc5a845 7756 ALC225_STANDARD_PINS,
8a132099 7757 {0x12, 0xb7a60130},
cfc5a845 7758 {0x14, 0x901701b0}),
8a132099
HW
7759 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7760 ALC225_STANDARD_PINS,
7761 {0x12, 0xb7a60150},
7762 {0x14, 0x901701a0}),
7763 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7764 ALC225_STANDARD_PINS,
7765 {0x12, 0xb7a60150},
7766 {0x14, 0x901701b0}),
7767 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7768 ALC225_STANDARD_PINS,
7769 {0x12, 0xb7a60130},
7770 {0x1b, 0x90170110}),
0ce48e17
KHF
7771 SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7772 {0x1b, 0x01111010},
7773 {0x1e, 0x01451130},
7774 {0x21, 0x02211020}),
986376b6
HW
7775 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
7776 {0x12, 0x90a60140},
7777 {0x14, 0x90170110},
7778 {0x19, 0x02a11030},
7779 {0x21, 0x02211020}),
e41fc8c5
HW
7780 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
7781 {0x14, 0x90170110},
7782 {0x19, 0x02a11030},
7783 {0x1a, 0x02a11040},
7784 {0x1b, 0x01014020},
7785 {0x21, 0x0221101f}),
d06fb562
HW
7786 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
7787 {0x14, 0x90170110},
7788 {0x19, 0x02a11030},
7789 {0x1a, 0x02a11040},
7790 {0x1b, 0x01011020},
7791 {0x21, 0x0221101f}),
c6b17f10
HW
7792 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
7793 {0x14, 0x90170110},
7794 {0x19, 0x02a11020},
7795 {0x1a, 0x02a11030},
7796 {0x21, 0x0221101f}),
c77900e6 7797 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
c77900e6 7798 {0x14, 0x90170110},
c77900e6 7799 {0x21, 0x02211020}),
86c72d1c
HW
7800 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7801 {0x14, 0x90170130},
7802 {0x21, 0x02211040}),
76c2132e
DH
7803 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7804 {0x12, 0x90a60140},
7805 {0x14, 0x90170110},
76c2132e
DH
7806 {0x21, 0x02211020}),
7807 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7808 {0x12, 0x90a60160},
7809 {0x14, 0x90170120},
76c2132e 7810 {0x21, 0x02211030}),
392c9da2
HW
7811 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7812 {0x14, 0x90170110},
7813 {0x1b, 0x02011020},
7814 {0x21, 0x0221101f}),
6aecd871
HW
7815 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7816 {0x14, 0x90170110},
7817 {0x1b, 0x01011020},
7818 {0x21, 0x0221101f}),
cba59972 7819 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
cba59972 7820 {0x14, 0x90170130},
cba59972 7821 {0x1b, 0x01014020},
cba59972 7822 {0x21, 0x0221103f}),
6aecd871
HW
7823 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7824 {0x14, 0x90170130},
7825 {0x1b, 0x01011020},
7826 {0x21, 0x0221103f}),
59ec4b57
HW
7827 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7828 {0x14, 0x90170130},
7829 {0x1b, 0x02011020},
7830 {0x21, 0x0221103f}),
e9c28e16 7831 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
e9c28e16 7832 {0x14, 0x90170150},
e9c28e16 7833 {0x1b, 0x02011020},
e9c28e16
WS
7834 {0x21, 0x0221105f}),
7835 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
e9c28e16 7836 {0x14, 0x90170110},
e9c28e16 7837 {0x1b, 0x01014020},
e9c28e16 7838 {0x21, 0x0221101f}),
76c2132e
DH
7839 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7840 {0x12, 0x90a60160},
7841 {0x14, 0x90170120},
7842 {0x17, 0x90170140},
76c2132e
DH
7843 {0x21, 0x0321102f}),
7844 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7845 {0x12, 0x90a60160},
7846 {0x14, 0x90170130},
76c2132e
DH
7847 {0x21, 0x02211040}),
7848 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7849 {0x12, 0x90a60160},
7850 {0x14, 0x90170140},
76c2132e
DH
7851 {0x21, 0x02211050}),
7852 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7853 {0x12, 0x90a60170},
7854 {0x14, 0x90170120},
76c2132e
DH
7855 {0x21, 0x02211030}),
7856 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7857 {0x12, 0x90a60170},
7858 {0x14, 0x90170130},
76c2132e 7859 {0x21, 0x02211040}),
0a1f90a9
HW
7860 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7861 {0x12, 0x90a60170},
7862 {0x14, 0x90171130},
7863 {0x21, 0x02211040}),
70658b99 7864 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
70658b99
HW
7865 {0x12, 0x90a60170},
7866 {0x14, 0x90170140},
70658b99 7867 {0x21, 0x02211050}),
9b5a4e39 7868 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9b5a4e39
DH
7869 {0x12, 0x90a60180},
7870 {0x14, 0x90170130},
9b5a4e39 7871 {0x21, 0x02211040}),
f90d83b3
AK
7872 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7873 {0x12, 0x90a60180},
7874 {0x14, 0x90170120},
7875 {0x21, 0x02211030}),
989dbe4a
HW
7876 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7877 {0x1b, 0x01011020},
7878 {0x21, 0x02211010}),
c1732ede
CC
7879 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
7880 {0x14, 0x90170110},
7881 {0x1b, 0x90a70130},
7882 {0x21, 0x04211020}),
7883 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
7884 {0x14, 0x90170110},
7885 {0x1b, 0x90a70130},
7886 {0x21, 0x03211020}),
a806ef1c
CC
7887 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
7888 {0x12, 0x90a60130},
7889 {0x14, 0x90170110},
7890 {0x21, 0x03211020}),
6ac371aa
JHP
7891 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
7892 {0x12, 0x90a60130},
7893 {0x14, 0x90170110},
7894 {0x21, 0x04211020}),
e1037354
JHP
7895 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
7896 {0x1a, 0x90a70130},
7897 {0x1b, 0x90170110},
7898 {0x21, 0x03211020}),
cf51eb9d
DH
7899 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
7900 {0x12, 0x90a60130},
cf51eb9d
DH
7901 {0x14, 0x90170110},
7902 {0x15, 0x0421101f},
11580297 7903 {0x1a, 0x04a11020}),
0279661b
HW
7904 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
7905 {0x12, 0x90a60140},
0279661b
HW
7906 {0x14, 0x90170110},
7907 {0x15, 0x0421101f},
0279661b 7908 {0x18, 0x02811030},
0279661b 7909 {0x1a, 0x04a1103f},
11580297 7910 {0x1b, 0x02011020}),
42304474 7911 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 7912 ALC282_STANDARD_PINS,
42304474 7913 {0x12, 0x99a30130},
42304474 7914 {0x19, 0x03a11020},
42304474 7915 {0x21, 0x0321101f}),
2c609999 7916 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 7917 ALC282_STANDARD_PINS,
2c609999 7918 {0x12, 0x99a30130},
2c609999 7919 {0x19, 0x03a11020},
2c609999
HW
7920 {0x21, 0x03211040}),
7921 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 7922 ALC282_STANDARD_PINS,
2c609999 7923 {0x12, 0x99a30130},
2c609999 7924 {0x19, 0x03a11030},
2c609999
HW
7925 {0x21, 0x03211020}),
7926 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 7927 ALC282_STANDARD_PINS,
2c609999 7928 {0x12, 0x99a30130},
2c609999 7929 {0x19, 0x04a11020},
2c609999 7930 {0x21, 0x0421101f}),
200afc09 7931 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
aec856d0 7932 ALC282_STANDARD_PINS,
200afc09 7933 {0x12, 0x90a60140},
200afc09 7934 {0x19, 0x04a11030},
200afc09 7935 {0x21, 0x04211020}),
76c2132e 7936 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 7937 ALC282_STANDARD_PINS,
76c2132e 7938 {0x12, 0x90a60130},
76c2132e
DH
7939 {0x21, 0x0321101f}),
7940 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7941 {0x12, 0x90a60160},
7942 {0x14, 0x90170120},
76c2132e 7943 {0x21, 0x02211030}),
bc262179 7944 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 7945 ALC282_STANDARD_PINS,
bc262179 7946 {0x12, 0x90a60130},
bc262179 7947 {0x19, 0x03a11020},
bc262179 7948 {0x21, 0x0321101f}),
c8c6ee61 7949 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
c4cfcf6f
HW
7950 {0x12, 0x90a60130},
7951 {0x14, 0x90170110},
7952 {0x19, 0x04a11040},
7953 {0x21, 0x04211020}),
33aaebd4
CC
7954 SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
7955 {0x12, 0x90a60130},
7956 {0x17, 0x90170110},
7957 {0x21, 0x02211020}),
d44a6864 7958 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
e1e62b98 7959 {0x12, 0x90a60120},
e1e62b98 7960 {0x14, 0x90170110},
e1e62b98 7961 {0x21, 0x0321101f}),
e4442bcf 7962 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 7963 ALC290_STANDARD_PINS,
e4442bcf 7964 {0x15, 0x04211040},
e4442bcf 7965 {0x18, 0x90170112},
11580297 7966 {0x1a, 0x04a11020}),
e4442bcf 7967 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 7968 ALC290_STANDARD_PINS,
e4442bcf 7969 {0x15, 0x04211040},
e4442bcf 7970 {0x18, 0x90170110},
11580297 7971 {0x1a, 0x04a11020}),
e4442bcf 7972 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 7973 ALC290_STANDARD_PINS,
e4442bcf 7974 {0x15, 0x0421101f},
11580297 7975 {0x1a, 0x04a11020}),
e4442bcf 7976 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 7977 ALC290_STANDARD_PINS,
e4442bcf 7978 {0x15, 0x04211020},
11580297 7979 {0x1a, 0x04a11040}),
e4442bcf 7980 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 7981 ALC290_STANDARD_PINS,
e4442bcf
HW
7982 {0x14, 0x90170110},
7983 {0x15, 0x04211020},
11580297 7984 {0x1a, 0x04a11040}),
e4442bcf 7985 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 7986 ALC290_STANDARD_PINS,
e4442bcf
HW
7987 {0x14, 0x90170110},
7988 {0x15, 0x04211020},
11580297 7989 {0x1a, 0x04a11020}),
e4442bcf 7990 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 7991 ALC290_STANDARD_PINS,
e4442bcf
HW
7992 {0x14, 0x90170110},
7993 {0x15, 0x0421101f},
11580297 7994 {0x1a, 0x04a11020}),
e8818fa8 7995 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
aec856d0 7996 ALC292_STANDARD_PINS,
e8818fa8 7997 {0x12, 0x90a60140},
e8818fa8 7998 {0x16, 0x01014020},
11580297 7999 {0x19, 0x01a19030}),
e8818fa8 8000 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
aec856d0 8001 ALC292_STANDARD_PINS,
e8818fa8 8002 {0x12, 0x90a60140},
e8818fa8
HW
8003 {0x16, 0x01014020},
8004 {0x18, 0x02a19031},
11580297 8005 {0x19, 0x01a1903e}),
76c2132e 8006 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
aec856d0 8007 ALC292_STANDARD_PINS,
11580297 8008 {0x12, 0x90a60140}),
76c2132e 8009 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 8010 ALC292_STANDARD_PINS,
76c2132e 8011 {0x13, 0x90a60140},
76c2132e 8012 {0x16, 0x21014020},
11580297 8013 {0x19, 0x21a19030}),
e03fdbde 8014 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 8015 ALC292_STANDARD_PINS,
11580297 8016 {0x13, 0x90a60140}),
d8ae458e
CC
8017 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
8018 {0x14, 0x90170110},
8019 {0x1b, 0x90a70130},
8020 {0x21, 0x04211020}),
8bb37a2a
JHP
8021 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
8022 {0x12, 0x90a60130},
8023 {0x17, 0x90170110},
8024 {0x21, 0x03211020}),
0bea4cc8
JHP
8025 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
8026 {0x12, 0x90a60130},
8027 {0x17, 0x90170110},
8028 {0x21, 0x04211020}),
3887c26c
TI
8029 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
8030 {0x12, 0x90a60130},
8031 {0x17, 0x90170110},
8032 {0x21, 0x03211020}),
9e43342b 8033 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
ad97d667
JHP
8034 {0x12, 0x90a60120},
8035 {0x17, 0x90170110},
8036 {0x21, 0x04211030}),
8037 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
9e43342b
CC
8038 {0x12, 0x90a60130},
8039 {0x17, 0x90170110},
8040 {0x21, 0x03211020}),
8041 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
8042 {0x12, 0x90a60130},
8043 {0x17, 0x90170110},
8044 {0x21, 0x03211020}),
fbc57129 8045 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
0a29c57b
KY
8046 {0x14, 0x90170110},
8047 {0x21, 0x04211020}),
fbc57129
KY
8048 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
8049 {0x14, 0x90170110},
8050 {0x21, 0x04211030}),
3f640970 8051 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
f771d5bb
HW
8052 ALC295_STANDARD_PINS,
8053 {0x17, 0x21014020},
8054 {0x18, 0x21a19030}),
8055 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
8056 ALC295_STANDARD_PINS,
8057 {0x17, 0x21014040},
8058 {0x18, 0x21a19050}),
3f307834
HW
8059 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
8060 ALC295_STANDARD_PINS),
9f502ff5
TI
8061 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
8062 ALC298_STANDARD_PINS,
8063 {0x17, 0x90170110}),
977e6276 8064 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
703867e2
WS
8065 ALC298_STANDARD_PINS,
8066 {0x17, 0x90170140}),
8067 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
8068 ALC298_STANDARD_PINS,
9f502ff5 8069 {0x17, 0x90170150}),
9f1bc2c4
KHF
8070 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
8071 {0x12, 0xb7a60140},
8072 {0x13, 0xb7a60150},
8073 {0x17, 0x90170110},
8074 {0x1a, 0x03011020},
8075 {0x21, 0x03211030}),
54324221
JM
8076 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
8077 {0x12, 0xb7a60140},
8078 {0x17, 0x90170110},
8079 {0x1a, 0x03a11030},
8080 {0x21, 0x03211020}),
fcc6c877
KY
8081 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
8082 ALC225_STANDARD_PINS,
8083 {0x12, 0xb7a60130},
fcc6c877 8084 {0x17, 0x90170110}),
e1918938
HW
8085 {}
8086};
6dda9f4a 8087
7c0a6939
HW
8088/* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
8089 * more machines, don't need to match all valid pins, just need to match
8090 * all the pins defined in the tbl. Just because of this reason, it is possible
8091 * that a single machine matches multiple tbls, so there is one limitation:
8092 * at most one tbl is allowed to define for the same vendor and same codec
8093 */
8094static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
8095 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
8096 {0x19, 0x40000000},
8097 {0x1b, 0x40000000}),
aed8c7f4
HW
8098 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8099 {0x19, 0x40000000},
8100 {0x1a, 0x40000000}),
d64ebdbf
HW
8101 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8102 {0x19, 0x40000000},
8103 {0x1a, 0x40000000}),
5815bdfd
HW
8104 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
8105 {0x19, 0x40000000},
8106 {0x1a, 0x40000000}),
7c0a6939
HW
8107 {}
8108};
8109
546bb678 8110static void alc269_fill_coef(struct hda_codec *codec)
1d045db9 8111{
526af6eb 8112 struct alc_spec *spec = codec->spec;
1d045db9 8113 int val;
ebb83eeb 8114
526af6eb 8115 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
546bb678 8116 return;
526af6eb 8117
1bb7e43e 8118 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
1d045db9
TI
8119 alc_write_coef_idx(codec, 0xf, 0x960b);
8120 alc_write_coef_idx(codec, 0xe, 0x8817);
8121 }
ebb83eeb 8122
1bb7e43e 8123 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
1d045db9
TI
8124 alc_write_coef_idx(codec, 0xf, 0x960b);
8125 alc_write_coef_idx(codec, 0xe, 0x8814);
8126 }
ebb83eeb 8127
1bb7e43e 8128 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
1d045db9 8129 /* Power up output pin */
98b24883 8130 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
1d045db9 8131 }
ebb83eeb 8132
1bb7e43e 8133 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
1d045db9 8134 val = alc_read_coef_idx(codec, 0xd);
f3ee07d8 8135 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
1d045db9
TI
8136 /* Capless ramp up clock control */
8137 alc_write_coef_idx(codec, 0xd, val | (1<<10));
8138 }
8139 val = alc_read_coef_idx(codec, 0x17);
f3ee07d8 8140 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
1d045db9
TI
8141 /* Class D power on reset */
8142 alc_write_coef_idx(codec, 0x17, val | (1<<7));
8143 }
8144 }
ebb83eeb 8145
98b24883
TI
8146 /* HP */
8147 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
1d045db9 8148}
a7f2371f 8149
1d045db9
TI
8150/*
8151 */
1d045db9
TI
8152static int patch_alc269(struct hda_codec *codec)
8153{
8154 struct alc_spec *spec;
3de95173 8155 int err;
f1d4e28b 8156
3de95173 8157 err = alc_alloc_spec(codec, 0x0b);
e16fb6d1 8158 if (err < 0)
3de95173
TI
8159 return err;
8160
8161 spec = codec->spec;
08c189f2 8162 spec->gen.shared_mic_vref_pin = 0x18;
317d9313 8163 codec->power_save_node = 0;
e16fb6d1 8164
225068ab
TI
8165#ifdef CONFIG_PM
8166 codec->patch_ops.suspend = alc269_suspend;
8167 codec->patch_ops.resume = alc269_resume;
8168#endif
c2d6af53
KY
8169 spec->shutup = alc_default_shutup;
8170 spec->init_hook = alc_default_init;
225068ab 8171
7639a06c 8172 switch (codec->core.vendor_id) {
065380f0 8173 case 0x10ec0269:
1d045db9 8174 spec->codec_variant = ALC269_TYPE_ALC269VA;
1bb7e43e
TI
8175 switch (alc_get_coef0(codec) & 0x00f0) {
8176 case 0x0010:
5100cd07
TI
8177 if (codec->bus->pci &&
8178 codec->bus->pci->subsystem_vendor == 0x1025 &&
e16fb6d1 8179 spec->cdefine.platform_type == 1)
20ca0c35 8180 err = alc_codec_rename(codec, "ALC271X");
1d045db9 8181 spec->codec_variant = ALC269_TYPE_ALC269VB;
1bb7e43e
TI
8182 break;
8183 case 0x0020:
5100cd07
TI
8184 if (codec->bus->pci &&
8185 codec->bus->pci->subsystem_vendor == 0x17aa &&
e16fb6d1 8186 codec->bus->pci->subsystem_device == 0x21f3)
20ca0c35 8187 err = alc_codec_rename(codec, "ALC3202");
1d045db9 8188 spec->codec_variant = ALC269_TYPE_ALC269VC;
1bb7e43e 8189 break;
adcc70b2
KY
8190 case 0x0030:
8191 spec->codec_variant = ALC269_TYPE_ALC269VD;
8192 break;
1bb7e43e 8193 default:
1d045db9 8194 alc_fix_pll_init(codec, 0x20, 0x04, 15);
1bb7e43e 8195 }
e16fb6d1
TI
8196 if (err < 0)
8197 goto error;
c2d6af53 8198 spec->shutup = alc269_shutup;
546bb678 8199 spec->init_hook = alc269_fill_coef;
1d045db9 8200 alc269_fill_coef(codec);
065380f0
KY
8201 break;
8202
8203 case 0x10ec0280:
8204 case 0x10ec0290:
8205 spec->codec_variant = ALC269_TYPE_ALC280;
8206 break;
8207 case 0x10ec0282:
065380f0 8208 spec->codec_variant = ALC269_TYPE_ALC282;
7b5c7a02
KY
8209 spec->shutup = alc282_shutup;
8210 spec->init_hook = alc282_init;
065380f0 8211 break;
2af02be7
KY
8212 case 0x10ec0233:
8213 case 0x10ec0283:
8214 spec->codec_variant = ALC269_TYPE_ALC283;
8215 spec->shutup = alc283_shutup;
8216 spec->init_hook = alc283_init;
8217 break;
065380f0
KY
8218 case 0x10ec0284:
8219 case 0x10ec0292:
8220 spec->codec_variant = ALC269_TYPE_ALC284;
8221 break;
161ebf29 8222 case 0x10ec0293:
4731d5de 8223 spec->codec_variant = ALC269_TYPE_ALC293;
161ebf29 8224 break;
7fc7d047 8225 case 0x10ec0286:
7c665932 8226 case 0x10ec0288:
7fc7d047
KY
8227 spec->codec_variant = ALC269_TYPE_ALC286;
8228 break;
506b62c3
KY
8229 case 0x10ec0298:
8230 spec->codec_variant = ALC269_TYPE_ALC298;
8231 break;
ea04a1db 8232 case 0x10ec0235:
1d04c9de
KY
8233 case 0x10ec0255:
8234 spec->codec_variant = ALC269_TYPE_ALC255;
ab3b8e51
KY
8235 spec->shutup = alc256_shutup;
8236 spec->init_hook = alc256_init;
1d04c9de 8237 break;
736f20a7 8238 case 0x10ec0236:
4344aec8
KY
8239 case 0x10ec0256:
8240 spec->codec_variant = ALC269_TYPE_ALC256;
4a219ef8
KY
8241 spec->shutup = alc256_shutup;
8242 spec->init_hook = alc256_init;
7d1b6e29 8243 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
4344aec8 8244 break;
f429e7e4
KY
8245 case 0x10ec0257:
8246 spec->codec_variant = ALC269_TYPE_ALC257;
88d42b2b
KY
8247 spec->shutup = alc256_shutup;
8248 spec->init_hook = alc256_init;
f429e7e4
KY
8249 spec->gen.mixer_nid = 0;
8250 break;
0a6f0600 8251 case 0x10ec0215:
7fbdcd83 8252 case 0x10ec0245:
0a6f0600
KY
8253 case 0x10ec0285:
8254 case 0x10ec0289:
8255 spec->codec_variant = ALC269_TYPE_ALC215;
1b6832be
KY
8256 spec->shutup = alc225_shutup;
8257 spec->init_hook = alc225_init;
0a6f0600
KY
8258 spec->gen.mixer_nid = 0;
8259 break;
4231430d 8260 case 0x10ec0225:
7d727869 8261 case 0x10ec0295:
28f1f9b2 8262 case 0x10ec0299:
4231430d 8263 spec->codec_variant = ALC269_TYPE_ALC225;
da911b1f
KY
8264 spec->shutup = alc225_shutup;
8265 spec->init_hook = alc225_init;
c1350bff 8266 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
4231430d 8267 break;
dcd4f0db
KY
8268 case 0x10ec0234:
8269 case 0x10ec0274:
8270 case 0x10ec0294:
8271 spec->codec_variant = ALC269_TYPE_ALC294;
532a7784 8272 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
71683c32 8273 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
693abe11 8274 spec->init_hook = alc294_init;
dcd4f0db 8275 break;
1078bef0
KY
8276 case 0x10ec0300:
8277 spec->codec_variant = ALC269_TYPE_ALC300;
8278 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
dcd4f0db 8279 break;
f0778871
KY
8280 case 0x10ec0623:
8281 spec->codec_variant = ALC269_TYPE_ALC623;
8282 break;
6fbae35a
KY
8283 case 0x10ec0700:
8284 case 0x10ec0701:
8285 case 0x10ec0703:
83629532 8286 case 0x10ec0711:
6fbae35a
KY
8287 spec->codec_variant = ALC269_TYPE_ALC700;
8288 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
2d7fe618 8289 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
693abe11 8290 spec->init_hook = alc294_init;
6fbae35a
KY
8291 break;
8292
1d045db9 8293 }
6dda9f4a 8294
ad60d502 8295 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
97a26570 8296 spec->has_alc5505_dsp = 1;
ad60d502
KY
8297 spec->init_hook = alc5505_dsp_init;
8298 }
8299
c9af753f
TI
8300 alc_pre_init(codec);
8301
efe55732
TI
8302 snd_hda_pick_fixup(codec, alc269_fixup_models,
8303 alc269_fixup_tbl, alc269_fixups);
0fc1e447 8304 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
7c0a6939 8305 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
efe55732
TI
8306 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
8307 alc269_fixups);
8308 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
8309
8310 alc_auto_parse_customize_define(codec);
8311
8312 if (has_cdefine_beep(codec))
8313 spec->gen.beep_nid = 0x01;
8314
a4297b5d
TI
8315 /* automatic parse from the BIOS config */
8316 err = alc269_parse_auto_config(codec);
e16fb6d1
TI
8317 if (err < 0)
8318 goto error;
6dda9f4a 8319
fea80fae
TI
8320 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
8321 err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
8322 if (err < 0)
8323 goto error;
8324 }
f1d4e28b 8325
1727a771 8326 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 8327
1d045db9 8328 return 0;
e16fb6d1
TI
8329
8330 error:
8331 alc_free(codec);
8332 return err;
1d045db9 8333}
f1d4e28b 8334
1d045db9
TI
8335/*
8336 * ALC861
8337 */
622e84cd 8338
1d045db9 8339static int alc861_parse_auto_config(struct hda_codec *codec)
6dda9f4a 8340{
1d045db9 8341 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
3e6179b8
TI
8342 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
8343 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
604401a9
TI
8344}
8345
1d045db9
TI
8346/* Pin config fixes */
8347enum {
e652f4c8
TI
8348 ALC861_FIXUP_FSC_AMILO_PI1505,
8349 ALC861_FIXUP_AMP_VREF_0F,
8350 ALC861_FIXUP_NO_JACK_DETECT,
8351 ALC861_FIXUP_ASUS_A6RP,
6ddf0fd1 8352 ALC660_FIXUP_ASUS_W7J,
1d045db9 8353};
7085ec12 8354
31150f23
TI
8355/* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
8356static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
1727a771 8357 const struct hda_fixup *fix, int action)
31150f23
TI
8358{
8359 struct alc_spec *spec = codec->spec;
8360 unsigned int val;
8361
1727a771 8362 if (action != HDA_FIXUP_ACT_INIT)
31150f23 8363 return;
d3f02d60 8364 val = snd_hda_codec_get_pin_target(codec, 0x0f);
31150f23
TI
8365 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
8366 val |= AC_PINCTL_IN_EN;
8367 val |= AC_PINCTL_VREF_50;
cdd03ced 8368 snd_hda_set_pin_ctl(codec, 0x0f, val);
08c189f2 8369 spec->gen.keep_vref_in_automute = 1;
31150f23
TI
8370}
8371
e652f4c8
TI
8372/* suppress the jack-detection */
8373static void alc_fixup_no_jack_detect(struct hda_codec *codec,
1727a771 8374 const struct hda_fixup *fix, int action)
e652f4c8 8375{
1727a771 8376 if (action == HDA_FIXUP_ACT_PRE_PROBE)
e652f4c8 8377 codec->no_jack_detect = 1;
7d7eb9ea 8378}
e652f4c8 8379
1727a771 8380static const struct hda_fixup alc861_fixups[] = {
e652f4c8 8381 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
1727a771
TI
8382 .type = HDA_FIXUP_PINS,
8383 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
8384 { 0x0b, 0x0221101f }, /* HP */
8385 { 0x0f, 0x90170310 }, /* speaker */
8386 { }
8387 }
8388 },
e652f4c8 8389 [ALC861_FIXUP_AMP_VREF_0F] = {
1727a771 8390 .type = HDA_FIXUP_FUNC,
31150f23 8391 .v.func = alc861_fixup_asus_amp_vref_0f,
3b25eb69 8392 },
e652f4c8 8393 [ALC861_FIXUP_NO_JACK_DETECT] = {
1727a771 8394 .type = HDA_FIXUP_FUNC,
e652f4c8
TI
8395 .v.func = alc_fixup_no_jack_detect,
8396 },
8397 [ALC861_FIXUP_ASUS_A6RP] = {
1727a771 8398 .type = HDA_FIXUP_FUNC,
e652f4c8
TI
8399 .v.func = alc861_fixup_asus_amp_vref_0f,
8400 .chained = true,
8401 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
6ddf0fd1
TI
8402 },
8403 [ALC660_FIXUP_ASUS_W7J] = {
8404 .type = HDA_FIXUP_VERBS,
8405 .v.verbs = (const struct hda_verb[]) {
8406 /* ASUS W7J needs a magic pin setup on unused NID 0x10
8407 * for enabling outputs
8408 */
8409 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8410 { }
8411 },
e652f4c8 8412 }
1d045db9 8413};
7085ec12 8414
1d045db9 8415static const struct snd_pci_quirk alc861_fixup_tbl[] = {
6ddf0fd1 8416 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
e7ca237b 8417 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
e652f4c8
TI
8418 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
8419 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
8420 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
8421 SND_PCI_QUIRK(0x1584, 0x2b01, "Haier W18", ALC861_FIXUP_AMP_VREF_0F),
8422 SND_PCI_QUIRK(0x1584, 0x0000, "Uniwill ECS M31EI", ALC861_FIXUP_AMP_VREF_0F),
8423 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
1d045db9
TI
8424 {}
8425};
3af9ee6b 8426
1d045db9
TI
8427/*
8428 */
1d045db9 8429static int patch_alc861(struct hda_codec *codec)
7085ec12 8430{
1d045db9 8431 struct alc_spec *spec;
1d045db9 8432 int err;
7085ec12 8433
3de95173
TI
8434 err = alc_alloc_spec(codec, 0x15);
8435 if (err < 0)
8436 return err;
1d045db9 8437
3de95173 8438 spec = codec->spec;
2722b535
TI
8439 if (has_cdefine_beep(codec))
8440 spec->gen.beep_nid = 0x23;
1d045db9 8441
225068ab
TI
8442#ifdef CONFIG_PM
8443 spec->power_hook = alc_power_eapd;
8444#endif
8445
c9af753f
TI
8446 alc_pre_init(codec);
8447
1727a771
TI
8448 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
8449 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
3af9ee6b 8450
cb4e4824
TI
8451 /* automatic parse from the BIOS config */
8452 err = alc861_parse_auto_config(codec);
e16fb6d1
TI
8453 if (err < 0)
8454 goto error;
3af9ee6b 8455
fea80fae
TI
8456 if (!spec->gen.no_analog) {
8457 err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
8458 if (err < 0)
8459 goto error;
8460 }
7085ec12 8461
1727a771 8462 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 8463
1d045db9 8464 return 0;
e16fb6d1
TI
8465
8466 error:
8467 alc_free(codec);
8468 return err;
7085ec12
TI
8469}
8470
1d045db9
TI
8471/*
8472 * ALC861-VD support
8473 *
8474 * Based on ALC882
8475 *
8476 * In addition, an independent DAC
8477 */
1d045db9 8478static int alc861vd_parse_auto_config(struct hda_codec *codec)
bc9f98a9 8479{
1d045db9 8480 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
3e6179b8
TI
8481 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
8482 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
ce764ab2
TI
8483}
8484
1d045db9 8485enum {
8fdcb6fe
TI
8486 ALC660VD_FIX_ASUS_GPIO1,
8487 ALC861VD_FIX_DALLAS,
1d045db9 8488};
ce764ab2 8489
8fdcb6fe
TI
8490/* exclude VREF80 */
8491static void alc861vd_fixup_dallas(struct hda_codec *codec,
1727a771 8492 const struct hda_fixup *fix, int action)
8fdcb6fe 8493{
1727a771 8494 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
b78562b1
TI
8495 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
8496 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
8fdcb6fe
TI
8497 }
8498}
8499
df73d83f
TI
8500/* reset GPIO1 */
8501static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
8502 const struct hda_fixup *fix, int action)
8503{
8504 struct alc_spec *spec = codec->spec;
8505
8506 if (action == HDA_FIXUP_ACT_PRE_PROBE)
8507 spec->gpio_mask |= 0x02;
8508 alc_fixup_gpio(codec, action, 0x01);
8509}
8510
1727a771 8511static const struct hda_fixup alc861vd_fixups[] = {
1d045db9 8512 [ALC660VD_FIX_ASUS_GPIO1] = {
df73d83f
TI
8513 .type = HDA_FIXUP_FUNC,
8514 .v.func = alc660vd_fixup_asus_gpio1,
1d045db9 8515 },
8fdcb6fe 8516 [ALC861VD_FIX_DALLAS] = {
1727a771 8517 .type = HDA_FIXUP_FUNC,
8fdcb6fe
TI
8518 .v.func = alc861vd_fixup_dallas,
8519 },
1d045db9 8520};
ce764ab2 8521
1d045db9 8522static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
8fdcb6fe 8523 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
1d045db9 8524 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
8fdcb6fe 8525 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
1d045db9
TI
8526 {}
8527};
ce764ab2 8528
1d045db9
TI
8529/*
8530 */
1d045db9 8531static int patch_alc861vd(struct hda_codec *codec)
ce764ab2 8532{
1d045db9 8533 struct alc_spec *spec;
cb4e4824 8534 int err;
ce764ab2 8535
3de95173
TI
8536 err = alc_alloc_spec(codec, 0x0b);
8537 if (err < 0)
8538 return err;
1d045db9 8539
3de95173 8540 spec = codec->spec;
2722b535
TI
8541 if (has_cdefine_beep(codec))
8542 spec->gen.beep_nid = 0x23;
1d045db9 8543
225068ab
TI
8544 spec->shutup = alc_eapd_shutup;
8545
c9af753f
TI
8546 alc_pre_init(codec);
8547
1727a771
TI
8548 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
8549 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1d045db9 8550
cb4e4824
TI
8551 /* automatic parse from the BIOS config */
8552 err = alc861vd_parse_auto_config(codec);
e16fb6d1
TI
8553 if (err < 0)
8554 goto error;
ce764ab2 8555
fea80fae
TI
8556 if (!spec->gen.no_analog) {
8557 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
8558 if (err < 0)
8559 goto error;
8560 }
1d045db9 8561
1727a771 8562 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 8563
ce764ab2 8564 return 0;
e16fb6d1
TI
8565
8566 error:
8567 alc_free(codec);
8568 return err;
ce764ab2
TI
8569}
8570
1d045db9
TI
8571/*
8572 * ALC662 support
8573 *
8574 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
8575 * configuration. Each pin widget can choose any input DACs and a mixer.
8576 * Each ADC is connected from a mixer of all inputs. This makes possible
8577 * 6-channel independent captures.
8578 *
8579 * In addition, an independent DAC for the multi-playback (not used in this
8580 * driver yet).
8581 */
1d045db9
TI
8582
8583/*
8584 * BIOS auto configuration
8585 */
8586
bc9f98a9
KY
8587static int alc662_parse_auto_config(struct hda_codec *codec)
8588{
4c6d72d1 8589 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
3e6179b8
TI
8590 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
8591 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
8592 const hda_nid_t *ssids;
ee979a14 8593
7639a06c
TI
8594 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
8595 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
8596 codec->core.vendor_id == 0x10ec0671)
3e6179b8 8597 ssids = alc663_ssids;
6227cdce 8598 else
3e6179b8
TI
8599 ssids = alc662_ssids;
8600 return alc_parse_auto_config(codec, alc662_ignore, ssids);
bc9f98a9
KY
8601}
8602
6be7948f 8603static void alc272_fixup_mario(struct hda_codec *codec,
1727a771 8604 const struct hda_fixup *fix, int action)
6fc398cb 8605{
9bb1f06f 8606 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6fc398cb 8607 return;
6be7948f
TB
8608 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
8609 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
8610 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
8611 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
8612 (0 << AC_AMPCAP_MUTE_SHIFT)))
4e76a883 8613 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
6be7948f
TB
8614}
8615
8e383953
TI
8616static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
8617 { .channels = 2,
8618 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
8619 { .channels = 4,
8620 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
8621 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
8622 { }
8623};
8624
8625/* override the 2.1 chmap */
eb9ca3ab 8626static void alc_fixup_bass_chmap(struct hda_codec *codec,
8e383953
TI
8627 const struct hda_fixup *fix, int action)
8628{
8629 if (action == HDA_FIXUP_ACT_BUILD) {
8630 struct alc_spec *spec = codec->spec;
bbbc7e85 8631 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
8e383953
TI
8632 }
8633}
8634
bf68665d
TI
8635/* avoid D3 for keeping GPIO up */
8636static unsigned int gpio_led_power_filter(struct hda_codec *codec,
8637 hda_nid_t nid,
8638 unsigned int power_state)
8639{
8640 struct alc_spec *spec = codec->spec;
d261eec8 8641 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
bf68665d
TI
8642 return AC_PWRST_D0;
8643 return power_state;
8644}
8645
3e887f37
TI
8646static void alc662_fixup_led_gpio1(struct hda_codec *codec,
8647 const struct hda_fixup *fix, int action)
8648{
8649 struct alc_spec *spec = codec->spec;
3e887f37 8650
01e4a275 8651 alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
3e887f37 8652 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
0f32fd19 8653 spec->mute_led_polarity = 1;
bf68665d 8654 codec->power_filter = gpio_led_power_filter;
3e887f37
TI
8655 }
8656}
8657
c6790c8e
KY
8658static void alc662_usi_automute_hook(struct hda_codec *codec,
8659 struct hda_jack_callback *jack)
8660{
8661 struct alc_spec *spec = codec->spec;
8662 int vref;
8663 msleep(200);
8664 snd_hda_gen_hp_automute(codec, jack);
8665
8666 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
8667 msleep(100);
8668 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8669 vref);
8670}
8671
8672static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
8673 const struct hda_fixup *fix, int action)
8674{
8675 struct alc_spec *spec = codec->spec;
8676 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
8677 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
8678 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
8679 }
8680}
8681
00066e97
SB
8682static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
8683 struct hda_jack_callback *cb)
8684{
8685 /* surround speakers at 0x1b already get muted automatically when
8686 * headphones are plugged in, but we have to mute/unmute the remaining
8687 * channels manually:
8688 * 0x15 - front left/front right
8689 * 0x18 - front center/ LFE
8690 */
8691 if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
8692 snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
8693 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
8694 } else {
8695 snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
8696 snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
8697 }
8698}
8699
8700static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
8701 const struct hda_fixup *fix, int action)
8702{
8703 /* Pin 0x1b: shared headphones jack and surround speakers */
8704 if (!is_jack_detectable(codec, 0x1b))
8705 return;
8706
8707 switch (action) {
8708 case HDA_FIXUP_ACT_PRE_PROBE:
8709 snd_hda_jack_detect_enable_callback(codec, 0x1b,
8710 alc662_aspire_ethos_mute_speakers);
336820c4
TI
8711 /* subwoofer needs an extra GPIO setting to become audible */
8712 alc_setup_gpio(codec, 0x02);
00066e97
SB
8713 break;
8714 case HDA_FIXUP_ACT_INIT:
8715 /* Make sure to start in a correct state, i.e. if
8716 * headphones have been plugged in before powering up the system
8717 */
8718 alc662_aspire_ethos_mute_speakers(codec, NULL);
8719 break;
8720 }
8721}
8722
5af29028
KY
8723static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
8724 const struct hda_fixup *fix, int action)
8725{
8726 struct alc_spec *spec = codec->spec;
8727
8728 static const struct hda_pintbl pincfgs[] = {
8729 { 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
8730 { 0x1b, 0x0181304f },
8731 { }
8732 };
8733
8734 switch (action) {
8735 case HDA_FIXUP_ACT_PRE_PROBE:
8736 spec->gen.mixer_nid = 0;
8737 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
8738 snd_hda_apply_pincfgs(codec, pincfgs);
8739 break;
8740 case HDA_FIXUP_ACT_INIT:
8741 alc_write_coef_idx(codec, 0x19, 0xa054);
8742 break;
8743 }
8744}
8745
6b0f95c4 8746static const struct coef_fw alc668_coefs[] = {
f3f9185f
KY
8747 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
8748 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
8749 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
8750 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
8751 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
8752 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
8753 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
8754 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
8755 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
8756 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
8757 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
8758 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
8759 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
8760 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
8761 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
8762 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
8763 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
8764 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
8765 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
8766 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
8767 {}
8768};
8769
8770static void alc668_restore_default_value(struct hda_codec *codec)
8771{
8772 alc_process_coef_fw(codec, alc668_coefs);
8773}
8774
6cb3b707 8775enum {
2df03514 8776 ALC662_FIXUP_ASPIRE,
3e887f37 8777 ALC662_FIXUP_LED_GPIO1,
6cb3b707 8778 ALC662_FIXUP_IDEAPAD,
6be7948f 8779 ALC272_FIXUP_MARIO,
d2ebd479 8780 ALC662_FIXUP_CZC_P10T,
94024cd1 8781 ALC662_FIXUP_SKU_IGNORE,
e59ea3ed 8782 ALC662_FIXUP_HP_RP5800,
53c334ad
TI
8783 ALC662_FIXUP_ASUS_MODE1,
8784 ALC662_FIXUP_ASUS_MODE2,
8785 ALC662_FIXUP_ASUS_MODE3,
8786 ALC662_FIXUP_ASUS_MODE4,
8787 ALC662_FIXUP_ASUS_MODE5,
8788 ALC662_FIXUP_ASUS_MODE6,
8789 ALC662_FIXUP_ASUS_MODE7,
8790 ALC662_FIXUP_ASUS_MODE8,
1565cc35 8791 ALC662_FIXUP_NO_JACK_DETECT,
edfe3bfc 8792 ALC662_FIXUP_ZOTAC_Z68,
125821ae 8793 ALC662_FIXUP_INV_DMIC,
1f8b46cd 8794 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
73bdd597 8795 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
1f8b46cd 8796 ALC662_FIXUP_HEADSET_MODE,
73bdd597 8797 ALC668_FIXUP_HEADSET_MODE,
8e54b4ac 8798 ALC662_FIXUP_BASS_MODE4_CHMAP,
61a75f13 8799 ALC662_FIXUP_BASS_16,
a30c9aaa 8800 ALC662_FIXUP_BASS_1A,
8e54b4ac 8801 ALC662_FIXUP_BASS_CHMAP,
493a52a9 8802 ALC668_FIXUP_AUTO_MUTE,
5e6db669 8803 ALC668_FIXUP_DELL_DISABLE_AAMIX,
033b0a7c 8804 ALC668_FIXUP_DELL_XPS13,
9d4dc584 8805 ALC662_FIXUP_ASUS_Nx50,
fc7438b1 8806 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
3231e205 8807 ALC668_FIXUP_ASUS_Nx51,
5b7c5e1f 8808 ALC668_FIXUP_MIC_COEF,
11ba6111 8809 ALC668_FIXUP_ASUS_G751,
78f4f7c2
KY
8810 ALC891_FIXUP_HEADSET_MODE,
8811 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
9b51fe3e 8812 ALC662_FIXUP_ACER_VERITON,
1a3f0991 8813 ALC892_FIXUP_ASROCK_MOBO,
c6790c8e
KY
8814 ALC662_FIXUP_USI_FUNC,
8815 ALC662_FIXUP_USI_HEADSET_MODE,
ca169cc2 8816 ALC662_FIXUP_LENOVO_MULTI_CODECS,
00066e97 8817 ALC669_FIXUP_ACER_ASPIRE_ETHOS,
00066e97 8818 ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
5af29028 8819 ALC671_FIXUP_HP_HEADSET_MIC2,
d858c706 8820 ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
a124458a 8821 ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
6cb3b707
DH
8822};
8823
1727a771 8824static const struct hda_fixup alc662_fixups[] = {
2df03514 8825 [ALC662_FIXUP_ASPIRE] = {
1727a771
TI
8826 .type = HDA_FIXUP_PINS,
8827 .v.pins = (const struct hda_pintbl[]) {
2df03514
DC
8828 { 0x15, 0x99130112 }, /* subwoofer */
8829 { }
8830 }
8831 },
3e887f37
TI
8832 [ALC662_FIXUP_LED_GPIO1] = {
8833 .type = HDA_FIXUP_FUNC,
8834 .v.func = alc662_fixup_led_gpio1,
8835 },
6cb3b707 8836 [ALC662_FIXUP_IDEAPAD] = {
1727a771
TI
8837 .type = HDA_FIXUP_PINS,
8838 .v.pins = (const struct hda_pintbl[]) {
6cb3b707
DH
8839 { 0x17, 0x99130112 }, /* subwoofer */
8840 { }
3e887f37
TI
8841 },
8842 .chained = true,
8843 .chain_id = ALC662_FIXUP_LED_GPIO1,
6cb3b707 8844 },
6be7948f 8845 [ALC272_FIXUP_MARIO] = {
1727a771 8846 .type = HDA_FIXUP_FUNC,
b5bfbc67 8847 .v.func = alc272_fixup_mario,
d2ebd479
AA
8848 },
8849 [ALC662_FIXUP_CZC_P10T] = {
1727a771 8850 .type = HDA_FIXUP_VERBS,
d2ebd479
AA
8851 .v.verbs = (const struct hda_verb[]) {
8852 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
8853 {}
8854 }
8855 },
94024cd1 8856 [ALC662_FIXUP_SKU_IGNORE] = {
1727a771 8857 .type = HDA_FIXUP_FUNC,
23d30f28 8858 .v.func = alc_fixup_sku_ignore,
c6b35874 8859 },
e59ea3ed 8860 [ALC662_FIXUP_HP_RP5800] = {
1727a771
TI
8861 .type = HDA_FIXUP_PINS,
8862 .v.pins = (const struct hda_pintbl[]) {
e59ea3ed
TI
8863 { 0x14, 0x0221201f }, /* HP out */
8864 { }
8865 },
8866 .chained = true,
8867 .chain_id = ALC662_FIXUP_SKU_IGNORE
8868 },
53c334ad 8869 [ALC662_FIXUP_ASUS_MODE1] = {
1727a771
TI
8870 .type = HDA_FIXUP_PINS,
8871 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
8872 { 0x14, 0x99130110 }, /* speaker */
8873 { 0x18, 0x01a19c20 }, /* mic */
8874 { 0x19, 0x99a3092f }, /* int-mic */
8875 { 0x21, 0x0121401f }, /* HP out */
8876 { }
8877 },
8878 .chained = true,
8879 .chain_id = ALC662_FIXUP_SKU_IGNORE
8880 },
8881 [ALC662_FIXUP_ASUS_MODE2] = {
1727a771
TI
8882 .type = HDA_FIXUP_PINS,
8883 .v.pins = (const struct hda_pintbl[]) {
2996bdba
TI
8884 { 0x14, 0x99130110 }, /* speaker */
8885 { 0x18, 0x01a19820 }, /* mic */
8886 { 0x19, 0x99a3092f }, /* int-mic */
8887 { 0x1b, 0x0121401f }, /* HP out */
8888 { }
8889 },
53c334ad
TI
8890 .chained = true,
8891 .chain_id = ALC662_FIXUP_SKU_IGNORE
8892 },
8893 [ALC662_FIXUP_ASUS_MODE3] = {
1727a771
TI
8894 .type = HDA_FIXUP_PINS,
8895 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
8896 { 0x14, 0x99130110 }, /* speaker */
8897 { 0x15, 0x0121441f }, /* HP */
8898 { 0x18, 0x01a19840 }, /* mic */
8899 { 0x19, 0x99a3094f }, /* int-mic */
8900 { 0x21, 0x01211420 }, /* HP2 */
8901 { }
8902 },
8903 .chained = true,
8904 .chain_id = ALC662_FIXUP_SKU_IGNORE
8905 },
8906 [ALC662_FIXUP_ASUS_MODE4] = {
1727a771
TI
8907 .type = HDA_FIXUP_PINS,
8908 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
8909 { 0x14, 0x99130110 }, /* speaker */
8910 { 0x16, 0x99130111 }, /* speaker */
8911 { 0x18, 0x01a19840 }, /* mic */
8912 { 0x19, 0x99a3094f }, /* int-mic */
8913 { 0x21, 0x0121441f }, /* HP */
8914 { }
8915 },
8916 .chained = true,
8917 .chain_id = ALC662_FIXUP_SKU_IGNORE
8918 },
8919 [ALC662_FIXUP_ASUS_MODE5] = {
1727a771
TI
8920 .type = HDA_FIXUP_PINS,
8921 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
8922 { 0x14, 0x99130110 }, /* speaker */
8923 { 0x15, 0x0121441f }, /* HP */
8924 { 0x16, 0x99130111 }, /* speaker */
8925 { 0x18, 0x01a19840 }, /* mic */
8926 { 0x19, 0x99a3094f }, /* int-mic */
8927 { }
8928 },
8929 .chained = true,
8930 .chain_id = ALC662_FIXUP_SKU_IGNORE
8931 },
8932 [ALC662_FIXUP_ASUS_MODE6] = {
1727a771
TI
8933 .type = HDA_FIXUP_PINS,
8934 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
8935 { 0x14, 0x99130110 }, /* speaker */
8936 { 0x15, 0x01211420 }, /* HP2 */
8937 { 0x18, 0x01a19840 }, /* mic */
8938 { 0x19, 0x99a3094f }, /* int-mic */
8939 { 0x1b, 0x0121441f }, /* HP */
8940 { }
8941 },
8942 .chained = true,
8943 .chain_id = ALC662_FIXUP_SKU_IGNORE
8944 },
8945 [ALC662_FIXUP_ASUS_MODE7] = {
1727a771
TI
8946 .type = HDA_FIXUP_PINS,
8947 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
8948 { 0x14, 0x99130110 }, /* speaker */
8949 { 0x17, 0x99130111 }, /* speaker */
8950 { 0x18, 0x01a19840 }, /* mic */
8951 { 0x19, 0x99a3094f }, /* int-mic */
8952 { 0x1b, 0x01214020 }, /* HP */
8953 { 0x21, 0x0121401f }, /* HP */
8954 { }
8955 },
8956 .chained = true,
8957 .chain_id = ALC662_FIXUP_SKU_IGNORE
8958 },
8959 [ALC662_FIXUP_ASUS_MODE8] = {
1727a771
TI
8960 .type = HDA_FIXUP_PINS,
8961 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
8962 { 0x14, 0x99130110 }, /* speaker */
8963 { 0x12, 0x99a30970 }, /* int-mic */
8964 { 0x15, 0x01214020 }, /* HP */
8965 { 0x17, 0x99130111 }, /* speaker */
8966 { 0x18, 0x01a19840 }, /* mic */
8967 { 0x21, 0x0121401f }, /* HP */
8968 { }
8969 },
8970 .chained = true,
8971 .chain_id = ALC662_FIXUP_SKU_IGNORE
2996bdba 8972 },
1565cc35 8973 [ALC662_FIXUP_NO_JACK_DETECT] = {
1727a771 8974 .type = HDA_FIXUP_FUNC,
1565cc35
TI
8975 .v.func = alc_fixup_no_jack_detect,
8976 },
edfe3bfc 8977 [ALC662_FIXUP_ZOTAC_Z68] = {
1727a771
TI
8978 .type = HDA_FIXUP_PINS,
8979 .v.pins = (const struct hda_pintbl[]) {
edfe3bfc
DH
8980 { 0x1b, 0x02214020 }, /* Front HP */
8981 { }
8982 }
8983 },
125821ae 8984 [ALC662_FIXUP_INV_DMIC] = {
1727a771 8985 .type = HDA_FIXUP_FUNC,
9d36a7dc 8986 .v.func = alc_fixup_inv_dmic,
125821ae 8987 },
033b0a7c
GM
8988 [ALC668_FIXUP_DELL_XPS13] = {
8989 .type = HDA_FIXUP_FUNC,
8990 .v.func = alc_fixup_dell_xps13,
8991 .chained = true,
8992 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
8993 },
5e6db669
GM
8994 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
8995 .type = HDA_FIXUP_FUNC,
8996 .v.func = alc_fixup_disable_aamix,
8997 .chained = true,
8998 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
8999 },
493a52a9
HW
9000 [ALC668_FIXUP_AUTO_MUTE] = {
9001 .type = HDA_FIXUP_FUNC,
9002 .v.func = alc_fixup_auto_mute_via_amp,
9003 .chained = true,
9004 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
9005 },
1f8b46cd
DH
9006 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
9007 .type = HDA_FIXUP_PINS,
9008 .v.pins = (const struct hda_pintbl[]) {
9009 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
9010 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
9011 { }
9012 },
9013 .chained = true,
9014 .chain_id = ALC662_FIXUP_HEADSET_MODE
9015 },
9016 [ALC662_FIXUP_HEADSET_MODE] = {
9017 .type = HDA_FIXUP_FUNC,
9018 .v.func = alc_fixup_headset_mode_alc662,
9019 },
73bdd597
DH
9020 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
9021 .type = HDA_FIXUP_PINS,
9022 .v.pins = (const struct hda_pintbl[]) {
9023 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
9024 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
9025 { }
9026 },
9027 .chained = true,
9028 .chain_id = ALC668_FIXUP_HEADSET_MODE
9029 },
9030 [ALC668_FIXUP_HEADSET_MODE] = {
9031 .type = HDA_FIXUP_FUNC,
9032 .v.func = alc_fixup_headset_mode_alc668,
9033 },
8e54b4ac 9034 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
8e383953 9035 .type = HDA_FIXUP_FUNC,
eb9ca3ab 9036 .v.func = alc_fixup_bass_chmap,
8e383953
TI
9037 .chained = true,
9038 .chain_id = ALC662_FIXUP_ASUS_MODE4
9039 },
61a75f13
DH
9040 [ALC662_FIXUP_BASS_16] = {
9041 .type = HDA_FIXUP_PINS,
9042 .v.pins = (const struct hda_pintbl[]) {
9043 {0x16, 0x80106111}, /* bass speaker */
9044 {}
9045 },
9046 .chained = true,
9047 .chain_id = ALC662_FIXUP_BASS_CHMAP,
9048 },
a30c9aaa
TI
9049 [ALC662_FIXUP_BASS_1A] = {
9050 .type = HDA_FIXUP_PINS,
9051 .v.pins = (const struct hda_pintbl[]) {
9052 {0x1a, 0x80106111}, /* bass speaker */
9053 {}
9054 },
8e54b4ac
DH
9055 .chained = true,
9056 .chain_id = ALC662_FIXUP_BASS_CHMAP,
a30c9aaa 9057 },
8e54b4ac 9058 [ALC662_FIXUP_BASS_CHMAP] = {
a30c9aaa 9059 .type = HDA_FIXUP_FUNC,
eb9ca3ab 9060 .v.func = alc_fixup_bass_chmap,
a30c9aaa 9061 },
9d4dc584
BM
9062 [ALC662_FIXUP_ASUS_Nx50] = {
9063 .type = HDA_FIXUP_FUNC,
9064 .v.func = alc_fixup_auto_mute_via_amp,
9065 .chained = true,
9066 .chain_id = ALC662_FIXUP_BASS_1A
9067 },
fc7438b1
MP
9068 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
9069 .type = HDA_FIXUP_FUNC,
9070 .v.func = alc_fixup_headset_mode_alc668,
9071 .chain_id = ALC662_FIXUP_BASS_CHMAP
9072 },
3231e205
YP
9073 [ALC668_FIXUP_ASUS_Nx51] = {
9074 .type = HDA_FIXUP_PINS,
9075 .v.pins = (const struct hda_pintbl[]) {
fc7438b1
MP
9076 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
9077 { 0x1a, 0x90170151 }, /* bass speaker */
9078 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
3231e205
YP
9079 {}
9080 },
9081 .chained = true,
fc7438b1 9082 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
3231e205 9083 },
5b7c5e1f 9084 [ALC668_FIXUP_MIC_COEF] = {
11ba6111
TI
9085 .type = HDA_FIXUP_VERBS,
9086 .v.verbs = (const struct hda_verb[]) {
9087 { 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
9088 { 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
9089 {}
9090 },
9091 },
5b7c5e1f
TI
9092 [ALC668_FIXUP_ASUS_G751] = {
9093 .type = HDA_FIXUP_PINS,
9094 .v.pins = (const struct hda_pintbl[]) {
9095 { 0x16, 0x0421101f }, /* HP */
9096 {}
9097 },
9098 .chained = true,
9099 .chain_id = ALC668_FIXUP_MIC_COEF
9100 },
78f4f7c2
KY
9101 [ALC891_FIXUP_HEADSET_MODE] = {
9102 .type = HDA_FIXUP_FUNC,
9103 .v.func = alc_fixup_headset_mode,
9104 },
9105 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
9106 .type = HDA_FIXUP_PINS,
9107 .v.pins = (const struct hda_pintbl[]) {
9108 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
9109 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
9110 { }
9111 },
9112 .chained = true,
9113 .chain_id = ALC891_FIXUP_HEADSET_MODE
9114 },
9b51fe3e
SB
9115 [ALC662_FIXUP_ACER_VERITON] = {
9116 .type = HDA_FIXUP_PINS,
9117 .v.pins = (const struct hda_pintbl[]) {
9118 { 0x15, 0x50170120 }, /* no internal speaker */
9119 { }
9120 }
9121 },
1a3f0991
TI
9122 [ALC892_FIXUP_ASROCK_MOBO] = {
9123 .type = HDA_FIXUP_PINS,
9124 .v.pins = (const struct hda_pintbl[]) {
9125 { 0x15, 0x40f000f0 }, /* disabled */
9126 { 0x16, 0x40f000f0 }, /* disabled */
1a3f0991
TI
9127 { }
9128 }
9129 },
c6790c8e
KY
9130 [ALC662_FIXUP_USI_FUNC] = {
9131 .type = HDA_FIXUP_FUNC,
9132 .v.func = alc662_fixup_usi_headset_mic,
9133 },
9134 [ALC662_FIXUP_USI_HEADSET_MODE] = {
9135 .type = HDA_FIXUP_PINS,
9136 .v.pins = (const struct hda_pintbl[]) {
9137 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
9138 { 0x18, 0x01a1903d },
9139 { }
9140 },
9141 .chained = true,
9142 .chain_id = ALC662_FIXUP_USI_FUNC
9143 },
ca169cc2
KY
9144 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
9145 .type = HDA_FIXUP_FUNC,
9146 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
9147 },
00066e97
SB
9148 [ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
9149 .type = HDA_FIXUP_FUNC,
9150 .v.func = alc662_fixup_aspire_ethos_hp,
9151 },
00066e97
SB
9152 [ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
9153 .type = HDA_FIXUP_PINS,
9154 .v.pins = (const struct hda_pintbl[]) {
9155 { 0x15, 0x92130110 }, /* front speakers */
9156 { 0x18, 0x99130111 }, /* center/subwoofer */
9157 { 0x1b, 0x11130012 }, /* surround plus jack for HP */
9158 { }
9159 },
9160 .chained = true,
336820c4 9161 .chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
00066e97 9162 },
5af29028
KY
9163 [ALC671_FIXUP_HP_HEADSET_MIC2] = {
9164 .type = HDA_FIXUP_FUNC,
9165 .v.func = alc671_fixup_hp_headset_mic2,
9166 },
d858c706
JHP
9167 [ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
9168 .type = HDA_FIXUP_PINS,
9169 .v.pins = (const struct hda_pintbl[]) {
9170 { 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
9171 { }
9172 },
9173 .chained = true,
9174 .chain_id = ALC662_FIXUP_USI_FUNC
9175 },
a124458a
JHP
9176 [ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
9177 .type = HDA_FIXUP_PINS,
9178 .v.pins = (const struct hda_pintbl[]) {
9179 { 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
9180 { 0x1b, 0x0221144f },
9181 { }
9182 },
9183 .chained = true,
9184 .chain_id = ALC662_FIXUP_USI_FUNC
9185 },
6cb3b707
DH
9186};
9187
a9111321 9188static const struct snd_pci_quirk alc662_fixup_tbl[] = {
53c334ad 9189 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
d3d3835c 9190 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
02f6ff90 9191 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
a6c47a85 9192 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
94024cd1 9193 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
125821ae 9194 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
1801928e 9195 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
2df03514 9196 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
a124458a 9197 SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
d858c706 9198 SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
73bdd597
DH
9199 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
9200 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
c5d019c3 9201 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
033b0a7c 9202 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
467e1436 9203 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
09d2014f 9204 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
ad8ff99e 9205 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8dc9abb9
KY
9206 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
9207 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
6a98e34b 9208 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
e59ea3ed 9209 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
2da2dc9e 9210 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
83a9efb5 9211 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
db8948e6 9212 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
9d4dc584 9213 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
11ba6111 9214 SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
8e54b4ac 9215 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
61a75f13 9216 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
3231e205
YP
9217 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
9218 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
c7efff92 9219 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
61a75f13 9220 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
8e54b4ac 9221 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
1565cc35 9222 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
53c334ad 9223 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
a0e90acc 9224 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
c6790c8e 9225 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
ca169cc2 9226 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
d4118588 9227 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
6cb3b707 9228 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
1a3f0991 9229 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
edfe3bfc 9230 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
9b51fe3e 9231 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
d2ebd479 9232 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
00066e97 9233 SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
53c334ad
TI
9234
9235#if 0
9236 /* Below is a quirk table taken from the old code.
9237 * Basically the device should work as is without the fixup table.
9238 * If BIOS doesn't give a proper info, enable the corresponding
9239 * fixup entry.
7d7eb9ea 9240 */
53c334ad
TI
9241 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
9242 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
9243 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
9244 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
9245 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
9246 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9247 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
9248 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
9249 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
9250 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9251 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
9252 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
9253 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
9254 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
9255 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
9256 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9257 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
9258 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
9259 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9260 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
9261 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
9262 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9263 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
9264 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
9265 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
9266 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9267 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
9268 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
9269 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9270 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
9271 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9272 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9273 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
9274 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
9275 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
9276 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
9277 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
9278 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
9279 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
9280 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9281 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
9282 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
9283 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
9284 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
9285 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
9286 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
9287 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
9288 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
9289 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
9290 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
9291#endif
6cb3b707
DH
9292 {}
9293};
9294
1727a771 9295static const struct hda_model_fixup alc662_fixup_models[] = {
aa3841b5
TI
9296 {.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
9297 {.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
6be7948f 9298 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
aa3841b5 9299 {.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
53c334ad
TI
9300 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
9301 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
9302 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
9303 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
9304 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
9305 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
9306 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
9307 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
aa3841b5 9308 {.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
6e72aa5f 9309 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
aa3841b5 9310 {.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
e32aa85a 9311 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
aa3841b5
TI
9312 {.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
9313 {.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
9314 {.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
9315 {.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
9316 {.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
9317 {.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
9318 {.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
9319 {.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
40c51675 9320 {.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
aa3841b5
TI
9321 {.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
9322 {.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
9323 {.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
9324 {.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
9325 {.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
ba90d6a6 9326 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
00066e97 9327 {.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
6be7948f
TB
9328 {}
9329};
6cb3b707 9330
532895c5 9331static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
78f4f7c2
KY
9332 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
9333 {0x17, 0x02211010},
9334 {0x18, 0x01a19030},
9335 {0x1a, 0x01813040},
9336 {0x21, 0x01014020}),
4b4e0e32
HW
9337 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
9338 {0x16, 0x01813030},
9339 {0x17, 0x02211010},
9340 {0x18, 0x01a19040},
9341 {0x21, 0x01014020}),
1f8b46cd 9342 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
1f8b46cd 9343 {0x14, 0x01014010},
1f8b46cd 9344 {0x18, 0x01a19020},
1f8b46cd 9345 {0x1a, 0x0181302f},
11580297 9346 {0x1b, 0x0221401f}),
76c2132e
DH
9347 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
9348 {0x12, 0x99a30130},
9349 {0x14, 0x90170110},
9350 {0x15, 0x0321101f},
11580297 9351 {0x16, 0x03011020}),
76c2132e
DH
9352 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
9353 {0x12, 0x99a30140},
9354 {0x14, 0x90170110},
9355 {0x15, 0x0321101f},
11580297 9356 {0x16, 0x03011020}),
76c2132e
DH
9357 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
9358 {0x12, 0x99a30150},
9359 {0x14, 0x90170110},
9360 {0x15, 0x0321101f},
11580297 9361 {0x16, 0x03011020}),
76c2132e 9362 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
76c2132e
DH
9363 {0x14, 0x90170110},
9364 {0x15, 0x0321101f},
11580297 9365 {0x16, 0x03011020}),
76c2132e
DH
9366 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
9367 {0x12, 0x90a60130},
9368 {0x14, 0x90170110},
11580297 9369 {0x15, 0x0321101f}),
5af29028
KY
9370 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
9371 {0x14, 0x01014010},
9372 {0x17, 0x90170150},
f2adbae0 9373 {0x19, 0x02a11060},
5af29028
KY
9374 {0x1b, 0x01813030},
9375 {0x21, 0x02211020}),
9376 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
9377 {0x14, 0x01014010},
9378 {0x18, 0x01a19040},
9379 {0x1b, 0x01813030},
9380 {0x21, 0x02211020}),
9381 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
9382 {0x14, 0x01014020},
9383 {0x17, 0x90170110},
9384 {0x18, 0x01a19050},
9385 {0x1b, 0x01813040},
9386 {0x21, 0x02211030}),
532895c5
HW
9387 {}
9388};
9389
1d045db9
TI
9390/*
9391 */
bc9f98a9
KY
9392static int patch_alc662(struct hda_codec *codec)
9393{
9394 struct alc_spec *spec;
3de95173 9395 int err;
bc9f98a9 9396
3de95173
TI
9397 err = alc_alloc_spec(codec, 0x0b);
9398 if (err < 0)
9399 return err;
bc9f98a9 9400
3de95173 9401 spec = codec->spec;
1f0f4b80 9402
225068ab
TI
9403 spec->shutup = alc_eapd_shutup;
9404
53c334ad
TI
9405 /* handle multiple HPs as is */
9406 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
9407
2c3bf9ab
TI
9408 alc_fix_pll_init(codec, 0x20, 0x04, 15);
9409
7639a06c 9410 switch (codec->core.vendor_id) {
f3f9185f
KY
9411 case 0x10ec0668:
9412 spec->init_hook = alc668_restore_default_value;
9413 break;
f3f9185f 9414 }
8663ff75 9415
c9af753f
TI
9416 alc_pre_init(codec);
9417
1727a771 9418 snd_hda_pick_fixup(codec, alc662_fixup_models,
8e5a0509 9419 alc662_fixup_tbl, alc662_fixups);
0fc1e447 9420 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
1727a771 9421 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
8e5a0509
TI
9422
9423 alc_auto_parse_customize_define(codec);
9424
7504b6cd
TI
9425 if (has_cdefine_beep(codec))
9426 spec->gen.beep_nid = 0x01;
9427
1bb7e43e 9428 if ((alc_get_coef0(codec) & (1 << 14)) &&
5100cd07 9429 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
e16fb6d1 9430 spec->cdefine.platform_type == 1) {
6134b1a2
WY
9431 err = alc_codec_rename(codec, "ALC272X");
9432 if (err < 0)
e16fb6d1 9433 goto error;
20ca0c35 9434 }
274693f3 9435
b9c5106c
TI
9436 /* automatic parse from the BIOS config */
9437 err = alc662_parse_auto_config(codec);
e16fb6d1
TI
9438 if (err < 0)
9439 goto error;
bc9f98a9 9440
7504b6cd 9441 if (!spec->gen.no_analog && spec->gen.beep_nid) {
7639a06c 9442 switch (codec->core.vendor_id) {
da00c244 9443 case 0x10ec0662:
fea80fae 9444 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
da00c244
KY
9445 break;
9446 case 0x10ec0272:
9447 case 0x10ec0663:
9448 case 0x10ec0665:
9ad54547 9449 case 0x10ec0668:
fea80fae 9450 err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
da00c244
KY
9451 break;
9452 case 0x10ec0273:
fea80fae 9453 err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
da00c244
KY
9454 break;
9455 }
fea80fae
TI
9456 if (err < 0)
9457 goto error;
cec27c89 9458 }
2134ea4f 9459
1727a771 9460 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 9461
bc9f98a9 9462 return 0;
801f49d3 9463
e16fb6d1
TI
9464 error:
9465 alc_free(codec);
9466 return err;
b478b998
KY
9467}
9468
d1eb57f4
KY
9469/*
9470 * ALC680 support
9471 */
d1eb57f4 9472
d1eb57f4
KY
9473static int alc680_parse_auto_config(struct hda_codec *codec)
9474{
3e6179b8 9475 return alc_parse_auto_config(codec, NULL, NULL);
d1eb57f4
KY
9476}
9477
d1eb57f4 9478/*
d1eb57f4 9479 */
d1eb57f4
KY
9480static int patch_alc680(struct hda_codec *codec)
9481{
d1eb57f4
KY
9482 int err;
9483
1f0f4b80 9484 /* ALC680 has no aa-loopback mixer */
3de95173
TI
9485 err = alc_alloc_spec(codec, 0);
9486 if (err < 0)
9487 return err;
1f0f4b80 9488
1ebec5f2
TI
9489 /* automatic parse from the BIOS config */
9490 err = alc680_parse_auto_config(codec);
9491 if (err < 0) {
9492 alc_free(codec);
9493 return err;
d1eb57f4
KY
9494 }
9495
d1eb57f4
KY
9496 return 0;
9497}
9498
1da177e4
LT
9499/*
9500 * patch entries
9501 */
b9a94a9c 9502static const struct hda_device_id snd_hda_id_realtek[] = {
0a6f0600 9503 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
b9a94a9c 9504 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
2a36c16e 9505 HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
4231430d 9506 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
b9a94a9c
TI
9507 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
9508 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
dcd4f0db 9509 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
b9a94a9c 9510 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
736f20a7 9511 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
7fbdcd83 9512 HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
b9a94a9c
TI
9513 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
9514 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
f429e7e4 9515 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
b9a94a9c
TI
9516 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
9517 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
9518 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
9519 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
9520 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
9521 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
9522 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
dcd4f0db 9523 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
b9a94a9c
TI
9524 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
9525 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
9526 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
9527 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
9528 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
9529 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
0a6f0600 9530 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
b9a94a9c
TI
9531 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
9532 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
0a6f0600 9533 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
b9a94a9c
TI
9534 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
9535 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
9536 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
dcd4f0db 9537 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
7d727869 9538 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
b9a94a9c 9539 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
28f1f9b2 9540 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
1078bef0 9541 HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
f0778871 9542 HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
b9a94a9c
TI
9543 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
9544 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
9545 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
9546 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
9547 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
9548 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
9549 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
9550 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
9551 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
9552 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
9553 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
9554 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
9555 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
9556 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
6fbae35a
KY
9557 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
9558 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
9559 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
83629532 9560 HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
78f4f7c2 9561 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
b9a94a9c
TI
9562 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
9563 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
9564 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
9565 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
9566 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
9567 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
9568 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
9569 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
9570 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
9571 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
9572 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
9573 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
9574 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
6d9ffcff 9575 HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
65553b12 9576 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
a535ad57 9577 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
1da177e4
LT
9578 {} /* terminator */
9579};
b9a94a9c 9580MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
1289e9e8
TI
9581
9582MODULE_LICENSE("GPL");
9583MODULE_DESCRIPTION("Realtek HD-audio codec");
9584
d8a766a1 9585static struct hda_codec_driver realtek_driver = {
b9a94a9c 9586 .id = snd_hda_id_realtek,
1289e9e8
TI
9587};
9588
d8a766a1 9589module_hda_codec_driver(realtek_driver);