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