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