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