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