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