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