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