]> git.ipfire.org Git - thirdparty/linux.git/blame - sound/pci/hda/patch_realtek.c
ALSA: hda/realtek - Fix speakers on Acer Predator Helios 500 Ryzen laptops
[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,
7f665b1c
JS
1867 ALC1220_FIXUP_SYSTEM76_ORYP5,
1868 ALC1220_FIXUP_SYSTEM76_ORYP5_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
2073static void alc1220_fixup_system76_oryp5(struct hda_codec *codec,
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 },
7f665b1c
JS
2325 [ALC1220_FIXUP_SYSTEM76_ORYP5] = {
2326 .type = HDA_FIXUP_FUNC,
2327 .v.func = alc1220_fixup_system76_oryp5,
2328 },
2329 [ALC1220_FIXUP_SYSTEM76_ORYP5_PINS] = {
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,
2336 .chain_id = ALC1220_FIXUP_SYSTEM76_ORYP5,
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),
7f665b1c
JS
2414 SND_PCI_QUIRK(0x1558, 0x96e1, "System76 Oryx Pro (oryp5)", ALC1220_FIXUP_SYSTEM76_ORYP5_PINS),
2415 SND_PCI_QUIRK(0x1558, 0x97e1, "System76 Oryx Pro (oryp5)", ALC1220_FIXUP_SYSTEM76_ORYP5_PINS),
7a6069bf
TI
2416 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2417 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
ac9b1cdd 2418 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
68ef0561 2419 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
ff818c24
TI
2420 {}
2421};
2422
1727a771 2423static const struct hda_model_fixup alc882_fixup_models[] = {
772c2917
TI
2424 {.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2425 {.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2426 {.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2427 {.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2428 {.id = ALC889_FIXUP_CD, .name = "cd"},
2429 {.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2430 {.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2431 {.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2432 {.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2433 {.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2434 {.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2435 {.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2436 {.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2437 {.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2438 {.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
912093bc
TI
2439 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2440 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2441 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
772c2917
TI
2442 {.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2443 {.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2444 {.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2445 {.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2446 {.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2447 {.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2448 {.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2449 {.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
6e72aa5f 2450 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
e427c237 2451 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
772c2917 2452 {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
ba90d6a6 2453 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
772c2917 2454 {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
912093bc
TI
2455 {}
2456};
2457
f6a92248 2458/*
1d045db9 2459 * BIOS auto configuration
f6a92248 2460 */
1d045db9
TI
2461/* almost identical with ALC880 parser... */
2462static int alc882_parse_auto_config(struct hda_codec *codec)
2463{
1d045db9 2464 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
3e6179b8
TI
2465 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2466 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
1d045db9 2467}
b896b4eb 2468
1d045db9
TI
2469/*
2470 */
1d045db9 2471static int patch_alc882(struct hda_codec *codec)
f6a92248
KY
2472{
2473 struct alc_spec *spec;
1a97b7f2 2474 int err;
f6a92248 2475
3de95173
TI
2476 err = alc_alloc_spec(codec, 0x0b);
2477 if (err < 0)
2478 return err;
f6a92248 2479
3de95173 2480 spec = codec->spec;
1f0f4b80 2481
7639a06c 2482 switch (codec->core.vendor_id) {
1d045db9
TI
2483 case 0x10ec0882:
2484 case 0x10ec0885:
acf08081 2485 case 0x10ec0900:
a535ad57 2486 case 0x10ec1220:
1d045db9
TI
2487 break;
2488 default:
2489 /* ALC883 and variants */
2490 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2491 break;
c793bec5 2492 }
977ddd6b 2493
1727a771 2494 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
912093bc 2495 alc882_fixups);
1727a771 2496 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
ff818c24 2497
1d045db9
TI
2498 alc_auto_parse_customize_define(codec);
2499
7504b6cd
TI
2500 if (has_cdefine_beep(codec))
2501 spec->gen.beep_nid = 0x01;
2502
1a97b7f2
TI
2503 /* automatic parse from the BIOS config */
2504 err = alc882_parse_auto_config(codec);
2505 if (err < 0)
2506 goto error;
f6a92248 2507
fea80fae
TI
2508 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2509 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2510 if (err < 0)
2511 goto error;
2512 }
f6a92248 2513
1727a771 2514 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 2515
f6a92248 2516 return 0;
e16fb6d1
TI
2517
2518 error:
2519 alc_free(codec);
2520 return err;
f6a92248
KY
2521}
2522
df694daa 2523
df694daa 2524/*
1d045db9 2525 * ALC262 support
df694daa 2526 */
1d045db9 2527static int alc262_parse_auto_config(struct hda_codec *codec)
df694daa 2528{
1d045db9 2529 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
3e6179b8
TI
2530 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2531 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
df694daa
KY
2532}
2533
df694daa 2534/*
1d045db9 2535 * Pin config fixes
df694daa 2536 */
cfc9b06f 2537enum {
ea4e7af1 2538 ALC262_FIXUP_FSC_H270,
7513e6da 2539 ALC262_FIXUP_FSC_S7110,
ea4e7af1
TI
2540 ALC262_FIXUP_HP_Z200,
2541 ALC262_FIXUP_TYAN,
c470150c 2542 ALC262_FIXUP_LENOVO_3000,
b42590b8
TI
2543 ALC262_FIXUP_BENQ,
2544 ALC262_FIXUP_BENQ_T31,
6e72aa5f 2545 ALC262_FIXUP_INV_DMIC,
b5c6611f 2546 ALC262_FIXUP_INTEL_BAYLEYBAY,
cfc9b06f
TI
2547};
2548
1727a771 2549static const struct hda_fixup alc262_fixups[] = {
ea4e7af1 2550 [ALC262_FIXUP_FSC_H270] = {
1727a771
TI
2551 .type = HDA_FIXUP_PINS,
2552 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
2553 { 0x14, 0x99130110 }, /* speaker */
2554 { 0x15, 0x0221142f }, /* front HP */
2555 { 0x1b, 0x0121141f }, /* rear HP */
2556 { }
2557 }
2558 },
7513e6da
TI
2559 [ALC262_FIXUP_FSC_S7110] = {
2560 .type = HDA_FIXUP_PINS,
2561 .v.pins = (const struct hda_pintbl[]) {
2562 { 0x15, 0x90170110 }, /* speaker */
2563 { }
2564 },
2565 .chained = true,
2566 .chain_id = ALC262_FIXUP_BENQ,
2567 },
ea4e7af1 2568 [ALC262_FIXUP_HP_Z200] = {
1727a771
TI
2569 .type = HDA_FIXUP_PINS,
2570 .v.pins = (const struct hda_pintbl[]) {
1d045db9 2571 { 0x16, 0x99130120 }, /* internal speaker */
73413b12
TI
2572 { }
2573 }
cfc9b06f 2574 },
ea4e7af1 2575 [ALC262_FIXUP_TYAN] = {
1727a771
TI
2576 .type = HDA_FIXUP_PINS,
2577 .v.pins = (const struct hda_pintbl[]) {
ea4e7af1
TI
2578 { 0x14, 0x1993e1f0 }, /* int AUX */
2579 { }
2580 }
2581 },
c470150c 2582 [ALC262_FIXUP_LENOVO_3000] = {
fd108215
TI
2583 .type = HDA_FIXUP_PINCTLS,
2584 .v.pins = (const struct hda_pintbl[]) {
2585 { 0x19, PIN_VREF50 },
b42590b8
TI
2586 {}
2587 },
2588 .chained = true,
2589 .chain_id = ALC262_FIXUP_BENQ,
2590 },
2591 [ALC262_FIXUP_BENQ] = {
1727a771 2592 .type = HDA_FIXUP_VERBS,
b42590b8 2593 .v.verbs = (const struct hda_verb[]) {
c470150c
TI
2594 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2595 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2596 {}
2597 }
2598 },
b42590b8 2599 [ALC262_FIXUP_BENQ_T31] = {
1727a771 2600 .type = HDA_FIXUP_VERBS,
b42590b8
TI
2601 .v.verbs = (const struct hda_verb[]) {
2602 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2603 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2604 {}
2605 }
2606 },
6e72aa5f 2607 [ALC262_FIXUP_INV_DMIC] = {
1727a771 2608 .type = HDA_FIXUP_FUNC,
9d36a7dc 2609 .v.func = alc_fixup_inv_dmic,
6e72aa5f 2610 },
b5c6611f
ML
2611 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2612 .type = HDA_FIXUP_FUNC,
2613 .v.func = alc_fixup_no_depop_delay,
2614 },
cfc9b06f
TI
2615};
2616
1d045db9 2617static const struct snd_pci_quirk alc262_fixup_tbl[] = {
ea4e7af1 2618 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
7513e6da 2619 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
3dcd3be3 2620 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
ea4e7af1 2621 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
275ec0cb 2622 SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
ea4e7af1 2623 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
c470150c 2624 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
b42590b8
TI
2625 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2626 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
b5c6611f 2627 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
cfc9b06f
TI
2628 {}
2629};
df694daa 2630
1727a771 2631static const struct hda_model_fixup alc262_fixup_models[] = {
6e72aa5f 2632 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
e43c44d6
TI
2633 {.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2634 {.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2635 {.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2636 {.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2637 {.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2638 {.id = ALC262_FIXUP_BENQ, .name = "benq"},
2639 {.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2640 {.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
6e72aa5f
TI
2641 {}
2642};
1d045db9 2643
1d045db9
TI
2644/*
2645 */
1d045db9 2646static int patch_alc262(struct hda_codec *codec)
df694daa
KY
2647{
2648 struct alc_spec *spec;
df694daa
KY
2649 int err;
2650
3de95173
TI
2651 err = alc_alloc_spec(codec, 0x0b);
2652 if (err < 0)
2653 return err;
df694daa 2654
3de95173 2655 spec = codec->spec;
08c189f2 2656 spec->gen.shared_mic_vref_pin = 0x18;
1d045db9 2657
225068ab
TI
2658 spec->shutup = alc_eapd_shutup;
2659
1d045db9
TI
2660#if 0
2661 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2662 * under-run
2663 */
98b24883 2664 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
1d045db9 2665#endif
1d045db9
TI
2666 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2667
1727a771 2668 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
6e72aa5f 2669 alc262_fixups);
1727a771 2670 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
9c7f852e 2671
af741c15
TI
2672 alc_auto_parse_customize_define(codec);
2673
7504b6cd
TI
2674 if (has_cdefine_beep(codec))
2675 spec->gen.beep_nid = 0x01;
2676
42399f7a
TI
2677 /* automatic parse from the BIOS config */
2678 err = alc262_parse_auto_config(codec);
2679 if (err < 0)
2680 goto error;
df694daa 2681
fea80fae
TI
2682 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2683 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2684 if (err < 0)
2685 goto error;
2686 }
2134ea4f 2687
1727a771 2688 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 2689
1da177e4 2690 return 0;
e16fb6d1
TI
2691
2692 error:
2693 alc_free(codec);
2694 return err;
1da177e4
LT
2695}
2696
f32610ed 2697/*
1d045db9 2698 * ALC268
f32610ed 2699 */
1d045db9 2700/* bind Beep switches of both NID 0x0f and 0x10 */
a717777d
TI
2701static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2702 struct snd_ctl_elem_value *ucontrol)
2703{
2704 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2705 unsigned long pval;
2706 int err;
2707
2708 mutex_lock(&codec->control_mutex);
2709 pval = kcontrol->private_value;
2710 kcontrol->private_value = (pval & ~0xff) | 0x0f;
2711 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2712 if (err >= 0) {
2713 kcontrol->private_value = (pval & ~0xff) | 0x10;
2714 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2715 }
2716 kcontrol->private_value = pval;
2717 mutex_unlock(&codec->control_mutex);
2718 return err;
2719}
f32610ed 2720
1d045db9
TI
2721static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2722 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
a717777d
TI
2723 {
2724 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2725 .name = "Beep Playback Switch",
2726 .subdevice = HDA_SUBDEV_AMP_FLAG,
2727 .info = snd_hda_mixer_amp_switch_info,
2728 .get = snd_hda_mixer_amp_switch_get,
2729 .put = alc268_beep_switch_put,
2730 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
2731 },
f32610ed
JS
2732};
2733
1d045db9
TI
2734/* set PCBEEP vol = 0, mute connections */
2735static const struct hda_verb alc268_beep_init_verbs[] = {
2736 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2737 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2738 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2739 { }
f32610ed
JS
2740};
2741
6e72aa5f
TI
2742enum {
2743 ALC268_FIXUP_INV_DMIC,
cb766404 2744 ALC268_FIXUP_HP_EAPD,
24eff328 2745 ALC268_FIXUP_SPDIF,
6e72aa5f
TI
2746};
2747
1727a771 2748static const struct hda_fixup alc268_fixups[] = {
6e72aa5f 2749 [ALC268_FIXUP_INV_DMIC] = {
1727a771 2750 .type = HDA_FIXUP_FUNC,
9d36a7dc 2751 .v.func = alc_fixup_inv_dmic,
6e72aa5f 2752 },
cb766404 2753 [ALC268_FIXUP_HP_EAPD] = {
1727a771 2754 .type = HDA_FIXUP_VERBS,
cb766404
TI
2755 .v.verbs = (const struct hda_verb[]) {
2756 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
2757 {}
2758 }
2759 },
24eff328
TI
2760 [ALC268_FIXUP_SPDIF] = {
2761 .type = HDA_FIXUP_PINS,
2762 .v.pins = (const struct hda_pintbl[]) {
2763 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
2764 {}
2765 }
2766 },
6e72aa5f
TI
2767};
2768
1727a771 2769static const struct hda_model_fixup alc268_fixup_models[] = {
6e72aa5f 2770 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
cb766404 2771 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
03bf11c9 2772 {.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
cb766404
TI
2773 {}
2774};
2775
2776static const struct snd_pci_quirk alc268_fixup_tbl[] = {
24eff328 2777 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
fcd8f3b1 2778 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
cb766404
TI
2779 /* below is codec SSID since multiple Toshiba laptops have the
2780 * same PCI SSID 1179:ff00
2781 */
2782 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
6e72aa5f
TI
2783 {}
2784};
2785
f32610ed
JS
2786/*
2787 * BIOS auto configuration
2788 */
1d045db9 2789static int alc268_parse_auto_config(struct hda_codec *codec)
f32610ed 2790{
3e6179b8 2791 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
7504b6cd 2792 return alc_parse_auto_config(codec, NULL, alc268_ssids);
f32610ed
JS
2793}
2794
1d045db9
TI
2795/*
2796 */
1d045db9 2797static int patch_alc268(struct hda_codec *codec)
f32610ed
JS
2798{
2799 struct alc_spec *spec;
a5cb463a 2800 int i, err;
f32610ed 2801
1d045db9 2802 /* ALC268 has no aa-loopback mixer */
3de95173
TI
2803 err = alc_alloc_spec(codec, 0);
2804 if (err < 0)
2805 return err;
2806
2807 spec = codec->spec;
7504b6cd 2808 spec->gen.beep_nid = 0x01;
1f0f4b80 2809
225068ab
TI
2810 spec->shutup = alc_eapd_shutup;
2811
1727a771
TI
2812 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
2813 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
6e72aa5f 2814
6ebb8053
TI
2815 /* automatic parse from the BIOS config */
2816 err = alc268_parse_auto_config(codec);
e16fb6d1
TI
2817 if (err < 0)
2818 goto error;
f32610ed 2819
7504b6cd
TI
2820 if (err > 0 && !spec->gen.no_analog &&
2821 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
a5cb463a
TI
2822 for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
2823 if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
2824 &alc268_beep_mixer[i])) {
2825 err = -ENOMEM;
2826 goto error;
2827 }
2828 }
7504b6cd 2829 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
1d045db9
TI
2830 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
2831 /* override the amp caps for beep generator */
2832 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
2833 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
2834 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
2835 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
2836 (0 << AC_AMPCAP_MUTE_SHIFT));
2f893286
KY
2837 }
2838
1727a771 2839 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
6e72aa5f 2840
f32610ed 2841 return 0;
e16fb6d1
TI
2842
2843 error:
2844 alc_free(codec);
2845 return err;
f32610ed
JS
2846}
2847
bc9f98a9 2848/*
1d045db9 2849 * ALC269
bc9f98a9 2850 */
08c189f2 2851
1d045db9 2852static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
1d045db9 2853 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
bc9f98a9
KY
2854};
2855
1d045db9 2856static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
1d045db9 2857 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
bc9f98a9 2858};
291702f0 2859
1d045db9
TI
2860/* different alc269-variants */
2861enum {
2862 ALC269_TYPE_ALC269VA,
2863 ALC269_TYPE_ALC269VB,
2864 ALC269_TYPE_ALC269VC,
adcc70b2 2865 ALC269_TYPE_ALC269VD,
065380f0
KY
2866 ALC269_TYPE_ALC280,
2867 ALC269_TYPE_ALC282,
2af02be7 2868 ALC269_TYPE_ALC283,
065380f0 2869 ALC269_TYPE_ALC284,
4731d5de 2870 ALC269_TYPE_ALC293,
7fc7d047 2871 ALC269_TYPE_ALC286,
506b62c3 2872 ALC269_TYPE_ALC298,
1d04c9de 2873 ALC269_TYPE_ALC255,
4344aec8 2874 ALC269_TYPE_ALC256,
f429e7e4 2875 ALC269_TYPE_ALC257,
0a6f0600 2876 ALC269_TYPE_ALC215,
4231430d 2877 ALC269_TYPE_ALC225,
dcd4f0db 2878 ALC269_TYPE_ALC294,
1078bef0 2879 ALC269_TYPE_ALC300,
6fbae35a 2880 ALC269_TYPE_ALC700,
bc9f98a9
KY
2881};
2882
2883/*
1d045db9 2884 * BIOS auto configuration
bc9f98a9 2885 */
1d045db9
TI
2886static int alc269_parse_auto_config(struct hda_codec *codec)
2887{
1d045db9 2888 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
3e6179b8
TI
2889 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
2890 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2891 struct alc_spec *spec = codec->spec;
adcc70b2
KY
2892 const hda_nid_t *ssids;
2893
2894 switch (spec->codec_variant) {
2895 case ALC269_TYPE_ALC269VA:
2896 case ALC269_TYPE_ALC269VC:
065380f0
KY
2897 case ALC269_TYPE_ALC280:
2898 case ALC269_TYPE_ALC284:
4731d5de 2899 case ALC269_TYPE_ALC293:
adcc70b2
KY
2900 ssids = alc269va_ssids;
2901 break;
2902 case ALC269_TYPE_ALC269VB:
2903 case ALC269_TYPE_ALC269VD:
065380f0 2904 case ALC269_TYPE_ALC282:
2af02be7 2905 case ALC269_TYPE_ALC283:
7fc7d047 2906 case ALC269_TYPE_ALC286:
506b62c3 2907 case ALC269_TYPE_ALC298:
1d04c9de 2908 case ALC269_TYPE_ALC255:
4344aec8 2909 case ALC269_TYPE_ALC256:
f429e7e4 2910 case ALC269_TYPE_ALC257:
0a6f0600 2911 case ALC269_TYPE_ALC215:
4231430d 2912 case ALC269_TYPE_ALC225:
dcd4f0db 2913 case ALC269_TYPE_ALC294:
1078bef0 2914 case ALC269_TYPE_ALC300:
6fbae35a 2915 case ALC269_TYPE_ALC700:
adcc70b2
KY
2916 ssids = alc269_ssids;
2917 break;
2918 default:
2919 ssids = alc269_ssids;
2920 break;
2921 }
bc9f98a9 2922
3e6179b8 2923 return alc_parse_auto_config(codec, alc269_ignore, ssids);
1d045db9 2924}
bc9f98a9 2925
f7ae9ba0
KY
2926static int find_ext_mic_pin(struct hda_codec *codec);
2927
2928static void alc286_shutup(struct hda_codec *codec)
2929{
a9c2dfc8 2930 const struct hda_pincfg *pin;
f7ae9ba0
KY
2931 int i;
2932 int mic_pin = find_ext_mic_pin(codec);
2933 /* don't shut up pins when unloading the driver; otherwise it breaks
2934 * the default pin setup at the next load of the driver
2935 */
2936 if (codec->bus->shutdown)
2937 return;
a9c2dfc8 2938 snd_array_for_each(&codec->init_pins, i, pin) {
f7ae9ba0
KY
2939 /* use read here for syncing after issuing each verb */
2940 if (pin->nid != mic_pin)
2941 snd_hda_codec_read(codec, pin->nid, 0,
2942 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
2943 }
2944 codec->pins_shutup = 1;
2945}
2946
1387e2d1 2947static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
1d045db9 2948{
98b24883 2949 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
1d045db9 2950}
291702f0 2951
1d045db9
TI
2952static void alc269_shutup(struct hda_codec *codec)
2953{
adcc70b2
KY
2954 struct alc_spec *spec = codec->spec;
2955
1387e2d1
KY
2956 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
2957 alc269vb_toggle_power_output(codec, 0);
2958 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
2959 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
1d045db9
TI
2960 msleep(150);
2961 }
c0ca5ece 2962 alc_shutup_pins(codec);
1d045db9 2963}
291702f0 2964
54db6c39
TI
2965static struct coef_fw alc282_coefs[] = {
2966 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
32fa7e49 2967 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
54db6c39
TI
2968 WRITE_COEF(0x07, 0x0200), /* DMIC control */
2969 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
2970 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
2971 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
2972 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
2973 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
2974 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
2975 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
2976 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
2977 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
2978 WRITE_COEF(0x34, 0xa0c0), /* ANC */
2979 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
2980 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
2981 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
2982 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
2983 WRITE_COEF(0x63, 0x2902), /* PLL */
2984 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
2985 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
2986 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
2987 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
2988 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
2989 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
2990 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
2991 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
2992 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
2993 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
2994 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
2995 {}
2996};
2997
cb149cb3
KY
2998static void alc282_restore_default_value(struct hda_codec *codec)
2999{
54db6c39 3000 alc_process_coef_fw(codec, alc282_coefs);
cb149cb3
KY
3001}
3002
7b5c7a02
KY
3003static void alc282_init(struct hda_codec *codec)
3004{
3005 struct alc_spec *spec = codec->spec;
35a39f98 3006 hda_nid_t hp_pin = alc_get_hp_pin(spec);
7b5c7a02
KY
3007 bool hp_pin_sense;
3008 int coef78;
3009
cb149cb3
KY
3010 alc282_restore_default_value(codec);
3011
7b5c7a02
KY
3012 if (!hp_pin)
3013 return;
3014 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3015 coef78 = alc_read_coef_idx(codec, 0x78);
3016
3017 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3018 /* Headphone capless set to high power mode */
3019 alc_write_coef_idx(codec, 0x78, 0x9004);
3020
3021 if (hp_pin_sense)
3022 msleep(2);
3023
3024 snd_hda_codec_write(codec, hp_pin, 0,
3025 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3026
3027 if (hp_pin_sense)
3028 msleep(85);
3029
3030 snd_hda_codec_write(codec, hp_pin, 0,
3031 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3032
3033 if (hp_pin_sense)
3034 msleep(100);
3035
3036 /* Headphone capless set to normal mode */
3037 alc_write_coef_idx(codec, 0x78, coef78);
3038}
3039
3040static void alc282_shutup(struct hda_codec *codec)
3041{
3042 struct alc_spec *spec = codec->spec;
35a39f98 3043 hda_nid_t hp_pin = alc_get_hp_pin(spec);
7b5c7a02
KY
3044 bool hp_pin_sense;
3045 int coef78;
3046
3047 if (!hp_pin) {
3048 alc269_shutup(codec);
3049 return;
3050 }
3051
3052 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3053 coef78 = alc_read_coef_idx(codec, 0x78);
3054 alc_write_coef_idx(codec, 0x78, 0x9004);
3055
3056 if (hp_pin_sense)
3057 msleep(2);
3058
3059 snd_hda_codec_write(codec, hp_pin, 0,
3060 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3061
3062 if (hp_pin_sense)
3063 msleep(85);
3064
c0ca5ece
TI
3065 if (!spec->no_shutup_pins)
3066 snd_hda_codec_write(codec, hp_pin, 0,
3067 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
7b5c7a02
KY
3068
3069 if (hp_pin_sense)
3070 msleep(100);
3071
3072 alc_auto_setup_eapd(codec, false);
c0ca5ece 3073 alc_shutup_pins(codec);
7b5c7a02
KY
3074 alc_write_coef_idx(codec, 0x78, coef78);
3075}
3076
54db6c39
TI
3077static struct coef_fw alc283_coefs[] = {
3078 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
56779864 3079 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
54db6c39
TI
3080 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3081 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3082 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3083 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3084 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3085 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3086 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3087 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3088 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3089 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3090 WRITE_COEF(0x22, 0xa0c0), /* ANC */
3091 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3092 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3093 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3094 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3095 WRITE_COEF(0x2e, 0x2902), /* PLL */
3096 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3097 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3098 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3099 WRITE_COEF(0x36, 0x0), /* capless control 5 */
3100 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3101 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3102 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3103 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3104 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3105 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3106 WRITE_COEF(0x49, 0x0), /* test mode */
3107 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3108 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3109 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
56779864 3110 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
54db6c39
TI
3111 {}
3112};
3113
6bd55b04
KY
3114static void alc283_restore_default_value(struct hda_codec *codec)
3115{
54db6c39 3116 alc_process_coef_fw(codec, alc283_coefs);
6bd55b04
KY
3117}
3118
2af02be7
KY
3119static void alc283_init(struct hda_codec *codec)
3120{
3121 struct alc_spec *spec = codec->spec;
35a39f98 3122 hda_nid_t hp_pin = alc_get_hp_pin(spec);
2af02be7 3123 bool hp_pin_sense;
2af02be7 3124
6bd55b04
KY
3125 alc283_restore_default_value(codec);
3126
2af02be7
KY
3127 if (!hp_pin)
3128 return;
a59d7199
KY
3129
3130 msleep(30);
2af02be7
KY
3131 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3132
3133 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3134 /* Headphone capless set to high power mode */
3135 alc_write_coef_idx(codec, 0x43, 0x9004);
3136
3137 snd_hda_codec_write(codec, hp_pin, 0,
3138 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3139
3140 if (hp_pin_sense)
3141 msleep(85);
3142
3143 snd_hda_codec_write(codec, hp_pin, 0,
3144 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3145
3146 if (hp_pin_sense)
3147 msleep(85);
3148 /* Index 0x46 Combo jack auto switch control 2 */
3149 /* 3k pull low control for Headset jack. */
98b24883 3150 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
2af02be7
KY
3151 /* Headphone capless set to normal mode */
3152 alc_write_coef_idx(codec, 0x43, 0x9614);
3153}
3154
3155static void alc283_shutup(struct hda_codec *codec)
3156{
3157 struct alc_spec *spec = codec->spec;
35a39f98 3158 hda_nid_t hp_pin = alc_get_hp_pin(spec);
2af02be7 3159 bool hp_pin_sense;
2af02be7
KY
3160
3161 if (!hp_pin) {
3162 alc269_shutup(codec);
3163 return;
3164 }
3165
3166 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3167
3168 alc_write_coef_idx(codec, 0x43, 0x9004);
3169
b450b17c
HP
3170 /*depop hp during suspend*/
3171 alc_write_coef_idx(codec, 0x06, 0x2100);
3172
2af02be7
KY
3173 snd_hda_codec_write(codec, hp_pin, 0,
3174 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3175
3176 if (hp_pin_sense)
88011c09 3177 msleep(100);
2af02be7 3178
c0ca5ece
TI
3179 if (!spec->no_shutup_pins)
3180 snd_hda_codec_write(codec, hp_pin, 0,
3181 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
2af02be7 3182
98b24883 3183 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
2af02be7
KY
3184
3185 if (hp_pin_sense)
88011c09 3186 msleep(100);
0435b3ff 3187 alc_auto_setup_eapd(codec, false);
c0ca5ece 3188 alc_shutup_pins(codec);
2af02be7
KY
3189 alc_write_coef_idx(codec, 0x43, 0x9614);
3190}
3191
4a219ef8
KY
3192static void alc256_init(struct hda_codec *codec)
3193{
3194 struct alc_spec *spec = codec->spec;
35a39f98 3195 hda_nid_t hp_pin = alc_get_hp_pin(spec);
4a219ef8
KY
3196 bool hp_pin_sense;
3197
3198 if (!hp_pin)
3199 return;
3200
3201 msleep(30);
3202
3203 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3204
3205 if (hp_pin_sense)
3206 msleep(2);
3207
3208 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3209
3210 snd_hda_codec_write(codec, hp_pin, 0,
3211 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3212
3213 if (hp_pin_sense)
3214 msleep(85);
3215
3216 snd_hda_codec_write(codec, hp_pin, 0,
3217 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3218
3219 if (hp_pin_sense)
3220 msleep(100);
3221
3222 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3223 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
88d42b2b
KY
3224 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3225 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
4a219ef8
KY
3226}
3227
3228static void alc256_shutup(struct hda_codec *codec)
3229{
3230 struct alc_spec *spec = codec->spec;
35a39f98 3231 hda_nid_t hp_pin = alc_get_hp_pin(spec);
4a219ef8
KY
3232 bool hp_pin_sense;
3233
3234 if (!hp_pin) {
3235 alc269_shutup(codec);
3236 return;
3237 }
3238
3239 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3240
3241 if (hp_pin_sense)
3242 msleep(2);
3243
3244 snd_hda_codec_write(codec, hp_pin, 0,
3245 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3246
3247 if (hp_pin_sense)
3248 msleep(85);
3249
1c9609e3
TI
3250 /* 3k pull low control for Headset jack. */
3251 /* NOTE: call this before clearing the pin, otherwise codec stalls */
3252 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3253
c0ca5ece
TI
3254 if (!spec->no_shutup_pins)
3255 snd_hda_codec_write(codec, hp_pin, 0,
3256 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4a219ef8 3257
4a219ef8
KY
3258 if (hp_pin_sense)
3259 msleep(100);
3260
3261 alc_auto_setup_eapd(codec, false);
c0ca5ece 3262 alc_shutup_pins(codec);
4a219ef8
KY
3263}
3264
da911b1f
KY
3265static void alc225_init(struct hda_codec *codec)
3266{
3267 struct alc_spec *spec = codec->spec;
35a39f98 3268 hda_nid_t hp_pin = alc_get_hp_pin(spec);
da911b1f
KY
3269 bool hp1_pin_sense, hp2_pin_sense;
3270
3271 if (!hp_pin)
3272 return;
3273
3274 msleep(30);
3275
3276 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3277 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3278
3279 if (hp1_pin_sense || hp2_pin_sense)
3280 msleep(2);
3281
3282 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3283
3284 if (hp1_pin_sense)
3285 snd_hda_codec_write(codec, hp_pin, 0,
3286 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3287 if (hp2_pin_sense)
3288 snd_hda_codec_write(codec, 0x16, 0,
3289 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3290
3291 if (hp1_pin_sense || hp2_pin_sense)
3292 msleep(85);
3293
3294 if (hp1_pin_sense)
3295 snd_hda_codec_write(codec, hp_pin, 0,
3296 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3297 if (hp2_pin_sense)
3298 snd_hda_codec_write(codec, 0x16, 0,
3299 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3300
3301 if (hp1_pin_sense || hp2_pin_sense)
3302 msleep(100);
3303
3304 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3305 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3306}
3307
3308static void alc225_shutup(struct hda_codec *codec)
3309{
3310 struct alc_spec *spec = codec->spec;
35a39f98 3311 hda_nid_t hp_pin = alc_get_hp_pin(spec);
da911b1f
KY
3312 bool hp1_pin_sense, hp2_pin_sense;
3313
3314 if (!hp_pin) {
3315 alc269_shutup(codec);
3316 return;
3317 }
3318
3319 /* 3k pull low control for Headset jack. */
3320 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3321
3322 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3323 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3324
3325 if (hp1_pin_sense || hp2_pin_sense)
3326 msleep(2);
3327
3328 if (hp1_pin_sense)
3329 snd_hda_codec_write(codec, hp_pin, 0,
3330 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3331 if (hp2_pin_sense)
3332 snd_hda_codec_write(codec, 0x16, 0,
3333 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3334
3335 if (hp1_pin_sense || hp2_pin_sense)
3336 msleep(85);
3337
3338 if (hp1_pin_sense)
3339 snd_hda_codec_write(codec, hp_pin, 0,
3340 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3341 if (hp2_pin_sense)
3342 snd_hda_codec_write(codec, 0x16, 0,
3343 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3344
3345 if (hp1_pin_sense || hp2_pin_sense)
3346 msleep(100);
3347
3348 alc_auto_setup_eapd(codec, false);
c0ca5ece 3349 alc_shutup_pins(codec);
da911b1f
KY
3350}
3351
c2d6af53
KY
3352static void alc_default_init(struct hda_codec *codec)
3353{
3354 struct alc_spec *spec = codec->spec;
35a39f98 3355 hda_nid_t hp_pin = alc_get_hp_pin(spec);
c2d6af53
KY
3356 bool hp_pin_sense;
3357
3358 if (!hp_pin)
3359 return;
3360
3361 msleep(30);
3362
3363 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3364
3365 if (hp_pin_sense)
3366 msleep(2);
3367
3368 snd_hda_codec_write(codec, hp_pin, 0,
3369 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3370
3371 if (hp_pin_sense)
3372 msleep(85);
3373
3374 snd_hda_codec_write(codec, hp_pin, 0,
3375 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3376
3377 if (hp_pin_sense)
3378 msleep(100);
3379}
3380
3381static void alc_default_shutup(struct hda_codec *codec)
3382{
3383 struct alc_spec *spec = codec->spec;
35a39f98 3384 hda_nid_t hp_pin = alc_get_hp_pin(spec);
c2d6af53
KY
3385 bool hp_pin_sense;
3386
3387 if (!hp_pin) {
3388 alc269_shutup(codec);
3389 return;
3390 }
3391
3392 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3393
3394 if (hp_pin_sense)
3395 msleep(2);
3396
3397 snd_hda_codec_write(codec, hp_pin, 0,
3398 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3399
3400 if (hp_pin_sense)
3401 msleep(85);
3402
c0ca5ece
TI
3403 if (!spec->no_shutup_pins)
3404 snd_hda_codec_write(codec, hp_pin, 0,
3405 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
c2d6af53
KY
3406
3407 if (hp_pin_sense)
3408 msleep(100);
3409
3410 alc_auto_setup_eapd(codec, false);
c0ca5ece 3411 alc_shutup_pins(codec);
c2d6af53
KY
3412}
3413
693abe11
KY
3414static void alc294_hp_init(struct hda_codec *codec)
3415{
3416 struct alc_spec *spec = codec->spec;
35a39f98 3417 hda_nid_t hp_pin = alc_get_hp_pin(spec);
693abe11
KY
3418 int i, val;
3419
3420 if (!hp_pin)
3421 return;
3422
3423 snd_hda_codec_write(codec, hp_pin, 0,
3424 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3425
3426 msleep(100);
3427
c0ca5ece
TI
3428 if (!spec->no_shutup_pins)
3429 snd_hda_codec_write(codec, hp_pin, 0,
3430 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
693abe11
KY
3431
3432 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3433 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3434
3435 /* Wait for depop procedure finish */
3436 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3437 for (i = 0; i < 20 && val & 0x0080; i++) {
3438 msleep(50);
3439 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3440 }
3441 /* Set HP depop to auto mode */
3442 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3443 msleep(50);
3444}
3445
3446static void alc294_init(struct hda_codec *codec)
3447{
3448 struct alc_spec *spec = codec->spec;
3449
f6ef4e0e
TI
3450 /* required only at boot or S4 resume time */
3451 if (!spec->done_hp_init ||
3452 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
693abe11
KY
3453 alc294_hp_init(codec);
3454 spec->done_hp_init = true;
3455 }
3456 alc_default_init(codec);
3457}
3458
ad60d502
KY
3459static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3460 unsigned int val)
3461{
3462 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3463 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3464 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3465}
3466
3467static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3468{
3469 unsigned int val;
3470
3471 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3472 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3473 & 0xffff;
3474 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3475 << 16;
3476 return val;
3477}
3478
3479static void alc5505_dsp_halt(struct hda_codec *codec)
3480{
3481 unsigned int val;
3482
3483 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3484 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3485 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3486 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3487 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3488 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3489 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3490 val = alc5505_coef_get(codec, 0x6220);
3491 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3492}
3493
3494static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3495{
3496 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3497 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3498 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3499 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3500 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3501 alc5505_coef_set(codec, 0x880c, 0x00000004);
3502}
3503
3504static void alc5505_dsp_init(struct hda_codec *codec)
3505{
3506 unsigned int val;
3507
3508 alc5505_dsp_halt(codec);
3509 alc5505_dsp_back_from_halt(codec);
3510 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3511 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3512 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3513 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3514 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3515 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3516 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3517 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3518 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3519 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3520 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3521 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3522 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3523
3524 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3525 if (val <= 3)
3526 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3527 else
3528 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3529
3530 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3531 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3532 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3533 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3534 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3535 alc5505_coef_set(codec, 0x880c, 0x00000003);
3536 alc5505_coef_set(codec, 0x880c, 0x00000010);
cd63a5ff
TI
3537
3538#ifdef HALT_REALTEK_ALC5505
3539 alc5505_dsp_halt(codec);
3540#endif
ad60d502
KY
3541}
3542
cd63a5ff
TI
3543#ifdef HALT_REALTEK_ALC5505
3544#define alc5505_dsp_suspend(codec) /* NOP */
3545#define alc5505_dsp_resume(codec) /* NOP */
3546#else
3547#define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
3548#define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
3549#endif
3550
2a43952a 3551#ifdef CONFIG_PM
ad60d502
KY
3552static int alc269_suspend(struct hda_codec *codec)
3553{
3554 struct alc_spec *spec = codec->spec;
3555
3556 if (spec->has_alc5505_dsp)
cd63a5ff 3557 alc5505_dsp_suspend(codec);
ad60d502
KY
3558 return alc_suspend(codec);
3559}
3560
1d045db9
TI
3561static int alc269_resume(struct hda_codec *codec)
3562{
adcc70b2
KY
3563 struct alc_spec *spec = codec->spec;
3564
1387e2d1
KY
3565 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3566 alc269vb_toggle_power_output(codec, 0);
3567 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
adcc70b2 3568 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
1d045db9
TI
3569 msleep(150);
3570 }
8c427226 3571
1d045db9 3572 codec->patch_ops.init(codec);
f1d4e28b 3573
1387e2d1
KY
3574 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3575 alc269vb_toggle_power_output(codec, 1);
3576 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
adcc70b2 3577 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
1d045db9
TI
3578 msleep(200);
3579 }
f1d4e28b 3580
eeecd9d1 3581 regcache_sync(codec->core.regmap);
1d045db9 3582 hda_call_check_power_status(codec, 0x01);
f475371a
HW
3583
3584 /* on some machine, the BIOS will clear the codec gpio data when enter
3585 * suspend, and won't restore the data after resume, so we restore it
3586 * in the driver.
3587 */
d261eec8
TI
3588 if (spec->gpio_data)
3589 alc_write_gpio_data(codec);
f475371a 3590
ad60d502 3591 if (spec->has_alc5505_dsp)
cd63a5ff 3592 alc5505_dsp_resume(codec);
c5177c86 3593
1d045db9
TI
3594 return 0;
3595}
2a43952a 3596#endif /* CONFIG_PM */
f1d4e28b 3597
108cc108 3598static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
1727a771 3599 const struct hda_fixup *fix, int action)
108cc108
DH
3600{
3601 struct alc_spec *spec = codec->spec;
3602
1727a771 3603 if (action == HDA_FIXUP_ACT_PRE_PROBE)
108cc108
DH
3604 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
3605}
3606
fdcc968a
JMG
3607static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
3608 const struct hda_fixup *fix,
3609 int action)
3610{
3611 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
3612 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
3613
3614 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
3615 snd_hda_codec_set_pincfg(codec, 0x19,
3616 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
3617 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
3618}
3619
1d045db9 3620static void alc269_fixup_hweq(struct hda_codec *codec,
1727a771 3621 const struct hda_fixup *fix, int action)
1d045db9 3622{
98b24883
TI
3623 if (action == HDA_FIXUP_ACT_INIT)
3624 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
1d045db9 3625}
f1d4e28b 3626
7c478f03
DH
3627static void alc269_fixup_headset_mic(struct hda_codec *codec,
3628 const struct hda_fixup *fix, int action)
3629{
3630 struct alc_spec *spec = codec->spec;
3631
3632 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3633 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3634}
3635
1d045db9 3636static void alc271_fixup_dmic(struct hda_codec *codec,
1727a771 3637 const struct hda_fixup *fix, int action)
1d045db9
TI
3638{
3639 static const struct hda_verb verbs[] = {
3640 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
3641 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
3642 {}
3643 };
3644 unsigned int cfg;
f1d4e28b 3645
7639a06c
TI
3646 if (strcmp(codec->core.chip_name, "ALC271X") &&
3647 strcmp(codec->core.chip_name, "ALC269VB"))
1d045db9
TI
3648 return;
3649 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
3650 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
3651 snd_hda_sequence_write(codec, verbs);
3652}
f1d4e28b 3653
017f2a10 3654static void alc269_fixup_pcm_44k(struct hda_codec *codec,
1727a771 3655 const struct hda_fixup *fix, int action)
017f2a10
TI
3656{
3657 struct alc_spec *spec = codec->spec;
3658
1727a771 3659 if (action != HDA_FIXUP_ACT_PROBE)
017f2a10
TI
3660 return;
3661
3662 /* Due to a hardware problem on Lenovo Ideadpad, we need to
3663 * fix the sample rate of analog I/O to 44.1kHz
3664 */
08c189f2
TI
3665 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
3666 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
017f2a10
TI
3667}
3668
adabb3ec 3669static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
1727a771 3670 const struct hda_fixup *fix, int action)
adabb3ec 3671{
adabb3ec
TI
3672 /* The digital-mic unit sends PDM (differential signal) instead of
3673 * the standard PCM, thus you can't record a valid mono stream as is.
3674 * Below is a workaround specific to ALC269 to control the dmic
3675 * signal source as mono.
3676 */
98b24883
TI
3677 if (action == HDA_FIXUP_ACT_INIT)
3678 alc_update_coef_idx(codec, 0x07, 0, 0x80);
adabb3ec
TI
3679}
3680
24519911
TI
3681static void alc269_quanta_automute(struct hda_codec *codec)
3682{
08c189f2 3683 snd_hda_gen_update_outputs(codec);
24519911 3684
1687ccc8
TI
3685 alc_write_coef_idx(codec, 0x0c, 0x680);
3686 alc_write_coef_idx(codec, 0x0c, 0x480);
24519911
TI
3687}
3688
3689static void alc269_fixup_quanta_mute(struct hda_codec *codec,
1727a771 3690 const struct hda_fixup *fix, int action)
24519911
TI
3691{
3692 struct alc_spec *spec = codec->spec;
1727a771 3693 if (action != HDA_FIXUP_ACT_PROBE)
24519911 3694 return;
08c189f2 3695 spec->gen.automute_hook = alc269_quanta_automute;
24519911
TI
3696}
3697
d240d1dc 3698static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
1a4f69d5 3699 struct hda_jack_callback *jack)
d240d1dc
DH
3700{
3701 struct alc_spec *spec = codec->spec;
3702 int vref;
3703 msleep(200);
3704 snd_hda_gen_hp_automute(codec, jack);
3705
3706 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
3707 msleep(100);
3708 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3709 vref);
3710 msleep(500);
3711 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3712 vref);
3713}
3714
3715static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
3716 const struct hda_fixup *fix, int action)
3717{
3718 struct alc_spec *spec = codec->spec;
3719 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3720 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3721 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
3722 }
3723}
3724
3725
08fb0d0e
TI
3726/* update mute-LED according to the speaker mute state via mic VREF pin */
3727static void alc269_fixup_mic_mute_hook(void *private_data, int enabled)
6d3cd5d4
DH
3728{
3729 struct hda_codec *codec = private_data;
08fb0d0e
TI
3730 struct alc_spec *spec = codec->spec;
3731 unsigned int pinval;
3732
3733 if (spec->mute_led_polarity)
3734 enabled = !enabled;
415d555e
TI
3735 pinval = snd_hda_codec_get_pin_target(codec, spec->mute_led_nid);
3736 pinval &= ~AC_PINCTL_VREFEN;
3737 pinval |= enabled ? AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80;
e40bdb03
TI
3738 if (spec->mute_led_nid) {
3739 /* temporarily power up/down for setting VREF */
3740 snd_hda_power_up_pm(codec);
08fb0d0e 3741 snd_hda_set_pin_ctl_cache(codec, spec->mute_led_nid, pinval);
e40bdb03
TI
3742 snd_hda_power_down_pm(codec);
3743 }
6d3cd5d4
DH
3744}
3745
d5b6b65e
DH
3746/* Make sure the led works even in runtime suspend */
3747static unsigned int led_power_filter(struct hda_codec *codec,
3748 hda_nid_t nid,
3749 unsigned int power_state)
3750{
3751 struct alc_spec *spec = codec->spec;
3752
50dd9050
HW
3753 if (power_state != AC_PWRST_D3 || nid == 0 ||
3754 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
d5b6b65e
DH
3755 return power_state;
3756
3757 /* Set pin ctl again, it might have just been set to 0 */
3758 snd_hda_set_pin_ctl(codec, nid,
3759 snd_hda_codec_get_pin_target(codec, nid));
3760
cffd3966 3761 return snd_hda_gen_path_power_filter(codec, nid, power_state);
d5b6b65e
DH
3762}
3763
08fb0d0e
TI
3764static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
3765 const struct hda_fixup *fix, int action)
6d3cd5d4
DH
3766{
3767 struct alc_spec *spec = codec->spec;
08fb0d0e
TI
3768 const struct dmi_device *dev = NULL;
3769
3770 if (action != HDA_FIXUP_ACT_PRE_PROBE)
3771 return;
3772
3773 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
3774 int pol, pin;
3775 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
3776 continue;
3777 if (pin < 0x0a || pin >= 0x10)
3778 break;
3779 spec->mute_led_polarity = pol;
3780 spec->mute_led_nid = pin - 0x0a + 0x18;
3781 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
fd25a97a 3782 spec->gen.vmaster_mute_enum = 1;
d5b6b65e 3783 codec->power_filter = led_power_filter;
4e76a883
TI
3784 codec_dbg(codec,
3785 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
08fb0d0e 3786 spec->mute_led_polarity);
6d3cd5d4
DH
3787 break;
3788 }
3789}
3790
85c467dc
TI
3791static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
3792 const struct hda_fixup *fix,
3793 int action, hda_nid_t pin)
d06ac143
DH
3794{
3795 struct alc_spec *spec = codec->spec;
85c467dc 3796
d06ac143
DH
3797 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3798 spec->mute_led_polarity = 0;
85c467dc 3799 spec->mute_led_nid = pin;
d06ac143
DH
3800 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3801 spec->gen.vmaster_mute_enum = 1;
d5b6b65e 3802 codec->power_filter = led_power_filter;
d06ac143
DH
3803 }
3804}
3805
85c467dc
TI
3806static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
3807 const struct hda_fixup *fix, int action)
3808{
3809 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
3810}
3811
08fb0d0e
TI
3812static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
3813 const struct hda_fixup *fix, int action)
420b0feb 3814{
85c467dc 3815 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
420b0feb
TI
3816}
3817
7f783bd5
TB
3818static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
3819 const struct hda_fixup *fix, int action)
3820{
85c467dc 3821 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
7f783bd5
TB
3822}
3823
0f32fd19
TI
3824/* update LED status via GPIO */
3825static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
3826 bool enabled)
9f5c6faf 3827{
9f5c6faf 3828 struct alc_spec *spec = codec->spec;
9f5c6faf 3829
0f32fd19
TI
3830 if (spec->mute_led_polarity)
3831 enabled = !enabled;
d261eec8 3832 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
9f5c6faf
TI
3833}
3834
0f32fd19
TI
3835/* turn on/off mute LED via GPIO per vmaster hook */
3836static void alc_fixup_gpio_mute_hook(void *private_data, int enabled)
9f5c6faf 3837{
0f32fd19 3838 struct hda_codec *codec = private_data;
9f5c6faf 3839 struct alc_spec *spec = codec->spec;
9f5c6faf 3840
0f32fd19
TI
3841 alc_update_gpio_led(codec, spec->gpio_mute_led_mask, enabled);
3842}
9f5c6faf 3843
0f32fd19 3844/* turn on/off mic-mute LED via GPIO per capture hook */
d03abeca 3845static void alc_gpio_micmute_update(struct hda_codec *codec)
0f32fd19
TI
3846{
3847 struct alc_spec *spec = codec->spec;
3848
d03abeca
TI
3849 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
3850 spec->gen.micmute_led.led_value);
9f5c6faf
TI
3851}
3852
01e4a275
TI
3853/* setup mute and mic-mute GPIO bits, add hooks appropriately */
3854static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
3855 int action,
3856 unsigned int mute_mask,
3857 unsigned int micmute_mask)
9f5c6faf
TI
3858{
3859 struct alc_spec *spec = codec->spec;
9f5c6faf 3860
01e4a275
TI
3861 alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
3862
3863 if (action != HDA_FIXUP_ACT_PRE_PROBE)
3864 return;
3865 if (mute_mask) {
3866 spec->gpio_mute_led_mask = mute_mask;
0f32fd19 3867 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
01e4a275
TI
3868 }
3869 if (micmute_mask) {
3870 spec->gpio_mic_led_mask = micmute_mask;
d03abeca 3871 snd_hda_gen_add_micmute_led(codec, alc_gpio_micmute_update);
9f5c6faf
TI
3872 }
3873}
3874
01e4a275 3875static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
eaa8e5ef
KY
3876 const struct hda_fixup *fix, int action)
3877{
01e4a275
TI
3878 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
3879}
eaa8e5ef 3880
01e4a275
TI
3881static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
3882 const struct hda_fixup *fix, int action)
3883{
3884 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
9f5c6faf
TI
3885}
3886
9c5dc3bf 3887/* turn on/off mic-mute LED per capture hook */
d03abeca 3888static void alc_cap_micmute_update(struct hda_codec *codec)
9c5dc3bf
KY
3889{
3890 struct alc_spec *spec = codec->spec;
d03abeca 3891 unsigned int pinval;
9c5dc3bf 3892
d03abeca
TI
3893 if (!spec->cap_mute_led_nid)
3894 return;
fc1fad93 3895 pinval = snd_hda_codec_get_pin_target(codec, spec->cap_mute_led_nid);
9c5dc3bf 3896 pinval &= ~AC_PINCTL_VREFEN;
d03abeca
TI
3897 if (spec->gen.micmute_led.led_value)
3898 pinval |= AC_PINCTL_VREF_80;
9c5dc3bf 3899 else
d03abeca
TI
3900 pinval |= AC_PINCTL_VREF_HIZ;
3901 snd_hda_set_pin_ctl_cache(codec, spec->cap_mute_led_nid, pinval);
9c5dc3bf
KY
3902}
3903
3904static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
3905 const struct hda_fixup *fix, int action)
3906{
3907 struct alc_spec *spec = codec->spec;
9c5dc3bf 3908
01e4a275 3909 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
9c5dc3bf 3910 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
01e4a275
TI
3911 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to
3912 * enable headphone amp
3913 */
3914 spec->gpio_mask |= 0x10;
3915 spec->gpio_dir |= 0x10;
9c5dc3bf 3916 spec->cap_mute_led_nid = 0x18;
d03abeca 3917 snd_hda_gen_add_micmute_led(codec, alc_cap_micmute_update);
50dd9050 3918 codec->power_filter = led_power_filter;
9c5dc3bf
KY
3919 }
3920}
3921
7a5255f1
DH
3922static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
3923 const struct hda_fixup *fix, int action)
3924{
7a5255f1 3925 struct alc_spec *spec = codec->spec;
7a5255f1 3926
01e4a275 3927 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
7a5255f1 3928 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
7a5255f1 3929 spec->cap_mute_led_nid = 0x18;
d03abeca 3930 snd_hda_gen_add_micmute_led(codec, alc_cap_micmute_update);
7a5255f1
DH
3931 codec->power_filter = led_power_filter;
3932 }
3933}
3934
6a30abaa 3935#if IS_REACHABLE(CONFIG_INPUT)
33f4acd3
DH
3936static void gpio2_mic_hotkey_event(struct hda_codec *codec,
3937 struct hda_jack_callback *event)
3938{
3939 struct alc_spec *spec = codec->spec;
3940
3941 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
3942 send both key on and key off event for every interrupt. */
c7b60a89 3943 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
33f4acd3 3944 input_sync(spec->kb_dev);
c7b60a89 3945 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
33f4acd3
DH
3946 input_sync(spec->kb_dev);
3947}
33f4acd3 3948
3694cb29
K
3949static int alc_register_micmute_input_device(struct hda_codec *codec)
3950{
3951 struct alc_spec *spec = codec->spec;
c7b60a89 3952 int i;
3694cb29
K
3953
3954 spec->kb_dev = input_allocate_device();
3955 if (!spec->kb_dev) {
3956 codec_err(codec, "Out of memory (input_allocate_device)\n");
3957 return -ENOMEM;
3958 }
c7b60a89
HW
3959
3960 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
3961
3694cb29
K
3962 spec->kb_dev->name = "Microphone Mute Button";
3963 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
c7b60a89
HW
3964 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
3965 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
3966 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
3967 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
3968 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
3694cb29
K
3969
3970 if (input_register_device(spec->kb_dev)) {
3971 codec_err(codec, "input_register_device failed\n");
3972 input_free_device(spec->kb_dev);
3973 spec->kb_dev = NULL;
3974 return -ENOMEM;
3975 }
3976
3977 return 0;
3978}
3979
01e4a275
TI
3980/* GPIO1 = set according to SKU external amp
3981 * GPIO2 = mic mute hotkey
3982 * GPIO3 = mute LED
3983 * GPIO4 = mic mute LED
3984 */
33f4acd3
DH
3985static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
3986 const struct hda_fixup *fix, int action)
3987{
33f4acd3
DH
3988 struct alc_spec *spec = codec->spec;
3989
01e4a275 3990 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
33f4acd3 3991 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1c76aa5f 3992 spec->init_amp = ALC_INIT_DEFAULT;
3694cb29 3993 if (alc_register_micmute_input_device(codec) != 0)
33f4acd3 3994 return;
33f4acd3 3995
01e4a275
TI
3996 spec->gpio_mask |= 0x06;
3997 spec->gpio_dir |= 0x02;
3998 spec->gpio_data |= 0x02;
7639a06c 3999 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
33f4acd3 4000 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
7639a06c 4001 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
33f4acd3 4002 gpio2_mic_hotkey_event);
33f4acd3
DH
4003 return;
4004 }
4005
4006 if (!spec->kb_dev)
4007 return;
4008
4009 switch (action) {
33f4acd3
DH
4010 case HDA_FIXUP_ACT_FREE:
4011 input_unregister_device(spec->kb_dev);
33f4acd3
DH
4012 spec->kb_dev = NULL;
4013 }
33f4acd3
DH
4014}
4015
01e4a275
TI
4016/* Line2 = mic mute hotkey
4017 * GPIO2 = mic mute LED
4018 */
3694cb29
K
4019static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4020 const struct hda_fixup *fix, int action)
4021{
3694cb29
K
4022 struct alc_spec *spec = codec->spec;
4023
01e4a275 4024 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
3694cb29 4025 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1c76aa5f 4026 spec->init_amp = ALC_INIT_DEFAULT;
3694cb29
K
4027 if (alc_register_micmute_input_device(codec) != 0)
4028 return;
4029
3694cb29
K
4030 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4031 gpio2_mic_hotkey_event);
3694cb29
K
4032 return;
4033 }
4034
4035 if (!spec->kb_dev)
4036 return;
4037
4038 switch (action) {
3694cb29
K
4039 case HDA_FIXUP_ACT_FREE:
4040 input_unregister_device(spec->kb_dev);
4041 spec->kb_dev = NULL;
4042 }
4043}
c469652b
TI
4044#else /* INPUT */
4045#define alc280_fixup_hp_gpio2_mic_hotkey NULL
4046#define alc233_fixup_lenovo_line2_mic_hotkey NULL
4047#endif /* INPUT */
3694cb29 4048
9c5dc3bf
KY
4049static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4050 const struct hda_fixup *fix, int action)
4051{
4052 struct alc_spec *spec = codec->spec;
4053
1bce62a6 4054 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
9c5dc3bf 4055 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
9c5dc3bf 4056 spec->cap_mute_led_nid = 0x18;
d03abeca 4057 snd_hda_gen_add_micmute_led(codec, alc_cap_micmute_update);
9c5dc3bf
KY
4058 }
4059}
4060
5a36767a
KY
4061static struct coef_fw alc225_pre_hsmode[] = {
4062 UPDATE_COEF(0x4a, 1<<8, 0),
4063 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4064 UPDATE_COEF(0x63, 3<<14, 3<<14),
4065 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4066 UPDATE_COEF(0x4a, 3<<10, 3<<10),
4067 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4068 UPDATE_COEF(0x4a, 3<<10, 0),
4069 {}
4070};
4071
73bdd597
DH
4072static void alc_headset_mode_unplugged(struct hda_codec *codec)
4073{
54db6c39 4074 static struct coef_fw coef0255[] = {
54db6c39
TI
4075 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4076 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4077 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4078 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4079 {}
4080 };
e69e7e03
KY
4081 static struct coef_fw coef0255_1[] = {
4082 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
4083 {}
4084 };
4085 static struct coef_fw coef0256[] = {
4086 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
4087 {}
4088 };
54db6c39
TI
4089 static struct coef_fw coef0233[] = {
4090 WRITE_COEF(0x1b, 0x0c0b),
4091 WRITE_COEF(0x45, 0xc429),
4092 UPDATE_COEF(0x35, 0x4000, 0),
4093 WRITE_COEF(0x06, 0x2104),
4094 WRITE_COEF(0x1a, 0x0001),
4095 WRITE_COEF(0x26, 0x0004),
4096 WRITE_COEF(0x32, 0x42a3),
4097 {}
4098 };
f3b70332
KY
4099 static struct coef_fw coef0288[] = {
4100 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4101 UPDATE_COEF(0x50, 0x2000, 0x2000),
4102 UPDATE_COEF(0x56, 0x0006, 0x0006),
4103 UPDATE_COEF(0x66, 0x0008, 0),
4104 UPDATE_COEF(0x67, 0x2000, 0),
4105 {}
4106 };
89542936
KY
4107 static struct coef_fw coef0298[] = {
4108 UPDATE_COEF(0x19, 0x1300, 0x0300),
4109 {}
4110 };
54db6c39
TI
4111 static struct coef_fw coef0292[] = {
4112 WRITE_COEF(0x76, 0x000e),
4113 WRITE_COEF(0x6c, 0x2400),
4114 WRITE_COEF(0x18, 0x7308),
4115 WRITE_COEF(0x6b, 0xc429),
4116 {}
4117 };
4118 static struct coef_fw coef0293[] = {
4119 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
4120 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
4121 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
4122 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
4123 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
4124 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4125 {}
4126 };
4127 static struct coef_fw coef0668[] = {
4128 WRITE_COEF(0x15, 0x0d40),
4129 WRITE_COEF(0xb7, 0x802b),
4130 {}
4131 };
4cc9b9d6 4132 static struct coef_fw coef0225[] = {
5a36767a 4133 UPDATE_COEF(0x63, 3<<14, 0),
4cc9b9d6
KY
4134 {}
4135 };
71683c32
KY
4136 static struct coef_fw coef0274[] = {
4137 UPDATE_COEF(0x4a, 0x0100, 0),
4138 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
4139 UPDATE_COEF(0x6b, 0xf000, 0x5000),
4140 UPDATE_COEF(0x4a, 0x0010, 0),
4141 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
4142 WRITE_COEF(0x45, 0x5289),
4143 UPDATE_COEF(0x4a, 0x0c00, 0),
4144 {}
4145 };
54db6c39 4146
7639a06c 4147 switch (codec->core.vendor_id) {
9a22a8f5 4148 case 0x10ec0255:
e69e7e03
KY
4149 alc_process_coef_fw(codec, coef0255_1);
4150 alc_process_coef_fw(codec, coef0255);
4151 break;
736f20a7 4152 case 0x10ec0236:
7081adf3 4153 case 0x10ec0256:
e69e7e03 4154 alc_process_coef_fw(codec, coef0256);
54db6c39 4155 alc_process_coef_fw(codec, coef0255);
9a22a8f5 4156 break;
71683c32
KY
4157 case 0x10ec0234:
4158 case 0x10ec0274:
4159 case 0x10ec0294:
4160 alc_process_coef_fw(codec, coef0274);
4161 break;
13fd08a3 4162 case 0x10ec0233:
73bdd597 4163 case 0x10ec0283:
54db6c39 4164 alc_process_coef_fw(codec, coef0233);
73bdd597 4165 break;
f3b70332
KY
4166 case 0x10ec0286:
4167 case 0x10ec0288:
89542936
KY
4168 alc_process_coef_fw(codec, coef0288);
4169 break;
1a5bc8d9 4170 case 0x10ec0298:
89542936 4171 alc_process_coef_fw(codec, coef0298);
f3b70332
KY
4172 alc_process_coef_fw(codec, coef0288);
4173 break;
73bdd597 4174 case 0x10ec0292:
54db6c39 4175 alc_process_coef_fw(codec, coef0292);
73bdd597 4176 break;
a22aa26f 4177 case 0x10ec0293:
54db6c39 4178 alc_process_coef_fw(codec, coef0293);
a22aa26f 4179 break;
73bdd597 4180 case 0x10ec0668:
54db6c39 4181 alc_process_coef_fw(codec, coef0668);
73bdd597 4182 break;
c2b691ee 4183 case 0x10ec0215:
4cc9b9d6 4184 case 0x10ec0225:
c2b691ee 4185 case 0x10ec0285:
7d727869 4186 case 0x10ec0295:
c2b691ee 4187 case 0x10ec0289:
28f1f9b2 4188 case 0x10ec0299:
4d4b0c52 4189 alc_process_coef_fw(codec, alc225_pre_hsmode);
4cc9b9d6
KY
4190 alc_process_coef_fw(codec, coef0225);
4191 break;
78f4f7c2
KY
4192 case 0x10ec0867:
4193 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4194 break;
73bdd597 4195 }
4e76a883 4196 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
73bdd597
DH
4197}
4198
4199
4200static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
4201 hda_nid_t mic_pin)
4202{
54db6c39
TI
4203 static struct coef_fw coef0255[] = {
4204 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
4205 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4206 {}
4207 };
4208 static struct coef_fw coef0233[] = {
4209 UPDATE_COEF(0x35, 0, 1<<14),
4210 WRITE_COEF(0x06, 0x2100),
4211 WRITE_COEF(0x1a, 0x0021),
4212 WRITE_COEF(0x26, 0x008c),
4213 {}
4214 };
f3b70332 4215 static struct coef_fw coef0288[] = {
89542936 4216 UPDATE_COEF(0x4f, 0x00c0, 0),
f3b70332
KY
4217 UPDATE_COEF(0x50, 0x2000, 0),
4218 UPDATE_COEF(0x56, 0x0006, 0),
4219 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4220 UPDATE_COEF(0x66, 0x0008, 0x0008),
4221 UPDATE_COEF(0x67, 0x2000, 0x2000),
4222 {}
4223 };
54db6c39
TI
4224 static struct coef_fw coef0292[] = {
4225 WRITE_COEF(0x19, 0xa208),
4226 WRITE_COEF(0x2e, 0xacf0),
4227 {}
4228 };
4229 static struct coef_fw coef0293[] = {
4230 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
4231 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
4232 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4233 {}
4234 };
4235 static struct coef_fw coef0688[] = {
4236 WRITE_COEF(0xb7, 0x802b),
4237 WRITE_COEF(0xb5, 0x1040),
4238 UPDATE_COEF(0xc3, 0, 1<<12),
4239 {}
4240 };
4cc9b9d6
KY
4241 static struct coef_fw coef0225[] = {
4242 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
4243 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4244 UPDATE_COEF(0x63, 3<<14, 0),
4245 {}
4246 };
71683c32
KY
4247 static struct coef_fw coef0274[] = {
4248 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
4249 UPDATE_COEF(0x4a, 0x0010, 0),
4250 UPDATE_COEF(0x6b, 0xf000, 0),
4251 {}
4252 };
54db6c39 4253
7639a06c 4254 switch (codec->core.vendor_id) {
736f20a7 4255 case 0x10ec0236:
9a22a8f5 4256 case 0x10ec0255:
7081adf3 4257 case 0x10ec0256:
9a22a8f5
KY
4258 alc_write_coef_idx(codec, 0x45, 0xc489);
4259 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 4260 alc_process_coef_fw(codec, coef0255);
9a22a8f5
KY
4261 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4262 break;
71683c32
KY
4263 case 0x10ec0234:
4264 case 0x10ec0274:
4265 case 0x10ec0294:
4266 alc_write_coef_idx(codec, 0x45, 0x4689);
4267 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4268 alc_process_coef_fw(codec, coef0274);
4269 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4270 break;
13fd08a3 4271 case 0x10ec0233:
73bdd597
DH
4272 case 0x10ec0283:
4273 alc_write_coef_idx(codec, 0x45, 0xc429);
4274 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 4275 alc_process_coef_fw(codec, coef0233);
73bdd597
DH
4276 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4277 break;
f3b70332
KY
4278 case 0x10ec0286:
4279 case 0x10ec0288:
1a5bc8d9 4280 case 0x10ec0298:
f3b70332
KY
4281 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4282 alc_process_coef_fw(codec, coef0288);
4283 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4284 break;
73bdd597
DH
4285 case 0x10ec0292:
4286 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 4287 alc_process_coef_fw(codec, coef0292);
73bdd597 4288 break;
a22aa26f
KY
4289 case 0x10ec0293:
4290 /* Set to TRS mode */
4291 alc_write_coef_idx(codec, 0x45, 0xc429);
4292 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 4293 alc_process_coef_fw(codec, coef0293);
a22aa26f
KY
4294 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4295 break;
78f4f7c2
KY
4296 case 0x10ec0867:
4297 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
4298 /* fallthru */
9eb5d0e6 4299 case 0x10ec0221:
1f8b46cd
DH
4300 case 0x10ec0662:
4301 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4302 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4303 break;
73bdd597
DH
4304 case 0x10ec0668:
4305 alc_write_coef_idx(codec, 0x11, 0x0001);
4306 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 4307 alc_process_coef_fw(codec, coef0688);
73bdd597
DH
4308 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4309 break;
c2b691ee 4310 case 0x10ec0215:
4cc9b9d6 4311 case 0x10ec0225:
c2b691ee 4312 case 0x10ec0285:
7d727869 4313 case 0x10ec0295:
c2b691ee 4314 case 0x10ec0289:
28f1f9b2 4315 case 0x10ec0299:
5a36767a 4316 alc_process_coef_fw(codec, alc225_pre_hsmode);
4cc9b9d6
KY
4317 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
4318 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4319 alc_process_coef_fw(codec, coef0225);
4320 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4321 break;
73bdd597 4322 }
4e76a883 4323 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
73bdd597
DH
4324}
4325
4326static void alc_headset_mode_default(struct hda_codec *codec)
4327{
2ae95577 4328 static struct coef_fw coef0225[] = {
5a36767a
KY
4329 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
4330 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
4331 UPDATE_COEF(0x49, 3<<8, 0<<8),
4332 UPDATE_COEF(0x4a, 3<<4, 3<<4),
4333 UPDATE_COEF(0x63, 3<<14, 0),
4334 UPDATE_COEF(0x67, 0xf000, 0x3000),
2ae95577
DH
4335 {}
4336 };
54db6c39
TI
4337 static struct coef_fw coef0255[] = {
4338 WRITE_COEF(0x45, 0xc089),
4339 WRITE_COEF(0x45, 0xc489),
4340 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4341 WRITE_COEF(0x49, 0x0049),
4342 {}
4343 };
4344 static struct coef_fw coef0233[] = {
4345 WRITE_COEF(0x06, 0x2100),
4346 WRITE_COEF(0x32, 0x4ea3),
4347 {}
4348 };
f3b70332
KY
4349 static struct coef_fw coef0288[] = {
4350 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
4351 UPDATE_COEF(0x50, 0x2000, 0x2000),
4352 UPDATE_COEF(0x56, 0x0006, 0x0006),
4353 UPDATE_COEF(0x66, 0x0008, 0),
4354 UPDATE_COEF(0x67, 0x2000, 0),
4355 {}
4356 };
54db6c39
TI
4357 static struct coef_fw coef0292[] = {
4358 WRITE_COEF(0x76, 0x000e),
4359 WRITE_COEF(0x6c, 0x2400),
4360 WRITE_COEF(0x6b, 0xc429),
4361 WRITE_COEF(0x18, 0x7308),
4362 {}
4363 };
4364 static struct coef_fw coef0293[] = {
4365 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4366 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
4367 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4368 {}
4369 };
4370 static struct coef_fw coef0688[] = {
4371 WRITE_COEF(0x11, 0x0041),
4372 WRITE_COEF(0x15, 0x0d40),
4373 WRITE_COEF(0xb7, 0x802b),
4374 {}
4375 };
71683c32
KY
4376 static struct coef_fw coef0274[] = {
4377 WRITE_COEF(0x45, 0x4289),
4378 UPDATE_COEF(0x4a, 0x0010, 0x0010),
4379 UPDATE_COEF(0x6b, 0x0f00, 0),
4380 UPDATE_COEF(0x49, 0x0300, 0x0300),
4381 {}
4382 };
54db6c39 4383
7639a06c 4384 switch (codec->core.vendor_id) {
c2b691ee 4385 case 0x10ec0215:
2ae95577 4386 case 0x10ec0225:
c2b691ee 4387 case 0x10ec0285:
7d727869 4388 case 0x10ec0295:
c2b691ee 4389 case 0x10ec0289:
28f1f9b2 4390 case 0x10ec0299:
5a36767a 4391 alc_process_coef_fw(codec, alc225_pre_hsmode);
2ae95577
DH
4392 alc_process_coef_fw(codec, coef0225);
4393 break;
736f20a7 4394 case 0x10ec0236:
9a22a8f5 4395 case 0x10ec0255:
7081adf3 4396 case 0x10ec0256:
54db6c39 4397 alc_process_coef_fw(codec, coef0255);
9a22a8f5 4398 break;
71683c32
KY
4399 case 0x10ec0234:
4400 case 0x10ec0274:
4401 case 0x10ec0294:
4402 alc_process_coef_fw(codec, coef0274);
4403 break;
13fd08a3 4404 case 0x10ec0233:
73bdd597 4405 case 0x10ec0283:
54db6c39 4406 alc_process_coef_fw(codec, coef0233);
73bdd597 4407 break;
f3b70332
KY
4408 case 0x10ec0286:
4409 case 0x10ec0288:
1a5bc8d9 4410 case 0x10ec0298:
f3b70332
KY
4411 alc_process_coef_fw(codec, coef0288);
4412 break;
73bdd597 4413 case 0x10ec0292:
54db6c39 4414 alc_process_coef_fw(codec, coef0292);
73bdd597 4415 break;
a22aa26f 4416 case 0x10ec0293:
54db6c39 4417 alc_process_coef_fw(codec, coef0293);
a22aa26f 4418 break;
73bdd597 4419 case 0x10ec0668:
54db6c39 4420 alc_process_coef_fw(codec, coef0688);
73bdd597 4421 break;
78f4f7c2
KY
4422 case 0x10ec0867:
4423 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4424 break;
73bdd597 4425 }
4e76a883 4426 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
73bdd597
DH
4427}
4428
4429/* Iphone type */
4430static void alc_headset_mode_ctia(struct hda_codec *codec)
4431{
89542936
KY
4432 int val;
4433
54db6c39
TI
4434 static struct coef_fw coef0255[] = {
4435 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
4436 WRITE_COEF(0x1b, 0x0c2b),
4437 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4438 {}
4439 };
e69e7e03
KY
4440 static struct coef_fw coef0256[] = {
4441 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
4442 WRITE_COEF(0x1b, 0x0c6b),
4443 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4444 {}
4445 };
54db6c39
TI
4446 static struct coef_fw coef0233[] = {
4447 WRITE_COEF(0x45, 0xd429),
4448 WRITE_COEF(0x1b, 0x0c2b),
4449 WRITE_COEF(0x32, 0x4ea3),
4450 {}
4451 };
f3b70332
KY
4452 static struct coef_fw coef0288[] = {
4453 UPDATE_COEF(0x50, 0x2000, 0x2000),
4454 UPDATE_COEF(0x56, 0x0006, 0x0006),
4455 UPDATE_COEF(0x66, 0x0008, 0),
4456 UPDATE_COEF(0x67, 0x2000, 0),
4457 {}
4458 };
54db6c39
TI
4459 static struct coef_fw coef0292[] = {
4460 WRITE_COEF(0x6b, 0xd429),
4461 WRITE_COEF(0x76, 0x0008),
4462 WRITE_COEF(0x18, 0x7388),
4463 {}
4464 };
4465 static struct coef_fw coef0293[] = {
4466 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
4467 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
4468 {}
4469 };
4470 static struct coef_fw coef0688[] = {
4471 WRITE_COEF(0x11, 0x0001),
4472 WRITE_COEF(0x15, 0x0d60),
4473 WRITE_COEF(0xc3, 0x0000),
4474 {}
4475 };
5a36767a 4476 static struct coef_fw coef0225_1[] = {
4cc9b9d6 4477 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5a36767a
KY
4478 UPDATE_COEF(0x63, 3<<14, 2<<14),
4479 {}
4480 };
4481 static struct coef_fw coef0225_2[] = {
4482 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
4483 UPDATE_COEF(0x63, 3<<14, 1<<14),
4cc9b9d6
KY
4484 {}
4485 };
54db6c39 4486
7639a06c 4487 switch (codec->core.vendor_id) {
9a22a8f5 4488 case 0x10ec0255:
54db6c39 4489 alc_process_coef_fw(codec, coef0255);
9a22a8f5 4490 break;
736f20a7 4491 case 0x10ec0236:
e69e7e03
KY
4492 case 0x10ec0256:
4493 alc_process_coef_fw(codec, coef0256);
4494 break;
71683c32
KY
4495 case 0x10ec0234:
4496 case 0x10ec0274:
4497 case 0x10ec0294:
4498 alc_write_coef_idx(codec, 0x45, 0xd689);
4499 break;
13fd08a3 4500 case 0x10ec0233:
73bdd597 4501 case 0x10ec0283:
54db6c39 4502 alc_process_coef_fw(codec, coef0233);
73bdd597 4503 break;
1a5bc8d9 4504 case 0x10ec0298:
89542936
KY
4505 val = alc_read_coef_idx(codec, 0x50);
4506 if (val & (1 << 12)) {
4507 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
4508 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4509 msleep(300);
4510 } else {
4511 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
4512 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4513 msleep(300);
4514 }
4515 break;
f3b70332
KY
4516 case 0x10ec0286:
4517 case 0x10ec0288:
4518 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4519 msleep(300);
4520 alc_process_coef_fw(codec, coef0288);
4521 break;
73bdd597 4522 case 0x10ec0292:
54db6c39 4523 alc_process_coef_fw(codec, coef0292);
73bdd597 4524 break;
a22aa26f 4525 case 0x10ec0293:
54db6c39 4526 alc_process_coef_fw(codec, coef0293);
a22aa26f 4527 break;
73bdd597 4528 case 0x10ec0668:
54db6c39 4529 alc_process_coef_fw(codec, coef0688);
73bdd597 4530 break;
c2b691ee 4531 case 0x10ec0215:
4cc9b9d6 4532 case 0x10ec0225:
c2b691ee 4533 case 0x10ec0285:
7d727869 4534 case 0x10ec0295:
c2b691ee 4535 case 0x10ec0289:
28f1f9b2 4536 case 0x10ec0299:
5a36767a
KY
4537 val = alc_read_coef_idx(codec, 0x45);
4538 if (val & (1 << 9))
4539 alc_process_coef_fw(codec, coef0225_2);
4540 else
4541 alc_process_coef_fw(codec, coef0225_1);
4cc9b9d6 4542 break;
78f4f7c2
KY
4543 case 0x10ec0867:
4544 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4545 break;
73bdd597 4546 }
4e76a883 4547 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
73bdd597
DH
4548}
4549
4550/* Nokia type */
4551static void alc_headset_mode_omtp(struct hda_codec *codec)
4552{
54db6c39
TI
4553 static struct coef_fw coef0255[] = {
4554 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
4555 WRITE_COEF(0x1b, 0x0c2b),
4556 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4557 {}
4558 };
e69e7e03
KY
4559 static struct coef_fw coef0256[] = {
4560 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
4561 WRITE_COEF(0x1b, 0x0c6b),
4562 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4563 {}
4564 };
54db6c39
TI
4565 static struct coef_fw coef0233[] = {
4566 WRITE_COEF(0x45, 0xe429),
4567 WRITE_COEF(0x1b, 0x0c2b),
4568 WRITE_COEF(0x32, 0x4ea3),
4569 {}
4570 };
f3b70332
KY
4571 static struct coef_fw coef0288[] = {
4572 UPDATE_COEF(0x50, 0x2000, 0x2000),
4573 UPDATE_COEF(0x56, 0x0006, 0x0006),
4574 UPDATE_COEF(0x66, 0x0008, 0),
4575 UPDATE_COEF(0x67, 0x2000, 0),
4576 {}
4577 };
54db6c39
TI
4578 static struct coef_fw coef0292[] = {
4579 WRITE_COEF(0x6b, 0xe429),
4580 WRITE_COEF(0x76, 0x0008),
4581 WRITE_COEF(0x18, 0x7388),
4582 {}
4583 };
4584 static struct coef_fw coef0293[] = {
4585 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
4586 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
4587 {}
4588 };
4589 static struct coef_fw coef0688[] = {
4590 WRITE_COEF(0x11, 0x0001),
4591 WRITE_COEF(0x15, 0x0d50),
4592 WRITE_COEF(0xc3, 0x0000),
4593 {}
4594 };
4cc9b9d6
KY
4595 static struct coef_fw coef0225[] = {
4596 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
5a36767a 4597 UPDATE_COEF(0x63, 3<<14, 2<<14),
4cc9b9d6
KY
4598 {}
4599 };
54db6c39 4600
7639a06c 4601 switch (codec->core.vendor_id) {
9a22a8f5 4602 case 0x10ec0255:
54db6c39 4603 alc_process_coef_fw(codec, coef0255);
9a22a8f5 4604 break;
736f20a7 4605 case 0x10ec0236:
e69e7e03
KY
4606 case 0x10ec0256:
4607 alc_process_coef_fw(codec, coef0256);
4608 break;
71683c32
KY
4609 case 0x10ec0234:
4610 case 0x10ec0274:
4611 case 0x10ec0294:
4612 alc_write_coef_idx(codec, 0x45, 0xe689);
4613 break;
13fd08a3 4614 case 0x10ec0233:
73bdd597 4615 case 0x10ec0283:
54db6c39 4616 alc_process_coef_fw(codec, coef0233);
73bdd597 4617 break;
1a5bc8d9
KY
4618 case 0x10ec0298:
4619 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
89542936
KY
4620 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
4621 msleep(300);
4622 break;
f3b70332
KY
4623 case 0x10ec0286:
4624 case 0x10ec0288:
4625 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
4626 msleep(300);
4627 alc_process_coef_fw(codec, coef0288);
4628 break;
73bdd597 4629 case 0x10ec0292:
54db6c39 4630 alc_process_coef_fw(codec, coef0292);
73bdd597 4631 break;
a22aa26f 4632 case 0x10ec0293:
54db6c39 4633 alc_process_coef_fw(codec, coef0293);
a22aa26f 4634 break;
73bdd597 4635 case 0x10ec0668:
54db6c39 4636 alc_process_coef_fw(codec, coef0688);
73bdd597 4637 break;
c2b691ee 4638 case 0x10ec0215:
4cc9b9d6 4639 case 0x10ec0225:
c2b691ee 4640 case 0x10ec0285:
7d727869 4641 case 0x10ec0295:
c2b691ee 4642 case 0x10ec0289:
28f1f9b2 4643 case 0x10ec0299:
4cc9b9d6
KY
4644 alc_process_coef_fw(codec, coef0225);
4645 break;
73bdd597 4646 }
4e76a883 4647 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
73bdd597
DH
4648}
4649
4650static void alc_determine_headset_type(struct hda_codec *codec)
4651{
4652 int val;
4653 bool is_ctia = false;
4654 struct alc_spec *spec = codec->spec;
54db6c39
TI
4655 static struct coef_fw coef0255[] = {
4656 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
4657 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
4658 conteol) */
4659 {}
4660 };
f3b70332
KY
4661 static struct coef_fw coef0288[] = {
4662 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
4663 {}
4664 };
89542936
KY
4665 static struct coef_fw coef0298[] = {
4666 UPDATE_COEF(0x50, 0x2000, 0x2000),
4667 UPDATE_COEF(0x56, 0x0006, 0x0006),
4668 UPDATE_COEF(0x66, 0x0008, 0),
4669 UPDATE_COEF(0x67, 0x2000, 0),
4670 UPDATE_COEF(0x19, 0x1300, 0x1300),
4671 {}
4672 };
54db6c39
TI
4673 static struct coef_fw coef0293[] = {
4674 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
4675 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
4676 {}
4677 };
4678 static struct coef_fw coef0688[] = {
4679 WRITE_COEF(0x11, 0x0001),
4680 WRITE_COEF(0xb7, 0x802b),
4681 WRITE_COEF(0x15, 0x0d60),
4682 WRITE_COEF(0xc3, 0x0c00),
4683 {}
4684 };
71683c32
KY
4685 static struct coef_fw coef0274[] = {
4686 UPDATE_COEF(0x4a, 0x0010, 0),
4687 UPDATE_COEF(0x4a, 0x8000, 0),
4688 WRITE_COEF(0x45, 0xd289),
4689 UPDATE_COEF(0x49, 0x0300, 0x0300),
4690 {}
4691 };
73bdd597 4692
7639a06c 4693 switch (codec->core.vendor_id) {
736f20a7 4694 case 0x10ec0236:
9a22a8f5 4695 case 0x10ec0255:
7081adf3 4696 case 0x10ec0256:
54db6c39 4697 alc_process_coef_fw(codec, coef0255);
9a22a8f5
KY
4698 msleep(300);
4699 val = alc_read_coef_idx(codec, 0x46);
4700 is_ctia = (val & 0x0070) == 0x0070;
4701 break;
71683c32
KY
4702 case 0x10ec0234:
4703 case 0x10ec0274:
4704 case 0x10ec0294:
4705 alc_process_coef_fw(codec, coef0274);
4706 msleep(80);
4707 val = alc_read_coef_idx(codec, 0x46);
4708 is_ctia = (val & 0x00f0) == 0x00f0;
4709 break;
13fd08a3 4710 case 0x10ec0233:
73bdd597
DH
4711 case 0x10ec0283:
4712 alc_write_coef_idx(codec, 0x45, 0xd029);
4713 msleep(300);
4714 val = alc_read_coef_idx(codec, 0x46);
4715 is_ctia = (val & 0x0070) == 0x0070;
4716 break;
1a5bc8d9 4717 case 0x10ec0298:
89542936
KY
4718 snd_hda_codec_write(codec, 0x21, 0,
4719 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
4720 msleep(100);
4721 snd_hda_codec_write(codec, 0x21, 0,
4722 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4723 msleep(200);
4724
4725 val = alc_read_coef_idx(codec, 0x50);
4726 if (val & (1 << 12)) {
4727 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
4728 alc_process_coef_fw(codec, coef0288);
4729 msleep(350);
4730 val = alc_read_coef_idx(codec, 0x50);
4731 is_ctia = (val & 0x0070) == 0x0070;
4732 } else {
4733 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
4734 alc_process_coef_fw(codec, coef0288);
4735 msleep(350);
4736 val = alc_read_coef_idx(codec, 0x50);
4737 is_ctia = (val & 0x0070) == 0x0070;
4738 }
4739 alc_process_coef_fw(codec, coef0298);
4740 snd_hda_codec_write(codec, 0x21, 0,
4741 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
4742 msleep(75);
4743 snd_hda_codec_write(codec, 0x21, 0,
4744 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
4745 break;
f3b70332
KY
4746 case 0x10ec0286:
4747 case 0x10ec0288:
4748 alc_process_coef_fw(codec, coef0288);
4749 msleep(350);
4750 val = alc_read_coef_idx(codec, 0x50);
4751 is_ctia = (val & 0x0070) == 0x0070;
4752 break;
73bdd597
DH
4753 case 0x10ec0292:
4754 alc_write_coef_idx(codec, 0x6b, 0xd429);
4755 msleep(300);
4756 val = alc_read_coef_idx(codec, 0x6c);
4757 is_ctia = (val & 0x001c) == 0x001c;
4758 break;
a22aa26f 4759 case 0x10ec0293:
54db6c39 4760 alc_process_coef_fw(codec, coef0293);
a22aa26f
KY
4761 msleep(300);
4762 val = alc_read_coef_idx(codec, 0x46);
4763 is_ctia = (val & 0x0070) == 0x0070;
4764 break;
73bdd597 4765 case 0x10ec0668:
54db6c39 4766 alc_process_coef_fw(codec, coef0688);
73bdd597
DH
4767 msleep(300);
4768 val = alc_read_coef_idx(codec, 0xbe);
4769 is_ctia = (val & 0x1c02) == 0x1c02;
4770 break;
c2b691ee 4771 case 0x10ec0215:
4cc9b9d6 4772 case 0x10ec0225:
c2b691ee 4773 case 0x10ec0285:
7d727869 4774 case 0x10ec0295:
c2b691ee 4775 case 0x10ec0289:
28f1f9b2 4776 case 0x10ec0299:
da911b1f
KY
4777 snd_hda_codec_write(codec, 0x21, 0,
4778 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
4779 msleep(80);
4780 snd_hda_codec_write(codec, 0x21, 0,
4781 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4782
5a36767a
KY
4783 alc_process_coef_fw(codec, alc225_pre_hsmode);
4784 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
4785 val = alc_read_coef_idx(codec, 0x45);
4786 if (val & (1 << 9)) {
4787 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
4788 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
4789 msleep(800);
4790 val = alc_read_coef_idx(codec, 0x46);
4791 is_ctia = (val & 0x00f0) == 0x00f0;
4792 } else {
4793 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
4794 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
4795 msleep(800);
4796 val = alc_read_coef_idx(codec, 0x46);
4797 is_ctia = (val & 0x00f0) == 0x00f0;
4798 }
4799 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
4800 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
4801 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
da911b1f
KY
4802
4803 snd_hda_codec_write(codec, 0x21, 0,
4804 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
4805 msleep(80);
4806 snd_hda_codec_write(codec, 0x21, 0,
4807 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
4cc9b9d6 4808 break;
78f4f7c2
KY
4809 case 0x10ec0867:
4810 is_ctia = true;
4811 break;
73bdd597
DH
4812 }
4813
4e76a883 4814 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
73bdd597
DH
4815 is_ctia ? "yes" : "no");
4816 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
4817}
4818
4819static void alc_update_headset_mode(struct hda_codec *codec)
4820{
4821 struct alc_spec *spec = codec->spec;
4822
4823 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
35a39f98 4824 hda_nid_t hp_pin = alc_get_hp_pin(spec);
73bdd597
DH
4825
4826 int new_headset_mode;
4827
4828 if (!snd_hda_jack_detect(codec, hp_pin))
4829 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
4830 else if (mux_pin == spec->headset_mic_pin)
4831 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
4832 else if (mux_pin == spec->headphone_mic_pin)
4833 new_headset_mode = ALC_HEADSET_MODE_MIC;
4834 else
4835 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
4836
5959a6bc
DH
4837 if (new_headset_mode == spec->current_headset_mode) {
4838 snd_hda_gen_update_outputs(codec);
73bdd597 4839 return;
5959a6bc 4840 }
73bdd597
DH
4841
4842 switch (new_headset_mode) {
4843 case ALC_HEADSET_MODE_UNPLUGGED:
4844 alc_headset_mode_unplugged(codec);
4845 spec->gen.hp_jack_present = false;
4846 break;
4847 case ALC_HEADSET_MODE_HEADSET:
4848 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
4849 alc_determine_headset_type(codec);
4850 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
4851 alc_headset_mode_ctia(codec);
4852 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
4853 alc_headset_mode_omtp(codec);
4854 spec->gen.hp_jack_present = true;
4855 break;
4856 case ALC_HEADSET_MODE_MIC:
4857 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
4858 spec->gen.hp_jack_present = false;
4859 break;
4860 case ALC_HEADSET_MODE_HEADPHONE:
4861 alc_headset_mode_default(codec);
4862 spec->gen.hp_jack_present = true;
4863 break;
4864 }
4865 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
4866 snd_hda_set_pin_ctl_cache(codec, hp_pin,
4867 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
1f8b46cd 4868 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
73bdd597
DH
4869 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
4870 PIN_VREFHIZ);
4871 }
4872 spec->current_headset_mode = new_headset_mode;
4873
4874 snd_hda_gen_update_outputs(codec);
4875}
4876
4877static void alc_update_headset_mode_hook(struct hda_codec *codec,
7fe30711
TI
4878 struct snd_kcontrol *kcontrol,
4879 struct snd_ctl_elem_value *ucontrol)
73bdd597
DH
4880{
4881 alc_update_headset_mode(codec);
4882}
4883
1a4f69d5
TI
4884static void alc_update_headset_jack_cb(struct hda_codec *codec,
4885 struct hda_jack_callback *jack)
73bdd597
DH
4886{
4887 struct alc_spec *spec = codec->spec;
5db4d34b 4888 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
73bdd597
DH
4889 snd_hda_gen_hp_automute(codec, jack);
4890}
4891
4892static void alc_probe_headset_mode(struct hda_codec *codec)
4893{
4894 int i;
4895 struct alc_spec *spec = codec->spec;
4896 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
4897
4898 /* Find mic pins */
4899 for (i = 0; i < cfg->num_inputs; i++) {
4900 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
4901 spec->headset_mic_pin = cfg->inputs[i].pin;
4902 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
4903 spec->headphone_mic_pin = cfg->inputs[i].pin;
4904 }
4905
0bed2aa3 4906 WARN_ON(spec->gen.cap_sync_hook);
73bdd597
DH
4907 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
4908 spec->gen.automute_hook = alc_update_headset_mode;
4909 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
4910}
4911
4912static void alc_fixup_headset_mode(struct hda_codec *codec,
4913 const struct hda_fixup *fix, int action)
4914{
4915 struct alc_spec *spec = codec->spec;
4916
4917 switch (action) {
4918 case HDA_FIXUP_ACT_PRE_PROBE:
4919 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
4920 break;
4921 case HDA_FIXUP_ACT_PROBE:
4922 alc_probe_headset_mode(codec);
4923 break;
4924 case HDA_FIXUP_ACT_INIT:
4925 spec->current_headset_mode = 0;
4926 alc_update_headset_mode(codec);
4927 break;
4928 }
4929}
4930
4931static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
4932 const struct hda_fixup *fix, int action)
4933{
4934 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4935 struct alc_spec *spec = codec->spec;
4936 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4937 }
4938 else
4939 alc_fixup_headset_mode(codec, fix, action);
4940}
4941
31278997
KY
4942static void alc255_set_default_jack_type(struct hda_codec *codec)
4943{
4944 /* Set to iphone type */
e69e7e03 4945 static struct coef_fw alc255fw[] = {
54db6c39
TI
4946 WRITE_COEF(0x1b, 0x880b),
4947 WRITE_COEF(0x45, 0xd089),
4948 WRITE_COEF(0x1b, 0x080b),
4949 WRITE_COEF(0x46, 0x0004),
4950 WRITE_COEF(0x1b, 0x0c0b),
4951 {}
4952 };
e69e7e03
KY
4953 static struct coef_fw alc256fw[] = {
4954 WRITE_COEF(0x1b, 0x884b),
4955 WRITE_COEF(0x45, 0xd089),
4956 WRITE_COEF(0x1b, 0x084b),
4957 WRITE_COEF(0x46, 0x0004),
4958 WRITE_COEF(0x1b, 0x0c4b),
4959 {}
4960 };
4961 switch (codec->core.vendor_id) {
4962 case 0x10ec0255:
4963 alc_process_coef_fw(codec, alc255fw);
4964 break;
736f20a7 4965 case 0x10ec0236:
e69e7e03
KY
4966 case 0x10ec0256:
4967 alc_process_coef_fw(codec, alc256fw);
4968 break;
4969 }
31278997
KY
4970 msleep(30);
4971}
4972
9a22a8f5
KY
4973static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
4974 const struct hda_fixup *fix, int action)
4975{
4976 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
31278997 4977 alc255_set_default_jack_type(codec);
9a22a8f5
KY
4978 }
4979 alc_fixup_headset_mode(codec, fix, action);
4980}
4981
31278997
KY
4982static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
4983 const struct hda_fixup *fix, int action)
4984{
4985 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4986 struct alc_spec *spec = codec->spec;
4987 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4988 alc255_set_default_jack_type(codec);
4989 }
4990 else
4991 alc_fixup_headset_mode(codec, fix, action);
4992}
4993
e1e62b98
KY
4994static void alc288_update_headset_jack_cb(struct hda_codec *codec,
4995 struct hda_jack_callback *jack)
4996{
4997 struct alc_spec *spec = codec->spec;
e1e62b98
KY
4998
4999 alc_update_headset_jack_cb(codec, jack);
5000 /* Headset Mic enable or disable, only for Dell Dino */
d44a6864 5001 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
e1e62b98
KY
5002}
5003
5004static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5005 const struct hda_fixup *fix, int action)
5006{
5007 alc_fixup_headset_mode(codec, fix, action);
5008 if (action == HDA_FIXUP_ACT_PROBE) {
5009 struct alc_spec *spec = codec->spec;
d44a6864
TI
5010 /* toggled via hp_automute_hook */
5011 spec->gpio_mask |= 0x40;
5012 spec->gpio_dir |= 0x40;
e1e62b98
KY
5013 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
5014 }
5015}
5016
493a52a9
HW
5017static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5018 const struct hda_fixup *fix, int action)
5019{
5020 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5021 struct alc_spec *spec = codec->spec;
5022 spec->gen.auto_mute_via_amp = 1;
5023 }
5024}
5025
9b745ab8
TI
5026static void alc_fixup_no_shutup(struct hda_codec *codec,
5027 const struct hda_fixup *fix, int action)
5028{
efe55732 5029 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
9b745ab8 5030 struct alc_spec *spec = codec->spec;
c0ca5ece 5031 spec->no_shutup_pins = 1;
9b745ab8
TI
5032 }
5033}
5034
5e6db669
GM
5035static void alc_fixup_disable_aamix(struct hda_codec *codec,
5036 const struct hda_fixup *fix, int action)
5037{
5038 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5039 struct alc_spec *spec = codec->spec;
5040 /* Disable AA-loopback as it causes white noise */
5041 spec->gen.mixer_nid = 0;
5042 }
5043}
5044
7f57d803
TI
5045/* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
5046static void alc_fixup_tpt440_dock(struct hda_codec *codec,
5047 const struct hda_fixup *fix, int action)
5048{
5049 static const struct hda_pintbl pincfgs[] = {
5050 { 0x16, 0x21211010 }, /* dock headphone */
5051 { 0x19, 0x21a11010 }, /* dock mic */
5052 { }
5053 };
5054 struct alc_spec *spec = codec->spec;
5055
5056 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
70a0976b 5057 spec->reboot_notify = alc_d3_at_reboot; /* reduce noise */
7f57d803
TI
5058 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5059 codec->power_save_node = 0; /* avoid click noises */
5060 snd_hda_apply_pincfgs(codec, pincfgs);
5061 }
5062}
5063
61fcf8ec
KY
5064static void alc_fixup_tpt470_dock(struct hda_codec *codec,
5065 const struct hda_fixup *fix, int action)
5066{
5067 static const struct hda_pintbl pincfgs[] = {
5068 { 0x17, 0x21211010 }, /* dock headphone */
5069 { 0x19, 0x21a11010 }, /* dock mic */
5070 { }
5071 };
54947cd6
TI
5072 /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
5073 * the speaker output becomes too low by some reason on Thinkpads with
5074 * ALC298 codec
5075 */
5076 static hda_nid_t preferred_pairs[] = {
5077 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
5078 0
5079 };
61fcf8ec
KY
5080 struct alc_spec *spec = codec->spec;
5081
5082 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
54947cd6 5083 spec->gen.preferred_dacs = preferred_pairs;
61fcf8ec 5084 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
71db96dd
TI
5085 snd_hda_apply_pincfgs(codec, pincfgs);
5086 } else if (action == HDA_FIXUP_ACT_INIT) {
61fcf8ec
KY
5087 /* Enable DOCK device */
5088 snd_hda_codec_write(codec, 0x17, 0,
5089 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5090 /* Enable DOCK device */
5091 snd_hda_codec_write(codec, 0x19, 0,
5092 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
61fcf8ec
KY
5093 }
5094}
5095
9476d369 5096static void alc_shutup_dell_xps13(struct hda_codec *codec)
033b0a7c
GM
5097{
5098 struct alc_spec *spec = codec->spec;
35a39f98 5099 int hp_pin = alc_get_hp_pin(spec);
033b0a7c 5100
9476d369
GM
5101 /* Prevent pop noises when headphones are plugged in */
5102 snd_hda_codec_write(codec, hp_pin, 0,
5103 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5104 msleep(20);
033b0a7c
GM
5105}
5106
5107static void alc_fixup_dell_xps13(struct hda_codec *codec,
5108 const struct hda_fixup *fix, int action)
5109{
3e1b0c4a
TI
5110 struct alc_spec *spec = codec->spec;
5111 struct hda_input_mux *imux = &spec->gen.input_mux;
5112 int i;
f38663ab 5113
3e1b0c4a
TI
5114 switch (action) {
5115 case HDA_FIXUP_ACT_PRE_PROBE:
5116 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
5117 * it causes a click noise at start up
5118 */
5119 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
efe55732 5120 spec->shutup = alc_shutup_dell_xps13;
3e1b0c4a
TI
5121 break;
5122 case HDA_FIXUP_ACT_PROBE:
f38663ab
GM
5123 /* Make the internal mic the default input source. */
5124 for (i = 0; i < imux->num_items; i++) {
5125 if (spec->gen.imux_pins[i] == 0x12) {
5126 spec->gen.cur_mux[0] = i;
5127 break;
5128 }
5129 }
3e1b0c4a 5130 break;
033b0a7c
GM
5131 }
5132}
5133
1f8b46cd
DH
5134static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
5135 const struct hda_fixup *fix, int action)
5136{
5137 struct alc_spec *spec = codec->spec;
5138
5139 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5140 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5141 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
b40eda64
DH
5142
5143 /* Disable boost for mic-in permanently. (This code is only called
5144 from quirks that guarantee that the headphone is at NID 0x1b.) */
5145 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
5146 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
1f8b46cd
DH
5147 } else
5148 alc_fixup_headset_mode(codec, fix, action);
5149}
5150
73bdd597
DH
5151static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
5152 const struct hda_fixup *fix, int action)
5153{
5154 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
73bdd597 5155 alc_write_coef_idx(codec, 0xc4, 0x8000);
98b24883 5156 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
73bdd597
DH
5157 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
5158 }
5159 alc_fixup_headset_mode(codec, fix, action);
5160}
5161
bde7bc60
CCC
5162/* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
5163static int find_ext_mic_pin(struct hda_codec *codec)
5164{
5165 struct alc_spec *spec = codec->spec;
5166 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5167 hda_nid_t nid;
5168 unsigned int defcfg;
5169 int i;
5170
5171 for (i = 0; i < cfg->num_inputs; i++) {
5172 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5173 continue;
5174 nid = cfg->inputs[i].pin;
5175 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5176 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
5177 continue;
5178 return nid;
5179 }
5180
5181 return 0;
5182}
5183
08a978db 5184static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
1727a771 5185 const struct hda_fixup *fix,
08a978db
DR
5186 int action)
5187{
5188 struct alc_spec *spec = codec->spec;
5189
0db75790 5190 if (action == HDA_FIXUP_ACT_PROBE) {
bde7bc60 5191 int mic_pin = find_ext_mic_pin(codec);
35a39f98 5192 int hp_pin = alc_get_hp_pin(spec);
bde7bc60
CCC
5193
5194 if (snd_BUG_ON(!mic_pin || !hp_pin))
0db75790 5195 return;
bde7bc60 5196 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
0db75790 5197 }
08a978db 5198}
693b613d 5199
3e0d611b
DH
5200static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
5201 const struct hda_fixup *fix,
5202 int action)
5203{
5204 struct alc_spec *spec = codec->spec;
5205 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5206 int i;
5207
5208 /* The mic boosts on level 2 and 3 are too noisy
5209 on the internal mic input.
5210 Therefore limit the boost to 0 or 1. */
5211
5212 if (action != HDA_FIXUP_ACT_PROBE)
5213 return;
5214
5215 for (i = 0; i < cfg->num_inputs; i++) {
5216 hda_nid_t nid = cfg->inputs[i].pin;
5217 unsigned int defcfg;
5218 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5219 continue;
5220 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5221 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
5222 continue;
5223
5224 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
5225 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
5226 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
5227 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
5228 (0 << AC_AMPCAP_MUTE_SHIFT));
5229 }
5230}
5231
cd217a63 5232static void alc283_hp_automute_hook(struct hda_codec *codec,
1a4f69d5 5233 struct hda_jack_callback *jack)
cd217a63
KY
5234{
5235 struct alc_spec *spec = codec->spec;
5236 int vref;
5237
5238 msleep(200);
5239 snd_hda_gen_hp_automute(codec, jack);
5240
5241 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
5242
5243 msleep(600);
5244 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5245 vref);
5246}
5247
cd217a63
KY
5248static void alc283_fixup_chromebook(struct hda_codec *codec,
5249 const struct hda_fixup *fix, int action)
5250{
5251 struct alc_spec *spec = codec->spec;
cd217a63
KY
5252
5253 switch (action) {
5254 case HDA_FIXUP_ACT_PRE_PROBE:
0202e99c 5255 snd_hda_override_wcaps(codec, 0x03, 0);
d2e92709
TI
5256 /* Disable AA-loopback as it causes white noise */
5257 spec->gen.mixer_nid = 0;
38070219 5258 break;
0202e99c 5259 case HDA_FIXUP_ACT_INIT:
de9481cb
KY
5260 /* MIC2-VREF control */
5261 /* Set to manual mode */
98b24883 5262 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
0202e99c 5263 /* Enable Line1 input control by verb */
98b24883 5264 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
0202e99c
KY
5265 break;
5266 }
5267}
5268
5269static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
5270 const struct hda_fixup *fix, int action)
5271{
5272 struct alc_spec *spec = codec->spec;
0202e99c
KY
5273
5274 switch (action) {
5275 case HDA_FIXUP_ACT_PRE_PROBE:
cd217a63 5276 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
38070219
KY
5277 break;
5278 case HDA_FIXUP_ACT_INIT:
cd217a63
KY
5279 /* MIC2-VREF control */
5280 /* Set to manual mode */
98b24883 5281 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
cd217a63
KY
5282 break;
5283 }
5284}
5285
7bba2157
TI
5286/* mute tablet speaker pin (0x14) via dock plugging in addition */
5287static void asus_tx300_automute(struct hda_codec *codec)
5288{
5289 struct alc_spec *spec = codec->spec;
5290 snd_hda_gen_update_outputs(codec);
5291 if (snd_hda_jack_detect(codec, 0x1b))
5292 spec->gen.mute_bits |= (1ULL << 0x14);
5293}
5294
5295static void alc282_fixup_asus_tx300(struct hda_codec *codec,
5296 const struct hda_fixup *fix, int action)
5297{
5298 struct alc_spec *spec = codec->spec;
7bba2157
TI
5299 static const struct hda_pintbl dock_pins[] = {
5300 { 0x1b, 0x21114000 }, /* dock speaker pin */
5301 {}
5302 };
7bba2157
TI
5303
5304 switch (action) {
5305 case HDA_FIXUP_ACT_PRE_PROBE:
1c76aa5f 5306 spec->init_amp = ALC_INIT_DEFAULT;
ae065f1c
TI
5307 /* TX300 needs to set up GPIO2 for the speaker amp */
5308 alc_setup_gpio(codec, 0x04);
7bba2157
TI
5309 snd_hda_apply_pincfgs(codec, dock_pins);
5310 spec->gen.auto_mute_via_amp = 1;
5311 spec->gen.automute_hook = asus_tx300_automute;
5312 snd_hda_jack_detect_enable_callback(codec, 0x1b,
7bba2157
TI
5313 snd_hda_gen_hp_automute);
5314 break;
5579cd6f
TI
5315 case HDA_FIXUP_ACT_PROBE:
5316 spec->init_amp = ALC_INIT_DEFAULT;
5317 break;
7bba2157
TI
5318 case HDA_FIXUP_ACT_BUILD:
5319 /* this is a bit tricky; give more sane names for the main
5320 * (tablet) speaker and the dock speaker, respectively
5321 */
56798e6b
TI
5322 rename_ctl(codec, "Speaker Playback Switch",
5323 "Dock Speaker Playback Switch");
5324 rename_ctl(codec, "Bass Speaker Playback Switch",
5325 "Speaker Playback Switch");
7bba2157
TI
5326 break;
5327 }
5328}
5329
338cae56
DH
5330static void alc290_fixup_mono_speakers(struct hda_codec *codec,
5331 const struct hda_fixup *fix, int action)
5332{
0f4881dc
DH
5333 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5334 /* DAC node 0x03 is giving mono output. We therefore want to
5335 make sure 0x14 (front speaker) and 0x15 (headphones) use the
5336 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
5337 hda_nid_t conn1[2] = { 0x0c };
5338 snd_hda_override_conn_list(codec, 0x14, 1, conn1);
5339 snd_hda_override_conn_list(codec, 0x15, 1, conn1);
5340 }
338cae56
DH
5341}
5342
dd9aa335
HW
5343static void alc298_fixup_speaker_volume(struct hda_codec *codec,
5344 const struct hda_fixup *fix, int action)
5345{
5346 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5347 /* The speaker is routed to the Node 0x06 by a mistake, as a result
5348 we can't adjust the speaker's volume since this node does not has
5349 Amp-out capability. we change the speaker's route to:
5350 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
5351 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
5352 speaker's volume now. */
5353
5354 hda_nid_t conn1[1] = { 0x0c };
5355 snd_hda_override_conn_list(codec, 0x17, 1, conn1);
5356 }
5357}
5358
e312a869
TI
5359/* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
5360static void alc295_fixup_disable_dac3(struct hda_codec *codec,
5361 const struct hda_fixup *fix, int action)
5362{
5363 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5364 hda_nid_t conn[2] = { 0x02, 0x03 };
5365 snd_hda_override_conn_list(codec, 0x17, 2, conn);
5366 }
5367}
5368
98973f2f
KP
5369/* Hook to update amp GPIO4 for automute */
5370static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
5371 struct hda_jack_callback *jack)
5372{
5373 struct alc_spec *spec = codec->spec;
5374
5375 snd_hda_gen_hp_automute(codec, jack);
5376 /* mute_led_polarity is set to 0, so we pass inverted value here */
5377 alc_update_gpio_led(codec, 0x10, !spec->gen.hp_jack_present);
5378}
5379
5380/* Manage GPIOs for HP EliteBook Folio 9480m.
5381 *
5382 * GPIO4 is the headphone amplifier power control
5383 * GPIO3 is the audio output mute indicator LED
5384 */
5385
5386static void alc280_fixup_hp_9480m(struct hda_codec *codec,
5387 const struct hda_fixup *fix,
5388 int action)
5389{
5390 struct alc_spec *spec = codec->spec;
98973f2f 5391
01e4a275 5392 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
98973f2f 5393 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
01e4a275
TI
5394 /* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
5395 spec->gpio_mask |= 0x10;
5396 spec->gpio_dir |= 0x10;
98973f2f 5397 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
98973f2f
KP
5398 }
5399}
5400
ae065f1c
TI
5401static void alc275_fixup_gpio4_off(struct hda_codec *codec,
5402 const struct hda_fixup *fix,
5403 int action)
5404{
5405 struct alc_spec *spec = codec->spec;
5406
5407 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5408 spec->gpio_mask |= 0x04;
5409 spec->gpio_dir |= 0x04;
5410 /* set data bit low */
5411 }
5412}
5413
ca169cc2
KY
5414static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
5415 const struct hda_fixup *fix,
5416 int action)
5417{
5418 alc_fixup_dual_codecs(codec, fix, action);
5419 switch (action) {
5420 case HDA_FIXUP_ACT_PRE_PROBE:
5421 /* override card longname to provide a unique UCM profile */
5422 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
5423 break;
5424 case HDA_FIXUP_ACT_BUILD:
5425 /* rename Capture controls depending on the codec */
5426 rename_ctl(codec, "Capture Volume",
5427 codec->addr == 0 ?
5428 "Rear-Panel Capture Volume" :
5429 "Front-Panel Capture Volume");
5430 rename_ctl(codec, "Capture Switch",
5431 codec->addr == 0 ?
5432 "Rear-Panel Capture Switch" :
5433 "Front-Panel Capture Switch");
5434 break;
5435 }
5436}
5437
92266651
KY
5438/* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
5439static void alc274_fixup_bind_dacs(struct hda_codec *codec,
5440 const struct hda_fixup *fix, int action)
5441{
5442 struct alc_spec *spec = codec->spec;
5443 static hda_nid_t preferred_pairs[] = {
5444 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
5445 0
5446 };
5447
5448 if (action != HDA_FIXUP_ACT_PRE_PROBE)
5449 return;
5450
5451 spec->gen.preferred_dacs = preferred_pairs;
5452}
5453
c4cfcf6f
HW
5454/* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */
5455static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
5456 const struct hda_fixup *fix, int action)
5457{
5458 if (action != HDA_FIXUP_ACT_PRE_PROBE)
5459 return;
5460
5461 snd_hda_override_wcaps(codec, 0x03, 0);
5462}
5463
e854747d
KY
5464static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
5465 { SND_JACK_BTN_0, KEY_PLAYPAUSE },
5466 { SND_JACK_BTN_1, KEY_VOICECOMMAND },
5467 { SND_JACK_BTN_2, KEY_VOLUMEUP },
5468 { SND_JACK_BTN_3, KEY_VOLUMEDOWN },
5469 {}
5470};
5471
5472static void alc_headset_btn_callback(struct hda_codec *codec,
5473 struct hda_jack_callback *jack)
5474{
5475 int report = 0;
5476
5477 if (jack->unsol_res & (7 << 13))
5478 report |= SND_JACK_BTN_0;
5479
5480 if (jack->unsol_res & (1 << 16 | 3 << 8))
5481 report |= SND_JACK_BTN_1;
5482
5483 /* Volume up key */
5484 if (jack->unsol_res & (7 << 23))
5485 report |= SND_JACK_BTN_2;
5486
5487 /* Volume down key */
5488 if (jack->unsol_res & (7 << 10))
5489 report |= SND_JACK_BTN_3;
5490
5491 jack->jack->button_state = report;
5492}
5493
c8a9afa6 5494static void alc295_fixup_chromebook(struct hda_codec *codec,
e854747d
KY
5495 const struct hda_fixup *fix, int action)
5496{
5497
5498 switch (action) {
5499 case HDA_FIXUP_ACT_PRE_PROBE:
5500 snd_hda_jack_detect_enable_callback(codec, 0x55,
5501 alc_headset_btn_callback);
5502 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack", false,
5503 SND_JACK_HEADSET, alc_headset_btn_keymap);
c8a9afa6
JK
5504 switch (codec->core.vendor_id) {
5505 case 0x10ec0295:
5506 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
5507 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
5508 break;
5509 case 0x10ec0236:
5510 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
5511 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
5512 break;
5513 }
e854747d
KY
5514 break;
5515 case HDA_FIXUP_ACT_INIT:
5516 switch (codec->core.vendor_id) {
5517 case 0x10ec0225:
5518 case 0x10ec0295:
5519 case 0x10ec0299:
5520 alc_write_coef_idx(codec, 0x48, 0xd011);
5521 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
5522 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
5523 break;
5524 case 0x10ec0236:
5525 case 0x10ec0256:
5526 alc_write_coef_idx(codec, 0x48, 0xd011);
5527 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
5528 break;
5529 }
5530 break;
5531 }
5532}
5533
d1dd4211
KY
5534static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
5535 const struct hda_fixup *fix, int action)
5536{
5537 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5538 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
5539}
5540
b317b032
TI
5541/* for hda_fixup_thinkpad_acpi() */
5542#include "thinkpad_helper.c"
b67ae3f1 5543
d5a6cabf
TI
5544static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
5545 const struct hda_fixup *fix, int action)
5546{
5547 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
5548 hda_fixup_thinkpad_acpi(codec, fix, action);
5549}
5550
bbf8ff6b
TB
5551/* for alc295_fixup_hp_top_speakers */
5552#include "hp_x360_helper.c"
5553
1d045db9
TI
5554enum {
5555 ALC269_FIXUP_SONY_VAIO,
5556 ALC275_FIXUP_SONY_VAIO_GPIO2,
5557 ALC269_FIXUP_DELL_M101Z,
5558 ALC269_FIXUP_SKU_IGNORE,
5559 ALC269_FIXUP_ASUS_G73JW,
5560 ALC269_FIXUP_LENOVO_EAPD,
5561 ALC275_FIXUP_SONY_HWEQ,
e9bd7d5c 5562 ALC275_FIXUP_SONY_DISABLE_AAMIX,
1d045db9 5563 ALC271_FIXUP_DMIC,
017f2a10 5564 ALC269_FIXUP_PCM_44K,
adabb3ec 5565 ALC269_FIXUP_STEREO_DMIC,
7c478f03 5566 ALC269_FIXUP_HEADSET_MIC,
24519911
TI
5567 ALC269_FIXUP_QUANTA_MUTE,
5568 ALC269_FIXUP_LIFEBOOK,
2041d564 5569 ALC269_FIXUP_LIFEBOOK_EXTMIC,
cc7016ab 5570 ALC269_FIXUP_LIFEBOOK_HP_PIN,
4df3fd17 5571 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
fdcc968a 5572 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
a4297b5d
TI
5573 ALC269_FIXUP_AMIC,
5574 ALC269_FIXUP_DMIC,
5575 ALC269VB_FIXUP_AMIC,
5576 ALC269VB_FIXUP_DMIC,
08fb0d0e 5577 ALC269_FIXUP_HP_MUTE_LED,
d06ac143 5578 ALC269_FIXUP_HP_MUTE_LED_MIC1,
08fb0d0e 5579 ALC269_FIXUP_HP_MUTE_LED_MIC2,
7f783bd5 5580 ALC269_FIXUP_HP_MUTE_LED_MIC3,
9f5c6faf 5581 ALC269_FIXUP_HP_GPIO_LED,
9c5dc3bf
KY
5582 ALC269_FIXUP_HP_GPIO_MIC1_LED,
5583 ALC269_FIXUP_HP_LINE1_MIC1_LED,
693b613d 5584 ALC269_FIXUP_INV_DMIC,
108cc108 5585 ALC269_FIXUP_LENOVO_DOCK,
9b745ab8 5586 ALC269_FIXUP_NO_SHUTUP,
88cfcf86 5587 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
108cc108 5588 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
73bdd597
DH
5589 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
5590 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
338cae56 5591 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
fcc6c877 5592 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
73bdd597
DH
5593 ALC269_FIXUP_HEADSET_MODE,
5594 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
7819717b 5595 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
d240d1dc
DH
5596 ALC269_FIXUP_ASUS_X101_FUNC,
5597 ALC269_FIXUP_ASUS_X101_VERB,
5598 ALC269_FIXUP_ASUS_X101,
08a978db
DR
5599 ALC271_FIXUP_AMIC_MIC2,
5600 ALC271_FIXUP_HP_GATE_MIC_JACK,
b1e8972e 5601 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
42397004 5602 ALC269_FIXUP_ACER_AC700,
3e0d611b 5603 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
2cede303 5604 ALC269VB_FIXUP_ASUS_ZENBOOK,
23870831 5605 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
8e35cd4a 5606 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
02b504d9 5607 ALC269VB_FIXUP_ORDISSIMO_EVE2,
cd217a63 5608 ALC283_FIXUP_CHROME_BOOK,
0202e99c 5609 ALC283_FIXUP_SENSE_COMBO_JACK,
7bba2157 5610 ALC282_FIXUP_ASUS_TX300,
1bb3e062 5611 ALC283_FIXUP_INT_MIC,
338cae56 5612 ALC290_FIXUP_MONO_SPEAKERS,
0f4881dc
DH
5613 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
5614 ALC290_FIXUP_SUBWOOFER,
5615 ALC290_FIXUP_SUBWOOFER_HSJACK,
b67ae3f1 5616 ALC269_FIXUP_THINKPAD_ACPI,
56f27013 5617 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
5824ce8d 5618 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
615966ad 5619 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9a22a8f5 5620 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
31278997 5621 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
9a22a8f5 5622 ALC255_FIXUP_HEADSET_MODE,
31278997 5623 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
a22aa26f 5624 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
1c37c223 5625 ALC292_FIXUP_TPT440_DOCK,
9a811230 5626 ALC292_FIXUP_TPT440,
abaa2274 5627 ALC283_FIXUP_HEADSET_MIC,
b3802783 5628 ALC255_FIXUP_MIC_MUTE_LED,
1a22e775 5629 ALC282_FIXUP_ASPIRE_V5_PINS,
7a5255f1 5630 ALC280_FIXUP_HP_GPIO4,
eaa8e5ef 5631 ALC286_FIXUP_HP_GPIO_LED,
33f4acd3 5632 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
b4b33f9d 5633 ALC280_FIXUP_HP_DOCK_PINS,
04d5466a 5634 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
98973f2f 5635 ALC280_FIXUP_HP_9480M,
e1e62b98
KY
5636 ALC288_FIXUP_DELL_HEADSET_MODE,
5637 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
831bfdf9
HW
5638 ALC288_FIXUP_DELL_XPS_13,
5639 ALC288_FIXUP_DISABLE_AAMIX,
8b99aba7
TI
5640 ALC292_FIXUP_DELL_E7X,
5641 ALC292_FIXUP_DISABLE_AAMIX,
c04017ea 5642 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
977e6276 5643 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
2f726aec 5644 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
6ed1131f 5645 ALC275_FIXUP_DELL_XPS,
8c69729b 5646 ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE,
23adc192 5647 ALC293_FIXUP_LENOVO_SPK_NOISE,
3694cb29 5648 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
3b43b71f 5649 ALC255_FIXUP_DELL_SPK_NOISE,
d1dd4211 5650 ALC225_FIXUP_DISABLE_MIC_VREF,
2ae95577 5651 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
e312a869 5652 ALC295_FIXUP_DISABLE_DAC3,
f883982d 5653 ALC280_FIXUP_HP_HEADSET_MIC,
e549d190 5654 ALC221_FIXUP_HP_FRONT_MIC,
c636b95e 5655 ALC292_FIXUP_TPT460,
dd9aa335 5656 ALC298_FIXUP_SPK_VOLUME,
fd06c77e 5657 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
823ff161 5658 ALC269_FIXUP_ATIV_BOOK_8,
9eb5d0e6 5659 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
c1732ede
CC
5660 ALC256_FIXUP_ASUS_HEADSET_MODE,
5661 ALC256_FIXUP_ASUS_MIC,
eeed4cd1 5662 ALC256_FIXUP_ASUS_AIO_GPIO2,
216d7aeb
CC
5663 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
5664 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
ca169cc2 5665 ALC233_FIXUP_LENOVO_MULTI_CODECS,
f33f79f3 5666 ALC294_FIXUP_LENOVO_MIC_LOCATION,
5f364135 5667 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
b84e8436 5668 ALC700_FIXUP_INTEL_REFERENCE,
92266651
KY
5669 ALC274_FIXUP_DELL_BIND_DACS,
5670 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
61fcf8ec 5671 ALC298_FIXUP_TPT470_DOCK,
ae104a21 5672 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
f0ba9d69 5673 ALC255_FIXUP_DELL_HEADSET_MIC,
8ac51bbc 5674 ALC256_FIXUP_HUAWEI_MBXP_PINS,
bbf8ff6b 5675 ALC295_FIXUP_HP_X360,
8a328ac1 5676 ALC221_FIXUP_HP_HEADSET_MIC,
c4cfcf6f 5677 ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
e8ed64b0 5678 ALC295_FIXUP_HP_AUTO_MUTE,
33aaebd4 5679 ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
d8ae458e 5680 ALC294_FIXUP_ASUS_MIC,
4e051106
JHP
5681 ALC294_FIXUP_ASUS_HEADSET_MIC,
5682 ALC294_FIXUP_ASUS_SPK,
89e3a568 5683 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
c8c6ee61 5684 ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
cbc05fd6 5685 ALC255_FIXUP_ACER_HEADSET_MIC,
10f5b1b8 5686 ALC295_FIXUP_CHROME_BOOK,
136824ef
KY
5687 ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
5688 ALC225_FIXUP_WYSE_AUTO_MUTE,
5689 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
667a8f73 5690 ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
e1037354 5691 ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
e2a829b3 5692 ALC299_FIXUP_PREDATOR_SPK,
f1d4e28b
KY
5693};
5694
1727a771 5695static const struct hda_fixup alc269_fixups[] = {
1d045db9 5696 [ALC269_FIXUP_SONY_VAIO] = {
fd108215
TI
5697 .type = HDA_FIXUP_PINCTLS,
5698 .v.pins = (const struct hda_pintbl[]) {
5699 {0x19, PIN_VREFGRD},
1d045db9
TI
5700 {}
5701 }
f1d4e28b 5702 },
1d045db9 5703 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
ae065f1c
TI
5704 .type = HDA_FIXUP_FUNC,
5705 .v.func = alc275_fixup_gpio4_off,
1d045db9
TI
5706 .chained = true,
5707 .chain_id = ALC269_FIXUP_SONY_VAIO
5708 },
5709 [ALC269_FIXUP_DELL_M101Z] = {
1727a771 5710 .type = HDA_FIXUP_VERBS,
1d045db9
TI
5711 .v.verbs = (const struct hda_verb[]) {
5712 /* Enables internal speaker */
5713 {0x20, AC_VERB_SET_COEF_INDEX, 13},
5714 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
5715 {}
5716 }
5717 },
5718 [ALC269_FIXUP_SKU_IGNORE] = {
1727a771 5719 .type = HDA_FIXUP_FUNC,
23d30f28 5720 .v.func = alc_fixup_sku_ignore,
1d045db9
TI
5721 },
5722 [ALC269_FIXUP_ASUS_G73JW] = {
1727a771
TI
5723 .type = HDA_FIXUP_PINS,
5724 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
5725 { 0x17, 0x99130111 }, /* subwoofer */
5726 { }
5727 }
5728 },
5729 [ALC269_FIXUP_LENOVO_EAPD] = {
1727a771 5730 .type = HDA_FIXUP_VERBS,
1d045db9
TI
5731 .v.verbs = (const struct hda_verb[]) {
5732 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
5733 {}
5734 }
5735 },
5736 [ALC275_FIXUP_SONY_HWEQ] = {
1727a771 5737 .type = HDA_FIXUP_FUNC,
1d045db9
TI
5738 .v.func = alc269_fixup_hweq,
5739 .chained = true,
5740 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
5741 },
e9bd7d5c
TI
5742 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
5743 .type = HDA_FIXUP_FUNC,
5744 .v.func = alc_fixup_disable_aamix,
5745 .chained = true,
5746 .chain_id = ALC269_FIXUP_SONY_VAIO
5747 },
1d045db9 5748 [ALC271_FIXUP_DMIC] = {
1727a771 5749 .type = HDA_FIXUP_FUNC,
1d045db9 5750 .v.func = alc271_fixup_dmic,
f1d4e28b 5751 },
017f2a10 5752 [ALC269_FIXUP_PCM_44K] = {
1727a771 5753 .type = HDA_FIXUP_FUNC,
017f2a10 5754 .v.func = alc269_fixup_pcm_44k,
012e7eb1
DH
5755 .chained = true,
5756 .chain_id = ALC269_FIXUP_QUANTA_MUTE
017f2a10 5757 },
adabb3ec 5758 [ALC269_FIXUP_STEREO_DMIC] = {
1727a771 5759 .type = HDA_FIXUP_FUNC,
adabb3ec
TI
5760 .v.func = alc269_fixup_stereo_dmic,
5761 },
7c478f03
DH
5762 [ALC269_FIXUP_HEADSET_MIC] = {
5763 .type = HDA_FIXUP_FUNC,
5764 .v.func = alc269_fixup_headset_mic,
5765 },
24519911 5766 [ALC269_FIXUP_QUANTA_MUTE] = {
1727a771 5767 .type = HDA_FIXUP_FUNC,
24519911
TI
5768 .v.func = alc269_fixup_quanta_mute,
5769 },
5770 [ALC269_FIXUP_LIFEBOOK] = {
1727a771
TI
5771 .type = HDA_FIXUP_PINS,
5772 .v.pins = (const struct hda_pintbl[]) {
24519911
TI
5773 { 0x1a, 0x2101103f }, /* dock line-out */
5774 { 0x1b, 0x23a11040 }, /* dock mic-in */
5775 { }
5776 },
5777 .chained = true,
5778 .chain_id = ALC269_FIXUP_QUANTA_MUTE
5779 },
2041d564
DH
5780 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
5781 .type = HDA_FIXUP_PINS,
5782 .v.pins = (const struct hda_pintbl[]) {
5783 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
5784 { }
5785 },
5786 },
cc7016ab
TI
5787 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
5788 .type = HDA_FIXUP_PINS,
5789 .v.pins = (const struct hda_pintbl[]) {
5790 { 0x21, 0x0221102f }, /* HP out */
5791 { }
5792 },
5793 },
4df3fd17
TI
5794 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
5795 .type = HDA_FIXUP_FUNC,
5796 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
5797 },
fdcc968a
JMG
5798 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
5799 .type = HDA_FIXUP_FUNC,
5800 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
5801 },
a4297b5d 5802 [ALC269_FIXUP_AMIC] = {
1727a771
TI
5803 .type = HDA_FIXUP_PINS,
5804 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
5805 { 0x14, 0x99130110 }, /* speaker */
5806 { 0x15, 0x0121401f }, /* HP out */
5807 { 0x18, 0x01a19c20 }, /* mic */
5808 { 0x19, 0x99a3092f }, /* int-mic */
5809 { }
5810 },
5811 },
5812 [ALC269_FIXUP_DMIC] = {
1727a771
TI
5813 .type = HDA_FIXUP_PINS,
5814 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
5815 { 0x12, 0x99a3092f }, /* int-mic */
5816 { 0x14, 0x99130110 }, /* speaker */
5817 { 0x15, 0x0121401f }, /* HP out */
5818 { 0x18, 0x01a19c20 }, /* mic */
5819 { }
5820 },
5821 },
5822 [ALC269VB_FIXUP_AMIC] = {
1727a771
TI
5823 .type = HDA_FIXUP_PINS,
5824 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
5825 { 0x14, 0x99130110 }, /* speaker */
5826 { 0x18, 0x01a19c20 }, /* mic */
5827 { 0x19, 0x99a3092f }, /* int-mic */
5828 { 0x21, 0x0121401f }, /* HP out */
5829 { }
5830 },
5831 },
2267ea97 5832 [ALC269VB_FIXUP_DMIC] = {
1727a771
TI
5833 .type = HDA_FIXUP_PINS,
5834 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
5835 { 0x12, 0x99a3092f }, /* int-mic */
5836 { 0x14, 0x99130110 }, /* speaker */
5837 { 0x18, 0x01a19c20 }, /* mic */
5838 { 0x21, 0x0121401f }, /* HP out */
5839 { }
5840 },
5841 },
08fb0d0e 5842 [ALC269_FIXUP_HP_MUTE_LED] = {
1727a771 5843 .type = HDA_FIXUP_FUNC,
08fb0d0e 5844 .v.func = alc269_fixup_hp_mute_led,
6d3cd5d4 5845 },
d06ac143
DH
5846 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
5847 .type = HDA_FIXUP_FUNC,
5848 .v.func = alc269_fixup_hp_mute_led_mic1,
5849 },
08fb0d0e 5850 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
1727a771 5851 .type = HDA_FIXUP_FUNC,
08fb0d0e 5852 .v.func = alc269_fixup_hp_mute_led_mic2,
420b0feb 5853 },
7f783bd5
TB
5854 [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
5855 .type = HDA_FIXUP_FUNC,
5856 .v.func = alc269_fixup_hp_mute_led_mic3,
e8ed64b0
GKK
5857 .chained = true,
5858 .chain_id = ALC295_FIXUP_HP_AUTO_MUTE
7f783bd5 5859 },
9f5c6faf
TI
5860 [ALC269_FIXUP_HP_GPIO_LED] = {
5861 .type = HDA_FIXUP_FUNC,
5862 .v.func = alc269_fixup_hp_gpio_led,
5863 },
9c5dc3bf
KY
5864 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
5865 .type = HDA_FIXUP_FUNC,
5866 .v.func = alc269_fixup_hp_gpio_mic1_led,
5867 },
5868 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
5869 .type = HDA_FIXUP_FUNC,
5870 .v.func = alc269_fixup_hp_line1_mic1_led,
5871 },
693b613d 5872 [ALC269_FIXUP_INV_DMIC] = {
1727a771 5873 .type = HDA_FIXUP_FUNC,
9d36a7dc 5874 .v.func = alc_fixup_inv_dmic,
693b613d 5875 },
9b745ab8
TI
5876 [ALC269_FIXUP_NO_SHUTUP] = {
5877 .type = HDA_FIXUP_FUNC,
5878 .v.func = alc_fixup_no_shutup,
5879 },
108cc108 5880 [ALC269_FIXUP_LENOVO_DOCK] = {
1727a771
TI
5881 .type = HDA_FIXUP_PINS,
5882 .v.pins = (const struct hda_pintbl[]) {
108cc108
DH
5883 { 0x19, 0x23a11040 }, /* dock mic */
5884 { 0x1b, 0x2121103f }, /* dock headphone */
5885 { }
5886 },
5887 .chained = true,
5888 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
5889 },
5890 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
1727a771 5891 .type = HDA_FIXUP_FUNC,
108cc108 5892 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
52129000
DH
5893 .chained = true,
5894 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
108cc108 5895 },
73bdd597
DH
5896 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
5897 .type = HDA_FIXUP_PINS,
5898 .v.pins = (const struct hda_pintbl[]) {
5899 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5900 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5901 { }
5902 },
5903 .chained = true,
5904 .chain_id = ALC269_FIXUP_HEADSET_MODE
5905 },
5906 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
5907 .type = HDA_FIXUP_PINS,
5908 .v.pins = (const struct hda_pintbl[]) {
5909 { 0x16, 0x21014020 }, /* dock line out */
5910 { 0x19, 0x21a19030 }, /* dock mic */
5911 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5912 { }
5913 },
5914 .chained = true,
5915 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
5916 },
338cae56
DH
5917 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
5918 .type = HDA_FIXUP_PINS,
5919 .v.pins = (const struct hda_pintbl[]) {
5920 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5921 { }
5922 },
5923 .chained = true,
5924 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
5925 },
fcc6c877
KY
5926 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
5927 .type = HDA_FIXUP_PINS,
5928 .v.pins = (const struct hda_pintbl[]) {
5929 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5930 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5931 { }
5932 },
5933 .chained = true,
5934 .chain_id = ALC269_FIXUP_HEADSET_MODE
5935 },
73bdd597
DH
5936 [ALC269_FIXUP_HEADSET_MODE] = {
5937 .type = HDA_FIXUP_FUNC,
5938 .v.func = alc_fixup_headset_mode,
6676f308 5939 .chained = true,
b3802783 5940 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
73bdd597
DH
5941 },
5942 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
5943 .type = HDA_FIXUP_FUNC,
5944 .v.func = alc_fixup_headset_mode_no_hp_mic,
5945 },
7819717b
TI
5946 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
5947 .type = HDA_FIXUP_PINS,
5948 .v.pins = (const struct hda_pintbl[]) {
5949 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
5950 { }
5951 },
5952 .chained = true,
5953 .chain_id = ALC269_FIXUP_HEADSET_MODE,
5954 },
88cfcf86
DH
5955 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
5956 .type = HDA_FIXUP_PINS,
5957 .v.pins = (const struct hda_pintbl[]) {
5958 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5959 { }
5960 },
fbc78ad6
DH
5961 .chained = true,
5962 .chain_id = ALC269_FIXUP_HEADSET_MIC
88cfcf86 5963 },
8ac51bbc
AB
5964 [ALC256_FIXUP_HUAWEI_MBXP_PINS] = {
5965 .type = HDA_FIXUP_PINS,
5966 .v.pins = (const struct hda_pintbl[]) {
5967 {0x12, 0x90a60130},
5968 {0x13, 0x40000000},
5969 {0x14, 0x90170110},
5970 {0x18, 0x411111f0},
5971 {0x19, 0x04a11040},
5972 {0x1a, 0x411111f0},
5973 {0x1b, 0x90170112},
5974 {0x1d, 0x40759a05},
5975 {0x1e, 0x411111f0},
5976 {0x21, 0x04211020},
5977 { }
5978 },
e2744fd7
AB
5979 .chained = true,
5980 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
8ac51bbc 5981 },
d240d1dc
DH
5982 [ALC269_FIXUP_ASUS_X101_FUNC] = {
5983 .type = HDA_FIXUP_FUNC,
5984 .v.func = alc269_fixup_x101_headset_mic,
5985 },
5986 [ALC269_FIXUP_ASUS_X101_VERB] = {
5987 .type = HDA_FIXUP_VERBS,
5988 .v.verbs = (const struct hda_verb[]) {
5989 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5990 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
5991 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
5992 { }
5993 },
5994 .chained = true,
5995 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
5996 },
5997 [ALC269_FIXUP_ASUS_X101] = {
5998 .type = HDA_FIXUP_PINS,
5999 .v.pins = (const struct hda_pintbl[]) {
6000 { 0x18, 0x04a1182c }, /* Headset mic */
6001 { }
6002 },
6003 .chained = true,
6004 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
6005 },
08a978db 6006 [ALC271_FIXUP_AMIC_MIC2] = {
1727a771
TI
6007 .type = HDA_FIXUP_PINS,
6008 .v.pins = (const struct hda_pintbl[]) {
08a978db
DR
6009 { 0x14, 0x99130110 }, /* speaker */
6010 { 0x19, 0x01a19c20 }, /* mic */
6011 { 0x1b, 0x99a7012f }, /* int-mic */
6012 { 0x21, 0x0121401f }, /* HP out */
6013 { }
6014 },
6015 },
6016 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
1727a771 6017 .type = HDA_FIXUP_FUNC,
08a978db
DR
6018 .v.func = alc271_hp_gate_mic_jack,
6019 .chained = true,
6020 .chain_id = ALC271_FIXUP_AMIC_MIC2,
6021 },
b1e8972e
OR
6022 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
6023 .type = HDA_FIXUP_FUNC,
6024 .v.func = alc269_fixup_limit_int_mic_boost,
6025 .chained = true,
6026 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
6027 },
42397004
DR
6028 [ALC269_FIXUP_ACER_AC700] = {
6029 .type = HDA_FIXUP_PINS,
6030 .v.pins = (const struct hda_pintbl[]) {
6031 { 0x12, 0x99a3092f }, /* int-mic */
6032 { 0x14, 0x99130110 }, /* speaker */
6033 { 0x18, 0x03a11c20 }, /* mic */
6034 { 0x1e, 0x0346101e }, /* SPDIF1 */
6035 { 0x21, 0x0321101f }, /* HP out */
6036 { }
6037 },
6038 .chained = true,
6039 .chain_id = ALC271_FIXUP_DMIC,
6040 },
3e0d611b
DH
6041 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
6042 .type = HDA_FIXUP_FUNC,
6043 .v.func = alc269_fixup_limit_int_mic_boost,
2793769f
DH
6044 .chained = true,
6045 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
3e0d611b 6046 },
2cede303
OR
6047 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
6048 .type = HDA_FIXUP_FUNC,
6049 .v.func = alc269_fixup_limit_int_mic_boost,
6050 .chained = true,
6051 .chain_id = ALC269VB_FIXUP_DMIC,
6052 },
23870831
TI
6053 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
6054 .type = HDA_FIXUP_VERBS,
6055 .v.verbs = (const struct hda_verb[]) {
6056 /* class-D output amp +5dB */
6057 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
6058 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
6059 {}
6060 },
6061 .chained = true,
6062 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
6063 },
8e35cd4a
DH
6064 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
6065 .type = HDA_FIXUP_FUNC,
6066 .v.func = alc269_fixup_limit_int_mic_boost,
6067 .chained = true,
6068 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
6069 },
02b504d9
AA
6070 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
6071 .type = HDA_FIXUP_PINS,
6072 .v.pins = (const struct hda_pintbl[]) {
6073 { 0x12, 0x99a3092f }, /* int-mic */
6074 { 0x18, 0x03a11d20 }, /* mic */
6075 { 0x19, 0x411111f0 }, /* Unused bogus pin */
6076 { }
6077 },
6078 },
cd217a63
KY
6079 [ALC283_FIXUP_CHROME_BOOK] = {
6080 .type = HDA_FIXUP_FUNC,
6081 .v.func = alc283_fixup_chromebook,
6082 },
0202e99c
KY
6083 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
6084 .type = HDA_FIXUP_FUNC,
6085 .v.func = alc283_fixup_sense_combo_jack,
6086 .chained = true,
6087 .chain_id = ALC283_FIXUP_CHROME_BOOK,
6088 },
7bba2157
TI
6089 [ALC282_FIXUP_ASUS_TX300] = {
6090 .type = HDA_FIXUP_FUNC,
6091 .v.func = alc282_fixup_asus_tx300,
6092 },
1bb3e062
KY
6093 [ALC283_FIXUP_INT_MIC] = {
6094 .type = HDA_FIXUP_VERBS,
6095 .v.verbs = (const struct hda_verb[]) {
6096 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
6097 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
6098 { }
6099 },
6100 .chained = true,
6101 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
6102 },
0f4881dc
DH
6103 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
6104 .type = HDA_FIXUP_PINS,
6105 .v.pins = (const struct hda_pintbl[]) {
6106 { 0x17, 0x90170112 }, /* subwoofer */
6107 { }
6108 },
6109 .chained = true,
6110 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6111 },
6112 [ALC290_FIXUP_SUBWOOFER] = {
6113 .type = HDA_FIXUP_PINS,
6114 .v.pins = (const struct hda_pintbl[]) {
6115 { 0x17, 0x90170112 }, /* subwoofer */
6116 { }
6117 },
6118 .chained = true,
6119 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
6120 },
338cae56
DH
6121 [ALC290_FIXUP_MONO_SPEAKERS] = {
6122 .type = HDA_FIXUP_FUNC,
6123 .v.func = alc290_fixup_mono_speakers,
0f4881dc
DH
6124 },
6125 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
6126 .type = HDA_FIXUP_FUNC,
6127 .v.func = alc290_fixup_mono_speakers,
338cae56
DH
6128 .chained = true,
6129 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
6130 },
b67ae3f1
DH
6131 [ALC269_FIXUP_THINKPAD_ACPI] = {
6132 .type = HDA_FIXUP_FUNC,
d5a6cabf 6133 .v.func = alc_fixup_thinkpad_acpi,
09da111a
TI
6134 .chained = true,
6135 .chain_id = ALC269_FIXUP_SKU_IGNORE,
b67ae3f1 6136 },
56f27013
DH
6137 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
6138 .type = HDA_FIXUP_FUNC,
6139 .v.func = alc_fixup_inv_dmic,
6140 .chained = true,
6141 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
6142 },
5824ce8d
CC
6143 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
6144 .type = HDA_FIXUP_PINS,
6145 .v.pins = (const struct hda_pintbl[]) {
6146 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6147 { }
6148 },
6149 .chained = true,
6150 .chain_id = ALC255_FIXUP_HEADSET_MODE
6151 },
615966ad
CC
6152 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
6153 .type = HDA_FIXUP_PINS,
6154 .v.pins = (const struct hda_pintbl[]) {
6155 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6156 { }
6157 },
6158 .chained = true,
6159 .chain_id = ALC255_FIXUP_HEADSET_MODE
6160 },
9a22a8f5
KY
6161 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6162 .type = HDA_FIXUP_PINS,
6163 .v.pins = (const struct hda_pintbl[]) {
6164 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6165 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6166 { }
6167 },
6168 .chained = true,
6169 .chain_id = ALC255_FIXUP_HEADSET_MODE
6170 },
31278997
KY
6171 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
6172 .type = HDA_FIXUP_PINS,
6173 .v.pins = (const struct hda_pintbl[]) {
6174 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6175 { }
6176 },
6177 .chained = true,
6178 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
6179 },
9a22a8f5
KY
6180 [ALC255_FIXUP_HEADSET_MODE] = {
6181 .type = HDA_FIXUP_FUNC,
6182 .v.func = alc_fixup_headset_mode_alc255,
4a83d42a 6183 .chained = true,
b3802783 6184 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
9a22a8f5 6185 },
31278997
KY
6186 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
6187 .type = HDA_FIXUP_FUNC,
6188 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
6189 },
a22aa26f
KY
6190 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6191 .type = HDA_FIXUP_PINS,
6192 .v.pins = (const struct hda_pintbl[]) {
6193 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6194 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6195 { }
6196 },
6197 .chained = true,
6198 .chain_id = ALC269_FIXUP_HEADSET_MODE
6199 },
1c37c223 6200 [ALC292_FIXUP_TPT440_DOCK] = {
ec56af67 6201 .type = HDA_FIXUP_FUNC,
7f57d803 6202 .v.func = alc_fixup_tpt440_dock,
1c37c223
TI
6203 .chained = true,
6204 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
6205 },
9a811230
TI
6206 [ALC292_FIXUP_TPT440] = {
6207 .type = HDA_FIXUP_FUNC,
157f0b7f 6208 .v.func = alc_fixup_disable_aamix,
9a811230
TI
6209 .chained = true,
6210 .chain_id = ALC292_FIXUP_TPT440_DOCK,
6211 },
abaa2274 6212 [ALC283_FIXUP_HEADSET_MIC] = {
9dc12862
DD
6213 .type = HDA_FIXUP_PINS,
6214 .v.pins = (const struct hda_pintbl[]) {
6215 { 0x19, 0x04a110f0 },
6216 { },
6217 },
6218 },
b3802783 6219 [ALC255_FIXUP_MIC_MUTE_LED] = {
00ef9940 6220 .type = HDA_FIXUP_FUNC,
b3802783 6221 .v.func = snd_hda_gen_fixup_micmute_led,
00ef9940 6222 },
1a22e775
TI
6223 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
6224 .type = HDA_FIXUP_PINS,
6225 .v.pins = (const struct hda_pintbl[]) {
6226 { 0x12, 0x90a60130 },
6227 { 0x14, 0x90170110 },
6228 { 0x17, 0x40000008 },
6229 { 0x18, 0x411111f0 },
0420694d 6230 { 0x19, 0x01a1913c },
1a22e775
TI
6231 { 0x1a, 0x411111f0 },
6232 { 0x1b, 0x411111f0 },
6233 { 0x1d, 0x40f89b2d },
6234 { 0x1e, 0x411111f0 },
6235 { 0x21, 0x0321101f },
6236 { },
6237 },
6238 },
7a5255f1
DH
6239 [ALC280_FIXUP_HP_GPIO4] = {
6240 .type = HDA_FIXUP_FUNC,
6241 .v.func = alc280_fixup_hp_gpio4,
6242 },
eaa8e5ef
KY
6243 [ALC286_FIXUP_HP_GPIO_LED] = {
6244 .type = HDA_FIXUP_FUNC,
6245 .v.func = alc286_fixup_hp_gpio_led,
6246 },
33f4acd3
DH
6247 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
6248 .type = HDA_FIXUP_FUNC,
6249 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
6250 },
b4b33f9d
TC
6251 [ALC280_FIXUP_HP_DOCK_PINS] = {
6252 .type = HDA_FIXUP_PINS,
6253 .v.pins = (const struct hda_pintbl[]) {
6254 { 0x1b, 0x21011020 }, /* line-out */
6255 { 0x1a, 0x01a1903c }, /* headset mic */
6256 { 0x18, 0x2181103f }, /* line-in */
6257 { },
6258 },
6259 .chained = true,
6260 .chain_id = ALC280_FIXUP_HP_GPIO4
6261 },
04d5466a
JK
6262 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
6263 .type = HDA_FIXUP_PINS,
6264 .v.pins = (const struct hda_pintbl[]) {
6265 { 0x1b, 0x21011020 }, /* line-out */
6266 { 0x18, 0x2181103f }, /* line-in */
6267 { },
6268 },
6269 .chained = true,
6270 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
6271 },
98973f2f
KP
6272 [ALC280_FIXUP_HP_9480M] = {
6273 .type = HDA_FIXUP_FUNC,
6274 .v.func = alc280_fixup_hp_9480m,
6275 },
e1e62b98
KY
6276 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
6277 .type = HDA_FIXUP_FUNC,
6278 .v.func = alc_fixup_headset_mode_dell_alc288,
6279 .chained = true,
b3802783 6280 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
e1e62b98
KY
6281 },
6282 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6283 .type = HDA_FIXUP_PINS,
6284 .v.pins = (const struct hda_pintbl[]) {
6285 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6286 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6287 { }
6288 },
6289 .chained = true,
6290 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
6291 },
831bfdf9
HW
6292 [ALC288_FIXUP_DISABLE_AAMIX] = {
6293 .type = HDA_FIXUP_FUNC,
6294 .v.func = alc_fixup_disable_aamix,
6295 .chained = true,
d44a6864 6296 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
831bfdf9
HW
6297 },
6298 [ALC288_FIXUP_DELL_XPS_13] = {
6299 .type = HDA_FIXUP_FUNC,
6300 .v.func = alc_fixup_dell_xps13,
6301 .chained = true,
6302 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
6303 },
8b99aba7
TI
6304 [ALC292_FIXUP_DISABLE_AAMIX] = {
6305 .type = HDA_FIXUP_FUNC,
6306 .v.func = alc_fixup_disable_aamix,
831bfdf9
HW
6307 .chained = true,
6308 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
8b99aba7 6309 },
c04017ea
DH
6310 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
6311 .type = HDA_FIXUP_FUNC,
6312 .v.func = alc_fixup_disable_aamix,
6313 .chained = true,
6314 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
6315 },
8b99aba7
TI
6316 [ALC292_FIXUP_DELL_E7X] = {
6317 .type = HDA_FIXUP_FUNC,
6318 .v.func = alc_fixup_dell_xps13,
6319 .chained = true,
6320 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
6321 },
977e6276
KY
6322 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6323 .type = HDA_FIXUP_PINS,
6324 .v.pins = (const struct hda_pintbl[]) {
6325 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6326 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6327 { }
6328 },
6329 .chained = true,
6330 .chain_id = ALC269_FIXUP_HEADSET_MODE
6331 },
2f726aec
HW
6332 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
6333 .type = HDA_FIXUP_PINS,
6334 .v.pins = (const struct hda_pintbl[]) {
6335 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6336 { }
6337 },
6338 .chained = true,
6339 .chain_id = ALC269_FIXUP_HEADSET_MODE
6340 },
6ed1131f
KY
6341 [ALC275_FIXUP_DELL_XPS] = {
6342 .type = HDA_FIXUP_VERBS,
6343 .v.verbs = (const struct hda_verb[]) {
6344 /* Enables internal speaker */
6345 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
6346 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
6347 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
6348 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
6349 {}
6350 }
6351 },
8c69729b
HW
6352 [ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE] = {
6353 .type = HDA_FIXUP_VERBS,
6354 .v.verbs = (const struct hda_verb[]) {
6355 /* Disable pass-through path for FRONT 14h */
6356 {0x20, AC_VERB_SET_COEF_INDEX, 0x36},
6357 {0x20, AC_VERB_SET_PROC_COEF, 0x1737},
6358 {}
6359 },
6360 .chained = true,
6361 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6362 },
23adc192
HW
6363 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
6364 .type = HDA_FIXUP_FUNC,
6365 .v.func = alc_fixup_disable_aamix,
6366 .chained = true,
6367 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
6368 },
3694cb29
K
6369 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
6370 .type = HDA_FIXUP_FUNC,
6371 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
6372 },
3b43b71f
KHF
6373 [ALC255_FIXUP_DELL_SPK_NOISE] = {
6374 .type = HDA_FIXUP_FUNC,
6375 .v.func = alc_fixup_disable_aamix,
6376 .chained = true,
6377 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6378 },
d1dd4211
KY
6379 [ALC225_FIXUP_DISABLE_MIC_VREF] = {
6380 .type = HDA_FIXUP_FUNC,
6381 .v.func = alc_fixup_disable_mic_vref,
6382 .chained = true,
6383 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
6384 },
2ae95577
DH
6385 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6386 .type = HDA_FIXUP_VERBS,
6387 .v.verbs = (const struct hda_verb[]) {
6388 /* Disable pass-through path for FRONT 14h */
6389 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
6390 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
6391 {}
6392 },
6393 .chained = true,
d1dd4211 6394 .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
2ae95577 6395 },
f883982d
TI
6396 [ALC280_FIXUP_HP_HEADSET_MIC] = {
6397 .type = HDA_FIXUP_FUNC,
6398 .v.func = alc_fixup_disable_aamix,
6399 .chained = true,
6400 .chain_id = ALC269_FIXUP_HEADSET_MIC,
6401 },
e549d190
HW
6402 [ALC221_FIXUP_HP_FRONT_MIC] = {
6403 .type = HDA_FIXUP_PINS,
6404 .v.pins = (const struct hda_pintbl[]) {
6405 { 0x19, 0x02a19020 }, /* Front Mic */
6406 { }
6407 },
6408 },
c636b95e
SE
6409 [ALC292_FIXUP_TPT460] = {
6410 .type = HDA_FIXUP_FUNC,
6411 .v.func = alc_fixup_tpt440_dock,
6412 .chained = true,
6413 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
6414 },
dd9aa335
HW
6415 [ALC298_FIXUP_SPK_VOLUME] = {
6416 .type = HDA_FIXUP_FUNC,
6417 .v.func = alc298_fixup_speaker_volume,
59ec4b57 6418 .chained = true,
2f726aec 6419 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
dd9aa335 6420 },
e312a869
TI
6421 [ALC295_FIXUP_DISABLE_DAC3] = {
6422 .type = HDA_FIXUP_FUNC,
6423 .v.func = alc295_fixup_disable_dac3,
6424 },
fd06c77e
KHF
6425 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
6426 .type = HDA_FIXUP_PINS,
6427 .v.pins = (const struct hda_pintbl[]) {
6428 { 0x1b, 0x90170151 },
6429 { }
6430 },
6431 .chained = true,
6432 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6433 },
823ff161
GM
6434 [ALC269_FIXUP_ATIV_BOOK_8] = {
6435 .type = HDA_FIXUP_FUNC,
6436 .v.func = alc_fixup_auto_mute_via_amp,
6437 .chained = true,
6438 .chain_id = ALC269_FIXUP_NO_SHUTUP
6439 },
9eb5d0e6
KY
6440 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
6441 .type = HDA_FIXUP_PINS,
6442 .v.pins = (const struct hda_pintbl[]) {
6443 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6444 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6445 { }
6446 },
6447 .chained = true,
6448 .chain_id = ALC269_FIXUP_HEADSET_MODE
6449 },
c1732ede
CC
6450 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
6451 .type = HDA_FIXUP_FUNC,
6452 .v.func = alc_fixup_headset_mode,
6453 },
6454 [ALC256_FIXUP_ASUS_MIC] = {
6455 .type = HDA_FIXUP_PINS,
6456 .v.pins = (const struct hda_pintbl[]) {
6457 { 0x13, 0x90a60160 }, /* use as internal mic */
6458 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
6459 { }
6460 },
6461 .chained = true,
6462 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
6463 },
eeed4cd1 6464 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
ae065f1c
TI
6465 .type = HDA_FIXUP_FUNC,
6466 /* Set up GPIO2 for the speaker amp */
6467 .v.func = alc_fixup_gpio4,
eeed4cd1 6468 },
216d7aeb
CC
6469 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
6470 .type = HDA_FIXUP_PINS,
6471 .v.pins = (const struct hda_pintbl[]) {
6472 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6473 { }
6474 },
6475 .chained = true,
6476 .chain_id = ALC269_FIXUP_HEADSET_MIC
6477 },
6478 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
6479 .type = HDA_FIXUP_VERBS,
6480 .v.verbs = (const struct hda_verb[]) {
6481 /* Enables internal speaker */
6482 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
6483 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
6484 {}
6485 },
6486 .chained = true,
6487 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
6488 },
ca169cc2
KY
6489 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
6490 .type = HDA_FIXUP_FUNC,
6491 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
6492 },
f33f79f3
HW
6493 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
6494 .type = HDA_FIXUP_PINS,
6495 .v.pins = (const struct hda_pintbl[]) {
6496 /* Change the mic location from front to right, otherwise there are
6497 two front mics with the same name, pulseaudio can't handle them.
6498 This is just a temporary workaround, after applying this fixup,
6499 there will be one "Front Mic" and one "Mic" in this machine.
6500 */
6501 { 0x1a, 0x04a19040 },
6502 { }
6503 },
6504 },
5f364135
KY
6505 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
6506 .type = HDA_FIXUP_PINS,
6507 .v.pins = (const struct hda_pintbl[]) {
6508 { 0x16, 0x0101102f }, /* Rear Headset HP */
6509 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
6510 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
6511 { 0x1b, 0x02011020 },
6512 { }
6513 },
6514 .chained = true,
6515 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6516 },
b84e8436
PH
6517 [ALC700_FIXUP_INTEL_REFERENCE] = {
6518 .type = HDA_FIXUP_VERBS,
6519 .v.verbs = (const struct hda_verb[]) {
6520 /* Enables internal speaker */
6521 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
6522 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
6523 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
6524 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
6525 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
6526 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
6527 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
6528 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
6529 {}
6530 }
6531 },
92266651
KY
6532 [ALC274_FIXUP_DELL_BIND_DACS] = {
6533 .type = HDA_FIXUP_FUNC,
6534 .v.func = alc274_fixup_bind_dacs,
6535 .chained = true,
6536 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
6537 },
6538 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
6539 .type = HDA_FIXUP_PINS,
6540 .v.pins = (const struct hda_pintbl[]) {
6541 { 0x1b, 0x0401102f },
6542 { }
6543 },
6544 .chained = true,
6545 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
6546 },
61fcf8ec
KY
6547 [ALC298_FIXUP_TPT470_DOCK] = {
6548 .type = HDA_FIXUP_FUNC,
6549 .v.func = alc_fixup_tpt470_dock,
6550 .chained = true,
6551 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
6552 },
ae104a21
KY
6553 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
6554 .type = HDA_FIXUP_PINS,
6555 .v.pins = (const struct hda_pintbl[]) {
6556 { 0x14, 0x0201101f },
6557 { }
6558 },
6559 .chained = true,
6560 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6561 },
f0ba9d69
KY
6562 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
6563 .type = HDA_FIXUP_PINS,
6564 .v.pins = (const struct hda_pintbl[]) {
6565 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6566 { }
6567 },
3ce0d5aa
HW
6568 .chained = true,
6569 .chain_id = ALC269_FIXUP_HEADSET_MIC
f0ba9d69 6570 },
bbf8ff6b
TB
6571 [ALC295_FIXUP_HP_X360] = {
6572 .type = HDA_FIXUP_FUNC,
6573 .v.func = alc295_fixup_hp_top_speakers,
6574 .chained = true,
6575 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
8a328ac1
KY
6576 },
6577 [ALC221_FIXUP_HP_HEADSET_MIC] = {
6578 .type = HDA_FIXUP_PINS,
6579 .v.pins = (const struct hda_pintbl[]) {
6580 { 0x19, 0x0181313f},
6581 { }
6582 },
6583 .chained = true,
6584 .chain_id = ALC269_FIXUP_HEADSET_MIC
6585 },
c4cfcf6f
HW
6586 [ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
6587 .type = HDA_FIXUP_FUNC,
6588 .v.func = alc285_fixup_invalidate_dacs,
6ba189c5
HW
6589 .chained = true,
6590 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
c4cfcf6f 6591 },
e8ed64b0
GKK
6592 [ALC295_FIXUP_HP_AUTO_MUTE] = {
6593 .type = HDA_FIXUP_FUNC,
6594 .v.func = alc_fixup_auto_mute_via_amp,
6595 },
33aaebd4
CC
6596 [ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
6597 .type = HDA_FIXUP_PINS,
6598 .v.pins = (const struct hda_pintbl[]) {
6599 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6600 { }
6601 },
6602 .chained = true,
6603 .chain_id = ALC269_FIXUP_HEADSET_MIC
6604 },
d8ae458e
CC
6605 [ALC294_FIXUP_ASUS_MIC] = {
6606 .type = HDA_FIXUP_PINS,
6607 .v.pins = (const struct hda_pintbl[]) {
6608 { 0x13, 0x90a60160 }, /* use as internal mic */
6609 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
6610 { }
6611 },
6612 .chained = true,
6613 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6614 },
4e051106
JHP
6615 [ALC294_FIXUP_ASUS_HEADSET_MIC] = {
6616 .type = HDA_FIXUP_PINS,
6617 .v.pins = (const struct hda_pintbl[]) {
82b01149 6618 { 0x19, 0x01a1103c }, /* use as headset mic */
4e051106
JHP
6619 { }
6620 },
6621 .chained = true,
6622 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6623 },
6624 [ALC294_FIXUP_ASUS_SPK] = {
6625 .type = HDA_FIXUP_VERBS,
6626 .v.verbs = (const struct hda_verb[]) {
6627 /* Set EAPD high */
6628 { 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
6629 { 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
6630 { }
6631 },
6632 .chained = true,
6633 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
6634 },
c8a9afa6 6635 [ALC295_FIXUP_CHROME_BOOK] = {
e854747d 6636 .type = HDA_FIXUP_FUNC,
c8a9afa6 6637 .v.func = alc295_fixup_chromebook,
e854747d 6638 },
89e3a568
JS
6639 [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
6640 .type = HDA_FIXUP_PINS,
6641 .v.pins = (const struct hda_pintbl[]) {
6642 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6643 { }
6644 },
6645 .chained = true,
6646 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6647 },
c8c6ee61
HW
6648 [ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
6649 .type = HDA_FIXUP_VERBS,
6650 .v.verbs = (const struct hda_verb[]) {
6651 /* Disable PCBEEP-IN passthrough */
6652 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
6653 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
6654 { }
6655 },
6656 .chained = true,
6657 .chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
6658 },
cbc05fd6
JHP
6659 [ALC255_FIXUP_ACER_HEADSET_MIC] = {
6660 .type = HDA_FIXUP_PINS,
6661 .v.pins = (const struct hda_pintbl[]) {
6662 { 0x19, 0x03a11130 },
6663 { 0x1a, 0x90a60140 }, /* use as internal mic */
6664 { }
6665 },
6666 .chained = true,
6667 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
6668 },
136824ef
KY
6669 [ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
6670 .type = HDA_FIXUP_PINS,
6671 .v.pins = (const struct hda_pintbl[]) {
6672 { 0x16, 0x01011020 }, /* Rear Line out */
6673 { 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
6674 { }
6675 },
6676 .chained = true,
6677 .chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
6678 },
6679 [ALC225_FIXUP_WYSE_AUTO_MUTE] = {
6680 .type = HDA_FIXUP_FUNC,
6681 .v.func = alc_fixup_auto_mute_via_amp,
6682 .chained = true,
6683 .chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
6684 },
6685 [ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
6686 .type = HDA_FIXUP_FUNC,
6687 .v.func = alc_fixup_disable_mic_vref,
6688 .chained = true,
6689 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6690 },
667a8f73
JHP
6691 [ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
6692 .type = HDA_FIXUP_VERBS,
6693 .v.verbs = (const struct hda_verb[]) {
6694 { 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
6695 { 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
6696 { }
6697 },
6698 .chained = true,
6699 .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
6700 },
e1037354
JHP
6701 [ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
6702 .type = HDA_FIXUP_PINS,
6703 .v.pins = (const struct hda_pintbl[]) {
6704 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
6705 { }
6706 },
6707 .chained = true,
6708 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
6709 },
e2a829b3
BR
6710 [ALC299_FIXUP_PREDATOR_SPK] = {
6711 .type = HDA_FIXUP_PINS,
6712 .v.pins = (const struct hda_pintbl[]) {
6713 { 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
6714 { }
6715 }
6716 },
f1d4e28b
KY
6717};
6718
1d045db9 6719static const struct snd_pci_quirk alc269_fixup_tbl[] = {
a6b92b66 6720 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
693b613d
DH
6721 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
6722 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
aaedfb47 6723 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
7819717b
TI
6724 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
6725 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
aaedfb47
DH
6726 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
6727 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
02322ac9 6728 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
b1e8972e 6729 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
1a22e775 6730 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
705b65f1 6731 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
b9c2fa52 6732 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
c7531e31
CC
6733 SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
6734 SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
e2a829b3 6735 SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
667a8f73
JHP
6736 SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
6737 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
6738 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
2733cceb 6739 SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
cbc05fd6 6740 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
aaedfb47 6741 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
6ed1131f 6742 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
86f799b8 6743 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
cf52103a 6744 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
8b99aba7
TI
6745 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
6746 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
0f4881dc 6747 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
73bdd597
DH
6748 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
6749 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
6750 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
0f4881dc
DH
6751 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
6752 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
98070576 6753 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
4275554d 6754 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
0f4881dc 6755 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
a22aa26f
KY
6756 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6757 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
831bfdf9 6758 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
afecb146 6759 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
3a05d12f 6760 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
8b72415d 6761 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
b734304f
KY
6762 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6763 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
c04017ea
DH
6764 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6765 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6766 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6767 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6768 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
423cd785 6769 SND_PCI_QUIRK(0x1028, 0x0704, "Dell XPS 13 9350", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
fd06c77e 6770 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
3b43b71f 6771 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
c0ca5ece 6772 SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
423cd785 6773 SND_PCI_QUIRK(0x1028, 0x075b, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
709ae62e 6774 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
dd9aa335 6775 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
e312a869 6776 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
493de342 6777 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
5f364135 6778 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
e4c9fd10 6779 SND_PCI_QUIRK(0x1028, 0x082a, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
40e2c4e5
KY
6780 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
6781 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
f0ba9d69
KY
6782 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
6783 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
ae104a21 6784 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
136824ef 6785 SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
da484d00 6786 SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
c2a7c55a 6787 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
a22aa26f
KY
6788 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6789 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
08fb0d0e 6790 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
9f5c6faf 6791 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
8e35cd4a 6792 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
33f4acd3 6793 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
c60666bd 6794 /* ALC282 */
7976eb49 6795 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8a02b164 6796 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8a02b164 6797 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9c5dc3bf
KY
6798 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6799 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6800 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6801 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9c5dc3bf 6802 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
c60666bd 6803 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd
KY
6804 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6805 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8a02b164 6806 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
eaa8e5ef 6807 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
b4b33f9d 6808 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
3271cb22 6809 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
c60666bd 6810 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd
KY
6811 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6812 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6813 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 6814 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
98973f2f 6815 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
9c5dc3bf
KY
6816 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6817 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
c60666bd 6818 /* ALC290 */
9c5dc3bf 6819 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9c5dc3bf 6820 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9c5dc3bf 6821 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9c5dc3bf
KY
6822 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6823 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6824 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6825 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6826 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9c5dc3bf 6827 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
04d5466a 6828 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
c60666bd 6829 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd
KY
6830 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6831 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6832 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9c5dc3bf
KY
6833 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6834 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9c5dc3bf 6835 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
c60666bd 6836 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 6837 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 6838 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd
KY
6839 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6840 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd
KY
6841 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6842 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 6843 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8a02b164
KY
6844 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6845 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6846 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6847 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
f883982d 6848 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
167897f4
JK
6849 SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
6850 SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
563785ed 6851 SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
e549d190 6852 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
bbf8ff6b 6853 SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
167897f4
JK
6854 SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
6855 SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
56e40eb6 6856 SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
c1732ede 6857 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
7bba2157 6858 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
3e0d611b 6859 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9cf6533e 6860 SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
c1732ede 6861 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
4eab0ea1 6862 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
3e0d611b 6863 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4eab0ea1
TI
6864 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
6865 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
6866 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
c1732ede
CC
6867 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
6868 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
6869 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
2cede303 6870 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
23870831 6871 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
3e0d611b 6872 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
017f2a10 6873 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
28e8af8a 6874 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
693b613d 6875 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
615966ad 6876 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
4eab0ea1 6877 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
c1732ede 6878 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
eeed4cd1 6879 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
adabb3ec
TI
6880 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
6881 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
6882 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
6883 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
d240d1dc 6884 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
f88abaa0 6885 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
88cfcf86 6886 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
1d045db9
TI
6887 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
6888 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
6889 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
e9bd7d5c 6890 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
24519911 6891 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
4df3fd17 6892 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
cc7016ab 6893 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
88776f36 6894 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
fdcc968a 6895 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
2041d564 6896 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
b84e8436 6897 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
0fca97a2 6898 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
a33cc48d 6899 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
823ff161 6900 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
abaa2274
AA
6901 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
6902 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
8cd65271 6903 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
89e3a568 6904 SND_PCI_QUIRK(0x1558, 0x1325, "System76 Darter Pro (darp5)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
ca169cc2 6905 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
1d045db9
TI
6906 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
6907 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
6908 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
6909 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
6910 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
707fba3f 6911 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK),
c8415a48 6912 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
84f98fdf 6913 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
4407be6b 6914 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
108cc108 6915 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
aaedfb47 6916 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
9a811230 6917 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
1c37c223 6918 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
a12137e7 6919 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
59a51a6b 6920 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
6d16941a 6921 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
7c21539c 6922 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
a4a9e082 6923 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
b6903c0e 6924 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
d05ea7da 6925 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
c0278669 6926 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
61fcf8ec
KY
6927 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6928 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
dab38e43 6929 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
c636b95e 6930 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
61fcf8ec
KY
6931 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
6932 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6933 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
e4c07b3b 6934 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
61fcf8ec
KY
6935 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6936 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6937 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
85981dfd 6938 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
3694cb29 6939 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
6ef2f68f 6940 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
f33f79f3 6941 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
e41fc8c5 6942 SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
65811834 6943 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
8da5bbfc 6944 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
56f27013 6945 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
fedb2245 6946 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
9b745ab8 6947 SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP),
a4a9e082 6948 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
1bb3e062 6949 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
c497d9f9 6950 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
cd5302c0 6951 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
f2aa1110 6952 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
80b311d3 6953 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
09ea9976 6954 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
037e1197 6955 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
23adc192 6956 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
0f087ee3 6957 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
9cd25743 6958 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
0f087ee3 6959 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
61fcf8ec
KY
6960 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6961 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6962 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
cd5302c0 6963 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
61fcf8ec
KY
6964 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6965 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
012e7eb1 6966 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
1d045db9 6967 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
e2744fd7
AB
6968 SND_PCI_QUIRK(0x19e5, 0x3200, "Huawei MBX", ALC255_FIXUP_MIC_MUTE_LED),
6969 SND_PCI_QUIRK(0x19e5, 0x3201, "Huawei MBX", ALC255_FIXUP_MIC_MUTE_LED),
8ac51bbc 6970 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MBXP", ALC256_FIXUP_HUAWEI_MBXP_PINS),
02b504d9 6971 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
a4297b5d 6972
a7f3eedc 6973#if 0
a4297b5d
TI
6974 /* Below is a quirk table taken from the old code.
6975 * Basically the device should work as is without the fixup table.
6976 * If BIOS doesn't give a proper info, enable the corresponding
6977 * fixup entry.
7d7eb9ea 6978 */
a4297b5d
TI
6979 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
6980 ALC269_FIXUP_AMIC),
6981 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
a4297b5d
TI
6982 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
6983 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
6984 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
6985 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
6986 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
6987 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
6988 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
6989 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
6990 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
6991 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
6992 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
6993 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
6994 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
6995 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
6996 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
6997 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
6998 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
6999 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
7000 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
7001 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
7002 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
7003 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
7004 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
7005 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
7006 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
7007 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
7008 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
7009 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
7010 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
7011 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
7012 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
7013 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
7014 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
7015 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
7016 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
7017 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
7018 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
7019 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
7020#endif
7021 {}
7022};
7023
214eef76
DH
7024static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
7025 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
7026 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
7027 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
7028 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
7029 {}
7030};
7031
1727a771 7032static const struct hda_model_fixup alc269_fixup_models[] = {
a4297b5d
TI
7033 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
7034 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
6e72aa5f
TI
7035 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
7036 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
7037 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
7c478f03 7038 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
b016951e
TI
7039 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
7040 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
108cc108 7041 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
9f5c6faf 7042 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
04d5466a 7043 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
e32aa85a
DH
7044 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
7045 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
a26d96c7
TI
7046 {.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
7047 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
be8ef16a 7048 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
0202e99c 7049 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
1c37c223 7050 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
9a811230 7051 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
c636b95e 7052 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
a26d96c7 7053 {.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
ba90d6a6 7054 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
28d1d6d2 7055 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
a26d96c7
TI
7056 {.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
7057 {.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
7058 {.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
7059 {.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
7060 {.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
7061 {.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
7062 {.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
7063 {.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
7064 {.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
7065 {.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
7066 {.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
7067 {.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
7068 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
7069 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
7070 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
7071 {.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
7072 {.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
7073 {.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
7074 {.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
7075 {.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
7076 {.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
7077 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
7078 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
7079 {.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
7080 {.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
7081 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
7082 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
7083 {.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
7084 {.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
7085 {.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
7086 {.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
7087 {.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
7088 {.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
7089 {.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
7090 {.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
7091 {.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
7092 {.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
7093 {.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
7094 {.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
7095 {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
b3802783 7096 {.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
a26d96c7
TI
7097 {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
7098 {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
7099 {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
7100 {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
7101 {.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
7102 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
7103 {.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
7104 {.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
7105 {.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
7106 {.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
7107 {.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
7108 {.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
7109 {.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
7110 {.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
7111 {.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
7112 {.id = ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE, .name = "alc256-dell-xps13"},
7113 {.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
7114 {.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
7115 {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
82aa0d7e 7116 {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
a26d96c7
TI
7117 {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
7118 {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
7119 {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
7120 {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
7121 {.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
7122 {.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
7123 {.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
7124 {.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
7125 {.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
7126 {.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
7127 {.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
7128 {.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
7129 {.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
7130 {.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
7131 {.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
7132 {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
7133 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
7134 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
10f5b1b8 7135 {.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-sense-combo"},
e2a829b3 7136 {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
1d045db9 7137 {}
6dda9f4a 7138};
cfc5a845 7139#define ALC225_STANDARD_PINS \
cfc5a845 7140 {0x21, 0x04211020}
6dda9f4a 7141
e8191a8e
HW
7142#define ALC256_STANDARD_PINS \
7143 {0x12, 0x90a60140}, \
7144 {0x14, 0x90170110}, \
e8191a8e
HW
7145 {0x21, 0x02211020}
7146
fea185e2 7147#define ALC282_STANDARD_PINS \
11580297 7148 {0x14, 0x90170110}
e1e62b98 7149
fea185e2 7150#define ALC290_STANDARD_PINS \
11580297 7151 {0x12, 0x99a30130}
fea185e2
DH
7152
7153#define ALC292_STANDARD_PINS \
7154 {0x14, 0x90170110}, \
11580297 7155 {0x15, 0x0221401f}
977e6276 7156
3f640970
HW
7157#define ALC295_STANDARD_PINS \
7158 {0x12, 0xb7a60130}, \
7159 {0x14, 0x90170110}, \
3f640970
HW
7160 {0x21, 0x04211020}
7161
703867e2
WS
7162#define ALC298_STANDARD_PINS \
7163 {0x12, 0x90a60130}, \
7164 {0x21, 0x03211020}
7165
e1918938 7166static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
8a328ac1
KY
7167 SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
7168 {0x14, 0x01014020},
7169 {0x17, 0x90170110},
7170 {0x18, 0x02a11030},
7171 {0x19, 0x0181303F},
7172 {0x21, 0x0221102f}),
5824ce8d
CC
7173 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
7174 {0x12, 0x90a601c0},
7175 {0x14, 0x90171120},
7176 {0x21, 0x02211030}),
615966ad
CC
7177 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
7178 {0x14, 0x90170110},
7179 {0x1b, 0x90a70130},
7180 {0x21, 0x03211020}),
7181 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
7182 {0x1a, 0x90a70130},
7183 {0x1b, 0x90170110},
7184 {0x21, 0x03211020}),
2ae95577 7185 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
cfc5a845 7186 ALC225_STANDARD_PINS,
8a132099 7187 {0x12, 0xb7a60130},
cfc5a845 7188 {0x14, 0x901701a0}),
2ae95577 7189 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
cfc5a845 7190 ALC225_STANDARD_PINS,
8a132099 7191 {0x12, 0xb7a60130},
cfc5a845 7192 {0x14, 0x901701b0}),
8a132099
HW
7193 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7194 ALC225_STANDARD_PINS,
7195 {0x12, 0xb7a60150},
7196 {0x14, 0x901701a0}),
7197 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7198 ALC225_STANDARD_PINS,
7199 {0x12, 0xb7a60150},
7200 {0x14, 0x901701b0}),
7201 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7202 ALC225_STANDARD_PINS,
7203 {0x12, 0xb7a60130},
7204 {0x1b, 0x90170110}),
0ce48e17
KHF
7205 SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7206 {0x1b, 0x01111010},
7207 {0x1e, 0x01451130},
7208 {0x21, 0x02211020}),
986376b6
HW
7209 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
7210 {0x12, 0x90a60140},
7211 {0x14, 0x90170110},
7212 {0x19, 0x02a11030},
7213 {0x21, 0x02211020}),
e41fc8c5
HW
7214 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
7215 {0x14, 0x90170110},
7216 {0x19, 0x02a11030},
7217 {0x1a, 0x02a11040},
7218 {0x1b, 0x01014020},
7219 {0x21, 0x0221101f}),
d06fb562
HW
7220 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
7221 {0x14, 0x90170110},
7222 {0x19, 0x02a11030},
7223 {0x1a, 0x02a11040},
7224 {0x1b, 0x01011020},
7225 {0x21, 0x0221101f}),
c6b17f10
HW
7226 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
7227 {0x14, 0x90170110},
7228 {0x19, 0x02a11020},
7229 {0x1a, 0x02a11030},
7230 {0x21, 0x0221101f}),
f265788c
HW
7231 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7232 {0x12, 0x90a60140},
7233 {0x14, 0x90170110},
7234 {0x21, 0x02211020}),
7235 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7236 {0x12, 0x90a60140},
7237 {0x14, 0x90170150},
7238 {0x21, 0x02211020}),
c77900e6 7239 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
c77900e6 7240 {0x14, 0x90170110},
c77900e6 7241 {0x21, 0x02211020}),
86c72d1c
HW
7242 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7243 {0x14, 0x90170130},
7244 {0x21, 0x02211040}),
76c2132e
DH
7245 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7246 {0x12, 0x90a60140},
7247 {0x14, 0x90170110},
76c2132e
DH
7248 {0x21, 0x02211020}),
7249 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7250 {0x12, 0x90a60160},
7251 {0x14, 0x90170120},
76c2132e 7252 {0x21, 0x02211030}),
392c9da2
HW
7253 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7254 {0x14, 0x90170110},
7255 {0x1b, 0x02011020},
7256 {0x21, 0x0221101f}),
6aecd871
HW
7257 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7258 {0x14, 0x90170110},
7259 {0x1b, 0x01011020},
7260 {0x21, 0x0221101f}),
cba59972 7261 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
cba59972 7262 {0x14, 0x90170130},
cba59972 7263 {0x1b, 0x01014020},
cba59972 7264 {0x21, 0x0221103f}),
6aecd871
HW
7265 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7266 {0x14, 0x90170130},
7267 {0x1b, 0x01011020},
7268 {0x21, 0x0221103f}),
59ec4b57
HW
7269 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7270 {0x14, 0x90170130},
7271 {0x1b, 0x02011020},
7272 {0x21, 0x0221103f}),
e9c28e16 7273 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
e9c28e16 7274 {0x14, 0x90170150},
e9c28e16 7275 {0x1b, 0x02011020},
e9c28e16
WS
7276 {0x21, 0x0221105f}),
7277 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
e9c28e16 7278 {0x14, 0x90170110},
e9c28e16 7279 {0x1b, 0x01014020},
e9c28e16 7280 {0x21, 0x0221101f}),
76c2132e
DH
7281 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7282 {0x12, 0x90a60160},
7283 {0x14, 0x90170120},
7284 {0x17, 0x90170140},
76c2132e
DH
7285 {0x21, 0x0321102f}),
7286 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7287 {0x12, 0x90a60160},
7288 {0x14, 0x90170130},
76c2132e
DH
7289 {0x21, 0x02211040}),
7290 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7291 {0x12, 0x90a60160},
7292 {0x14, 0x90170140},
76c2132e
DH
7293 {0x21, 0x02211050}),
7294 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7295 {0x12, 0x90a60170},
7296 {0x14, 0x90170120},
76c2132e
DH
7297 {0x21, 0x02211030}),
7298 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7299 {0x12, 0x90a60170},
7300 {0x14, 0x90170130},
76c2132e 7301 {0x21, 0x02211040}),
0a1f90a9
HW
7302 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7303 {0x12, 0x90a60170},
7304 {0x14, 0x90171130},
7305 {0x21, 0x02211040}),
70658b99 7306 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
70658b99
HW
7307 {0x12, 0x90a60170},
7308 {0x14, 0x90170140},
70658b99 7309 {0x21, 0x02211050}),
9b5a4e39 7310 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9b5a4e39
DH
7311 {0x12, 0x90a60180},
7312 {0x14, 0x90170130},
9b5a4e39 7313 {0x21, 0x02211040}),
f90d83b3
AK
7314 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7315 {0x12, 0x90a60180},
7316 {0x14, 0x90170120},
7317 {0x21, 0x02211030}),
989dbe4a
HW
7318 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7319 {0x1b, 0x01011020},
7320 {0x21, 0x02211010}),
285d5ddc
HW
7321 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7322 {0x12, 0x90a60130},
7323 {0x14, 0x90170110},
7324 {0x1b, 0x01011020},
7325 {0x21, 0x0221101f}),
81a1231b 7326 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
81a1231b
KY
7327 {0x12, 0x90a60160},
7328 {0x14, 0x90170120},
81a1231b 7329 {0x21, 0x02211030}),
f83c3292
WS
7330 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7331 {0x12, 0x90a60170},
7332 {0x14, 0x90170120},
7333 {0x21, 0x02211030}),
311042d1
SB
7334 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell Inspiron 5468", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7335 {0x12, 0x90a60180},
7336 {0x14, 0x90170120},
7337 {0x21, 0x02211030}),
3f640970
HW
7338 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7339 {0x12, 0xb7a60130},
7340 {0x14, 0x90170110},
7341 {0x21, 0x02211020}),
3f2f7c55
HW
7342 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7343 {0x12, 0x90a60130},
7344 {0x14, 0x90170110},
7345 {0x14, 0x01011020},
7346 {0x21, 0x0221101f}),
7081adf3 7347 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11580297 7348 ALC256_STANDARD_PINS),
c1732ede
CC
7349 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
7350 {0x14, 0x90170110},
7351 {0x1b, 0x90a70130},
7352 {0x21, 0x04211020}),
7353 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
7354 {0x14, 0x90170110},
7355 {0x1b, 0x90a70130},
7356 {0x21, 0x03211020}),
a806ef1c
CC
7357 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
7358 {0x12, 0x90a60130},
7359 {0x14, 0x90170110},
7360 {0x21, 0x03211020}),
6ac371aa
JHP
7361 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
7362 {0x12, 0x90a60130},
7363 {0x14, 0x90170110},
7364 {0x21, 0x04211020}),
e1037354
JHP
7365 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
7366 {0x1a, 0x90a70130},
7367 {0x1b, 0x90170110},
7368 {0x21, 0x03211020}),
92266651 7369 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
75ee94b2
HW
7370 {0x12, 0xb7a60130},
7371 {0x13, 0xb8a61140},
7372 {0x16, 0x90170110},
7373 {0x21, 0x04211020}),
cf51eb9d
DH
7374 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
7375 {0x12, 0x90a60130},
cf51eb9d
DH
7376 {0x14, 0x90170110},
7377 {0x15, 0x0421101f},
11580297 7378 {0x1a, 0x04a11020}),
0279661b
HW
7379 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
7380 {0x12, 0x90a60140},
0279661b
HW
7381 {0x14, 0x90170110},
7382 {0x15, 0x0421101f},
0279661b 7383 {0x18, 0x02811030},
0279661b 7384 {0x1a, 0x04a1103f},
11580297 7385 {0x1b, 0x02011020}),
42304474 7386 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 7387 ALC282_STANDARD_PINS,
42304474 7388 {0x12, 0x99a30130},
42304474 7389 {0x19, 0x03a11020},
42304474 7390 {0x21, 0x0321101f}),
2c609999 7391 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 7392 ALC282_STANDARD_PINS,
2c609999 7393 {0x12, 0x99a30130},
2c609999 7394 {0x19, 0x03a11020},
2c609999
HW
7395 {0x21, 0x03211040}),
7396 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 7397 ALC282_STANDARD_PINS,
2c609999 7398 {0x12, 0x99a30130},
2c609999 7399 {0x19, 0x03a11030},
2c609999
HW
7400 {0x21, 0x03211020}),
7401 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 7402 ALC282_STANDARD_PINS,
2c609999 7403 {0x12, 0x99a30130},
2c609999 7404 {0x19, 0x04a11020},
2c609999 7405 {0x21, 0x0421101f}),
200afc09 7406 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
aec856d0 7407 ALC282_STANDARD_PINS,
200afc09 7408 {0x12, 0x90a60140},
200afc09 7409 {0x19, 0x04a11030},
200afc09 7410 {0x21, 0x04211020}),
76c2132e 7411 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 7412 ALC282_STANDARD_PINS,
76c2132e 7413 {0x12, 0x90a60130},
76c2132e
DH
7414 {0x21, 0x0321101f}),
7415 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7416 {0x12, 0x90a60160},
7417 {0x14, 0x90170120},
76c2132e 7418 {0x21, 0x02211030}),
bc262179 7419 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 7420 ALC282_STANDARD_PINS,
bc262179 7421 {0x12, 0x90a60130},
bc262179 7422 {0x19, 0x03a11020},
bc262179 7423 {0x21, 0x0321101f}),
c8c6ee61 7424 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
c4cfcf6f
HW
7425 {0x12, 0x90a60130},
7426 {0x14, 0x90170110},
7427 {0x19, 0x04a11040},
7428 {0x21, 0x04211020}),
33aaebd4
CC
7429 SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
7430 {0x12, 0x90a60130},
7431 {0x17, 0x90170110},
7432 {0x21, 0x02211020}),
d44a6864 7433 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
e1e62b98 7434 {0x12, 0x90a60120},
e1e62b98 7435 {0x14, 0x90170110},
e1e62b98 7436 {0x21, 0x0321101f}),
d5078193 7437 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
3f2f7c55
HW
7438 {0x12, 0xb7a60130},
7439 {0x14, 0x90170110},
7440 {0x21, 0x04211020}),
e4442bcf 7441 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 7442 ALC290_STANDARD_PINS,
e4442bcf 7443 {0x15, 0x04211040},
e4442bcf 7444 {0x18, 0x90170112},
11580297 7445 {0x1a, 0x04a11020}),
e4442bcf 7446 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 7447 ALC290_STANDARD_PINS,
e4442bcf 7448 {0x15, 0x04211040},
e4442bcf 7449 {0x18, 0x90170110},
11580297 7450 {0x1a, 0x04a11020}),
e4442bcf 7451 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 7452 ALC290_STANDARD_PINS,
e4442bcf 7453 {0x15, 0x0421101f},
11580297 7454 {0x1a, 0x04a11020}),
e4442bcf 7455 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 7456 ALC290_STANDARD_PINS,
e4442bcf 7457 {0x15, 0x04211020},
11580297 7458 {0x1a, 0x04a11040}),
e4442bcf 7459 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 7460 ALC290_STANDARD_PINS,
e4442bcf
HW
7461 {0x14, 0x90170110},
7462 {0x15, 0x04211020},
11580297 7463 {0x1a, 0x04a11040}),
e4442bcf 7464 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 7465 ALC290_STANDARD_PINS,
e4442bcf
HW
7466 {0x14, 0x90170110},
7467 {0x15, 0x04211020},
11580297 7468 {0x1a, 0x04a11020}),
e4442bcf 7469 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 7470 ALC290_STANDARD_PINS,
e4442bcf
HW
7471 {0x14, 0x90170110},
7472 {0x15, 0x0421101f},
11580297 7473 {0x1a, 0x04a11020}),
e8818fa8 7474 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
aec856d0 7475 ALC292_STANDARD_PINS,
e8818fa8 7476 {0x12, 0x90a60140},
e8818fa8 7477 {0x16, 0x01014020},
11580297 7478 {0x19, 0x01a19030}),
e8818fa8 7479 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
aec856d0 7480 ALC292_STANDARD_PINS,
e8818fa8 7481 {0x12, 0x90a60140},
e8818fa8
HW
7482 {0x16, 0x01014020},
7483 {0x18, 0x02a19031},
11580297 7484 {0x19, 0x01a1903e}),
76c2132e 7485 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
aec856d0 7486 ALC292_STANDARD_PINS,
11580297 7487 {0x12, 0x90a60140}),
76c2132e 7488 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 7489 ALC292_STANDARD_PINS,
76c2132e 7490 {0x13, 0x90a60140},
76c2132e 7491 {0x16, 0x21014020},
11580297 7492 {0x19, 0x21a19030}),
e03fdbde 7493 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 7494 ALC292_STANDARD_PINS,
11580297 7495 {0x13, 0x90a60140}),
d8ae458e
CC
7496 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
7497 {0x14, 0x90170110},
7498 {0x1b, 0x90a70130},
7499 {0x21, 0x04211020}),
8bb37a2a
JHP
7500 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
7501 {0x12, 0x90a60130},
7502 {0x17, 0x90170110},
7503 {0x21, 0x03211020}),
0bea4cc8
JHP
7504 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
7505 {0x12, 0x90a60130},
7506 {0x17, 0x90170110},
7507 {0x21, 0x04211020}),
3f640970 7508 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
f771d5bb
HW
7509 ALC295_STANDARD_PINS,
7510 {0x17, 0x21014020},
7511 {0x18, 0x21a19030}),
7512 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7513 ALC295_STANDARD_PINS,
7514 {0x17, 0x21014040},
7515 {0x18, 0x21a19050}),
3f307834
HW
7516 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7517 ALC295_STANDARD_PINS),
9f502ff5
TI
7518 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7519 ALC298_STANDARD_PINS,
7520 {0x17, 0x90170110}),
977e6276 7521 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
703867e2
WS
7522 ALC298_STANDARD_PINS,
7523 {0x17, 0x90170140}),
7524 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7525 ALC298_STANDARD_PINS,
9f502ff5 7526 {0x17, 0x90170150}),
9f1bc2c4
KHF
7527 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
7528 {0x12, 0xb7a60140},
7529 {0x13, 0xb7a60150},
7530 {0x17, 0x90170110},
7531 {0x1a, 0x03011020},
7532 {0x21, 0x03211030}),
fcc6c877
KY
7533 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
7534 ALC225_STANDARD_PINS,
7535 {0x12, 0xb7a60130},
fcc6c877 7536 {0x17, 0x90170110}),
e1918938
HW
7537 {}
7538};
6dda9f4a 7539
546bb678 7540static void alc269_fill_coef(struct hda_codec *codec)
1d045db9 7541{
526af6eb 7542 struct alc_spec *spec = codec->spec;
1d045db9 7543 int val;
ebb83eeb 7544
526af6eb 7545 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
546bb678 7546 return;
526af6eb 7547
1bb7e43e 7548 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
1d045db9
TI
7549 alc_write_coef_idx(codec, 0xf, 0x960b);
7550 alc_write_coef_idx(codec, 0xe, 0x8817);
7551 }
ebb83eeb 7552
1bb7e43e 7553 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
1d045db9
TI
7554 alc_write_coef_idx(codec, 0xf, 0x960b);
7555 alc_write_coef_idx(codec, 0xe, 0x8814);
7556 }
ebb83eeb 7557
1bb7e43e 7558 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
1d045db9 7559 /* Power up output pin */
98b24883 7560 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
1d045db9 7561 }
ebb83eeb 7562
1bb7e43e 7563 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
1d045db9 7564 val = alc_read_coef_idx(codec, 0xd);
f3ee07d8 7565 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
1d045db9
TI
7566 /* Capless ramp up clock control */
7567 alc_write_coef_idx(codec, 0xd, val | (1<<10));
7568 }
7569 val = alc_read_coef_idx(codec, 0x17);
f3ee07d8 7570 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
1d045db9
TI
7571 /* Class D power on reset */
7572 alc_write_coef_idx(codec, 0x17, val | (1<<7));
7573 }
7574 }
ebb83eeb 7575
98b24883
TI
7576 /* HP */
7577 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
1d045db9 7578}
a7f2371f 7579
1d045db9
TI
7580/*
7581 */
1d045db9
TI
7582static int patch_alc269(struct hda_codec *codec)
7583{
7584 struct alc_spec *spec;
3de95173 7585 int err;
f1d4e28b 7586
3de95173 7587 err = alc_alloc_spec(codec, 0x0b);
e16fb6d1 7588 if (err < 0)
3de95173
TI
7589 return err;
7590
7591 spec = codec->spec;
08c189f2 7592 spec->gen.shared_mic_vref_pin = 0x18;
8b99aba7 7593 codec->power_save_node = 1;
e16fb6d1 7594
225068ab
TI
7595#ifdef CONFIG_PM
7596 codec->patch_ops.suspend = alc269_suspend;
7597 codec->patch_ops.resume = alc269_resume;
7598#endif
c2d6af53
KY
7599 spec->shutup = alc_default_shutup;
7600 spec->init_hook = alc_default_init;
225068ab 7601
7639a06c 7602 switch (codec->core.vendor_id) {
065380f0 7603 case 0x10ec0269:
1d045db9 7604 spec->codec_variant = ALC269_TYPE_ALC269VA;
1bb7e43e
TI
7605 switch (alc_get_coef0(codec) & 0x00f0) {
7606 case 0x0010:
5100cd07
TI
7607 if (codec->bus->pci &&
7608 codec->bus->pci->subsystem_vendor == 0x1025 &&
e16fb6d1 7609 spec->cdefine.platform_type == 1)
20ca0c35 7610 err = alc_codec_rename(codec, "ALC271X");
1d045db9 7611 spec->codec_variant = ALC269_TYPE_ALC269VB;
1bb7e43e
TI
7612 break;
7613 case 0x0020:
5100cd07
TI
7614 if (codec->bus->pci &&
7615 codec->bus->pci->subsystem_vendor == 0x17aa &&
e16fb6d1 7616 codec->bus->pci->subsystem_device == 0x21f3)
20ca0c35 7617 err = alc_codec_rename(codec, "ALC3202");
1d045db9 7618 spec->codec_variant = ALC269_TYPE_ALC269VC;
1bb7e43e 7619 break;
adcc70b2
KY
7620 case 0x0030:
7621 spec->codec_variant = ALC269_TYPE_ALC269VD;
7622 break;
1bb7e43e 7623 default:
1d045db9 7624 alc_fix_pll_init(codec, 0x20, 0x04, 15);
1bb7e43e 7625 }
e16fb6d1
TI
7626 if (err < 0)
7627 goto error;
c2d6af53 7628 spec->shutup = alc269_shutup;
546bb678 7629 spec->init_hook = alc269_fill_coef;
1d045db9 7630 alc269_fill_coef(codec);
065380f0
KY
7631 break;
7632
7633 case 0x10ec0280:
7634 case 0x10ec0290:
7635 spec->codec_variant = ALC269_TYPE_ALC280;
7636 break;
7637 case 0x10ec0282:
065380f0 7638 spec->codec_variant = ALC269_TYPE_ALC282;
7b5c7a02
KY
7639 spec->shutup = alc282_shutup;
7640 spec->init_hook = alc282_init;
065380f0 7641 break;
2af02be7
KY
7642 case 0x10ec0233:
7643 case 0x10ec0283:
7644 spec->codec_variant = ALC269_TYPE_ALC283;
7645 spec->shutup = alc283_shutup;
7646 spec->init_hook = alc283_init;
7647 break;
065380f0
KY
7648 case 0x10ec0284:
7649 case 0x10ec0292:
7650 spec->codec_variant = ALC269_TYPE_ALC284;
7651 break;
161ebf29 7652 case 0x10ec0293:
4731d5de 7653 spec->codec_variant = ALC269_TYPE_ALC293;
161ebf29 7654 break;
7fc7d047 7655 case 0x10ec0286:
7c665932 7656 case 0x10ec0288:
7fc7d047 7657 spec->codec_variant = ALC269_TYPE_ALC286;
f7ae9ba0 7658 spec->shutup = alc286_shutup;
7fc7d047 7659 break;
506b62c3
KY
7660 case 0x10ec0298:
7661 spec->codec_variant = ALC269_TYPE_ALC298;
7662 break;
ea04a1db 7663 case 0x10ec0235:
1d04c9de
KY
7664 case 0x10ec0255:
7665 spec->codec_variant = ALC269_TYPE_ALC255;
ab3b8e51
KY
7666 spec->shutup = alc256_shutup;
7667 spec->init_hook = alc256_init;
1d04c9de 7668 break;
736f20a7 7669 case 0x10ec0236:
4344aec8
KY
7670 case 0x10ec0256:
7671 spec->codec_variant = ALC269_TYPE_ALC256;
4a219ef8
KY
7672 spec->shutup = alc256_shutup;
7673 spec->init_hook = alc256_init;
7d1b6e29 7674 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
d32b6666 7675 alc_update_coef_idx(codec, 0x36, 1 << 13, 1 << 5); /* Switch pcbeep path to Line in path*/
4344aec8 7676 break;
f429e7e4
KY
7677 case 0x10ec0257:
7678 spec->codec_variant = ALC269_TYPE_ALC257;
88d42b2b
KY
7679 spec->shutup = alc256_shutup;
7680 spec->init_hook = alc256_init;
f429e7e4
KY
7681 spec->gen.mixer_nid = 0;
7682 break;
0a6f0600
KY
7683 case 0x10ec0215:
7684 case 0x10ec0285:
7685 case 0x10ec0289:
7686 spec->codec_variant = ALC269_TYPE_ALC215;
1b6832be
KY
7687 spec->shutup = alc225_shutup;
7688 spec->init_hook = alc225_init;
0a6f0600
KY
7689 spec->gen.mixer_nid = 0;
7690 break;
4231430d 7691 case 0x10ec0225:
7d727869 7692 case 0x10ec0295:
28f1f9b2 7693 case 0x10ec0299:
4231430d 7694 spec->codec_variant = ALC269_TYPE_ALC225;
da911b1f
KY
7695 spec->shutup = alc225_shutup;
7696 spec->init_hook = alc225_init;
c1350bff 7697 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
4231430d 7698 break;
dcd4f0db
KY
7699 case 0x10ec0234:
7700 case 0x10ec0274:
7701 case 0x10ec0294:
7702 spec->codec_variant = ALC269_TYPE_ALC294;
532a7784 7703 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
71683c32 7704 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
693abe11 7705 spec->init_hook = alc294_init;
dcd4f0db 7706 break;
1078bef0
KY
7707 case 0x10ec0300:
7708 spec->codec_variant = ALC269_TYPE_ALC300;
7709 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
dcd4f0db 7710 break;
6fbae35a
KY
7711 case 0x10ec0700:
7712 case 0x10ec0701:
7713 case 0x10ec0703:
7714 spec->codec_variant = ALC269_TYPE_ALC700;
7715 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
2d7fe618 7716 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
693abe11 7717 spec->init_hook = alc294_init;
6fbae35a
KY
7718 break;
7719
1d045db9 7720 }
6dda9f4a 7721
ad60d502 7722 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
97a26570 7723 spec->has_alc5505_dsp = 1;
ad60d502
KY
7724 spec->init_hook = alc5505_dsp_init;
7725 }
7726
efe55732
TI
7727 snd_hda_pick_fixup(codec, alc269_fixup_models,
7728 alc269_fixup_tbl, alc269_fixups);
7729 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups);
7730 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
7731 alc269_fixups);
7732 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
7733
7734 alc_auto_parse_customize_define(codec);
7735
7736 if (has_cdefine_beep(codec))
7737 spec->gen.beep_nid = 0x01;
7738
a4297b5d
TI
7739 /* automatic parse from the BIOS config */
7740 err = alc269_parse_auto_config(codec);
e16fb6d1
TI
7741 if (err < 0)
7742 goto error;
6dda9f4a 7743
fea80fae
TI
7744 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
7745 err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
7746 if (err < 0)
7747 goto error;
7748 }
f1d4e28b 7749
1727a771 7750 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 7751
1d045db9 7752 return 0;
e16fb6d1
TI
7753
7754 error:
7755 alc_free(codec);
7756 return err;
1d045db9 7757}
f1d4e28b 7758
1d045db9
TI
7759/*
7760 * ALC861
7761 */
622e84cd 7762
1d045db9 7763static int alc861_parse_auto_config(struct hda_codec *codec)
6dda9f4a 7764{
1d045db9 7765 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
3e6179b8
TI
7766 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
7767 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
604401a9
TI
7768}
7769
1d045db9
TI
7770/* Pin config fixes */
7771enum {
e652f4c8
TI
7772 ALC861_FIXUP_FSC_AMILO_PI1505,
7773 ALC861_FIXUP_AMP_VREF_0F,
7774 ALC861_FIXUP_NO_JACK_DETECT,
7775 ALC861_FIXUP_ASUS_A6RP,
6ddf0fd1 7776 ALC660_FIXUP_ASUS_W7J,
1d045db9 7777};
7085ec12 7778
31150f23
TI
7779/* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
7780static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
1727a771 7781 const struct hda_fixup *fix, int action)
31150f23
TI
7782{
7783 struct alc_spec *spec = codec->spec;
7784 unsigned int val;
7785
1727a771 7786 if (action != HDA_FIXUP_ACT_INIT)
31150f23 7787 return;
d3f02d60 7788 val = snd_hda_codec_get_pin_target(codec, 0x0f);
31150f23
TI
7789 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
7790 val |= AC_PINCTL_IN_EN;
7791 val |= AC_PINCTL_VREF_50;
cdd03ced 7792 snd_hda_set_pin_ctl(codec, 0x0f, val);
08c189f2 7793 spec->gen.keep_vref_in_automute = 1;
31150f23
TI
7794}
7795
e652f4c8
TI
7796/* suppress the jack-detection */
7797static void alc_fixup_no_jack_detect(struct hda_codec *codec,
1727a771 7798 const struct hda_fixup *fix, int action)
e652f4c8 7799{
1727a771 7800 if (action == HDA_FIXUP_ACT_PRE_PROBE)
e652f4c8 7801 codec->no_jack_detect = 1;
7d7eb9ea 7802}
e652f4c8 7803
1727a771 7804static const struct hda_fixup alc861_fixups[] = {
e652f4c8 7805 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
1727a771
TI
7806 .type = HDA_FIXUP_PINS,
7807 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
7808 { 0x0b, 0x0221101f }, /* HP */
7809 { 0x0f, 0x90170310 }, /* speaker */
7810 { }
7811 }
7812 },
e652f4c8 7813 [ALC861_FIXUP_AMP_VREF_0F] = {
1727a771 7814 .type = HDA_FIXUP_FUNC,
31150f23 7815 .v.func = alc861_fixup_asus_amp_vref_0f,
3b25eb69 7816 },
e652f4c8 7817 [ALC861_FIXUP_NO_JACK_DETECT] = {
1727a771 7818 .type = HDA_FIXUP_FUNC,
e652f4c8
TI
7819 .v.func = alc_fixup_no_jack_detect,
7820 },
7821 [ALC861_FIXUP_ASUS_A6RP] = {
1727a771 7822 .type = HDA_FIXUP_FUNC,
e652f4c8
TI
7823 .v.func = alc861_fixup_asus_amp_vref_0f,
7824 .chained = true,
7825 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
6ddf0fd1
TI
7826 },
7827 [ALC660_FIXUP_ASUS_W7J] = {
7828 .type = HDA_FIXUP_VERBS,
7829 .v.verbs = (const struct hda_verb[]) {
7830 /* ASUS W7J needs a magic pin setup on unused NID 0x10
7831 * for enabling outputs
7832 */
7833 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
7834 { }
7835 },
e652f4c8 7836 }
1d045db9 7837};
7085ec12 7838
1d045db9 7839static const struct snd_pci_quirk alc861_fixup_tbl[] = {
6ddf0fd1 7840 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
e7ca237b 7841 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
e652f4c8
TI
7842 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
7843 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
7844 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
7845 SND_PCI_QUIRK(0x1584, 0x2b01, "Haier W18", ALC861_FIXUP_AMP_VREF_0F),
7846 SND_PCI_QUIRK(0x1584, 0x0000, "Uniwill ECS M31EI", ALC861_FIXUP_AMP_VREF_0F),
7847 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
1d045db9
TI
7848 {}
7849};
3af9ee6b 7850
1d045db9
TI
7851/*
7852 */
1d045db9 7853static int patch_alc861(struct hda_codec *codec)
7085ec12 7854{
1d045db9 7855 struct alc_spec *spec;
1d045db9 7856 int err;
7085ec12 7857
3de95173
TI
7858 err = alc_alloc_spec(codec, 0x15);
7859 if (err < 0)
7860 return err;
1d045db9 7861
3de95173 7862 spec = codec->spec;
7504b6cd 7863 spec->gen.beep_nid = 0x23;
1d045db9 7864
225068ab
TI
7865#ifdef CONFIG_PM
7866 spec->power_hook = alc_power_eapd;
7867#endif
7868
1727a771
TI
7869 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
7870 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
3af9ee6b 7871
cb4e4824
TI
7872 /* automatic parse from the BIOS config */
7873 err = alc861_parse_auto_config(codec);
e16fb6d1
TI
7874 if (err < 0)
7875 goto error;
3af9ee6b 7876
fea80fae
TI
7877 if (!spec->gen.no_analog) {
7878 err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
7879 if (err < 0)
7880 goto error;
7881 }
7085ec12 7882
1727a771 7883 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 7884
1d045db9 7885 return 0;
e16fb6d1
TI
7886
7887 error:
7888 alc_free(codec);
7889 return err;
7085ec12
TI
7890}
7891
1d045db9
TI
7892/*
7893 * ALC861-VD support
7894 *
7895 * Based on ALC882
7896 *
7897 * In addition, an independent DAC
7898 */
1d045db9 7899static int alc861vd_parse_auto_config(struct hda_codec *codec)
bc9f98a9 7900{
1d045db9 7901 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
3e6179b8
TI
7902 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
7903 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
ce764ab2
TI
7904}
7905
1d045db9 7906enum {
8fdcb6fe
TI
7907 ALC660VD_FIX_ASUS_GPIO1,
7908 ALC861VD_FIX_DALLAS,
1d045db9 7909};
ce764ab2 7910
8fdcb6fe
TI
7911/* exclude VREF80 */
7912static void alc861vd_fixup_dallas(struct hda_codec *codec,
1727a771 7913 const struct hda_fixup *fix, int action)
8fdcb6fe 7914{
1727a771 7915 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
b78562b1
TI
7916 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
7917 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
8fdcb6fe
TI
7918 }
7919}
7920
df73d83f
TI
7921/* reset GPIO1 */
7922static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
7923 const struct hda_fixup *fix, int action)
7924{
7925 struct alc_spec *spec = codec->spec;
7926
7927 if (action == HDA_FIXUP_ACT_PRE_PROBE)
7928 spec->gpio_mask |= 0x02;
7929 alc_fixup_gpio(codec, action, 0x01);
7930}
7931
1727a771 7932static const struct hda_fixup alc861vd_fixups[] = {
1d045db9 7933 [ALC660VD_FIX_ASUS_GPIO1] = {
df73d83f
TI
7934 .type = HDA_FIXUP_FUNC,
7935 .v.func = alc660vd_fixup_asus_gpio1,
1d045db9 7936 },
8fdcb6fe 7937 [ALC861VD_FIX_DALLAS] = {
1727a771 7938 .type = HDA_FIXUP_FUNC,
8fdcb6fe
TI
7939 .v.func = alc861vd_fixup_dallas,
7940 },
1d045db9 7941};
ce764ab2 7942
1d045db9 7943static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
8fdcb6fe 7944 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
1d045db9 7945 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
8fdcb6fe 7946 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
1d045db9
TI
7947 {}
7948};
ce764ab2 7949
1d045db9
TI
7950/*
7951 */
1d045db9 7952static int patch_alc861vd(struct hda_codec *codec)
ce764ab2 7953{
1d045db9 7954 struct alc_spec *spec;
cb4e4824 7955 int err;
ce764ab2 7956
3de95173
TI
7957 err = alc_alloc_spec(codec, 0x0b);
7958 if (err < 0)
7959 return err;
1d045db9 7960
3de95173 7961 spec = codec->spec;
7504b6cd 7962 spec->gen.beep_nid = 0x23;
1d045db9 7963
225068ab
TI
7964 spec->shutup = alc_eapd_shutup;
7965
1727a771
TI
7966 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
7967 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1d045db9 7968
cb4e4824
TI
7969 /* automatic parse from the BIOS config */
7970 err = alc861vd_parse_auto_config(codec);
e16fb6d1
TI
7971 if (err < 0)
7972 goto error;
ce764ab2 7973
fea80fae
TI
7974 if (!spec->gen.no_analog) {
7975 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
7976 if (err < 0)
7977 goto error;
7978 }
1d045db9 7979
1727a771 7980 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 7981
ce764ab2 7982 return 0;
e16fb6d1
TI
7983
7984 error:
7985 alc_free(codec);
7986 return err;
ce764ab2
TI
7987}
7988
1d045db9
TI
7989/*
7990 * ALC662 support
7991 *
7992 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
7993 * configuration. Each pin widget can choose any input DACs and a mixer.
7994 * Each ADC is connected from a mixer of all inputs. This makes possible
7995 * 6-channel independent captures.
7996 *
7997 * In addition, an independent DAC for the multi-playback (not used in this
7998 * driver yet).
7999 */
1d045db9
TI
8000
8001/*
8002 * BIOS auto configuration
8003 */
8004
bc9f98a9
KY
8005static int alc662_parse_auto_config(struct hda_codec *codec)
8006{
4c6d72d1 8007 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
3e6179b8
TI
8008 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
8009 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
8010 const hda_nid_t *ssids;
ee979a14 8011
7639a06c
TI
8012 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
8013 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
8014 codec->core.vendor_id == 0x10ec0671)
3e6179b8 8015 ssids = alc663_ssids;
6227cdce 8016 else
3e6179b8
TI
8017 ssids = alc662_ssids;
8018 return alc_parse_auto_config(codec, alc662_ignore, ssids);
bc9f98a9
KY
8019}
8020
6be7948f 8021static void alc272_fixup_mario(struct hda_codec *codec,
1727a771 8022 const struct hda_fixup *fix, int action)
6fc398cb 8023{
9bb1f06f 8024 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6fc398cb 8025 return;
6be7948f
TB
8026 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
8027 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
8028 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
8029 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
8030 (0 << AC_AMPCAP_MUTE_SHIFT)))
4e76a883 8031 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
6be7948f
TB
8032}
8033
8e383953
TI
8034static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
8035 { .channels = 2,
8036 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
8037 { .channels = 4,
8038 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
8039 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
8040 { }
8041};
8042
8043/* override the 2.1 chmap */
eb9ca3ab 8044static void alc_fixup_bass_chmap(struct hda_codec *codec,
8e383953
TI
8045 const struct hda_fixup *fix, int action)
8046{
8047 if (action == HDA_FIXUP_ACT_BUILD) {
8048 struct alc_spec *spec = codec->spec;
bbbc7e85 8049 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
8e383953
TI
8050 }
8051}
8052
bf68665d
TI
8053/* avoid D3 for keeping GPIO up */
8054static unsigned int gpio_led_power_filter(struct hda_codec *codec,
8055 hda_nid_t nid,
8056 unsigned int power_state)
8057{
8058 struct alc_spec *spec = codec->spec;
d261eec8 8059 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
bf68665d
TI
8060 return AC_PWRST_D0;
8061 return power_state;
8062}
8063
3e887f37
TI
8064static void alc662_fixup_led_gpio1(struct hda_codec *codec,
8065 const struct hda_fixup *fix, int action)
8066{
8067 struct alc_spec *spec = codec->spec;
3e887f37 8068
01e4a275 8069 alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
3e887f37 8070 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
0f32fd19 8071 spec->mute_led_polarity = 1;
bf68665d 8072 codec->power_filter = gpio_led_power_filter;
3e887f37
TI
8073 }
8074}
8075
c6790c8e
KY
8076static void alc662_usi_automute_hook(struct hda_codec *codec,
8077 struct hda_jack_callback *jack)
8078{
8079 struct alc_spec *spec = codec->spec;
8080 int vref;
8081 msleep(200);
8082 snd_hda_gen_hp_automute(codec, jack);
8083
8084 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
8085 msleep(100);
8086 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8087 vref);
8088}
8089
8090static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
8091 const struct hda_fixup *fix, int action)
8092{
8093 struct alc_spec *spec = codec->spec;
8094 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
8095 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
8096 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
8097 }
8098}
8099
f3f9185f
KY
8100static struct coef_fw alc668_coefs[] = {
8101 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
8102 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
8103 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
8104 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
8105 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
8106 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
8107 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
8108 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
8109 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
8110 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
8111 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
8112 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
8113 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
8114 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
8115 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
8116 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
8117 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
8118 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
8119 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
8120 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
8121 {}
8122};
8123
8124static void alc668_restore_default_value(struct hda_codec *codec)
8125{
8126 alc_process_coef_fw(codec, alc668_coefs);
8127}
8128
6cb3b707 8129enum {
2df03514 8130 ALC662_FIXUP_ASPIRE,
3e887f37 8131 ALC662_FIXUP_LED_GPIO1,
6cb3b707 8132 ALC662_FIXUP_IDEAPAD,
6be7948f 8133 ALC272_FIXUP_MARIO,
d2ebd479 8134 ALC662_FIXUP_CZC_P10T,
94024cd1 8135 ALC662_FIXUP_SKU_IGNORE,
e59ea3ed 8136 ALC662_FIXUP_HP_RP5800,
53c334ad
TI
8137 ALC662_FIXUP_ASUS_MODE1,
8138 ALC662_FIXUP_ASUS_MODE2,
8139 ALC662_FIXUP_ASUS_MODE3,
8140 ALC662_FIXUP_ASUS_MODE4,
8141 ALC662_FIXUP_ASUS_MODE5,
8142 ALC662_FIXUP_ASUS_MODE6,
8143 ALC662_FIXUP_ASUS_MODE7,
8144 ALC662_FIXUP_ASUS_MODE8,
1565cc35 8145 ALC662_FIXUP_NO_JACK_DETECT,
edfe3bfc 8146 ALC662_FIXUP_ZOTAC_Z68,
125821ae 8147 ALC662_FIXUP_INV_DMIC,
1f8b46cd 8148 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
73bdd597 8149 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
1f8b46cd 8150 ALC662_FIXUP_HEADSET_MODE,
73bdd597 8151 ALC668_FIXUP_HEADSET_MODE,
8e54b4ac 8152 ALC662_FIXUP_BASS_MODE4_CHMAP,
61a75f13 8153 ALC662_FIXUP_BASS_16,
a30c9aaa 8154 ALC662_FIXUP_BASS_1A,
8e54b4ac 8155 ALC662_FIXUP_BASS_CHMAP,
493a52a9 8156 ALC668_FIXUP_AUTO_MUTE,
5e6db669 8157 ALC668_FIXUP_DELL_DISABLE_AAMIX,
033b0a7c 8158 ALC668_FIXUP_DELL_XPS13,
9d4dc584 8159 ALC662_FIXUP_ASUS_Nx50,
fc7438b1 8160 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
3231e205 8161 ALC668_FIXUP_ASUS_Nx51,
5b7c5e1f 8162 ALC668_FIXUP_MIC_COEF,
11ba6111 8163 ALC668_FIXUP_ASUS_G751,
78f4f7c2
KY
8164 ALC891_FIXUP_HEADSET_MODE,
8165 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
9b51fe3e 8166 ALC662_FIXUP_ACER_VERITON,
1a3f0991 8167 ALC892_FIXUP_ASROCK_MOBO,
c6790c8e
KY
8168 ALC662_FIXUP_USI_FUNC,
8169 ALC662_FIXUP_USI_HEADSET_MODE,
ca169cc2 8170 ALC662_FIXUP_LENOVO_MULTI_CODECS,
6cb3b707
DH
8171};
8172
1727a771 8173static const struct hda_fixup alc662_fixups[] = {
2df03514 8174 [ALC662_FIXUP_ASPIRE] = {
1727a771
TI
8175 .type = HDA_FIXUP_PINS,
8176 .v.pins = (const struct hda_pintbl[]) {
2df03514
DC
8177 { 0x15, 0x99130112 }, /* subwoofer */
8178 { }
8179 }
8180 },
3e887f37
TI
8181 [ALC662_FIXUP_LED_GPIO1] = {
8182 .type = HDA_FIXUP_FUNC,
8183 .v.func = alc662_fixup_led_gpio1,
8184 },
6cb3b707 8185 [ALC662_FIXUP_IDEAPAD] = {
1727a771
TI
8186 .type = HDA_FIXUP_PINS,
8187 .v.pins = (const struct hda_pintbl[]) {
6cb3b707
DH
8188 { 0x17, 0x99130112 }, /* subwoofer */
8189 { }
3e887f37
TI
8190 },
8191 .chained = true,
8192 .chain_id = ALC662_FIXUP_LED_GPIO1,
6cb3b707 8193 },
6be7948f 8194 [ALC272_FIXUP_MARIO] = {
1727a771 8195 .type = HDA_FIXUP_FUNC,
b5bfbc67 8196 .v.func = alc272_fixup_mario,
d2ebd479
AA
8197 },
8198 [ALC662_FIXUP_CZC_P10T] = {
1727a771 8199 .type = HDA_FIXUP_VERBS,
d2ebd479
AA
8200 .v.verbs = (const struct hda_verb[]) {
8201 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
8202 {}
8203 }
8204 },
94024cd1 8205 [ALC662_FIXUP_SKU_IGNORE] = {
1727a771 8206 .type = HDA_FIXUP_FUNC,
23d30f28 8207 .v.func = alc_fixup_sku_ignore,
c6b35874 8208 },
e59ea3ed 8209 [ALC662_FIXUP_HP_RP5800] = {
1727a771
TI
8210 .type = HDA_FIXUP_PINS,
8211 .v.pins = (const struct hda_pintbl[]) {
e59ea3ed
TI
8212 { 0x14, 0x0221201f }, /* HP out */
8213 { }
8214 },
8215 .chained = true,
8216 .chain_id = ALC662_FIXUP_SKU_IGNORE
8217 },
53c334ad 8218 [ALC662_FIXUP_ASUS_MODE1] = {
1727a771
TI
8219 .type = HDA_FIXUP_PINS,
8220 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
8221 { 0x14, 0x99130110 }, /* speaker */
8222 { 0x18, 0x01a19c20 }, /* mic */
8223 { 0x19, 0x99a3092f }, /* int-mic */
8224 { 0x21, 0x0121401f }, /* HP out */
8225 { }
8226 },
8227 .chained = true,
8228 .chain_id = ALC662_FIXUP_SKU_IGNORE
8229 },
8230 [ALC662_FIXUP_ASUS_MODE2] = {
1727a771
TI
8231 .type = HDA_FIXUP_PINS,
8232 .v.pins = (const struct hda_pintbl[]) {
2996bdba
TI
8233 { 0x14, 0x99130110 }, /* speaker */
8234 { 0x18, 0x01a19820 }, /* mic */
8235 { 0x19, 0x99a3092f }, /* int-mic */
8236 { 0x1b, 0x0121401f }, /* HP out */
8237 { }
8238 },
53c334ad
TI
8239 .chained = true,
8240 .chain_id = ALC662_FIXUP_SKU_IGNORE
8241 },
8242 [ALC662_FIXUP_ASUS_MODE3] = {
1727a771
TI
8243 .type = HDA_FIXUP_PINS,
8244 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
8245 { 0x14, 0x99130110 }, /* speaker */
8246 { 0x15, 0x0121441f }, /* HP */
8247 { 0x18, 0x01a19840 }, /* mic */
8248 { 0x19, 0x99a3094f }, /* int-mic */
8249 { 0x21, 0x01211420 }, /* HP2 */
8250 { }
8251 },
8252 .chained = true,
8253 .chain_id = ALC662_FIXUP_SKU_IGNORE
8254 },
8255 [ALC662_FIXUP_ASUS_MODE4] = {
1727a771
TI
8256 .type = HDA_FIXUP_PINS,
8257 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
8258 { 0x14, 0x99130110 }, /* speaker */
8259 { 0x16, 0x99130111 }, /* speaker */
8260 { 0x18, 0x01a19840 }, /* mic */
8261 { 0x19, 0x99a3094f }, /* int-mic */
8262 { 0x21, 0x0121441f }, /* HP */
8263 { }
8264 },
8265 .chained = true,
8266 .chain_id = ALC662_FIXUP_SKU_IGNORE
8267 },
8268 [ALC662_FIXUP_ASUS_MODE5] = {
1727a771
TI
8269 .type = HDA_FIXUP_PINS,
8270 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
8271 { 0x14, 0x99130110 }, /* speaker */
8272 { 0x15, 0x0121441f }, /* HP */
8273 { 0x16, 0x99130111 }, /* speaker */
8274 { 0x18, 0x01a19840 }, /* mic */
8275 { 0x19, 0x99a3094f }, /* int-mic */
8276 { }
8277 },
8278 .chained = true,
8279 .chain_id = ALC662_FIXUP_SKU_IGNORE
8280 },
8281 [ALC662_FIXUP_ASUS_MODE6] = {
1727a771
TI
8282 .type = HDA_FIXUP_PINS,
8283 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
8284 { 0x14, 0x99130110 }, /* speaker */
8285 { 0x15, 0x01211420 }, /* HP2 */
8286 { 0x18, 0x01a19840 }, /* mic */
8287 { 0x19, 0x99a3094f }, /* int-mic */
8288 { 0x1b, 0x0121441f }, /* HP */
8289 { }
8290 },
8291 .chained = true,
8292 .chain_id = ALC662_FIXUP_SKU_IGNORE
8293 },
8294 [ALC662_FIXUP_ASUS_MODE7] = {
1727a771
TI
8295 .type = HDA_FIXUP_PINS,
8296 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
8297 { 0x14, 0x99130110 }, /* speaker */
8298 { 0x17, 0x99130111 }, /* speaker */
8299 { 0x18, 0x01a19840 }, /* mic */
8300 { 0x19, 0x99a3094f }, /* int-mic */
8301 { 0x1b, 0x01214020 }, /* HP */
8302 { 0x21, 0x0121401f }, /* HP */
8303 { }
8304 },
8305 .chained = true,
8306 .chain_id = ALC662_FIXUP_SKU_IGNORE
8307 },
8308 [ALC662_FIXUP_ASUS_MODE8] = {
1727a771
TI
8309 .type = HDA_FIXUP_PINS,
8310 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
8311 { 0x14, 0x99130110 }, /* speaker */
8312 { 0x12, 0x99a30970 }, /* int-mic */
8313 { 0x15, 0x01214020 }, /* HP */
8314 { 0x17, 0x99130111 }, /* speaker */
8315 { 0x18, 0x01a19840 }, /* mic */
8316 { 0x21, 0x0121401f }, /* HP */
8317 { }
8318 },
8319 .chained = true,
8320 .chain_id = ALC662_FIXUP_SKU_IGNORE
2996bdba 8321 },
1565cc35 8322 [ALC662_FIXUP_NO_JACK_DETECT] = {
1727a771 8323 .type = HDA_FIXUP_FUNC,
1565cc35
TI
8324 .v.func = alc_fixup_no_jack_detect,
8325 },
edfe3bfc 8326 [ALC662_FIXUP_ZOTAC_Z68] = {
1727a771
TI
8327 .type = HDA_FIXUP_PINS,
8328 .v.pins = (const struct hda_pintbl[]) {
edfe3bfc
DH
8329 { 0x1b, 0x02214020 }, /* Front HP */
8330 { }
8331 }
8332 },
125821ae 8333 [ALC662_FIXUP_INV_DMIC] = {
1727a771 8334 .type = HDA_FIXUP_FUNC,
9d36a7dc 8335 .v.func = alc_fixup_inv_dmic,
125821ae 8336 },
033b0a7c
GM
8337 [ALC668_FIXUP_DELL_XPS13] = {
8338 .type = HDA_FIXUP_FUNC,
8339 .v.func = alc_fixup_dell_xps13,
8340 .chained = true,
8341 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
8342 },
5e6db669
GM
8343 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
8344 .type = HDA_FIXUP_FUNC,
8345 .v.func = alc_fixup_disable_aamix,
8346 .chained = true,
8347 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
8348 },
493a52a9
HW
8349 [ALC668_FIXUP_AUTO_MUTE] = {
8350 .type = HDA_FIXUP_FUNC,
8351 .v.func = alc_fixup_auto_mute_via_amp,
8352 .chained = true,
8353 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
8354 },
1f8b46cd
DH
8355 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
8356 .type = HDA_FIXUP_PINS,
8357 .v.pins = (const struct hda_pintbl[]) {
8358 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
8359 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
8360 { }
8361 },
8362 .chained = true,
8363 .chain_id = ALC662_FIXUP_HEADSET_MODE
8364 },
8365 [ALC662_FIXUP_HEADSET_MODE] = {
8366 .type = HDA_FIXUP_FUNC,
8367 .v.func = alc_fixup_headset_mode_alc662,
8368 },
73bdd597
DH
8369 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
8370 .type = HDA_FIXUP_PINS,
8371 .v.pins = (const struct hda_pintbl[]) {
8372 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
8373 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
8374 { }
8375 },
8376 .chained = true,
8377 .chain_id = ALC668_FIXUP_HEADSET_MODE
8378 },
8379 [ALC668_FIXUP_HEADSET_MODE] = {
8380 .type = HDA_FIXUP_FUNC,
8381 .v.func = alc_fixup_headset_mode_alc668,
8382 },
8e54b4ac 8383 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
8e383953 8384 .type = HDA_FIXUP_FUNC,
eb9ca3ab 8385 .v.func = alc_fixup_bass_chmap,
8e383953
TI
8386 .chained = true,
8387 .chain_id = ALC662_FIXUP_ASUS_MODE4
8388 },
61a75f13
DH
8389 [ALC662_FIXUP_BASS_16] = {
8390 .type = HDA_FIXUP_PINS,
8391 .v.pins = (const struct hda_pintbl[]) {
8392 {0x16, 0x80106111}, /* bass speaker */
8393 {}
8394 },
8395 .chained = true,
8396 .chain_id = ALC662_FIXUP_BASS_CHMAP,
8397 },
a30c9aaa
TI
8398 [ALC662_FIXUP_BASS_1A] = {
8399 .type = HDA_FIXUP_PINS,
8400 .v.pins = (const struct hda_pintbl[]) {
8401 {0x1a, 0x80106111}, /* bass speaker */
8402 {}
8403 },
8e54b4ac
DH
8404 .chained = true,
8405 .chain_id = ALC662_FIXUP_BASS_CHMAP,
a30c9aaa 8406 },
8e54b4ac 8407 [ALC662_FIXUP_BASS_CHMAP] = {
a30c9aaa 8408 .type = HDA_FIXUP_FUNC,
eb9ca3ab 8409 .v.func = alc_fixup_bass_chmap,
a30c9aaa 8410 },
9d4dc584
BM
8411 [ALC662_FIXUP_ASUS_Nx50] = {
8412 .type = HDA_FIXUP_FUNC,
8413 .v.func = alc_fixup_auto_mute_via_amp,
8414 .chained = true,
8415 .chain_id = ALC662_FIXUP_BASS_1A
8416 },
fc7438b1
MP
8417 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
8418 .type = HDA_FIXUP_FUNC,
8419 .v.func = alc_fixup_headset_mode_alc668,
8420 .chain_id = ALC662_FIXUP_BASS_CHMAP
8421 },
3231e205
YP
8422 [ALC668_FIXUP_ASUS_Nx51] = {
8423 .type = HDA_FIXUP_PINS,
8424 .v.pins = (const struct hda_pintbl[]) {
fc7438b1
MP
8425 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
8426 { 0x1a, 0x90170151 }, /* bass speaker */
8427 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
3231e205
YP
8428 {}
8429 },
8430 .chained = true,
fc7438b1 8431 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
3231e205 8432 },
5b7c5e1f 8433 [ALC668_FIXUP_MIC_COEF] = {
11ba6111
TI
8434 .type = HDA_FIXUP_VERBS,
8435 .v.verbs = (const struct hda_verb[]) {
8436 { 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
8437 { 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
8438 {}
8439 },
8440 },
5b7c5e1f
TI
8441 [ALC668_FIXUP_ASUS_G751] = {
8442 .type = HDA_FIXUP_PINS,
8443 .v.pins = (const struct hda_pintbl[]) {
8444 { 0x16, 0x0421101f }, /* HP */
8445 {}
8446 },
8447 .chained = true,
8448 .chain_id = ALC668_FIXUP_MIC_COEF
8449 },
78f4f7c2
KY
8450 [ALC891_FIXUP_HEADSET_MODE] = {
8451 .type = HDA_FIXUP_FUNC,
8452 .v.func = alc_fixup_headset_mode,
8453 },
8454 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
8455 .type = HDA_FIXUP_PINS,
8456 .v.pins = (const struct hda_pintbl[]) {
8457 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
8458 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
8459 { }
8460 },
8461 .chained = true,
8462 .chain_id = ALC891_FIXUP_HEADSET_MODE
8463 },
9b51fe3e
SB
8464 [ALC662_FIXUP_ACER_VERITON] = {
8465 .type = HDA_FIXUP_PINS,
8466 .v.pins = (const struct hda_pintbl[]) {
8467 { 0x15, 0x50170120 }, /* no internal speaker */
8468 { }
8469 }
8470 },
1a3f0991
TI
8471 [ALC892_FIXUP_ASROCK_MOBO] = {
8472 .type = HDA_FIXUP_PINS,
8473 .v.pins = (const struct hda_pintbl[]) {
8474 { 0x15, 0x40f000f0 }, /* disabled */
8475 { 0x16, 0x40f000f0 }, /* disabled */
1a3f0991
TI
8476 { }
8477 }
8478 },
c6790c8e
KY
8479 [ALC662_FIXUP_USI_FUNC] = {
8480 .type = HDA_FIXUP_FUNC,
8481 .v.func = alc662_fixup_usi_headset_mic,
8482 },
8483 [ALC662_FIXUP_USI_HEADSET_MODE] = {
8484 .type = HDA_FIXUP_PINS,
8485 .v.pins = (const struct hda_pintbl[]) {
8486 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
8487 { 0x18, 0x01a1903d },
8488 { }
8489 },
8490 .chained = true,
8491 .chain_id = ALC662_FIXUP_USI_FUNC
8492 },
ca169cc2
KY
8493 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
8494 .type = HDA_FIXUP_FUNC,
8495 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
8496 },
6cb3b707
DH
8497};
8498
a9111321 8499static const struct snd_pci_quirk alc662_fixup_tbl[] = {
53c334ad 8500 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
d3d3835c 8501 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
02f6ff90 8502 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
a6c47a85 8503 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
94024cd1 8504 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
125821ae 8505 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
1801928e 8506 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
2df03514 8507 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
73bdd597
DH
8508 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8509 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
c5d019c3 8510 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
033b0a7c 8511 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
467e1436 8512 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
09d2014f 8513 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
ad8ff99e 8514 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8dc9abb9
KY
8515 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8516 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
6a98e34b 8517 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
e59ea3ed 8518 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
2da2dc9e 8519 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
83a9efb5 8520 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
db8948e6 8521 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
9d4dc584 8522 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
11ba6111 8523 SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
8e54b4ac 8524 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
61a75f13 8525 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
3231e205
YP
8526 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
8527 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
c7efff92 8528 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
61a75f13 8529 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
8e54b4ac 8530 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
1565cc35 8531 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
53c334ad 8532 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
a0e90acc 8533 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
c6790c8e 8534 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
ca169cc2 8535 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
d4118588 8536 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
6cb3b707 8537 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
1a3f0991 8538 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
edfe3bfc 8539 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
9b51fe3e 8540 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
d2ebd479 8541 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
53c334ad
TI
8542
8543#if 0
8544 /* Below is a quirk table taken from the old code.
8545 * Basically the device should work as is without the fixup table.
8546 * If BIOS doesn't give a proper info, enable the corresponding
8547 * fixup entry.
7d7eb9ea 8548 */
53c334ad
TI
8549 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
8550 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
8551 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
8552 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
8553 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8554 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8555 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8556 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
8557 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
8558 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8559 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
8560 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
8561 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
8562 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
8563 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
8564 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8565 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
8566 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
8567 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8568 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
8569 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
8570 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8571 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
8572 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
8573 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
8574 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8575 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
8576 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
8577 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8578 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
8579 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8580 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8581 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
8582 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
8583 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
8584 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
8585 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
8586 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
8587 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
8588 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8589 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
8590 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
8591 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8592 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
8593 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
8594 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
8595 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
8596 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
8597 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8598 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
8599#endif
6cb3b707
DH
8600 {}
8601};
8602
1727a771 8603static const struct hda_model_fixup alc662_fixup_models[] = {
aa3841b5
TI
8604 {.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
8605 {.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
6be7948f 8606 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
aa3841b5 8607 {.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
53c334ad
TI
8608 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
8609 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
8610 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
8611 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
8612 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
8613 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
8614 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
8615 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
aa3841b5 8616 {.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
6e72aa5f 8617 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
aa3841b5 8618 {.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
e32aa85a 8619 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
aa3841b5
TI
8620 {.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
8621 {.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
8622 {.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
8623 {.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
8624 {.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
8625 {.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
8626 {.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
8627 {.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
40c51675 8628 {.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
aa3841b5
TI
8629 {.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
8630 {.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
8631 {.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
8632 {.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
8633 {.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
ba90d6a6 8634 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
6be7948f
TB
8635 {}
8636};
6cb3b707 8637
532895c5 8638static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
78f4f7c2
KY
8639 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
8640 {0x17, 0x02211010},
8641 {0x18, 0x01a19030},
8642 {0x1a, 0x01813040},
8643 {0x21, 0x01014020}),
1f8b46cd 8644 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
1f8b46cd 8645 {0x14, 0x01014010},
1f8b46cd 8646 {0x18, 0x01a19020},
1f8b46cd 8647 {0x1a, 0x0181302f},
11580297 8648 {0x1b, 0x0221401f}),
76c2132e
DH
8649 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8650 {0x12, 0x99a30130},
8651 {0x14, 0x90170110},
8652 {0x15, 0x0321101f},
11580297 8653 {0x16, 0x03011020}),
76c2132e
DH
8654 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8655 {0x12, 0x99a30140},
8656 {0x14, 0x90170110},
8657 {0x15, 0x0321101f},
11580297 8658 {0x16, 0x03011020}),
76c2132e
DH
8659 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8660 {0x12, 0x99a30150},
8661 {0x14, 0x90170110},
8662 {0x15, 0x0321101f},
11580297 8663 {0x16, 0x03011020}),
76c2132e 8664 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
76c2132e
DH
8665 {0x14, 0x90170110},
8666 {0x15, 0x0321101f},
11580297 8667 {0x16, 0x03011020}),
76c2132e
DH
8668 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
8669 {0x12, 0x90a60130},
8670 {0x14, 0x90170110},
11580297 8671 {0x15, 0x0321101f}),
532895c5
HW
8672 {}
8673};
8674
1d045db9
TI
8675/*
8676 */
bc9f98a9
KY
8677static int patch_alc662(struct hda_codec *codec)
8678{
8679 struct alc_spec *spec;
3de95173 8680 int err;
bc9f98a9 8681
3de95173
TI
8682 err = alc_alloc_spec(codec, 0x0b);
8683 if (err < 0)
8684 return err;
bc9f98a9 8685
3de95173 8686 spec = codec->spec;
1f0f4b80 8687
225068ab
TI
8688 spec->shutup = alc_eapd_shutup;
8689
53c334ad
TI
8690 /* handle multiple HPs as is */
8691 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
8692
2c3bf9ab
TI
8693 alc_fix_pll_init(codec, 0x20, 0x04, 15);
8694
7639a06c 8695 switch (codec->core.vendor_id) {
f3f9185f
KY
8696 case 0x10ec0668:
8697 spec->init_hook = alc668_restore_default_value;
8698 break;
f3f9185f 8699 }
8663ff75 8700
1727a771 8701 snd_hda_pick_fixup(codec, alc662_fixup_models,
8e5a0509 8702 alc662_fixup_tbl, alc662_fixups);
532895c5 8703 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups);
1727a771 8704 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
8e5a0509
TI
8705
8706 alc_auto_parse_customize_define(codec);
8707
7504b6cd
TI
8708 if (has_cdefine_beep(codec))
8709 spec->gen.beep_nid = 0x01;
8710
1bb7e43e 8711 if ((alc_get_coef0(codec) & (1 << 14)) &&
5100cd07 8712 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
e16fb6d1 8713 spec->cdefine.platform_type == 1) {
6134b1a2
WY
8714 err = alc_codec_rename(codec, "ALC272X");
8715 if (err < 0)
e16fb6d1 8716 goto error;
20ca0c35 8717 }
274693f3 8718
b9c5106c
TI
8719 /* automatic parse from the BIOS config */
8720 err = alc662_parse_auto_config(codec);
e16fb6d1
TI
8721 if (err < 0)
8722 goto error;
bc9f98a9 8723
7504b6cd 8724 if (!spec->gen.no_analog && spec->gen.beep_nid) {
7639a06c 8725 switch (codec->core.vendor_id) {
da00c244 8726 case 0x10ec0662:
fea80fae 8727 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
da00c244
KY
8728 break;
8729 case 0x10ec0272:
8730 case 0x10ec0663:
8731 case 0x10ec0665:
9ad54547 8732 case 0x10ec0668:
fea80fae 8733 err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
da00c244
KY
8734 break;
8735 case 0x10ec0273:
fea80fae 8736 err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
da00c244
KY
8737 break;
8738 }
fea80fae
TI
8739 if (err < 0)
8740 goto error;
cec27c89 8741 }
2134ea4f 8742
1727a771 8743 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 8744
bc9f98a9 8745 return 0;
801f49d3 8746
e16fb6d1
TI
8747 error:
8748 alc_free(codec);
8749 return err;
b478b998
KY
8750}
8751
d1eb57f4
KY
8752/*
8753 * ALC680 support
8754 */
d1eb57f4 8755
d1eb57f4
KY
8756static int alc680_parse_auto_config(struct hda_codec *codec)
8757{
3e6179b8 8758 return alc_parse_auto_config(codec, NULL, NULL);
d1eb57f4
KY
8759}
8760
d1eb57f4 8761/*
d1eb57f4 8762 */
d1eb57f4
KY
8763static int patch_alc680(struct hda_codec *codec)
8764{
d1eb57f4
KY
8765 int err;
8766
1f0f4b80 8767 /* ALC680 has no aa-loopback mixer */
3de95173
TI
8768 err = alc_alloc_spec(codec, 0);
8769 if (err < 0)
8770 return err;
1f0f4b80 8771
1ebec5f2
TI
8772 /* automatic parse from the BIOS config */
8773 err = alc680_parse_auto_config(codec);
8774 if (err < 0) {
8775 alc_free(codec);
8776 return err;
d1eb57f4
KY
8777 }
8778
d1eb57f4
KY
8779 return 0;
8780}
8781
1da177e4
LT
8782/*
8783 * patch entries
8784 */
b9a94a9c 8785static const struct hda_device_id snd_hda_id_realtek[] = {
0a6f0600 8786 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
b9a94a9c 8787 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
4231430d 8788 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
b9a94a9c
TI
8789 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
8790 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
dcd4f0db 8791 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
b9a94a9c 8792 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
736f20a7 8793 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
b9a94a9c
TI
8794 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
8795 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
f429e7e4 8796 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
b9a94a9c
TI
8797 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
8798 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
8799 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
8800 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
8801 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
8802 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
8803 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
dcd4f0db 8804 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
b9a94a9c
TI
8805 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
8806 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
8807 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
8808 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
8809 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
8810 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
0a6f0600 8811 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
b9a94a9c
TI
8812 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
8813 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
0a6f0600 8814 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
b9a94a9c
TI
8815 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
8816 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
8817 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
dcd4f0db 8818 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
7d727869 8819 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
b9a94a9c 8820 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
28f1f9b2 8821 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
1078bef0 8822 HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
b9a94a9c
TI
8823 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
8824 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
8825 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
8826 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
8827 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
8828 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
8829 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
8830 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
8831 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
8832 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
8833 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
8834 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
8835 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
8836 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
6fbae35a
KY
8837 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
8838 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
8839 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
78f4f7c2 8840 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
b9a94a9c
TI
8841 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
8842 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
8843 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
8844 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
8845 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
8846 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
8847 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
8848 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
8849 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
8850 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
8851 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
8852 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
8853 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
65553b12 8854 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
a535ad57 8855 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
1da177e4
LT
8856 {} /* terminator */
8857};
b9a94a9c 8858MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
1289e9e8
TI
8859
8860MODULE_LICENSE("GPL");
8861MODULE_DESCRIPTION("Realtek HD-audio codec");
8862
d8a766a1 8863static struct hda_codec_driver realtek_driver = {
b9a94a9c 8864 .id = snd_hda_id_realtek,
1289e9e8
TI
8865};
8866
d8a766a1 8867module_hda_codec_driver(realtek_driver);