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