]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - sound/pci/hda/patch_realtek.c
ALSA: hda/realtek - Add support for ALC711
[mirror_ubuntu-bionic-kernel.git] / sound / pci / hda / patch_realtek.c
1 /*
2 * Universal Interface for Intel High Definition Audio Codec
3 *
4 * HD audio interface patch for Realtek ALC codecs
5 *
6 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
8 * Takashi Iwai <tiwai@suse.de>
9 * Jonathan Woithe <jwoithe@just42.net>
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
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <linux/dmi.h>
31 #include <linux/module.h>
32 #include <linux/input.h>
33 #include <sound/core.h>
34 #include <sound/jack.h>
35 #include "hda_codec.h"
36 #include "hda_local.h"
37 #include "hda_auto_parser.h"
38 #include "hda_jack.h"
39 #include "hda_generic.h"
40
41 /* keep halting ALC5505 DSP, for power saving */
42 #define HALT_REALTEK_ALC5505
43
44 /* extra amp-initialization sequence types */
45 enum {
46 ALC_INIT_NONE,
47 ALC_INIT_DEFAULT,
48 ALC_INIT_GPIO1,
49 ALC_INIT_GPIO2,
50 ALC_INIT_GPIO3,
51 };
52
53 enum {
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
61 enum {
62 ALC_HEADSET_TYPE_UNKNOWN,
63 ALC_HEADSET_TYPE_CTIA,
64 ALC_HEADSET_TYPE_OMTP,
65 };
66
67 enum {
68 ALC_KEY_MICMUTE_INDEX,
69 };
70
71 struct 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;
81 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
82 };
83
84 struct alc_spec {
85 struct hda_gen_spec gen; /* must be at head */
86
87 /* codec parameterization */
88 const struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
89 unsigned int num_mixers;
90 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
91
92 struct alc_customize_define cdefine;
93 unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
94
95 /* mute LED for HP laptops, see alc269_fixup_mic_mute_hook() */
96 int mute_led_polarity;
97 hda_nid_t mute_led_nid;
98 hda_nid_t cap_mute_led_nid;
99
100 unsigned int gpio_led; /* used for alc269_fixup_hp_gpio_led() */
101 unsigned int gpio_mute_led_mask;
102 unsigned int gpio_mic_led_mask;
103
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
109 /* hooks */
110 void (*init_hook)(struct hda_codec *codec);
111 #ifdef CONFIG_PM
112 void (*power_hook)(struct hda_codec *codec);
113 #endif
114 void (*shutup)(struct hda_codec *codec);
115 void (*reboot_notify)(struct hda_codec *codec);
116
117 int init_amp;
118 int codec_variant; /* flag for other variants */
119 unsigned int has_alc5505_dsp:1;
120 unsigned int no_depop_delay:1;
121 unsigned int done_hp_init:1;
122 unsigned int no_shutup_pins:1;
123
124 /* for PLL fix */
125 hda_nid_t pll_nid;
126 unsigned int pll_coef_idx, pll_coef_bit;
127 unsigned int coef0;
128 struct input_dev *kb_dev;
129 u8 alc_mute_keycode_map[1];
130 };
131
132 /*
133 * COEF access helper functions
134 */
135
136 static 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
149 static 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
159 static 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
173 /* a special bypass for COEF 0; read the cached value at the second time */
174 static 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
183 /* coef writes/updates batch */
184 struct 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
197 static 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
209 /*
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().
213 */
214 static void add_mixer(struct alc_spec *spec, const struct snd_kcontrol_new *mix)
215 {
216 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
217 return;
218 spec->mixers[spec->num_mixers++] = mix;
219 }
220
221 /*
222 * GPIO setup tables, used in initialization
223 */
224 /* Enable GPIO mask and set output */
225 static const struct hda_verb alc_gpio1_init_verbs[] = {
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
232 static const struct hda_verb alc_gpio2_init_verbs[] = {
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
239 static const struct hda_verb alc_gpio3_init_verbs[] = {
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
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 */
251 static void alc_fix_pll(struct hda_codec *codec)
252 {
253 struct alc_spec *spec = codec->spec;
254
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);
258 }
259
260 static 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
270 /* update the master volume per volume-knob's unsol event */
271 static void alc_update_knob_master(struct hda_codec *codec,
272 struct hda_jack_callback *jack)
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;
284 val = snd_hda_codec_read(codec, jack->nid, 0,
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
293 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
294 {
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);
298 }
299
300 /* Change EAPD to verb control */
301 static void alc_fill_eapd_coef(struct hda_codec *codec)
302 {
303 int coef;
304
305 coef = alc_get_coef0(codec);
306
307 switch (codec->core.vendor_id) {
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;
329 case 0x10ec0225:
330 case 0x10ec0295:
331 case 0x10ec0299:
332 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
333 /* fallthrough */
334 case 0x10ec0215:
335 case 0x10ec0233:
336 case 0x10ec0235:
337 case 0x10ec0236:
338 case 0x10ec0255:
339 case 0x10ec0256:
340 case 0x10ec0257:
341 case 0x10ec0282:
342 case 0x10ec0283:
343 case 0x10ec0286:
344 case 0x10ec0288:
345 case 0x10ec0285:
346 case 0x10ec0298:
347 case 0x10ec0289:
348 case 0x10ec0300:
349 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
350 break;
351 case 0x10ec0275:
352 alc_update_coef_idx(codec, 0xe, 0, 1<<0);
353 break;
354 case 0x10ec0293:
355 alc_update_coef_idx(codec, 0xa, 1<<13, 0);
356 break;
357 case 0x10ec0234:
358 case 0x10ec0274:
359 case 0x10ec0294:
360 case 0x10ec0700:
361 case 0x10ec0701:
362 case 0x10ec0703:
363 case 0x10ec0711:
364 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
365 break;
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;
379 case 0x10ec0623:
380 alc_update_coef_idx(codec, 0x19, 1<<13, 0);
381 break;
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:
397 case 0x10ec1168:
398 case 0x10ec1220:
399 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
400 break;
401 }
402 }
403
404 /* additional initialization for ALC888 variants */
405 static void alc888_coef_init(struct hda_codec *codec)
406 {
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 }
415 }
416
417 /* turn on/off EAPD control (only if available) */
418 static 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
427 /* turn on/off EAPD controls of the codec */
428 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
429 {
430 /* We currently only handle front, HP */
431 static hda_nid_t pins[] = {
432 0x0f, 0x10, 0x14, 0x15, 0x17, 0
433 };
434 hda_nid_t *p;
435 for (p = pins; *p; p++)
436 set_eapd(codec, *p, on);
437 }
438
439 static int find_ext_mic_pin(struct hda_codec *codec);
440
441 static 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
464 static void alc_shutup_pins(struct hda_codec *codec)
465 {
466 struct alc_spec *spec = codec->spec;
467
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 }
479 }
480
481 /* generic shutup callback;
482 * just turning off EAPD and a little pause for avoiding pop-noise
483 */
484 static void alc_eapd_shutup(struct hda_codec *codec)
485 {
486 struct alc_spec *spec = codec->spec;
487
488 alc_auto_setup_eapd(codec, false);
489 if (!spec->no_depop_delay)
490 msleep(200);
491 alc_shutup_pins(codec);
492 }
493
494 /* generic EAPD initialization */
495 static void alc_auto_init_amp(struct hda_codec *codec, int type)
496 {
497 alc_fill_eapd_coef(codec);
498 alc_auto_setup_eapd(codec, true);
499 switch (type) {
500 case ALC_INIT_GPIO1:
501 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
502 break;
503 case ALC_INIT_GPIO2:
504 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
505 break;
506 case ALC_INIT_GPIO3:
507 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
508 break;
509 case ALC_INIT_DEFAULT:
510 switch (codec->core.vendor_id) {
511 case 0x10ec0260:
512 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
513 break;
514 case 0x10ec0880:
515 case 0x10ec0882:
516 case 0x10ec0883:
517 case 0x10ec0885:
518 alc_update_coef_idx(codec, 7, 0, 0x2030);
519 break;
520 case 0x10ec0888:
521 alc888_coef_init(codec);
522 break;
523 }
524 break;
525 }
526 }
527
528 /* get a primary headphone pin if available */
529 static 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 }
537
538 /*
539 * Realtek SSID verification
540 */
541
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)
546
547 static void alc_fixup_sku_ignore(struct hda_codec *codec,
548 const struct hda_fixup *fix, int action)
549 {
550 struct alc_spec *spec = codec->spec;
551 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
552 spec->cdefine.fixup = 1;
553 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
554 }
555 }
556
557 static 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
562 if (action == HDA_FIXUP_ACT_PROBE) {
563 spec->no_depop_delay = 1;
564 codec->depop_delay = 0;
565 }
566 }
567
568 static int alc_auto_parse_customize_define(struct hda_codec *codec)
569 {
570 unsigned int ass, tmp, i;
571 unsigned nid = 0;
572 struct alc_spec *spec = codec->spec;
573
574 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
575
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;
581 }
582
583 if (!codec->bus->pci)
584 return -1;
585 ass = codec->core.subsystem_id & 0xffff;
586 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
587 goto do_sku;
588
589 nid = 0x1d;
590 if (codec->core.vendor_id == 0x10ec0260)
591 nid = 0x17;
592 ass = snd_hda_codec_get_pincfg(codec, nid);
593
594 if (!(ass & 1)) {
595 codec_info(codec, "%s: SKU not ready 0x%08x\n",
596 codec->core.chip_name, ass);
597 return -1;
598 }
599
600 /* check sum */
601 tmp = 0;
602 for (i = 1; i < 16; i++) {
603 if ((ass >> i) & 1)
604 tmp++;
605 }
606 if (((ass >> 16) & 0xf) != tmp)
607 return -1;
608
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;
613 do_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
620 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
621 nid, spec->cdefine.sku_cfg);
622 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
623 spec->cdefine.port_connectivity);
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);
631
632 return 0;
633 }
634
635 /* return the position of NID in the list, or -1 if not found */
636 static 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 }
644 /* return true if the given NID is found in the list */
645 static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
646 {
647 return find_idx_in_nid_list(nid, list, nums) >= 0;
648 }
649
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 */
659 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
660 {
661 unsigned int ass, tmp, i;
662 unsigned nid;
663 struct alc_spec *spec = codec->spec;
664
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
672 ass = codec->core.subsystem_id & 0xffff;
673 if (codec->bus->pci &&
674 ass != codec->bus->pci->subsystem_device && (ass & 1))
675 goto do_sku;
676
677 /* invalid SSID, check the special NID pin defcfg instead */
678 /*
679 * 31~30 : port connectivity
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;
687 if (codec->core.vendor_id == 0x10ec0260)
688 nid = 0x17;
689 ass = snd_hda_codec_get_pincfg(codec, nid);
690 codec_dbg(codec,
691 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
692 ass, nid);
693 if (!(ass & 1))
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;
706 do_sku:
707 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
708 ass & 0xffff, codec->core.vendor_id);
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:
728 default:
729 spec->init_amp = ALC_INIT_DEFAULT;
730 break;
731 }
732
733 /* is laptop or Desktop and enable the function "Mute internal speaker
734 * when the external headphone out jack is plugged"
735 */
736 if (!(ass & 0x8000))
737 return 1;
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 */
745 if (!alc_get_hp_pin(spec)) {
746 hda_nid_t nid;
747 tmp = (ass >> 11) & 0x3; /* HP to chassis */
748 nid = ports[tmp];
749 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
750 spec->gen.autocfg.line_outs))
751 return 1;
752 spec->gen.autocfg.hp_pins[0] = nid;
753 }
754 return 1;
755 }
756
757 /* Check the validity of ALC subsystem-id
758 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
759 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
760 {
761 if (!alc_subsystem_id(codec, ports)) {
762 struct alc_spec *spec = codec->spec;
763 codec_dbg(codec,
764 "realtek: Enable default setup for auto mode as fallback\n");
765 spec->init_amp = ALC_INIT_DEFAULT;
766 }
767 }
768
769 /*
770 */
771
772 static void alc_fixup_inv_dmic(struct hda_codec *codec,
773 const struct hda_fixup *fix, int action)
774 {
775 struct alc_spec *spec = codec->spec;
776
777 spec->gen.inv_dmic_split = 1;
778 }
779
780
781 #ifdef CONFIG_SND_HDA_INPUT_BEEP
782 /* additional beep mixers; the actual parameters are overwritten at build */
783 static 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),
786 { } /* end */
787 };
788 #endif
789
790 static int alc_build_controls(struct hda_codec *codec)
791 {
792 struct alc_spec *spec = codec->spec;
793 int i, err;
794
795 err = snd_hda_gen_build_controls(codec);
796 if (err < 0)
797 return err;
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 }
804
805 #ifdef CONFIG_SND_HDA_INPUT_BEEP
806 /* create beep controls if needed */
807 if (spec->beep_amp) {
808 const struct snd_kcontrol_new *knew;
809 for (knew = alc_beep_mixer; knew->name; knew++) {
810 struct snd_kcontrol *kctl;
811 kctl = snd_ctl_new1(knew, codec);
812 if (!kctl)
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;
818 }
819 }
820 #endif
821
822 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
823 return 0;
824 }
825
826
827 /*
828 * Common callbacks
829 */
830
831 static int alc_init(struct hda_codec *codec)
832 {
833 struct alc_spec *spec = codec->spec;
834
835 if (spec->init_hook)
836 spec->init_hook(codec);
837
838 spec->gen.skip_verbs = 1; /* applied in below */
839 snd_hda_gen_init(codec);
840 alc_fix_pll(codec);
841 alc_auto_init_amp(codec, spec->init_amp);
842 snd_hda_apply_verbs(codec); /* apply verbs here after own init */
843
844 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
845
846 return 0;
847 }
848
849 static inline void alc_shutup(struct hda_codec *codec)
850 {
851 struct alc_spec *spec = codec->spec;
852
853 if (spec && spec->shutup)
854 spec->shutup(codec);
855 else
856 alc_shutup_pins(codec);
857 }
858
859 static 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
869 #define alc_free snd_hda_gen_free
870
871 #ifdef CONFIG_PM
872 static void alc_power_eapd(struct hda_codec *codec)
873 {
874 alc_auto_setup_eapd(codec, false);
875 }
876
877 static int alc_suspend(struct hda_codec *codec)
878 {
879 struct alc_spec *spec = codec->spec;
880 alc_shutup(codec);
881 if (spec && spec->power_hook)
882 spec->power_hook(codec);
883 return 0;
884 }
885 #endif
886
887 #ifdef CONFIG_PM
888 static int alc_resume(struct hda_codec *codec)
889 {
890 struct alc_spec *spec = codec->spec;
891
892 if (!spec->no_depop_delay)
893 msleep(150); /* to avoid pop noise */
894 codec->patch_ops.init(codec);
895 regcache_sync(codec->core.regmap);
896 hda_call_check_power_status(codec, 0x01);
897 return 0;
898 }
899 #endif
900
901 /*
902 */
903 static 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,
911 .suspend = alc_suspend,
912 .check_power_status = snd_hda_gen_check_power_status,
913 #endif
914 .reboot_notify = alc_reboot_notify,
915 };
916
917
918 #define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
919
920 /*
921 * Rename codecs appropriately from COEF value or subvendor id
922 */
923 struct alc_codec_rename_table {
924 unsigned int vendor_id;
925 unsigned short coef_mask;
926 unsigned short coef_bits;
927 const char *name;
928 };
929
930 struct 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
937 static struct alc_codec_rename_table rename_tbl[] = {
938 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
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" },
947 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
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 };
957
958 static struct alc_codec_rename_pci_table rename_pci_tbl[] = {
959 { 0x10ec0280, 0x1028, 0, "ALC3220" },
960 { 0x10ec0282, 0x1028, 0, "ALC3221" },
961 { 0x10ec0283, 0x1028, 0, "ALC3223" },
962 { 0x10ec0288, 0x1028, 0, "ALC3263" },
963 { 0x10ec0292, 0x1028, 0, "ALC3226" },
964 { 0x10ec0293, 0x1028, 0, "ALC3235" },
965 { 0x10ec0255, 0x1028, 0, "ALC3234" },
966 { 0x10ec0668, 0x1028, 0, "ALC3661" },
967 { 0x10ec0275, 0x1028, 0, "ALC3260" },
968 { 0x10ec0899, 0x1028, 0, "ALC3861" },
969 { 0x10ec0298, 0x1028, 0, "ALC3266" },
970 { 0x10ec0236, 0x1028, 0, "ALC3204" },
971 { 0x10ec0256, 0x1028, 0, "ALC3246" },
972 { 0x10ec0225, 0x1028, 0, "ALC3253" },
973 { 0x10ec0295, 0x1028, 0, "ALC3254" },
974 { 0x10ec0299, 0x1028, 0, "ALC3271" },
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" },
986 { } /* terminator */
987 };
988
989 static int alc_codec_rename_from_preset(struct hda_codec *codec)
990 {
991 const struct alc_codec_rename_table *p;
992 const struct alc_codec_rename_pci_table *q;
993
994 for (p = rename_tbl; p->vendor_id; p++) {
995 if (p->vendor_id != codec->core.vendor_id)
996 continue;
997 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
998 return alc_codec_rename(codec, p->name);
999 }
1000
1001 if (!codec->bus->pci)
1002 return 0;
1003 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
1004 if (q->codec_vendor_id != codec->core.vendor_id)
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
1013 return 0;
1014 }
1015
1016
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))
1023
1024 static const struct snd_pci_quirk beep_white_list[] = {
1025 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
1026 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
1027 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
1028 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
1029 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1030 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1031 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
1032 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
1033 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
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),
1037 {}
1038 };
1039
1040 static 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
1053
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 */
1058 static int alc_parse_auto_config(struct hda_codec *codec,
1059 const hda_nid_t *ignore_nids,
1060 const hda_nid_t *ssid_nids)
1061 {
1062 struct alc_spec *spec = codec->spec;
1063 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
1064 int err;
1065
1066 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1067 spec->parse_flags);
1068 if (err < 0)
1069 return err;
1070
1071 if (ssid_nids)
1072 alc_ssid_check(codec, ssid_nids);
1073
1074 err = snd_hda_gen_parse_auto_config(codec, cfg);
1075 if (err < 0)
1076 return err;
1077
1078 return 1;
1079 }
1080
1081 /* common preparation job for alc_spec */
1082 static 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;
1090 snd_hda_gen_spec_init(&spec->gen);
1091 spec->gen.mixer_nid = mixer_nid;
1092 spec->gen.own_eapd_ctl = 1;
1093 codec->single_adc_amp = 1;
1094 /* FIXME: do we need this for all Realtek codec models? */
1095 codec->spdif_status_reset = 1;
1096 codec->patch_ops = alc_patch_ops;
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
1106 static int alc880_parse_auto_config(struct hda_codec *codec)
1107 {
1108 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
1109 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
1110 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1111 }
1112
1113 /*
1114 * ALC880 fix-ups
1115 */
1116 enum {
1117 ALC880_FIXUP_GPIO1,
1118 ALC880_FIXUP_GPIO2,
1119 ALC880_FIXUP_MEDION_RIM,
1120 ALC880_FIXUP_LG,
1121 ALC880_FIXUP_LG_LW25,
1122 ALC880_FIXUP_W810,
1123 ALC880_FIXUP_EAPD_COEF,
1124 ALC880_FIXUP_TCL_S700,
1125 ALC880_FIXUP_VOL_KNOB,
1126 ALC880_FIXUP_FUJITSU,
1127 ALC880_FIXUP_F1734,
1128 ALC880_FIXUP_UNIWILL,
1129 ALC880_FIXUP_UNIWILL_DIG,
1130 ALC880_FIXUP_Z71V,
1131 ALC880_FIXUP_ASUS_W5A,
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,
1141 ALC880_FIXUP_6ST_AUTOMUTE,
1142 };
1143
1144 /* enable the volume-knob widget support on NID 0x21 */
1145 static void alc880_fixup_vol_knob(struct hda_codec *codec,
1146 const struct hda_fixup *fix, int action)
1147 {
1148 if (action == HDA_FIXUP_ACT_PROBE)
1149 snd_hda_jack_detect_enable_callback(codec, 0x21,
1150 alc_update_knob_master);
1151 }
1152
1153 static const struct hda_fixup alc880_fixups[] = {
1154 [ALC880_FIXUP_GPIO1] = {
1155 .type = HDA_FIXUP_VERBS,
1156 .v.verbs = alc_gpio1_init_verbs,
1157 },
1158 [ALC880_FIXUP_GPIO2] = {
1159 .type = HDA_FIXUP_VERBS,
1160 .v.verbs = alc_gpio2_init_verbs,
1161 },
1162 [ALC880_FIXUP_MEDION_RIM] = {
1163 .type = HDA_FIXUP_VERBS,
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 },
1172 [ALC880_FIXUP_LG] = {
1173 .type = HDA_FIXUP_PINS,
1174 .v.pins = (const struct hda_pintbl[]) {
1175 /* disable bogus unused pins */
1176 { 0x16, 0x411111f0 },
1177 { 0x18, 0x411111f0 },
1178 { 0x1a, 0x411111f0 },
1179 { }
1180 }
1181 },
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 },
1190 [ALC880_FIXUP_W810] = {
1191 .type = HDA_FIXUP_PINS,
1192 .v.pins = (const struct hda_pintbl[]) {
1193 /* disable bogus unused pins */
1194 { 0x17, 0x411111f0 },
1195 { }
1196 },
1197 .chained = true,
1198 .chain_id = ALC880_FIXUP_GPIO2,
1199 },
1200 [ALC880_FIXUP_EAPD_COEF] = {
1201 .type = HDA_FIXUP_VERBS,
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 },
1209 [ALC880_FIXUP_TCL_S700] = {
1210 .type = HDA_FIXUP_VERBS,
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 },
1220 [ALC880_FIXUP_VOL_KNOB] = {
1221 .type = HDA_FIXUP_FUNC,
1222 .v.func = alc880_fixup_vol_knob,
1223 },
1224 [ALC880_FIXUP_FUJITSU] = {
1225 /* override all pins as BIOS on old Amilo is broken */
1226 .type = HDA_FIXUP_PINS,
1227 .v.pins = (const struct hda_pintbl[]) {
1228 { 0x14, 0x0121401f }, /* HP */
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 },
1244 [ALC880_FIXUP_F1734] = {
1245 /* almost compatible with FUJITSU, but no bass and SPDIF */
1246 .type = HDA_FIXUP_PINS,
1247 .v.pins = (const struct hda_pintbl[]) {
1248 { 0x14, 0x0121401f }, /* HP */
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 },
1264 [ALC880_FIXUP_UNIWILL] = {
1265 /* need to fix HP and speaker pins to be parsed correctly */
1266 .type = HDA_FIXUP_PINS,
1267 .v.pins = (const struct hda_pintbl[]) {
1268 { 0x14, 0x0121411f }, /* HP */
1269 { 0x15, 0x99030120 }, /* speaker */
1270 { 0x16, 0x99030130 }, /* bass speaker */
1271 { }
1272 },
1273 },
1274 [ALC880_FIXUP_UNIWILL_DIG] = {
1275 .type = HDA_FIXUP_PINS,
1276 .v.pins = (const struct hda_pintbl[]) {
1277 /* disable bogus unused pins */
1278 { 0x17, 0x411111f0 },
1279 { 0x19, 0x411111f0 },
1280 { 0x1b, 0x411111f0 },
1281 { 0x1f, 0x411111f0 },
1282 { }
1283 }
1284 },
1285 [ALC880_FIXUP_Z71V] = {
1286 .type = HDA_FIXUP_PINS,
1287 .v.pins = (const struct hda_pintbl[]) {
1288 /* set up the whole pins as BIOS is utterly broken */
1289 { 0x14, 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 },
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 },
1323 [ALC880_FIXUP_3ST_BASE] = {
1324 .type = HDA_FIXUP_PINS,
1325 .v.pins = (const struct hda_pintbl[]) {
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] = {
1342 .type = HDA_FIXUP_PINS,
1343 .v.pins = (const struct hda_pintbl[]) {
1344 { 0x1e, 0x411111f0 }, /* N/A */
1345 { }
1346 },
1347 .chained = true,
1348 .chain_id = ALC880_FIXUP_3ST_BASE,
1349 },
1350 [ALC880_FIXUP_3ST_DIG] = {
1351 .type = HDA_FIXUP_PINS,
1352 .v.pins = (const struct hda_pintbl[]) {
1353 { 0x1e, 0x0144111e }, /* SPDIF */
1354 { }
1355 },
1356 .chained = true,
1357 .chain_id = ALC880_FIXUP_3ST_BASE,
1358 },
1359 [ALC880_FIXUP_5ST_BASE] = {
1360 .type = HDA_FIXUP_PINS,
1361 .v.pins = (const struct hda_pintbl[]) {
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] = {
1378 .type = HDA_FIXUP_PINS,
1379 .v.pins = (const struct hda_pintbl[]) {
1380 { 0x1e, 0x411111f0 }, /* N/A */
1381 { }
1382 },
1383 .chained = true,
1384 .chain_id = ALC880_FIXUP_5ST_BASE,
1385 },
1386 [ALC880_FIXUP_5ST_DIG] = {
1387 .type = HDA_FIXUP_PINS,
1388 .v.pins = (const struct hda_pintbl[]) {
1389 { 0x1e, 0x0144111e }, /* SPDIF */
1390 { }
1391 },
1392 .chained = true,
1393 .chain_id = ALC880_FIXUP_5ST_BASE,
1394 },
1395 [ALC880_FIXUP_6ST_BASE] = {
1396 .type = HDA_FIXUP_PINS,
1397 .v.pins = (const struct hda_pintbl[]) {
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] = {
1414 .type = HDA_FIXUP_PINS,
1415 .v.pins = (const struct hda_pintbl[]) {
1416 { 0x1e, 0x411111f0 }, /* N/A */
1417 { }
1418 },
1419 .chained = true,
1420 .chain_id = ALC880_FIXUP_6ST_BASE,
1421 },
1422 [ALC880_FIXUP_6ST_DIG] = {
1423 .type = HDA_FIXUP_PINS,
1424 .v.pins = (const struct hda_pintbl[]) {
1425 { 0x1e, 0x0144111e }, /* SPDIF */
1426 { }
1427 },
1428 .chained = true,
1429 .chain_id = ALC880_FIXUP_6ST_BASE,
1430 },
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 },
1440 };
1441
1442 static const struct snd_pci_quirk alc880_fixup_tbl[] = {
1443 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
1444 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
1445 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
1446 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
1447 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
1448 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
1449 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
1450 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
1451 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
1452 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
1453 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
1454 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
1455 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
1456 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
1457 SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
1458 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
1459 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
1460 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
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),
1464 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
1465 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
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
1513 static const struct hda_model_fixup alc880_fixup_models[] = {
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"},
1520 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
1521 {}
1522 };
1523
1524
1525 /*
1526 * OK, here we have finally the patch for ALC880
1527 */
1528 static int patch_alc880(struct hda_codec *codec)
1529 {
1530 struct alc_spec *spec;
1531 int err;
1532
1533 err = alc_alloc_spec(codec, 0x0b);
1534 if (err < 0)
1535 return err;
1536
1537 spec = codec->spec;
1538 spec->gen.need_dac_fix = 1;
1539 spec->gen.beep_nid = 0x01;
1540
1541 codec->patch_ops.unsol_event = alc880_unsol_event;
1542
1543 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
1544 alc880_fixups);
1545 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1546
1547 /* automatic parse from the BIOS config */
1548 err = alc880_parse_auto_config(codec);
1549 if (err < 0)
1550 goto error;
1551
1552 if (!spec->gen.no_analog)
1553 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1554
1555 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1556
1557 return 0;
1558
1559 error:
1560 alc_free(codec);
1561 return err;
1562 }
1563
1564
1565 /*
1566 * ALC260 support
1567 */
1568 static int alc260_parse_auto_config(struct hda_codec *codec)
1569 {
1570 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
1571 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1572 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
1573 }
1574
1575 /*
1576 * Pin config fixes
1577 */
1578 enum {
1579 ALC260_FIXUP_HP_DC5750,
1580 ALC260_FIXUP_HP_PIN_0F,
1581 ALC260_FIXUP_COEF,
1582 ALC260_FIXUP_GPIO1,
1583 ALC260_FIXUP_GPIO1_TOGGLE,
1584 ALC260_FIXUP_REPLACER,
1585 ALC260_FIXUP_HP_B1900,
1586 ALC260_FIXUP_KN1,
1587 ALC260_FIXUP_FSC_S7020,
1588 ALC260_FIXUP_FSC_S7020_JWSE,
1589 ALC260_FIXUP_VAIO_PINS,
1590 };
1591
1592 static 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,
1596 spec->gen.hp_jack_present);
1597 }
1598
1599 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1600 const struct hda_fixup *fix, int action)
1601 {
1602 struct alc_spec *spec = codec->spec;
1603 if (action == HDA_FIXUP_ACT_PROBE) {
1604 /* although the machine has only one output pin, we need to
1605 * toggle GPIO1 according to the jack state
1606 */
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 */
1611 snd_hda_jack_detect_enable_callback(codec, 0x0f,
1612 snd_hda_gen_hp_automute);
1613 snd_hda_add_verbs(codec, alc_gpio1_init_verbs);
1614 }
1615 }
1616
1617 static void alc260_fixup_kn1(struct hda_codec *codec,
1618 const struct hda_fixup *fix, int action)
1619 {
1620 struct alc_spec *spec = codec->spec;
1621 static const struct hda_pintbl pincfgs[] = {
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) {
1638 case HDA_FIXUP_ACT_PRE_PROBE:
1639 snd_hda_apply_pincfgs(codec, pincfgs);
1640 break;
1641 case HDA_FIXUP_ACT_PROBE:
1642 spec->init_amp = ALC_INIT_NONE;
1643 break;
1644 }
1645 }
1646
1647 static 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;
1651 if (action == HDA_FIXUP_ACT_PROBE)
1652 spec->init_amp = ALC_INIT_NONE;
1653 }
1654
1655 static 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) {
1660 spec->gen.add_jack_modes = 1;
1661 spec->gen.hp_mic = 1;
1662 }
1663 }
1664
1665 static const struct hda_fixup alc260_fixups[] = {
1666 [ALC260_FIXUP_HP_DC5750] = {
1667 .type = HDA_FIXUP_PINS,
1668 .v.pins = (const struct hda_pintbl[]) {
1669 { 0x11, 0x90130110 }, /* speaker */
1670 { }
1671 }
1672 },
1673 [ALC260_FIXUP_HP_PIN_0F] = {
1674 .type = HDA_FIXUP_PINS,
1675 .v.pins = (const struct hda_pintbl[]) {
1676 { 0x0f, 0x01214000 }, /* HP */
1677 { }
1678 }
1679 },
1680 [ALC260_FIXUP_COEF] = {
1681 .type = HDA_FIXUP_VERBS,
1682 .v.verbs = (const struct hda_verb[]) {
1683 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1684 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
1685 { }
1686 },
1687 },
1688 [ALC260_FIXUP_GPIO1] = {
1689 .type = HDA_FIXUP_VERBS,
1690 .v.verbs = alc_gpio1_init_verbs,
1691 },
1692 [ALC260_FIXUP_GPIO1_TOGGLE] = {
1693 .type = HDA_FIXUP_FUNC,
1694 .v.func = alc260_fixup_gpio1_toggle,
1695 .chained = true,
1696 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1697 },
1698 [ALC260_FIXUP_REPLACER] = {
1699 .type = HDA_FIXUP_VERBS,
1700 .v.verbs = (const struct hda_verb[]) {
1701 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1702 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
1703 { }
1704 },
1705 .chained = true,
1706 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1707 },
1708 [ALC260_FIXUP_HP_B1900] = {
1709 .type = HDA_FIXUP_FUNC,
1710 .v.func = alc260_fixup_gpio1_toggle,
1711 .chained = true,
1712 .chain_id = ALC260_FIXUP_COEF,
1713 },
1714 [ALC260_FIXUP_KN1] = {
1715 .type = HDA_FIXUP_FUNC,
1716 .v.func = alc260_fixup_kn1,
1717 },
1718 [ALC260_FIXUP_FSC_S7020] = {
1719 .type = HDA_FIXUP_FUNC,
1720 .v.func = alc260_fixup_fsc_s7020,
1721 },
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 },
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 },
1746 };
1747
1748 static const struct snd_pci_quirk alc260_fixup_tbl[] = {
1749 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
1750 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
1751 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
1752 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
1753 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
1754 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
1755 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
1756 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
1757 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
1758 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
1759 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
1760 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
1761 {}
1762 };
1763
1764 static 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
1772 /*
1773 */
1774 static int patch_alc260(struct hda_codec *codec)
1775 {
1776 struct alc_spec *spec;
1777 int err;
1778
1779 err = alc_alloc_spec(codec, 0x07);
1780 if (err < 0)
1781 return err;
1782
1783 spec = codec->spec;
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;
1789 spec->gen.beep_nid = 0x01;
1790
1791 spec->shutup = alc_eapd_shutup;
1792
1793 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1794 alc260_fixups);
1795 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1796
1797 /* automatic parse from the BIOS config */
1798 err = alc260_parse_auto_config(codec);
1799 if (err < 0)
1800 goto error;
1801
1802 if (!spec->gen.no_analog)
1803 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1804
1805 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1806
1807 return 0;
1808
1809 error:
1810 alc_free(codec);
1811 return err;
1812 }
1813
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 */
1826
1827 /*
1828 * Pin config fixes
1829 */
1830 enum {
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,
1836 ALC889_FIXUP_CD,
1837 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
1838 ALC889_FIXUP_VAIO_TT,
1839 ALC888_FIXUP_EEE1601,
1840 ALC882_FIXUP_EAPD,
1841 ALC883_FIXUP_EAPD,
1842 ALC883_FIXUP_ACER_EAPD,
1843 ALC882_FIXUP_GPIO1,
1844 ALC882_FIXUP_GPIO2,
1845 ALC882_FIXUP_GPIO3,
1846 ALC889_FIXUP_COEF,
1847 ALC882_FIXUP_ASUS_W2JC,
1848 ALC882_FIXUP_ACER_ASPIRE_4930G,
1849 ALC882_FIXUP_ACER_ASPIRE_8930G,
1850 ALC882_FIXUP_ASPIRE_8930G_VERBS,
1851 ALC885_FIXUP_MACPRO_GPIO,
1852 ALC889_FIXUP_DAC_ROUTE,
1853 ALC889_FIXUP_MBP_VREF,
1854 ALC889_FIXUP_IMAC91_VREF,
1855 ALC889_FIXUP_MBA11_VREF,
1856 ALC889_FIXUP_MBA21_VREF,
1857 ALC889_FIXUP_MP11_VREF,
1858 ALC889_FIXUP_MP41_VREF,
1859 ALC882_FIXUP_INV_DMIC,
1860 ALC882_FIXUP_NO_PRIMARY_HP,
1861 ALC887_FIXUP_ASUS_BASS,
1862 ALC887_FIXUP_BASS_CHMAP,
1863 ALC1220_FIXUP_GB_DUAL_CODECS,
1864 ALC1220_FIXUP_CLEVO_P950,
1865 ALC1220_FIXUP_CLEVO_PB51ED,
1866 ALC1220_FIXUP_CLEVO_PB51ED_PINS,
1867 };
1868
1869 static void alc889_fixup_coef(struct hda_codec *codec,
1870 const struct hda_fixup *fix, int action)
1871 {
1872 if (action != HDA_FIXUP_ACT_INIT)
1873 return;
1874 alc_update_coef_idx(codec, 7, 0, 0x2030);
1875 }
1876
1877 /* toggle speaker-output according to the hp-jack state */
1878 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
1879 {
1880 unsigned int gpiostate, gpiomask, gpiodir;
1881
1882 gpiostate = snd_hda_codec_read(codec, codec->core.afg, 0,
1883 AC_VERB_GET_GPIO_DATA, 0);
1884
1885 if (!muted)
1886 gpiostate |= (1 << pin);
1887 else
1888 gpiostate &= ~(1 << pin);
1889
1890 gpiomask = snd_hda_codec_read(codec, codec->core.afg, 0,
1891 AC_VERB_GET_GPIO_MASK, 0);
1892 gpiomask |= (1 << pin);
1893
1894 gpiodir = snd_hda_codec_read(codec, codec->core.afg, 0,
1895 AC_VERB_GET_GPIO_DIRECTION, 0);
1896 gpiodir |= (1 << pin);
1897
1898
1899 snd_hda_codec_write(codec, codec->core.afg, 0,
1900 AC_VERB_SET_GPIO_MASK, gpiomask);
1901 snd_hda_codec_write(codec, codec->core.afg, 0,
1902 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
1903
1904 msleep(1);
1905
1906 snd_hda_codec_write(codec, codec->core.afg, 0,
1907 AC_VERB_SET_GPIO_DATA, gpiostate);
1908 }
1909
1910 /* set up GPIO at initialization */
1911 static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
1912 const struct hda_fixup *fix, int action)
1913 {
1914 if (action != HDA_FIXUP_ACT_INIT)
1915 return;
1916 alc882_gpio_mute(codec, 0, 0);
1917 alc882_gpio_mute(codec, 1, 0);
1918 }
1919
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 */
1924 static void alc889_fixup_dac_route(struct hda_codec *codec,
1925 const struct hda_fixup *fix, int action)
1926 {
1927 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1928 /* fake the connections during parsing the tree */
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);
1935 } else if (action == HDA_FIXUP_ACT_PROBE) {
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);
1942 }
1943 }
1944
1945 /* Set VREF on HP pin */
1946 static void alc889_fixup_mbp_vref(struct hda_codec *codec,
1947 const struct hda_fixup *fix, int action)
1948 {
1949 struct alc_spec *spec = codec->spec;
1950 static hda_nid_t nids[3] = { 0x14, 0x15, 0x19 };
1951 int i;
1952
1953 if (action != HDA_FIXUP_ACT_INIT)
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;
1959 val = snd_hda_codec_get_pin_target(codec, nids[i]);
1960 val |= AC_PINCTL_VREF_80;
1961 snd_hda_set_pin_ctl(codec, nids[i], val);
1962 spec->gen.keep_vref_in_automute = 1;
1963 break;
1964 }
1965 }
1966
1967 static void alc889_fixup_mac_pins(struct hda_codec *codec,
1968 const hda_nid_t *nids, int num_nids)
1969 {
1970 struct alc_spec *spec = codec->spec;
1971 int i;
1972
1973 for (i = 0; i < num_nids; i++) {
1974 unsigned int val;
1975 val = snd_hda_codec_get_pin_target(codec, nids[i]);
1976 val |= AC_PINCTL_VREF_50;
1977 snd_hda_set_pin_ctl(codec, nids[i], val);
1978 }
1979 spec->gen.keep_vref_in_automute = 1;
1980 }
1981
1982 /* Set VREF on speaker pins on imac91 */
1983 static 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
1992 /* Set VREF on speaker pins on mba11 */
1993 static 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
2002 /* Set VREF on speaker pins on mba21 */
2003 static 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
2012 /* Don't take HP output as primary
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
2015 */
2016 static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
2017 const struct hda_fixup *fix, int action)
2018 {
2019 struct alc_spec *spec = codec->spec;
2020 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2021 spec->gen.no_primary_hp = 1;
2022 spec->gen.no_multi_io = 1;
2023 }
2024 }
2025
2026 static void alc_fixup_bass_chmap(struct hda_codec *codec,
2027 const struct hda_fixup *fix, int action);
2028
2029 /* For dual-codec configuration, we need to disable some features to avoid
2030 * conflicts of kctls and PCM streams
2031 */
2032 static 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
2050 static 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
2060 static 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
2084 static 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
2101 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2102 const struct hda_fixup *fix, int action);
2103
2104 static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
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
2112 static const struct hda_fixup alc882_fixups[] = {
2113 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
2114 .type = HDA_FIXUP_PINS,
2115 .v.pins = (const struct hda_pintbl[]) {
2116 { 0x15, 0x01080104 }, /* side */
2117 { 0x16, 0x01011012 }, /* rear */
2118 { 0x17, 0x01016011 }, /* clfe */
2119 { }
2120 }
2121 },
2122 [ALC882_FIXUP_LENOVO_Y530] = {
2123 .type = HDA_FIXUP_PINS,
2124 .v.pins = (const struct hda_pintbl[]) {
2125 { 0x15, 0x99130112 }, /* rear int speakers */
2126 { 0x16, 0x99130111 }, /* subwoofer */
2127 { }
2128 }
2129 },
2130 [ALC882_FIXUP_PB_M5210] = {
2131 .type = HDA_FIXUP_PINCTLS,
2132 .v.pins = (const struct hda_pintbl[]) {
2133 { 0x19, PIN_VREF50 },
2134 {}
2135 }
2136 },
2137 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
2138 .type = HDA_FIXUP_FUNC,
2139 .v.func = alc_fixup_sku_ignore,
2140 },
2141 [ALC882_FIXUP_ASUS_W90V] = {
2142 .type = HDA_FIXUP_PINS,
2143 .v.pins = (const struct hda_pintbl[]) {
2144 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
2145 { }
2146 }
2147 },
2148 [ALC889_FIXUP_CD] = {
2149 .type = HDA_FIXUP_PINS,
2150 .v.pins = (const struct hda_pintbl[]) {
2151 { 0x1c, 0x993301f0 }, /* CD */
2152 { }
2153 }
2154 },
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 },
2164 [ALC889_FIXUP_VAIO_TT] = {
2165 .type = HDA_FIXUP_PINS,
2166 .v.pins = (const struct hda_pintbl[]) {
2167 { 0x17, 0x90170111 }, /* hidden surround speaker */
2168 { }
2169 }
2170 },
2171 [ALC888_FIXUP_EEE1601] = {
2172 .type = HDA_FIXUP_VERBS,
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 }
2178 },
2179 [ALC882_FIXUP_EAPD] = {
2180 .type = HDA_FIXUP_VERBS,
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 },
2188 [ALC883_FIXUP_EAPD] = {
2189 .type = HDA_FIXUP_VERBS,
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 },
2197 [ALC883_FIXUP_ACER_EAPD] = {
2198 .type = HDA_FIXUP_VERBS,
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 },
2206 [ALC882_FIXUP_GPIO1] = {
2207 .type = HDA_FIXUP_VERBS,
2208 .v.verbs = alc_gpio1_init_verbs,
2209 },
2210 [ALC882_FIXUP_GPIO2] = {
2211 .type = HDA_FIXUP_VERBS,
2212 .v.verbs = alc_gpio2_init_verbs,
2213 },
2214 [ALC882_FIXUP_GPIO3] = {
2215 .type = HDA_FIXUP_VERBS,
2216 .v.verbs = alc_gpio3_init_verbs,
2217 },
2218 [ALC882_FIXUP_ASUS_W2JC] = {
2219 .type = HDA_FIXUP_VERBS,
2220 .v.verbs = alc_gpio1_init_verbs,
2221 .chained = true,
2222 .chain_id = ALC882_FIXUP_EAPD,
2223 },
2224 [ALC889_FIXUP_COEF] = {
2225 .type = HDA_FIXUP_FUNC,
2226 .v.func = alc889_fixup_coef,
2227 },
2228 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
2229 .type = HDA_FIXUP_PINS,
2230 .v.pins = (const struct hda_pintbl[]) {
2231 { 0x16, 0x99130111 }, /* CLFE speaker */
2232 { 0x17, 0x99130112 }, /* surround speaker */
2233 { }
2234 },
2235 .chained = true,
2236 .chain_id = ALC882_FIXUP_GPIO1,
2237 },
2238 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
2239 .type = HDA_FIXUP_PINS,
2240 .v.pins = (const struct hda_pintbl[]) {
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 */
2250 .type = HDA_FIXUP_VERBS,
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 { }
2279 },
2280 .chained = true,
2281 .chain_id = ALC882_FIXUP_GPIO1,
2282 },
2283 [ALC885_FIXUP_MACPRO_GPIO] = {
2284 .type = HDA_FIXUP_FUNC,
2285 .v.func = alc885_fixup_macpro_gpio,
2286 },
2287 [ALC889_FIXUP_DAC_ROUTE] = {
2288 .type = HDA_FIXUP_FUNC,
2289 .v.func = alc889_fixup_dac_route,
2290 },
2291 [ALC889_FIXUP_MBP_VREF] = {
2292 .type = HDA_FIXUP_FUNC,
2293 .v.func = alc889_fixup_mbp_vref,
2294 .chained = true,
2295 .chain_id = ALC882_FIXUP_GPIO1,
2296 },
2297 [ALC889_FIXUP_IMAC91_VREF] = {
2298 .type = HDA_FIXUP_FUNC,
2299 .v.func = alc889_fixup_imac91_vref,
2300 .chained = true,
2301 .chain_id = ALC882_FIXUP_GPIO1,
2302 },
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 },
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 },
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 },
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 },
2327 [ALC882_FIXUP_INV_DMIC] = {
2328 .type = HDA_FIXUP_FUNC,
2329 .v.func = alc_fixup_inv_dmic,
2330 },
2331 [ALC882_FIXUP_NO_PRIMARY_HP] = {
2332 .type = HDA_FIXUP_FUNC,
2333 .v.func = alc882_fixup_no_primary_hp,
2334 },
2335 [ALC887_FIXUP_ASUS_BASS] = {
2336 .type = HDA_FIXUP_PINS,
2337 .v.pins = (const struct hda_pintbl[]) {
2338 {0x16, 0x99130130}, /* bass speaker */
2339 {}
2340 },
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,
2347 },
2348 [ALC1220_FIXUP_GB_DUAL_CODECS] = {
2349 .type = HDA_FIXUP_FUNC,
2350 .v.func = alc1220_fixup_gb_dual_codecs,
2351 },
2352 [ALC1220_FIXUP_CLEVO_P950] = {
2353 .type = HDA_FIXUP_FUNC,
2354 .v.func = alc1220_fixup_clevo_p950,
2355 },
2356 [ALC1220_FIXUP_CLEVO_PB51ED] = {
2357 .type = HDA_FIXUP_FUNC,
2358 .v.func = alc1220_fixup_clevo_pb51ed,
2359 },
2360 [ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
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,
2367 .chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
2368 },
2369 };
2370
2371 static const struct snd_pci_quirk alc882_fixup_tbl[] = {
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),
2374 SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
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),
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),
2393 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
2394 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2395 ALC882_FIXUP_ACER_ASPIRE_4930G),
2396 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
2397 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
2398 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
2399 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
2400 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
2401 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
2402 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
2403 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
2404 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
2405 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
2406 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
2407 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
2408 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2409 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
2410
2411 /* All Apple entries are in codec SSIDs */
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),
2415 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
2416 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2417 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
2418 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2419 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
2420 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
2421 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
2422 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
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),
2425 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
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),
2429 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
2430 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
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),
2433 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
2434
2435 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
2436 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
2437 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2438 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
2439 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2440 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
2441 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
2442 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
2443 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2444 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
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),
2449 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2450 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
2451 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
2452 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
2453 {}
2454 };
2455
2456 static const struct hda_model_fixup alc882_fixup_models[] = {
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"},
2460 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
2461 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
2462 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
2463 {}
2464 };
2465
2466 /*
2467 * BIOS auto configuration
2468 */
2469 /* almost identical with ALC880 parser... */
2470 static int alc882_parse_auto_config(struct hda_codec *codec)
2471 {
2472 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
2473 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2474 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
2475 }
2476
2477 /*
2478 */
2479 static int patch_alc882(struct hda_codec *codec)
2480 {
2481 struct alc_spec *spec;
2482 int err;
2483
2484 err = alc_alloc_spec(codec, 0x0b);
2485 if (err < 0)
2486 return err;
2487
2488 spec = codec->spec;
2489
2490 switch (codec->core.vendor_id) {
2491 case 0x10ec0882:
2492 case 0x10ec0885:
2493 case 0x10ec0900:
2494 case 0x10ec1220:
2495 break;
2496 default:
2497 /* ALC883 and variants */
2498 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2499 break;
2500 }
2501
2502 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
2503 alc882_fixups);
2504 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2505
2506 alc_auto_parse_customize_define(codec);
2507
2508 if (has_cdefine_beep(codec))
2509 spec->gen.beep_nid = 0x01;
2510
2511 /* automatic parse from the BIOS config */
2512 err = alc882_parse_auto_config(codec);
2513 if (err < 0)
2514 goto error;
2515
2516 if (!spec->gen.no_analog && spec->gen.beep_nid)
2517 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2518
2519 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2520
2521 return 0;
2522
2523 error:
2524 alc_free(codec);
2525 return err;
2526 }
2527
2528
2529 /*
2530 * ALC262 support
2531 */
2532 static int alc262_parse_auto_config(struct hda_codec *codec)
2533 {
2534 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
2535 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2536 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
2537 }
2538
2539 /*
2540 * Pin config fixes
2541 */
2542 enum {
2543 ALC262_FIXUP_FSC_H270,
2544 ALC262_FIXUP_FSC_S7110,
2545 ALC262_FIXUP_HP_Z200,
2546 ALC262_FIXUP_TYAN,
2547 ALC262_FIXUP_LENOVO_3000,
2548 ALC262_FIXUP_BENQ,
2549 ALC262_FIXUP_BENQ_T31,
2550 ALC262_FIXUP_INV_DMIC,
2551 ALC262_FIXUP_INTEL_BAYLEYBAY,
2552 };
2553
2554 static const struct hda_fixup alc262_fixups[] = {
2555 [ALC262_FIXUP_FSC_H270] = {
2556 .type = HDA_FIXUP_PINS,
2557 .v.pins = (const struct hda_pintbl[]) {
2558 { 0x14, 0x99130110 }, /* speaker */
2559 { 0x15, 0x0221142f }, /* front HP */
2560 { 0x1b, 0x0121141f }, /* rear HP */
2561 { }
2562 }
2563 },
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 },
2573 [ALC262_FIXUP_HP_Z200] = {
2574 .type = HDA_FIXUP_PINS,
2575 .v.pins = (const struct hda_pintbl[]) {
2576 { 0x16, 0x99130120 }, /* internal speaker */
2577 { }
2578 }
2579 },
2580 [ALC262_FIXUP_TYAN] = {
2581 .type = HDA_FIXUP_PINS,
2582 .v.pins = (const struct hda_pintbl[]) {
2583 { 0x14, 0x1993e1f0 }, /* int AUX */
2584 { }
2585 }
2586 },
2587 [ALC262_FIXUP_LENOVO_3000] = {
2588 .type = HDA_FIXUP_PINCTLS,
2589 .v.pins = (const struct hda_pintbl[]) {
2590 { 0x19, PIN_VREF50 },
2591 {}
2592 },
2593 .chained = true,
2594 .chain_id = ALC262_FIXUP_BENQ,
2595 },
2596 [ALC262_FIXUP_BENQ] = {
2597 .type = HDA_FIXUP_VERBS,
2598 .v.verbs = (const struct hda_verb[]) {
2599 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2600 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2601 {}
2602 }
2603 },
2604 [ALC262_FIXUP_BENQ_T31] = {
2605 .type = HDA_FIXUP_VERBS,
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 },
2612 [ALC262_FIXUP_INV_DMIC] = {
2613 .type = HDA_FIXUP_FUNC,
2614 .v.func = alc_fixup_inv_dmic,
2615 },
2616 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2617 .type = HDA_FIXUP_FUNC,
2618 .v.func = alc_fixup_no_depop_delay,
2619 },
2620 };
2621
2622 static const struct snd_pci_quirk alc262_fixup_tbl[] = {
2623 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
2624 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
2625 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
2626 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
2627 SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
2628 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
2629 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
2630 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2631 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
2632 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
2633 {}
2634 };
2635
2636 static const struct hda_model_fixup alc262_fixup_models[] = {
2637 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
2638 {}
2639 };
2640
2641 /*
2642 */
2643 static int patch_alc262(struct hda_codec *codec)
2644 {
2645 struct alc_spec *spec;
2646 int err;
2647
2648 err = alc_alloc_spec(codec, 0x0b);
2649 if (err < 0)
2650 return err;
2651
2652 spec = codec->spec;
2653 spec->gen.shared_mic_vref_pin = 0x18;
2654
2655 spec->shutup = alc_eapd_shutup;
2656
2657 #if 0
2658 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2659 * under-run
2660 */
2661 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
2662 #endif
2663 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2664
2665 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
2666 alc262_fixups);
2667 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2668
2669 alc_auto_parse_customize_define(codec);
2670
2671 if (has_cdefine_beep(codec))
2672 spec->gen.beep_nid = 0x01;
2673
2674 /* automatic parse from the BIOS config */
2675 err = alc262_parse_auto_config(codec);
2676 if (err < 0)
2677 goto error;
2678
2679 if (!spec->gen.no_analog && spec->gen.beep_nid)
2680 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2681
2682 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2683
2684 return 0;
2685
2686 error:
2687 alc_free(codec);
2688 return err;
2689 }
2690
2691 /*
2692 * ALC268
2693 */
2694 /* bind Beep switches of both NID 0x0f and 0x10 */
2695 static 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 }
2714
2715 static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2716 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
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 },
2726 { }
2727 };
2728
2729 /* set PCBEEP vol = 0, mute connections */
2730 static 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 { }
2735 };
2736
2737 enum {
2738 ALC268_FIXUP_INV_DMIC,
2739 ALC268_FIXUP_HP_EAPD,
2740 ALC268_FIXUP_SPDIF,
2741 };
2742
2743 static const struct hda_fixup alc268_fixups[] = {
2744 [ALC268_FIXUP_INV_DMIC] = {
2745 .type = HDA_FIXUP_FUNC,
2746 .v.func = alc_fixup_inv_dmic,
2747 },
2748 [ALC268_FIXUP_HP_EAPD] = {
2749 .type = HDA_FIXUP_VERBS,
2750 .v.verbs = (const struct hda_verb[]) {
2751 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
2752 {}
2753 }
2754 },
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 },
2762 };
2763
2764 static const struct hda_model_fixup alc268_fixup_models[] = {
2765 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
2766 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
2767 {}
2768 };
2769
2770 static const struct snd_pci_quirk alc268_fixup_tbl[] = {
2771 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
2772 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
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),
2777 {}
2778 };
2779
2780 /*
2781 * BIOS auto configuration
2782 */
2783 static int alc268_parse_auto_config(struct hda_codec *codec)
2784 {
2785 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2786 return alc_parse_auto_config(codec, NULL, alc268_ssids);
2787 }
2788
2789 /*
2790 */
2791 static int patch_alc268(struct hda_codec *codec)
2792 {
2793 struct alc_spec *spec;
2794 int err;
2795
2796 /* ALC268 has no aa-loopback mixer */
2797 err = alc_alloc_spec(codec, 0);
2798 if (err < 0)
2799 return err;
2800
2801 spec = codec->spec;
2802 spec->gen.beep_nid = 0x01;
2803
2804 spec->shutup = alc_eapd_shutup;
2805
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);
2808
2809 /* automatic parse from the BIOS config */
2810 err = alc268_parse_auto_config(codec);
2811 if (err < 0)
2812 goto error;
2813
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);
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));
2825 }
2826
2827 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2828
2829 return 0;
2830
2831 error:
2832 alc_free(codec);
2833 return err;
2834 }
2835
2836 /*
2837 * ALC269
2838 */
2839
2840 static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
2841 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
2842 };
2843
2844 static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
2845 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
2846 };
2847
2848 /* different alc269-variants */
2849 enum {
2850 ALC269_TYPE_ALC269VA,
2851 ALC269_TYPE_ALC269VB,
2852 ALC269_TYPE_ALC269VC,
2853 ALC269_TYPE_ALC269VD,
2854 ALC269_TYPE_ALC280,
2855 ALC269_TYPE_ALC282,
2856 ALC269_TYPE_ALC283,
2857 ALC269_TYPE_ALC284,
2858 ALC269_TYPE_ALC293,
2859 ALC269_TYPE_ALC286,
2860 ALC269_TYPE_ALC298,
2861 ALC269_TYPE_ALC255,
2862 ALC269_TYPE_ALC256,
2863 ALC269_TYPE_ALC257,
2864 ALC269_TYPE_ALC215,
2865 ALC269_TYPE_ALC225,
2866 ALC269_TYPE_ALC294,
2867 ALC269_TYPE_ALC300,
2868 ALC269_TYPE_ALC623,
2869 ALC269_TYPE_ALC700,
2870 };
2871
2872 /*
2873 * BIOS auto configuration
2874 */
2875 static int alc269_parse_auto_config(struct hda_codec *codec)
2876 {
2877 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
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;
2881 const hda_nid_t *ssids;
2882
2883 switch (spec->codec_variant) {
2884 case ALC269_TYPE_ALC269VA:
2885 case ALC269_TYPE_ALC269VC:
2886 case ALC269_TYPE_ALC280:
2887 case ALC269_TYPE_ALC284:
2888 case ALC269_TYPE_ALC293:
2889 ssids = alc269va_ssids;
2890 break;
2891 case ALC269_TYPE_ALC269VB:
2892 case ALC269_TYPE_ALC269VD:
2893 case ALC269_TYPE_ALC282:
2894 case ALC269_TYPE_ALC283:
2895 case ALC269_TYPE_ALC286:
2896 case ALC269_TYPE_ALC298:
2897 case ALC269_TYPE_ALC255:
2898 case ALC269_TYPE_ALC256:
2899 case ALC269_TYPE_ALC257:
2900 case ALC269_TYPE_ALC215:
2901 case ALC269_TYPE_ALC225:
2902 case ALC269_TYPE_ALC294:
2903 case ALC269_TYPE_ALC300:
2904 case ALC269_TYPE_ALC623:
2905 case ALC269_TYPE_ALC700:
2906 ssids = alc269_ssids;
2907 break;
2908 default:
2909 ssids = alc269_ssids;
2910 break;
2911 }
2912
2913 return alc_parse_auto_config(codec, alc269_ignore, ssids);
2914 }
2915
2916 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
2917 {
2918 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
2919 }
2920
2921 static void alc269_shutup(struct hda_codec *codec)
2922 {
2923 struct alc_spec *spec = codec->spec;
2924
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) {
2929 msleep(150);
2930 }
2931 alc_shutup_pins(codec);
2932 }
2933
2934 static struct coef_fw alc282_coefs[] = {
2935 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
2936 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
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
2967 static void alc282_restore_default_value(struct hda_codec *codec)
2968 {
2969 alc_process_coef_fw(codec, alc282_coefs);
2970 }
2971
2972 static void alc282_init(struct hda_codec *codec)
2973 {
2974 struct alc_spec *spec = codec->spec;
2975 hda_nid_t hp_pin = alc_get_hp_pin(spec);
2976 bool hp_pin_sense;
2977 int coef78;
2978
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
2984 alc282_restore_default_value(codec);
2985
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
3014 static void alc282_shutup(struct hda_codec *codec)
3015 {
3016 struct alc_spec *spec = codec->spec;
3017 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3018 bool hp_pin_sense;
3019 int coef78;
3020
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
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
3044 if (!spec->no_shutup_pins)
3045 snd_hda_codec_write(codec, hp_pin, 0,
3046 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3047
3048 if (hp_pin_sense)
3049 msleep(100);
3050
3051 alc_auto_setup_eapd(codec, false);
3052 alc_shutup_pins(codec);
3053 alc_write_coef_idx(codec, 0x78, coef78);
3054 }
3055
3056 static struct coef_fw alc283_coefs[] = {
3057 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3058 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
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 */
3089 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
3090 {}
3091 };
3092
3093 static void alc283_restore_default_value(struct hda_codec *codec)
3094 {
3095 alc_process_coef_fw(codec, alc283_coefs);
3096 }
3097
3098 static void alc283_init(struct hda_codec *codec)
3099 {
3100 struct alc_spec *spec = codec->spec;
3101 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3102 bool hp_pin_sense;
3103
3104 alc283_restore_default_value(codec);
3105
3106 if (!hp_pin)
3107 return;
3108
3109 msleep(30);
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. */
3129 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3130 /* Headphone capless set to normal mode */
3131 alc_write_coef_idx(codec, 0x43, 0x9614);
3132 }
3133
3134 static void alc283_shutup(struct hda_codec *codec)
3135 {
3136 struct alc_spec *spec = codec->spec;
3137 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3138 bool hp_pin_sense;
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
3149 /*depop hp during suspend*/
3150 alc_write_coef_idx(codec, 0x06, 0x2100);
3151
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)
3156 msleep(100);
3157
3158 if (!spec->no_shutup_pins)
3159 snd_hda_codec_write(codec, hp_pin, 0,
3160 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3161
3162 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3163
3164 if (hp_pin_sense)
3165 msleep(100);
3166 alc_auto_setup_eapd(codec, false);
3167 alc_shutup_pins(codec);
3168 alc_write_coef_idx(codec, 0x43, 0x9614);
3169 }
3170
3171 static void alc256_init(struct hda_codec *codec)
3172 {
3173 struct alc_spec *spec = codec->spec;
3174 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3175 bool hp_pin_sense;
3176
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
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 */
3208 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3209 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
3210 alc_update_coef_idx(codec, 0x36, 1 << 13, 1 << 5); /* Switch pcbeep path to Line in path*/
3211 }
3212
3213 static void alc256_shutup(struct hda_codec *codec)
3214 {
3215 struct alc_spec *spec = codec->spec;
3216 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3217 bool hp_pin_sense;
3218
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
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
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
3244 if (!spec->no_shutup_pins)
3245 snd_hda_codec_write(codec, hp_pin, 0,
3246 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3247
3248 if (hp_pin_sense)
3249 msleep(100);
3250
3251 alc_auto_setup_eapd(codec, false);
3252 alc_shutup_pins(codec);
3253 }
3254
3255 static void alc225_init(struct hda_codec *codec)
3256 {
3257 struct alc_spec *spec = codec->spec;
3258 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3259 bool hp1_pin_sense, hp2_pin_sense;
3260
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
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
3303 static void alc225_shutup(struct hda_codec *codec)
3304 {
3305 struct alc_spec *spec = codec->spec;
3306 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3307 bool hp1_pin_sense, hp2_pin_sense;
3308
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
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);
3349 alc_shutup_pins(codec);
3350 }
3351
3352 static void alc_default_init(struct hda_codec *codec)
3353 {
3354 struct alc_spec *spec = codec->spec;
3355 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3356 bool hp_pin_sense;
3357
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
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
3386 static void alc_default_shutup(struct hda_codec *codec)
3387 {
3388 struct alc_spec *spec = codec->spec;
3389 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3390 bool hp_pin_sense;
3391
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
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
3413 if (!spec->no_shutup_pins)
3414 snd_hda_codec_write(codec, hp_pin, 0,
3415 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3416
3417 if (hp_pin_sense)
3418 msleep(100);
3419
3420 alc_auto_setup_eapd(codec, false);
3421 alc_shutup_pins(codec);
3422 }
3423
3424 static void alc294_hp_init(struct hda_codec *codec)
3425 {
3426 struct alc_spec *spec = codec->spec;
3427 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3428 int i, val;
3429
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
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
3460 static void alc294_init(struct hda_codec *codec)
3461 {
3462 struct alc_spec *spec = codec->spec;
3463
3464 if (!spec->done_hp_init) {
3465 alc294_hp_init(codec);
3466 spec->done_hp_init = true;
3467 }
3468 alc_default_init(codec);
3469 }
3470
3471 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3472 unsigned int val)
3473 {
3474 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3475 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3476 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3477 }
3478
3479 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3480 {
3481 unsigned int val;
3482
3483 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3484 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3485 & 0xffff;
3486 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3487 << 16;
3488 return val;
3489 }
3490
3491 static void alc5505_dsp_halt(struct hda_codec *codec)
3492 {
3493 unsigned int val;
3494
3495 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3496 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3497 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3498 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3499 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3500 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3501 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3502 val = alc5505_coef_get(codec, 0x6220);
3503 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3504 }
3505
3506 static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3507 {
3508 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3509 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3510 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3511 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3512 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3513 alc5505_coef_set(codec, 0x880c, 0x00000004);
3514 }
3515
3516 static void alc5505_dsp_init(struct hda_codec *codec)
3517 {
3518 unsigned int val;
3519
3520 alc5505_dsp_halt(codec);
3521 alc5505_dsp_back_from_halt(codec);
3522 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3523 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3524 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3525 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3526 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3527 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3528 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3529 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3530 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3531 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3532 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3533 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3534 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3535
3536 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3537 if (val <= 3)
3538 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3539 else
3540 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3541
3542 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3543 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3544 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3545 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3546 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3547 alc5505_coef_set(codec, 0x880c, 0x00000003);
3548 alc5505_coef_set(codec, 0x880c, 0x00000010);
3549
3550 #ifdef HALT_REALTEK_ALC5505
3551 alc5505_dsp_halt(codec);
3552 #endif
3553 }
3554
3555 #ifdef HALT_REALTEK_ALC5505
3556 #define alc5505_dsp_suspend(codec) /* NOP */
3557 #define alc5505_dsp_resume(codec) /* NOP */
3558 #else
3559 #define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
3560 #define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
3561 #endif
3562
3563 #ifdef CONFIG_PM
3564 static int alc269_suspend(struct hda_codec *codec)
3565 {
3566 struct alc_spec *spec = codec->spec;
3567
3568 if (spec->has_alc5505_dsp)
3569 alc5505_dsp_suspend(codec);
3570 return alc_suspend(codec);
3571 }
3572
3573 static int alc269_resume(struct hda_codec *codec)
3574 {
3575 struct alc_spec *spec = codec->spec;
3576
3577 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3578 alc269vb_toggle_power_output(codec, 0);
3579 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3580 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
3581 msleep(150);
3582 }
3583
3584 codec->patch_ops.init(codec);
3585
3586 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3587 alc269vb_toggle_power_output(codec, 1);
3588 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3589 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
3590 msleep(200);
3591 }
3592
3593 regcache_sync(codec->core.regmap);
3594 hda_call_check_power_status(codec, 0x01);
3595
3596 /* on some machine, the BIOS will clear the codec gpio data when enter
3597 * suspend, and won't restore the data after resume, so we restore it
3598 * in the driver.
3599 */
3600 if (spec->gpio_led)
3601 snd_hda_codec_write(codec, codec->core.afg, 0, AC_VERB_SET_GPIO_DATA,
3602 spec->gpio_led);
3603
3604 if (spec->has_alc5505_dsp)
3605 alc5505_dsp_resume(codec);
3606
3607 return 0;
3608 }
3609 #endif /* CONFIG_PM */
3610
3611 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
3612 const struct hda_fixup *fix, int action)
3613 {
3614 struct alc_spec *spec = codec->spec;
3615
3616 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3617 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
3618 }
3619
3620 static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
3621 const struct hda_fixup *fix,
3622 int action)
3623 {
3624 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
3625 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
3626
3627 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
3628 snd_hda_codec_set_pincfg(codec, 0x19,
3629 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
3630 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
3631 }
3632
3633 static void alc269_fixup_hweq(struct hda_codec *codec,
3634 const struct hda_fixup *fix, int action)
3635 {
3636 if (action == HDA_FIXUP_ACT_INIT)
3637 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
3638 }
3639
3640 static void alc269_fixup_headset_mic(struct hda_codec *codec,
3641 const struct hda_fixup *fix, int action)
3642 {
3643 struct alc_spec *spec = codec->spec;
3644
3645 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3646 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3647 }
3648
3649 static void alc271_fixup_dmic(struct hda_codec *codec,
3650 const struct hda_fixup *fix, int action)
3651 {
3652 static const struct hda_verb verbs[] = {
3653 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
3654 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
3655 {}
3656 };
3657 unsigned int cfg;
3658
3659 if (strcmp(codec->core.chip_name, "ALC271X") &&
3660 strcmp(codec->core.chip_name, "ALC269VB"))
3661 return;
3662 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
3663 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
3664 snd_hda_sequence_write(codec, verbs);
3665 }
3666
3667 static void alc269_fixup_pcm_44k(struct hda_codec *codec,
3668 const struct hda_fixup *fix, int action)
3669 {
3670 struct alc_spec *spec = codec->spec;
3671
3672 if (action != HDA_FIXUP_ACT_PROBE)
3673 return;
3674
3675 /* Due to a hardware problem on Lenovo Ideadpad, we need to
3676 * fix the sample rate of analog I/O to 44.1kHz
3677 */
3678 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
3679 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
3680 }
3681
3682 static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
3683 const struct hda_fixup *fix, int action)
3684 {
3685 /* The digital-mic unit sends PDM (differential signal) instead of
3686 * the standard PCM, thus you can't record a valid mono stream as is.
3687 * Below is a workaround specific to ALC269 to control the dmic
3688 * signal source as mono.
3689 */
3690 if (action == HDA_FIXUP_ACT_INIT)
3691 alc_update_coef_idx(codec, 0x07, 0, 0x80);
3692 }
3693
3694 static void alc269_quanta_automute(struct hda_codec *codec)
3695 {
3696 snd_hda_gen_update_outputs(codec);
3697
3698 alc_write_coef_idx(codec, 0x0c, 0x680);
3699 alc_write_coef_idx(codec, 0x0c, 0x480);
3700 }
3701
3702 static void alc269_fixup_quanta_mute(struct hda_codec *codec,
3703 const struct hda_fixup *fix, int action)
3704 {
3705 struct alc_spec *spec = codec->spec;
3706 if (action != HDA_FIXUP_ACT_PROBE)
3707 return;
3708 spec->gen.automute_hook = alc269_quanta_automute;
3709 }
3710
3711 static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
3712 struct hda_jack_callback *jack)
3713 {
3714 struct alc_spec *spec = codec->spec;
3715 int vref;
3716 msleep(200);
3717 snd_hda_gen_hp_automute(codec, jack);
3718
3719 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
3720 msleep(100);
3721 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3722 vref);
3723 msleep(500);
3724 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3725 vref);
3726 }
3727
3728 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
3729 const struct hda_fixup *fix, int action)
3730 {
3731 struct alc_spec *spec = codec->spec;
3732 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3733 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3734 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
3735 }
3736 }
3737
3738
3739 /* update mute-LED according to the speaker mute state via mic VREF pin */
3740 static void alc269_fixup_mic_mute_hook(void *private_data, int enabled)
3741 {
3742 struct hda_codec *codec = private_data;
3743 struct alc_spec *spec = codec->spec;
3744 unsigned int pinval;
3745
3746 if (spec->mute_led_polarity)
3747 enabled = !enabled;
3748 pinval = snd_hda_codec_get_pin_target(codec, spec->mute_led_nid);
3749 pinval &= ~AC_PINCTL_VREFEN;
3750 pinval |= enabled ? AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80;
3751 if (spec->mute_led_nid) {
3752 /* temporarily power up/down for setting VREF */
3753 snd_hda_power_up_pm(codec);
3754 snd_hda_set_pin_ctl_cache(codec, spec->mute_led_nid, pinval);
3755 snd_hda_power_down_pm(codec);
3756 }
3757 }
3758
3759 /* Make sure the led works even in runtime suspend */
3760 static unsigned int led_power_filter(struct hda_codec *codec,
3761 hda_nid_t nid,
3762 unsigned int power_state)
3763 {
3764 struct alc_spec *spec = codec->spec;
3765
3766 if (power_state != AC_PWRST_D3 || nid == 0 ||
3767 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
3768 return power_state;
3769
3770 /* Set pin ctl again, it might have just been set to 0 */
3771 snd_hda_set_pin_ctl(codec, nid,
3772 snd_hda_codec_get_pin_target(codec, nid));
3773
3774 return snd_hda_gen_path_power_filter(codec, nid, power_state);
3775 }
3776
3777 static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
3778 const struct hda_fixup *fix, int action)
3779 {
3780 struct alc_spec *spec = codec->spec;
3781 const struct dmi_device *dev = NULL;
3782
3783 if (action != HDA_FIXUP_ACT_PRE_PROBE)
3784 return;
3785
3786 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
3787 int pol, pin;
3788 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
3789 continue;
3790 if (pin < 0x0a || pin >= 0x10)
3791 break;
3792 spec->mute_led_polarity = pol;
3793 spec->mute_led_nid = pin - 0x0a + 0x18;
3794 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3795 spec->gen.vmaster_mute_enum = 1;
3796 codec->power_filter = led_power_filter;
3797 codec_dbg(codec,
3798 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
3799 spec->mute_led_polarity);
3800 break;
3801 }
3802 }
3803
3804 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
3805 const struct hda_fixup *fix, int action)
3806 {
3807 struct alc_spec *spec = codec->spec;
3808 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3809 spec->mute_led_polarity = 0;
3810 spec->mute_led_nid = 0x18;
3811 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3812 spec->gen.vmaster_mute_enum = 1;
3813 codec->power_filter = led_power_filter;
3814 }
3815 }
3816
3817 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
3818 const struct hda_fixup *fix, int action)
3819 {
3820 struct alc_spec *spec = codec->spec;
3821 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3822 spec->mute_led_polarity = 0;
3823 spec->mute_led_nid = 0x19;
3824 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3825 spec->gen.vmaster_mute_enum = 1;
3826 codec->power_filter = led_power_filter;
3827 }
3828 }
3829
3830 static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
3831 const struct hda_fixup *fix, int action)
3832 {
3833 struct alc_spec *spec = codec->spec;
3834 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3835 spec->mute_led_polarity = 0;
3836 spec->mute_led_nid = 0x1b;
3837 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3838 spec->gen.vmaster_mute_enum = 1;
3839 codec->power_filter = led_power_filter;
3840 }
3841 }
3842
3843 /* update LED status via GPIO */
3844 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
3845 bool enabled)
3846 {
3847 struct alc_spec *spec = codec->spec;
3848 unsigned int oldval = spec->gpio_led;
3849
3850 if (spec->mute_led_polarity)
3851 enabled = !enabled;
3852
3853 if (enabled)
3854 spec->gpio_led &= ~mask;
3855 else
3856 spec->gpio_led |= mask;
3857 if (spec->gpio_led != oldval)
3858 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
3859 spec->gpio_led);
3860 }
3861
3862 /* turn on/off mute LED via GPIO per vmaster hook */
3863 static void alc_fixup_gpio_mute_hook(void *private_data, int enabled)
3864 {
3865 struct hda_codec *codec = private_data;
3866 struct alc_spec *spec = codec->spec;
3867
3868 alc_update_gpio_led(codec, spec->gpio_mute_led_mask, enabled);
3869 }
3870
3871 /* turn on/off mic-mute LED via GPIO per capture hook */
3872 static void alc_fixup_gpio_mic_mute_hook(struct hda_codec *codec,
3873 struct snd_kcontrol *kcontrol,
3874 struct snd_ctl_elem_value *ucontrol)
3875 {
3876 struct alc_spec *spec = codec->spec;
3877
3878 if (ucontrol)
3879 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
3880 ucontrol->value.integer.value[0] ||
3881 ucontrol->value.integer.value[1]);
3882 }
3883
3884 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
3885 const struct hda_fixup *fix, int action)
3886 {
3887 struct alc_spec *spec = codec->spec;
3888 static const struct hda_verb gpio_init[] = {
3889 { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 },
3890 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 },
3891 {}
3892 };
3893
3894 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3895 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
3896 spec->gen.cap_sync_hook = alc_fixup_gpio_mic_mute_hook;
3897 spec->gpio_led = 0;
3898 spec->mute_led_polarity = 0;
3899 spec->gpio_mute_led_mask = 0x08;
3900 spec->gpio_mic_led_mask = 0x10;
3901 snd_hda_add_verbs(codec, gpio_init);
3902 }
3903 }
3904
3905 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
3906 const struct hda_fixup *fix, int action)
3907 {
3908 struct alc_spec *spec = codec->spec;
3909 static const struct hda_verb gpio_init[] = {
3910 { 0x01, AC_VERB_SET_GPIO_MASK, 0x22 },
3911 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x22 },
3912 {}
3913 };
3914
3915 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3916 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
3917 spec->gen.cap_sync_hook = alc_fixup_gpio_mic_mute_hook;
3918 spec->gpio_led = 0;
3919 spec->mute_led_polarity = 0;
3920 spec->gpio_mute_led_mask = 0x02;
3921 spec->gpio_mic_led_mask = 0x20;
3922 snd_hda_add_verbs(codec, gpio_init);
3923 }
3924 }
3925
3926 /* turn on/off mic-mute LED per capture hook */
3927 static void alc269_fixup_hp_cap_mic_mute_hook(struct hda_codec *codec,
3928 struct snd_kcontrol *kcontrol,
3929 struct snd_ctl_elem_value *ucontrol)
3930 {
3931 struct alc_spec *spec = codec->spec;
3932 unsigned int pinval, enable, disable;
3933
3934 pinval = snd_hda_codec_get_pin_target(codec, spec->cap_mute_led_nid);
3935 pinval &= ~AC_PINCTL_VREFEN;
3936 enable = pinval | AC_PINCTL_VREF_80;
3937 disable = pinval | AC_PINCTL_VREF_HIZ;
3938
3939 if (!ucontrol)
3940 return;
3941
3942 if (ucontrol->value.integer.value[0] ||
3943 ucontrol->value.integer.value[1])
3944 pinval = disable;
3945 else
3946 pinval = enable;
3947
3948 if (spec->cap_mute_led_nid)
3949 snd_hda_set_pin_ctl_cache(codec, spec->cap_mute_led_nid, pinval);
3950 }
3951
3952 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
3953 const struct hda_fixup *fix, int action)
3954 {
3955 struct alc_spec *spec = codec->spec;
3956 static const struct hda_verb gpio_init[] = {
3957 { 0x01, AC_VERB_SET_GPIO_MASK, 0x08 },
3958 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x08 },
3959 {}
3960 };
3961
3962 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3963 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
3964 spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook;
3965 spec->gpio_led = 0;
3966 spec->mute_led_polarity = 0;
3967 spec->gpio_mute_led_mask = 0x08;
3968 spec->cap_mute_led_nid = 0x18;
3969 snd_hda_add_verbs(codec, gpio_init);
3970 codec->power_filter = led_power_filter;
3971 }
3972 }
3973
3974 static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
3975 const struct hda_fixup *fix, int action)
3976 {
3977 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to enable headphone amp */
3978 struct alc_spec *spec = codec->spec;
3979 static const struct hda_verb gpio_init[] = {
3980 { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 },
3981 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 },
3982 {}
3983 };
3984
3985 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3986 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
3987 spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook;
3988 spec->gpio_led = 0;
3989 spec->mute_led_polarity = 0;
3990 spec->gpio_mute_led_mask = 0x08;
3991 spec->cap_mute_led_nid = 0x18;
3992 snd_hda_add_verbs(codec, gpio_init);
3993 codec->power_filter = led_power_filter;
3994 }
3995 }
3996
3997 #if IS_REACHABLE(CONFIG_INPUT)
3998 static void gpio2_mic_hotkey_event(struct hda_codec *codec,
3999 struct hda_jack_callback *event)
4000 {
4001 struct alc_spec *spec = codec->spec;
4002
4003 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
4004 send both key on and key off event for every interrupt. */
4005 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
4006 input_sync(spec->kb_dev);
4007 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
4008 input_sync(spec->kb_dev);
4009 }
4010
4011 static int alc_register_micmute_input_device(struct hda_codec *codec)
4012 {
4013 struct alc_spec *spec = codec->spec;
4014 int i;
4015
4016 spec->kb_dev = input_allocate_device();
4017 if (!spec->kb_dev) {
4018 codec_err(codec, "Out of memory (input_allocate_device)\n");
4019 return -ENOMEM;
4020 }
4021
4022 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
4023
4024 spec->kb_dev->name = "Microphone Mute Button";
4025 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
4026 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
4027 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
4028 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
4029 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
4030 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
4031
4032 if (input_register_device(spec->kb_dev)) {
4033 codec_err(codec, "input_register_device failed\n");
4034 input_free_device(spec->kb_dev);
4035 spec->kb_dev = NULL;
4036 return -ENOMEM;
4037 }
4038
4039 return 0;
4040 }
4041
4042 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4043 const struct hda_fixup *fix, int action)
4044 {
4045 /* GPIO1 = set according to SKU external amp
4046 GPIO2 = mic mute hotkey
4047 GPIO3 = mute LED
4048 GPIO4 = mic mute LED */
4049 static const struct hda_verb gpio_init[] = {
4050 { 0x01, AC_VERB_SET_GPIO_MASK, 0x1e },
4051 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x1a },
4052 { 0x01, AC_VERB_SET_GPIO_DATA, 0x02 },
4053 {}
4054 };
4055
4056 struct alc_spec *spec = codec->spec;
4057
4058 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4059 if (alc_register_micmute_input_device(codec) != 0)
4060 return;
4061
4062 snd_hda_add_verbs(codec, gpio_init);
4063 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
4064 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
4065 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
4066 gpio2_mic_hotkey_event);
4067
4068 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
4069 spec->gen.cap_sync_hook = alc_fixup_gpio_mic_mute_hook;
4070 spec->gpio_led = 0;
4071 spec->mute_led_polarity = 0;
4072 spec->gpio_mute_led_mask = 0x08;
4073 spec->gpio_mic_led_mask = 0x10;
4074 return;
4075 }
4076
4077 if (!spec->kb_dev)
4078 return;
4079
4080 switch (action) {
4081 case HDA_FIXUP_ACT_PROBE:
4082 spec->init_amp = ALC_INIT_DEFAULT;
4083 break;
4084 case HDA_FIXUP_ACT_FREE:
4085 input_unregister_device(spec->kb_dev);
4086 spec->kb_dev = NULL;
4087 }
4088 }
4089
4090 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4091 const struct hda_fixup *fix, int action)
4092 {
4093 /* Line2 = mic mute hotkey
4094 GPIO2 = mic mute LED */
4095 static const struct hda_verb gpio_init[] = {
4096 { 0x01, AC_VERB_SET_GPIO_MASK, 0x04 },
4097 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04 },
4098 {}
4099 };
4100
4101 struct alc_spec *spec = codec->spec;
4102
4103 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4104 if (alc_register_micmute_input_device(codec) != 0)
4105 return;
4106
4107 snd_hda_add_verbs(codec, gpio_init);
4108 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4109 gpio2_mic_hotkey_event);
4110
4111 spec->gen.cap_sync_hook = alc_fixup_gpio_mic_mute_hook;
4112 spec->gpio_led = 0;
4113 spec->mute_led_polarity = 0;
4114 spec->gpio_mic_led_mask = 0x04;
4115 return;
4116 }
4117
4118 if (!spec->kb_dev)
4119 return;
4120
4121 switch (action) {
4122 case HDA_FIXUP_ACT_PROBE:
4123 spec->init_amp = ALC_INIT_DEFAULT;
4124 break;
4125 case HDA_FIXUP_ACT_FREE:
4126 input_unregister_device(spec->kb_dev);
4127 spec->kb_dev = NULL;
4128 }
4129 }
4130 #else /* INPUT */
4131 #define alc280_fixup_hp_gpio2_mic_hotkey NULL
4132 #define alc233_fixup_lenovo_line2_mic_hotkey NULL
4133 #endif /* INPUT */
4134
4135 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4136 const struct hda_fixup *fix, int action)
4137 {
4138 struct alc_spec *spec = codec->spec;
4139
4140 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4141 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
4142 spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook;
4143 spec->mute_led_polarity = 0;
4144 spec->mute_led_nid = 0x1a;
4145 spec->cap_mute_led_nid = 0x18;
4146 spec->gen.vmaster_mute_enum = 1;
4147 codec->power_filter = led_power_filter;
4148 }
4149 }
4150
4151 static struct coef_fw alc225_pre_hsmode[] = {
4152 UPDATE_COEF(0x4a, 1<<8, 0),
4153 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4154 UPDATE_COEF(0x63, 3<<14, 3<<14),
4155 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4156 UPDATE_COEF(0x4a, 3<<10, 3<<10),
4157 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4158 UPDATE_COEF(0x4a, 3<<10, 0),
4159 {}
4160 };
4161
4162 static void alc_headset_mode_unplugged(struct hda_codec *codec)
4163 {
4164 static struct coef_fw coef0255[] = {
4165 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
4166 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4167 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4168 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4169 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4170 {}
4171 };
4172 static struct coef_fw coef0256[] = {
4173 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
4174 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4175 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4176 WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
4177 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4178 {}
4179 };
4180 static struct coef_fw coef0233[] = {
4181 WRITE_COEF(0x1b, 0x0c0b),
4182 WRITE_COEF(0x45, 0xc429),
4183 UPDATE_COEF(0x35, 0x4000, 0),
4184 WRITE_COEF(0x06, 0x2104),
4185 WRITE_COEF(0x1a, 0x0001),
4186 WRITE_COEF(0x26, 0x0004),
4187 WRITE_COEF(0x32, 0x42a3),
4188 {}
4189 };
4190 static struct coef_fw coef0288[] = {
4191 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4192 UPDATE_COEF(0x50, 0x2000, 0x2000),
4193 UPDATE_COEF(0x56, 0x0006, 0x0006),
4194 UPDATE_COEF(0x66, 0x0008, 0),
4195 UPDATE_COEF(0x67, 0x2000, 0),
4196 {}
4197 };
4198 static struct coef_fw coef0298[] = {
4199 UPDATE_COEF(0x19, 0x1300, 0x0300),
4200 {}
4201 };
4202 static struct coef_fw coef0292[] = {
4203 WRITE_COEF(0x76, 0x000e),
4204 WRITE_COEF(0x6c, 0x2400),
4205 WRITE_COEF(0x18, 0x7308),
4206 WRITE_COEF(0x6b, 0xc429),
4207 {}
4208 };
4209 static struct coef_fw coef0293[] = {
4210 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
4211 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
4212 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
4213 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
4214 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
4215 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4216 {}
4217 };
4218 static struct coef_fw coef0668[] = {
4219 WRITE_COEF(0x15, 0x0d40),
4220 WRITE_COEF(0xb7, 0x802b),
4221 {}
4222 };
4223 static struct coef_fw coef0225[] = {
4224 UPDATE_COEF(0x63, 3<<14, 0),
4225 {}
4226 };
4227 static struct coef_fw coef0274[] = {
4228 UPDATE_COEF(0x4a, 0x0100, 0),
4229 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
4230 UPDATE_COEF(0x6b, 0xf000, 0x5000),
4231 UPDATE_COEF(0x4a, 0x0010, 0),
4232 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
4233 WRITE_COEF(0x45, 0x5289),
4234 UPDATE_COEF(0x4a, 0x0c00, 0),
4235 {}
4236 };
4237
4238 switch (codec->core.vendor_id) {
4239 case 0x10ec0255:
4240 alc_process_coef_fw(codec, coef0255);
4241 break;
4242 case 0x10ec0236:
4243 case 0x10ec0256:
4244 alc_process_coef_fw(codec, coef0256);
4245 break;
4246 case 0x10ec0234:
4247 case 0x10ec0274:
4248 case 0x10ec0294:
4249 alc_process_coef_fw(codec, coef0274);
4250 break;
4251 case 0x10ec0233:
4252 case 0x10ec0283:
4253 alc_process_coef_fw(codec, coef0233);
4254 break;
4255 case 0x10ec0286:
4256 case 0x10ec0288:
4257 alc_process_coef_fw(codec, coef0288);
4258 break;
4259 case 0x10ec0298:
4260 alc_process_coef_fw(codec, coef0298);
4261 alc_process_coef_fw(codec, coef0288);
4262 break;
4263 case 0x10ec0292:
4264 alc_process_coef_fw(codec, coef0292);
4265 break;
4266 case 0x10ec0293:
4267 alc_process_coef_fw(codec, coef0293);
4268 break;
4269 case 0x10ec0668:
4270 alc_process_coef_fw(codec, coef0668);
4271 break;
4272 case 0x10ec0215:
4273 case 0x10ec0225:
4274 case 0x10ec0285:
4275 case 0x10ec0295:
4276 case 0x10ec0289:
4277 case 0x10ec0299:
4278 alc_process_coef_fw(codec, alc225_pre_hsmode);
4279 alc_process_coef_fw(codec, coef0225);
4280 break;
4281 case 0x10ec0867:
4282 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4283 break;
4284 }
4285 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
4286 }
4287
4288
4289 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
4290 hda_nid_t mic_pin)
4291 {
4292 static struct coef_fw coef0255[] = {
4293 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
4294 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4295 {}
4296 };
4297 static struct coef_fw coef0256[] = {
4298 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
4299 WRITE_COEFEX(0x57, 0x03, 0x09a3),
4300 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4301 {}
4302 };
4303 static struct coef_fw coef0233[] = {
4304 UPDATE_COEF(0x35, 0, 1<<14),
4305 WRITE_COEF(0x06, 0x2100),
4306 WRITE_COEF(0x1a, 0x0021),
4307 WRITE_COEF(0x26, 0x008c),
4308 {}
4309 };
4310 static struct coef_fw coef0288[] = {
4311 UPDATE_COEF(0x4f, 0x00c0, 0),
4312 UPDATE_COEF(0x50, 0x2000, 0),
4313 UPDATE_COEF(0x56, 0x0006, 0),
4314 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4315 UPDATE_COEF(0x66, 0x0008, 0x0008),
4316 UPDATE_COEF(0x67, 0x2000, 0x2000),
4317 {}
4318 };
4319 static struct coef_fw coef0292[] = {
4320 WRITE_COEF(0x19, 0xa208),
4321 WRITE_COEF(0x2e, 0xacf0),
4322 {}
4323 };
4324 static struct coef_fw coef0293[] = {
4325 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
4326 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
4327 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4328 {}
4329 };
4330 static struct coef_fw coef0688[] = {
4331 WRITE_COEF(0xb7, 0x802b),
4332 WRITE_COEF(0xb5, 0x1040),
4333 UPDATE_COEF(0xc3, 0, 1<<12),
4334 {}
4335 };
4336 static struct coef_fw coef0225[] = {
4337 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
4338 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4339 UPDATE_COEF(0x63, 3<<14, 0),
4340 {}
4341 };
4342 static struct coef_fw coef0274[] = {
4343 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
4344 UPDATE_COEF(0x4a, 0x0010, 0),
4345 UPDATE_COEF(0x6b, 0xf000, 0),
4346 {}
4347 };
4348
4349 switch (codec->core.vendor_id) {
4350 case 0x10ec0255:
4351 alc_write_coef_idx(codec, 0x45, 0xc489);
4352 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4353 alc_process_coef_fw(codec, coef0255);
4354 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4355 break;
4356 case 0x10ec0236:
4357 case 0x10ec0256:
4358 alc_write_coef_idx(codec, 0x45, 0xc489);
4359 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4360 alc_process_coef_fw(codec, coef0256);
4361 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4362 break;
4363 case 0x10ec0234:
4364 case 0x10ec0274:
4365 case 0x10ec0294:
4366 alc_write_coef_idx(codec, 0x45, 0x4689);
4367 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4368 alc_process_coef_fw(codec, coef0274);
4369 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4370 break;
4371 case 0x10ec0233:
4372 case 0x10ec0283:
4373 alc_write_coef_idx(codec, 0x45, 0xc429);
4374 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4375 alc_process_coef_fw(codec, coef0233);
4376 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4377 break;
4378 case 0x10ec0286:
4379 case 0x10ec0288:
4380 case 0x10ec0298:
4381 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4382 alc_process_coef_fw(codec, coef0288);
4383 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4384 break;
4385 case 0x10ec0292:
4386 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4387 alc_process_coef_fw(codec, coef0292);
4388 break;
4389 case 0x10ec0293:
4390 /* Set to TRS mode */
4391 alc_write_coef_idx(codec, 0x45, 0xc429);
4392 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4393 alc_process_coef_fw(codec, coef0293);
4394 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4395 break;
4396 case 0x10ec0867:
4397 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
4398 /* fallthru */
4399 case 0x10ec0221:
4400 case 0x10ec0662:
4401 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4402 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4403 break;
4404 case 0x10ec0668:
4405 alc_write_coef_idx(codec, 0x11, 0x0001);
4406 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4407 alc_process_coef_fw(codec, coef0688);
4408 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4409 break;
4410 case 0x10ec0215:
4411 case 0x10ec0225:
4412 case 0x10ec0285:
4413 case 0x10ec0295:
4414 case 0x10ec0289:
4415 case 0x10ec0299:
4416 alc_process_coef_fw(codec, alc225_pre_hsmode);
4417 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
4418 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4419 alc_process_coef_fw(codec, coef0225);
4420 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4421 break;
4422 }
4423 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
4424 }
4425
4426 static void alc_headset_mode_default(struct hda_codec *codec)
4427 {
4428 static struct coef_fw coef0225[] = {
4429 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
4430 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
4431 UPDATE_COEF(0x49, 3<<8, 0<<8),
4432 UPDATE_COEF(0x4a, 3<<4, 3<<4),
4433 UPDATE_COEF(0x63, 3<<14, 0),
4434 UPDATE_COEF(0x67, 0xf000, 0x3000),
4435 {}
4436 };
4437 static struct coef_fw coef0255[] = {
4438 WRITE_COEF(0x45, 0xc089),
4439 WRITE_COEF(0x45, 0xc489),
4440 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4441 WRITE_COEF(0x49, 0x0049),
4442 {}
4443 };
4444 static struct coef_fw coef0256[] = {
4445 WRITE_COEF(0x45, 0xc489),
4446 WRITE_COEFEX(0x57, 0x03, 0x0da3),
4447 WRITE_COEF(0x49, 0x0049),
4448 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4449 WRITE_COEF(0x06, 0x6100),
4450 {}
4451 };
4452 static struct coef_fw coef0233[] = {
4453 WRITE_COEF(0x06, 0x2100),
4454 WRITE_COEF(0x32, 0x4ea3),
4455 {}
4456 };
4457 static struct coef_fw coef0288[] = {
4458 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
4459 UPDATE_COEF(0x50, 0x2000, 0x2000),
4460 UPDATE_COEF(0x56, 0x0006, 0x0006),
4461 UPDATE_COEF(0x66, 0x0008, 0),
4462 UPDATE_COEF(0x67, 0x2000, 0),
4463 {}
4464 };
4465 static struct coef_fw coef0292[] = {
4466 WRITE_COEF(0x76, 0x000e),
4467 WRITE_COEF(0x6c, 0x2400),
4468 WRITE_COEF(0x6b, 0xc429),
4469 WRITE_COEF(0x18, 0x7308),
4470 {}
4471 };
4472 static struct coef_fw coef0293[] = {
4473 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4474 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
4475 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4476 {}
4477 };
4478 static struct coef_fw coef0688[] = {
4479 WRITE_COEF(0x11, 0x0041),
4480 WRITE_COEF(0x15, 0x0d40),
4481 WRITE_COEF(0xb7, 0x802b),
4482 {}
4483 };
4484 static struct coef_fw coef0274[] = {
4485 WRITE_COEF(0x45, 0x4289),
4486 UPDATE_COEF(0x4a, 0x0010, 0x0010),
4487 UPDATE_COEF(0x6b, 0x0f00, 0),
4488 UPDATE_COEF(0x49, 0x0300, 0x0300),
4489 {}
4490 };
4491
4492 switch (codec->core.vendor_id) {
4493 case 0x10ec0215:
4494 case 0x10ec0225:
4495 case 0x10ec0285:
4496 case 0x10ec0295:
4497 case 0x10ec0289:
4498 case 0x10ec0299:
4499 alc_process_coef_fw(codec, alc225_pre_hsmode);
4500 alc_process_coef_fw(codec, coef0225);
4501 break;
4502 case 0x10ec0255:
4503 alc_process_coef_fw(codec, coef0255);
4504 break;
4505 case 0x10ec0236:
4506 case 0x10ec0256:
4507 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
4508 alc_write_coef_idx(codec, 0x45, 0xc089);
4509 msleep(50);
4510 alc_process_coef_fw(codec, coef0256);
4511 break;
4512 case 0x10ec0234:
4513 case 0x10ec0274:
4514 case 0x10ec0294:
4515 alc_process_coef_fw(codec, coef0274);
4516 break;
4517 case 0x10ec0233:
4518 case 0x10ec0283:
4519 alc_process_coef_fw(codec, coef0233);
4520 break;
4521 case 0x10ec0286:
4522 case 0x10ec0288:
4523 case 0x10ec0298:
4524 alc_process_coef_fw(codec, coef0288);
4525 break;
4526 case 0x10ec0292:
4527 alc_process_coef_fw(codec, coef0292);
4528 break;
4529 case 0x10ec0293:
4530 alc_process_coef_fw(codec, coef0293);
4531 break;
4532 case 0x10ec0668:
4533 alc_process_coef_fw(codec, coef0688);
4534 break;
4535 case 0x10ec0867:
4536 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4537 break;
4538 }
4539 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
4540 }
4541
4542 /* Iphone type */
4543 static void alc_headset_mode_ctia(struct hda_codec *codec)
4544 {
4545 int val;
4546
4547 static struct coef_fw coef0255[] = {
4548 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
4549 WRITE_COEF(0x1b, 0x0c2b),
4550 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4551 {}
4552 };
4553 static struct coef_fw coef0256[] = {
4554 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
4555 WRITE_COEF(0x1b, 0x0e6b),
4556 {}
4557 };
4558 static struct coef_fw coef0233[] = {
4559 WRITE_COEF(0x45, 0xd429),
4560 WRITE_COEF(0x1b, 0x0c2b),
4561 WRITE_COEF(0x32, 0x4ea3),
4562 {}
4563 };
4564 static struct coef_fw coef0288[] = {
4565 UPDATE_COEF(0x50, 0x2000, 0x2000),
4566 UPDATE_COEF(0x56, 0x0006, 0x0006),
4567 UPDATE_COEF(0x66, 0x0008, 0),
4568 UPDATE_COEF(0x67, 0x2000, 0),
4569 {}
4570 };
4571 static struct coef_fw coef0292[] = {
4572 WRITE_COEF(0x6b, 0xd429),
4573 WRITE_COEF(0x76, 0x0008),
4574 WRITE_COEF(0x18, 0x7388),
4575 {}
4576 };
4577 static struct coef_fw coef0293[] = {
4578 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
4579 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
4580 {}
4581 };
4582 static struct coef_fw coef0688[] = {
4583 WRITE_COEF(0x11, 0x0001),
4584 WRITE_COEF(0x15, 0x0d60),
4585 WRITE_COEF(0xc3, 0x0000),
4586 {}
4587 };
4588 static struct coef_fw coef0225_1[] = {
4589 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
4590 UPDATE_COEF(0x63, 3<<14, 2<<14),
4591 {}
4592 };
4593 static struct coef_fw coef0225_2[] = {
4594 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
4595 UPDATE_COEF(0x63, 3<<14, 1<<14),
4596 {}
4597 };
4598
4599 switch (codec->core.vendor_id) {
4600 case 0x10ec0255:
4601 alc_process_coef_fw(codec, coef0255);
4602 break;
4603 case 0x10ec0236:
4604 case 0x10ec0256:
4605 alc_process_coef_fw(codec, coef0256);
4606 break;
4607 case 0x10ec0234:
4608 case 0x10ec0274:
4609 case 0x10ec0294:
4610 alc_write_coef_idx(codec, 0x45, 0xd689);
4611 break;
4612 case 0x10ec0233:
4613 case 0x10ec0283:
4614 alc_process_coef_fw(codec, coef0233);
4615 break;
4616 case 0x10ec0298:
4617 val = alc_read_coef_idx(codec, 0x50);
4618 if (val & (1 << 12)) {
4619 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
4620 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4621 msleep(300);
4622 } else {
4623 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
4624 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4625 msleep(300);
4626 }
4627 break;
4628 case 0x10ec0286:
4629 case 0x10ec0288:
4630 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4631 msleep(300);
4632 alc_process_coef_fw(codec, coef0288);
4633 break;
4634 case 0x10ec0292:
4635 alc_process_coef_fw(codec, coef0292);
4636 break;
4637 case 0x10ec0293:
4638 alc_process_coef_fw(codec, coef0293);
4639 break;
4640 case 0x10ec0668:
4641 alc_process_coef_fw(codec, coef0688);
4642 break;
4643 case 0x10ec0215:
4644 case 0x10ec0225:
4645 case 0x10ec0285:
4646 case 0x10ec0295:
4647 case 0x10ec0289:
4648 case 0x10ec0299:
4649 val = alc_read_coef_idx(codec, 0x45);
4650 if (val & (1 << 9))
4651 alc_process_coef_fw(codec, coef0225_2);
4652 else
4653 alc_process_coef_fw(codec, coef0225_1);
4654 break;
4655 case 0x10ec0867:
4656 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4657 break;
4658 }
4659 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
4660 }
4661
4662 /* Nokia type */
4663 static void alc_headset_mode_omtp(struct hda_codec *codec)
4664 {
4665 static struct coef_fw coef0255[] = {
4666 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
4667 WRITE_COEF(0x1b, 0x0c2b),
4668 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4669 {}
4670 };
4671 static struct coef_fw coef0256[] = {
4672 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
4673 WRITE_COEF(0x1b, 0x0e6b),
4674 {}
4675 };
4676 static struct coef_fw coef0233[] = {
4677 WRITE_COEF(0x45, 0xe429),
4678 WRITE_COEF(0x1b, 0x0c2b),
4679 WRITE_COEF(0x32, 0x4ea3),
4680 {}
4681 };
4682 static struct coef_fw coef0288[] = {
4683 UPDATE_COEF(0x50, 0x2000, 0x2000),
4684 UPDATE_COEF(0x56, 0x0006, 0x0006),
4685 UPDATE_COEF(0x66, 0x0008, 0),
4686 UPDATE_COEF(0x67, 0x2000, 0),
4687 {}
4688 };
4689 static struct coef_fw coef0292[] = {
4690 WRITE_COEF(0x6b, 0xe429),
4691 WRITE_COEF(0x76, 0x0008),
4692 WRITE_COEF(0x18, 0x7388),
4693 {}
4694 };
4695 static struct coef_fw coef0293[] = {
4696 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
4697 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
4698 {}
4699 };
4700 static struct coef_fw coef0688[] = {
4701 WRITE_COEF(0x11, 0x0001),
4702 WRITE_COEF(0x15, 0x0d50),
4703 WRITE_COEF(0xc3, 0x0000),
4704 {}
4705 };
4706 static struct coef_fw coef0225[] = {
4707 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
4708 UPDATE_COEF(0x63, 3<<14, 2<<14),
4709 {}
4710 };
4711
4712 switch (codec->core.vendor_id) {
4713 case 0x10ec0255:
4714 alc_process_coef_fw(codec, coef0255);
4715 break;
4716 case 0x10ec0236:
4717 case 0x10ec0256:
4718 alc_process_coef_fw(codec, coef0256);
4719 break;
4720 case 0x10ec0234:
4721 case 0x10ec0274:
4722 case 0x10ec0294:
4723 alc_write_coef_idx(codec, 0x45, 0xe689);
4724 break;
4725 case 0x10ec0233:
4726 case 0x10ec0283:
4727 alc_process_coef_fw(codec, coef0233);
4728 break;
4729 case 0x10ec0298:
4730 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
4731 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
4732 msleep(300);
4733 break;
4734 case 0x10ec0286:
4735 case 0x10ec0288:
4736 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
4737 msleep(300);
4738 alc_process_coef_fw(codec, coef0288);
4739 break;
4740 case 0x10ec0292:
4741 alc_process_coef_fw(codec, coef0292);
4742 break;
4743 case 0x10ec0293:
4744 alc_process_coef_fw(codec, coef0293);
4745 break;
4746 case 0x10ec0668:
4747 alc_process_coef_fw(codec, coef0688);
4748 break;
4749 case 0x10ec0215:
4750 case 0x10ec0225:
4751 case 0x10ec0285:
4752 case 0x10ec0295:
4753 case 0x10ec0289:
4754 case 0x10ec0299:
4755 alc_process_coef_fw(codec, coef0225);
4756 break;
4757 }
4758 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
4759 }
4760
4761 static void alc_determine_headset_type(struct hda_codec *codec)
4762 {
4763 int val;
4764 bool is_ctia = false;
4765 struct alc_spec *spec = codec->spec;
4766 static struct coef_fw coef0255[] = {
4767 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
4768 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
4769 conteol) */
4770 {}
4771 };
4772 static struct coef_fw coef0288[] = {
4773 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
4774 {}
4775 };
4776 static struct coef_fw coef0298[] = {
4777 UPDATE_COEF(0x50, 0x2000, 0x2000),
4778 UPDATE_COEF(0x56, 0x0006, 0x0006),
4779 UPDATE_COEF(0x66, 0x0008, 0),
4780 UPDATE_COEF(0x67, 0x2000, 0),
4781 UPDATE_COEF(0x19, 0x1300, 0x1300),
4782 {}
4783 };
4784 static struct coef_fw coef0293[] = {
4785 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
4786 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
4787 {}
4788 };
4789 static struct coef_fw coef0688[] = {
4790 WRITE_COEF(0x11, 0x0001),
4791 WRITE_COEF(0xb7, 0x802b),
4792 WRITE_COEF(0x15, 0x0d60),
4793 WRITE_COEF(0xc3, 0x0c00),
4794 {}
4795 };
4796 static struct coef_fw coef0274[] = {
4797 UPDATE_COEF(0x4a, 0x0010, 0),
4798 UPDATE_COEF(0x4a, 0x8000, 0),
4799 WRITE_COEF(0x45, 0xd289),
4800 UPDATE_COEF(0x49, 0x0300, 0x0300),
4801 {}
4802 };
4803
4804 switch (codec->core.vendor_id) {
4805 case 0x10ec0255:
4806 alc_process_coef_fw(codec, coef0255);
4807 msleep(300);
4808 val = alc_read_coef_idx(codec, 0x46);
4809 is_ctia = (val & 0x0070) == 0x0070;
4810 break;
4811 case 0x10ec0236:
4812 case 0x10ec0256:
4813 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
4814 alc_write_coef_idx(codec, 0x06, 0x6104);
4815 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
4816
4817 snd_hda_codec_write(codec, 0x21, 0,
4818 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
4819 msleep(80);
4820 snd_hda_codec_write(codec, 0x21, 0,
4821 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4822
4823 alc_process_coef_fw(codec, coef0255);
4824 msleep(300);
4825 val = alc_read_coef_idx(codec, 0x46);
4826 is_ctia = (val & 0x0070) == 0x0070;
4827
4828 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
4829 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4830
4831 snd_hda_codec_write(codec, 0x21, 0,
4832 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
4833 msleep(80);
4834 snd_hda_codec_write(codec, 0x21, 0,
4835 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
4836 break;
4837 case 0x10ec0234:
4838 case 0x10ec0274:
4839 case 0x10ec0294:
4840 alc_process_coef_fw(codec, coef0274);
4841 msleep(80);
4842 val = alc_read_coef_idx(codec, 0x46);
4843 is_ctia = (val & 0x00f0) == 0x00f0;
4844 break;
4845 case 0x10ec0233:
4846 case 0x10ec0283:
4847 alc_write_coef_idx(codec, 0x45, 0xd029);
4848 msleep(300);
4849 val = alc_read_coef_idx(codec, 0x46);
4850 is_ctia = (val & 0x0070) == 0x0070;
4851 break;
4852 case 0x10ec0298:
4853 snd_hda_codec_write(codec, 0x21, 0,
4854 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
4855 msleep(100);
4856 snd_hda_codec_write(codec, 0x21, 0,
4857 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4858 msleep(200);
4859
4860 val = alc_read_coef_idx(codec, 0x50);
4861 if (val & (1 << 12)) {
4862 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
4863 alc_process_coef_fw(codec, coef0288);
4864 msleep(350);
4865 val = alc_read_coef_idx(codec, 0x50);
4866 is_ctia = (val & 0x0070) == 0x0070;
4867 } else {
4868 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
4869 alc_process_coef_fw(codec, coef0288);
4870 msleep(350);
4871 val = alc_read_coef_idx(codec, 0x50);
4872 is_ctia = (val & 0x0070) == 0x0070;
4873 }
4874 alc_process_coef_fw(codec, coef0298);
4875 snd_hda_codec_write(codec, 0x21, 0,
4876 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
4877 msleep(75);
4878 snd_hda_codec_write(codec, 0x21, 0,
4879 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
4880 break;
4881 case 0x10ec0286:
4882 case 0x10ec0288:
4883 alc_process_coef_fw(codec, coef0288);
4884 msleep(350);
4885 val = alc_read_coef_idx(codec, 0x50);
4886 is_ctia = (val & 0x0070) == 0x0070;
4887 break;
4888 case 0x10ec0292:
4889 alc_write_coef_idx(codec, 0x6b, 0xd429);
4890 msleep(300);
4891 val = alc_read_coef_idx(codec, 0x6c);
4892 is_ctia = (val & 0x001c) == 0x001c;
4893 break;
4894 case 0x10ec0293:
4895 alc_process_coef_fw(codec, coef0293);
4896 msleep(300);
4897 val = alc_read_coef_idx(codec, 0x46);
4898 is_ctia = (val & 0x0070) == 0x0070;
4899 break;
4900 case 0x10ec0668:
4901 alc_process_coef_fw(codec, coef0688);
4902 msleep(300);
4903 val = alc_read_coef_idx(codec, 0xbe);
4904 is_ctia = (val & 0x1c02) == 0x1c02;
4905 break;
4906 case 0x10ec0215:
4907 case 0x10ec0225:
4908 case 0x10ec0285:
4909 case 0x10ec0295:
4910 case 0x10ec0289:
4911 case 0x10ec0299:
4912 snd_hda_codec_write(codec, 0x21, 0,
4913 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
4914 msleep(80);
4915 snd_hda_codec_write(codec, 0x21, 0,
4916 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4917
4918 alc_process_coef_fw(codec, alc225_pre_hsmode);
4919 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
4920 val = alc_read_coef_idx(codec, 0x45);
4921 if (val & (1 << 9)) {
4922 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
4923 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
4924 msleep(800);
4925 val = alc_read_coef_idx(codec, 0x46);
4926 is_ctia = (val & 0x00f0) == 0x00f0;
4927 } else {
4928 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
4929 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
4930 msleep(800);
4931 val = alc_read_coef_idx(codec, 0x46);
4932 is_ctia = (val & 0x00f0) == 0x00f0;
4933 }
4934 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
4935 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
4936 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
4937
4938 snd_hda_codec_write(codec, 0x21, 0,
4939 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
4940 msleep(80);
4941 snd_hda_codec_write(codec, 0x21, 0,
4942 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
4943 break;
4944 case 0x10ec0867:
4945 is_ctia = true;
4946 break;
4947 }
4948
4949 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
4950 is_ctia ? "yes" : "no");
4951 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
4952 }
4953
4954 static void alc_update_headset_mode(struct hda_codec *codec)
4955 {
4956 struct alc_spec *spec = codec->spec;
4957
4958 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
4959 hda_nid_t hp_pin = alc_get_hp_pin(spec);
4960
4961 int new_headset_mode;
4962
4963 if (!snd_hda_jack_detect(codec, hp_pin))
4964 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
4965 else if (mux_pin == spec->headset_mic_pin)
4966 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
4967 else if (mux_pin == spec->headphone_mic_pin)
4968 new_headset_mode = ALC_HEADSET_MODE_MIC;
4969 else
4970 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
4971
4972 if (new_headset_mode == spec->current_headset_mode) {
4973 snd_hda_gen_update_outputs(codec);
4974 return;
4975 }
4976
4977 switch (new_headset_mode) {
4978 case ALC_HEADSET_MODE_UNPLUGGED:
4979 alc_headset_mode_unplugged(codec);
4980 spec->gen.hp_jack_present = false;
4981 break;
4982 case ALC_HEADSET_MODE_HEADSET:
4983 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
4984 alc_determine_headset_type(codec);
4985 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
4986 alc_headset_mode_ctia(codec);
4987 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
4988 alc_headset_mode_omtp(codec);
4989 spec->gen.hp_jack_present = true;
4990 break;
4991 case ALC_HEADSET_MODE_MIC:
4992 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
4993 spec->gen.hp_jack_present = false;
4994 break;
4995 case ALC_HEADSET_MODE_HEADPHONE:
4996 alc_headset_mode_default(codec);
4997 spec->gen.hp_jack_present = true;
4998 break;
4999 }
5000 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
5001 snd_hda_set_pin_ctl_cache(codec, hp_pin,
5002 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
5003 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
5004 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
5005 PIN_VREFHIZ);
5006 }
5007 spec->current_headset_mode = new_headset_mode;
5008
5009 snd_hda_gen_update_outputs(codec);
5010 }
5011
5012 static void alc_update_headset_mode_hook(struct hda_codec *codec,
5013 struct snd_kcontrol *kcontrol,
5014 struct snd_ctl_elem_value *ucontrol)
5015 {
5016 alc_update_headset_mode(codec);
5017 }
5018
5019 static void alc_update_headset_jack_cb(struct hda_codec *codec,
5020 struct hda_jack_callback *jack)
5021 {
5022 struct alc_spec *spec = codec->spec;
5023 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5024 snd_hda_gen_hp_automute(codec, jack);
5025 }
5026
5027 static void alc_probe_headset_mode(struct hda_codec *codec)
5028 {
5029 int i;
5030 struct alc_spec *spec = codec->spec;
5031 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5032
5033 /* Find mic pins */
5034 for (i = 0; i < cfg->num_inputs; i++) {
5035 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
5036 spec->headset_mic_pin = cfg->inputs[i].pin;
5037 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
5038 spec->headphone_mic_pin = cfg->inputs[i].pin;
5039 }
5040
5041 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
5042 spec->gen.automute_hook = alc_update_headset_mode;
5043 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
5044 }
5045
5046 static void alc_fixup_headset_mode(struct hda_codec *codec,
5047 const struct hda_fixup *fix, int action)
5048 {
5049 struct alc_spec *spec = codec->spec;
5050
5051 switch (action) {
5052 case HDA_FIXUP_ACT_PRE_PROBE:
5053 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
5054 break;
5055 case HDA_FIXUP_ACT_PROBE:
5056 alc_probe_headset_mode(codec);
5057 break;
5058 case HDA_FIXUP_ACT_INIT:
5059 spec->current_headset_mode = 0;
5060 alc_update_headset_mode(codec);
5061 break;
5062 }
5063 }
5064
5065 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
5066 const struct hda_fixup *fix, int action)
5067 {
5068 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5069 struct alc_spec *spec = codec->spec;
5070 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5071 }
5072 else
5073 alc_fixup_headset_mode(codec, fix, action);
5074 }
5075
5076 static void alc255_set_default_jack_type(struct hda_codec *codec)
5077 {
5078 /* Set to iphone type */
5079 static struct coef_fw alc255fw[] = {
5080 WRITE_COEF(0x1b, 0x880b),
5081 WRITE_COEF(0x45, 0xd089),
5082 WRITE_COEF(0x1b, 0x080b),
5083 WRITE_COEF(0x46, 0x0004),
5084 WRITE_COEF(0x1b, 0x0c0b),
5085 {}
5086 };
5087 static struct coef_fw alc256fw[] = {
5088 WRITE_COEF(0x1b, 0x884b),
5089 WRITE_COEF(0x45, 0xd089),
5090 WRITE_COEF(0x1b, 0x084b),
5091 WRITE_COEF(0x46, 0x0004),
5092 WRITE_COEF(0x1b, 0x0c4b),
5093 {}
5094 };
5095 switch (codec->core.vendor_id) {
5096 case 0x10ec0255:
5097 alc_process_coef_fw(codec, alc255fw);
5098 break;
5099 case 0x10ec0236:
5100 case 0x10ec0256:
5101 alc_process_coef_fw(codec, alc256fw);
5102 break;
5103 }
5104 msleep(30);
5105 }
5106
5107 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
5108 const struct hda_fixup *fix, int action)
5109 {
5110 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5111 alc255_set_default_jack_type(codec);
5112 }
5113 alc_fixup_headset_mode(codec, fix, action);
5114 }
5115
5116 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
5117 const struct hda_fixup *fix, int action)
5118 {
5119 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5120 struct alc_spec *spec = codec->spec;
5121 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5122 alc255_set_default_jack_type(codec);
5123 }
5124 else
5125 alc_fixup_headset_mode(codec, fix, action);
5126 }
5127
5128 static void alc288_update_headset_jack_cb(struct hda_codec *codec,
5129 struct hda_jack_callback *jack)
5130 {
5131 struct alc_spec *spec = codec->spec;
5132 int present;
5133
5134 alc_update_headset_jack_cb(codec, jack);
5135 /* Headset Mic enable or disable, only for Dell Dino */
5136 present = spec->gen.hp_jack_present ? 0x40 : 0;
5137 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
5138 present);
5139 }
5140
5141 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5142 const struct hda_fixup *fix, int action)
5143 {
5144 alc_fixup_headset_mode(codec, fix, action);
5145 if (action == HDA_FIXUP_ACT_PROBE) {
5146 struct alc_spec *spec = codec->spec;
5147 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
5148 }
5149 }
5150
5151 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5152 const struct hda_fixup *fix, int action)
5153 {
5154 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5155 struct alc_spec *spec = codec->spec;
5156 spec->gen.auto_mute_via_amp = 1;
5157 }
5158 }
5159
5160 static void alc_fixup_no_shutup(struct hda_codec *codec,
5161 const struct hda_fixup *fix, int action)
5162 {
5163 if (action == HDA_FIXUP_ACT_PROBE) {
5164 struct alc_spec *spec = codec->spec;
5165 spec->no_shutup_pins = 1;
5166 }
5167 }
5168
5169 static void alc_fixup_disable_aamix(struct hda_codec *codec,
5170 const struct hda_fixup *fix, int action)
5171 {
5172 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5173 struct alc_spec *spec = codec->spec;
5174 /* Disable AA-loopback as it causes white noise */
5175 spec->gen.mixer_nid = 0;
5176 }
5177 }
5178
5179 /* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
5180 static void alc_fixup_tpt440_dock(struct hda_codec *codec,
5181 const struct hda_fixup *fix, int action)
5182 {
5183 static const struct hda_pintbl pincfgs[] = {
5184 { 0x16, 0x21211010 }, /* dock headphone */
5185 { 0x19, 0x21a11010 }, /* dock mic */
5186 { }
5187 };
5188 struct alc_spec *spec = codec->spec;
5189
5190 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5191 spec->reboot_notify = snd_hda_gen_reboot_notify; /* reduce noise */
5192 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5193 codec->power_save_node = 0; /* avoid click noises */
5194 snd_hda_apply_pincfgs(codec, pincfgs);
5195 }
5196 }
5197
5198 static void alc_fixup_tpt470_dock(struct hda_codec *codec,
5199 const struct hda_fixup *fix, int action)
5200 {
5201 static const struct hda_pintbl pincfgs[] = {
5202 { 0x17, 0x21211010 }, /* dock headphone */
5203 { 0x19, 0x21a11010 }, /* dock mic */
5204 { }
5205 };
5206 /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
5207 * the speaker output becomes too low by some reason on Thinkpads with
5208 * ALC298 codec
5209 */
5210 static hda_nid_t preferred_pairs[] = {
5211 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
5212 0
5213 };
5214 struct alc_spec *spec = codec->spec;
5215
5216 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5217 spec->gen.preferred_dacs = preferred_pairs;
5218 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5219 snd_hda_apply_pincfgs(codec, pincfgs);
5220 } else if (action == HDA_FIXUP_ACT_INIT) {
5221 /* Enable DOCK device */
5222 snd_hda_codec_write(codec, 0x17, 0,
5223 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5224 /* Enable DOCK device */
5225 snd_hda_codec_write(codec, 0x19, 0,
5226 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5227 }
5228 }
5229
5230 static void alc_shutup_dell_xps13(struct hda_codec *codec)
5231 {
5232 struct alc_spec *spec = codec->spec;
5233 int hp_pin = alc_get_hp_pin(spec);
5234
5235 /* Prevent pop noises when headphones are plugged in */
5236 snd_hda_codec_write(codec, hp_pin, 0,
5237 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5238 msleep(20);
5239 }
5240
5241 static void alc_fixup_dell_xps13(struct hda_codec *codec,
5242 const struct hda_fixup *fix, int action)
5243 {
5244 struct alc_spec *spec = codec->spec;
5245 struct hda_input_mux *imux = &spec->gen.input_mux;
5246 int i;
5247
5248 switch (action) {
5249 case HDA_FIXUP_ACT_PRE_PROBE:
5250 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
5251 * it causes a click noise at start up
5252 */
5253 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
5254 break;
5255 case HDA_FIXUP_ACT_PROBE:
5256 spec->shutup = alc_shutup_dell_xps13;
5257
5258 /* Make the internal mic the default input source. */
5259 for (i = 0; i < imux->num_items; i++) {
5260 if (spec->gen.imux_pins[i] == 0x12) {
5261 spec->gen.cur_mux[0] = i;
5262 break;
5263 }
5264 }
5265 break;
5266 }
5267 }
5268
5269 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
5270 const struct hda_fixup *fix, int action)
5271 {
5272 struct alc_spec *spec = codec->spec;
5273
5274 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5275 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5276 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
5277
5278 /* Disable boost for mic-in permanently. (This code is only called
5279 from quirks that guarantee that the headphone is at NID 0x1b.) */
5280 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
5281 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
5282 } else
5283 alc_fixup_headset_mode(codec, fix, action);
5284 }
5285
5286 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
5287 const struct hda_fixup *fix, int action)
5288 {
5289 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5290 alc_write_coef_idx(codec, 0xc4, 0x8000);
5291 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
5292 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
5293 }
5294 alc_fixup_headset_mode(codec, fix, action);
5295 }
5296
5297 /* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
5298 static int find_ext_mic_pin(struct hda_codec *codec)
5299 {
5300 struct alc_spec *spec = codec->spec;
5301 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5302 hda_nid_t nid;
5303 unsigned int defcfg;
5304 int i;
5305
5306 for (i = 0; i < cfg->num_inputs; i++) {
5307 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5308 continue;
5309 nid = cfg->inputs[i].pin;
5310 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5311 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
5312 continue;
5313 return nid;
5314 }
5315
5316 return 0;
5317 }
5318
5319 static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
5320 const struct hda_fixup *fix,
5321 int action)
5322 {
5323 struct alc_spec *spec = codec->spec;
5324
5325 if (action == HDA_FIXUP_ACT_PROBE) {
5326 int mic_pin = find_ext_mic_pin(codec);
5327 int hp_pin = alc_get_hp_pin(spec);
5328
5329 if (snd_BUG_ON(!mic_pin || !hp_pin))
5330 return;
5331 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
5332 }
5333 }
5334
5335 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
5336 const struct hda_fixup *fix,
5337 int action)
5338 {
5339 struct alc_spec *spec = codec->spec;
5340 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5341 int i;
5342
5343 /* The mic boosts on level 2 and 3 are too noisy
5344 on the internal mic input.
5345 Therefore limit the boost to 0 or 1. */
5346
5347 if (action != HDA_FIXUP_ACT_PROBE)
5348 return;
5349
5350 for (i = 0; i < cfg->num_inputs; i++) {
5351 hda_nid_t nid = cfg->inputs[i].pin;
5352 unsigned int defcfg;
5353 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5354 continue;
5355 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5356 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
5357 continue;
5358
5359 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
5360 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
5361 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
5362 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
5363 (0 << AC_AMPCAP_MUTE_SHIFT));
5364 }
5365 }
5366
5367 static void alc283_hp_automute_hook(struct hda_codec *codec,
5368 struct hda_jack_callback *jack)
5369 {
5370 struct alc_spec *spec = codec->spec;
5371 int vref;
5372
5373 msleep(200);
5374 snd_hda_gen_hp_automute(codec, jack);
5375
5376 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
5377
5378 msleep(600);
5379 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5380 vref);
5381 }
5382
5383 static void alc283_fixup_chromebook(struct hda_codec *codec,
5384 const struct hda_fixup *fix, int action)
5385 {
5386 struct alc_spec *spec = codec->spec;
5387
5388 switch (action) {
5389 case HDA_FIXUP_ACT_PRE_PROBE:
5390 snd_hda_override_wcaps(codec, 0x03, 0);
5391 /* Disable AA-loopback as it causes white noise */
5392 spec->gen.mixer_nid = 0;
5393 break;
5394 case HDA_FIXUP_ACT_INIT:
5395 /* MIC2-VREF control */
5396 /* Set to manual mode */
5397 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
5398 /* Enable Line1 input control by verb */
5399 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
5400 break;
5401 }
5402 }
5403
5404 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
5405 const struct hda_fixup *fix, int action)
5406 {
5407 struct alc_spec *spec = codec->spec;
5408
5409 switch (action) {
5410 case HDA_FIXUP_ACT_PRE_PROBE:
5411 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
5412 break;
5413 case HDA_FIXUP_ACT_INIT:
5414 /* MIC2-VREF control */
5415 /* Set to manual mode */
5416 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
5417 break;
5418 }
5419 }
5420
5421 /* mute tablet speaker pin (0x14) via dock plugging in addition */
5422 static void asus_tx300_automute(struct hda_codec *codec)
5423 {
5424 struct alc_spec *spec = codec->spec;
5425 snd_hda_gen_update_outputs(codec);
5426 if (snd_hda_jack_detect(codec, 0x1b))
5427 spec->gen.mute_bits |= (1ULL << 0x14);
5428 }
5429
5430 static void alc282_fixup_asus_tx300(struct hda_codec *codec,
5431 const struct hda_fixup *fix, int action)
5432 {
5433 struct alc_spec *spec = codec->spec;
5434 /* TX300 needs to set up GPIO2 for the speaker amp */
5435 static const struct hda_verb gpio2_verbs[] = {
5436 { 0x01, AC_VERB_SET_GPIO_MASK, 0x04 },
5437 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04 },
5438 { 0x01, AC_VERB_SET_GPIO_DATA, 0x04 },
5439 {}
5440 };
5441 static const struct hda_pintbl dock_pins[] = {
5442 { 0x1b, 0x21114000 }, /* dock speaker pin */
5443 {}
5444 };
5445
5446 switch (action) {
5447 case HDA_FIXUP_ACT_PRE_PROBE:
5448 snd_hda_add_verbs(codec, gpio2_verbs);
5449 snd_hda_apply_pincfgs(codec, dock_pins);
5450 spec->gen.auto_mute_via_amp = 1;
5451 spec->gen.automute_hook = asus_tx300_automute;
5452 snd_hda_jack_detect_enable_callback(codec, 0x1b,
5453 snd_hda_gen_hp_automute);
5454 break;
5455 case HDA_FIXUP_ACT_BUILD:
5456 /* this is a bit tricky; give more sane names for the main
5457 * (tablet) speaker and the dock speaker, respectively
5458 */
5459 rename_ctl(codec, "Speaker Playback Switch",
5460 "Dock Speaker Playback Switch");
5461 rename_ctl(codec, "Bass Speaker Playback Switch",
5462 "Speaker Playback Switch");
5463 break;
5464 }
5465 }
5466
5467 static void alc290_fixup_mono_speakers(struct hda_codec *codec,
5468 const struct hda_fixup *fix, int action)
5469 {
5470 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5471 /* DAC node 0x03 is giving mono output. We therefore want to
5472 make sure 0x14 (front speaker) and 0x15 (headphones) use the
5473 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
5474 hda_nid_t conn1[2] = { 0x0c };
5475 snd_hda_override_conn_list(codec, 0x14, 1, conn1);
5476 snd_hda_override_conn_list(codec, 0x15, 1, conn1);
5477 }
5478 }
5479
5480 static void alc298_fixup_speaker_volume(struct hda_codec *codec,
5481 const struct hda_fixup *fix, int action)
5482 {
5483 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5484 /* The speaker is routed to the Node 0x06 by a mistake, as a result
5485 we can't adjust the speaker's volume since this node does not has
5486 Amp-out capability. we change the speaker's route to:
5487 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
5488 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
5489 speaker's volume now. */
5490
5491 hda_nid_t conn1[1] = { 0x0c };
5492 snd_hda_override_conn_list(codec, 0x17, 1, conn1);
5493 }
5494 }
5495
5496 /* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
5497 static void alc295_fixup_disable_dac3(struct hda_codec *codec,
5498 const struct hda_fixup *fix, int action)
5499 {
5500 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5501 hda_nid_t conn[2] = { 0x02, 0x03 };
5502 snd_hda_override_conn_list(codec, 0x17, 2, conn);
5503 }
5504 }
5505
5506 /* Hook to update amp GPIO4 for automute */
5507 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
5508 struct hda_jack_callback *jack)
5509 {
5510 struct alc_spec *spec = codec->spec;
5511
5512 snd_hda_gen_hp_automute(codec, jack);
5513 /* mute_led_polarity is set to 0, so we pass inverted value here */
5514 alc_update_gpio_led(codec, 0x10, !spec->gen.hp_jack_present);
5515 }
5516
5517 /* Manage GPIOs for HP EliteBook Folio 9480m.
5518 *
5519 * GPIO4 is the headphone amplifier power control
5520 * GPIO3 is the audio output mute indicator LED
5521 */
5522
5523 static void alc280_fixup_hp_9480m(struct hda_codec *codec,
5524 const struct hda_fixup *fix,
5525 int action)
5526 {
5527 struct alc_spec *spec = codec->spec;
5528 static const struct hda_verb gpio_init[] = {
5529 { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 },
5530 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 },
5531 {}
5532 };
5533
5534 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5535 /* Set the hooks to turn the headphone amp on/off
5536 * as needed
5537 */
5538 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
5539 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
5540
5541 /* The GPIOs are currently off */
5542 spec->gpio_led = 0;
5543
5544 /* GPIO3 is connected to the output mute LED,
5545 * high is on, low is off
5546 */
5547 spec->mute_led_polarity = 0;
5548 spec->gpio_mute_led_mask = 0x08;
5549
5550 /* Initialize GPIO configuration */
5551 snd_hda_add_verbs(codec, gpio_init);
5552 }
5553 }
5554
5555 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
5556 const struct hda_fixup *fix,
5557 int action)
5558 {
5559 alc_fixup_dual_codecs(codec, fix, action);
5560 switch (action) {
5561 case HDA_FIXUP_ACT_PRE_PROBE:
5562 /* override card longname to provide a unique UCM profile */
5563 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
5564 break;
5565 case HDA_FIXUP_ACT_BUILD:
5566 /* rename Capture controls depending on the codec */
5567 rename_ctl(codec, "Capture Volume",
5568 codec->addr == 0 ?
5569 "Rear-Panel Capture Volume" :
5570 "Front-Panel Capture Volume");
5571 rename_ctl(codec, "Capture Switch",
5572 codec->addr == 0 ?
5573 "Rear-Panel Capture Switch" :
5574 "Front-Panel Capture Switch");
5575 break;
5576 }
5577 }
5578
5579 /* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
5580 static void alc274_fixup_bind_dacs(struct hda_codec *codec,
5581 const struct hda_fixup *fix, int action)
5582 {
5583 struct alc_spec *spec = codec->spec;
5584 static hda_nid_t preferred_pairs[] = {
5585 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
5586 0
5587 };
5588
5589 if (action != HDA_FIXUP_ACT_PRE_PROBE)
5590 return;
5591
5592 spec->gen.preferred_dacs = preferred_pairs;
5593 spec->gen.auto_mute_via_amp = 1;
5594 codec->power_save_node = 0;
5595 }
5596
5597 /* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */
5598 static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
5599 const struct hda_fixup *fix, int action)
5600 {
5601 if (action != HDA_FIXUP_ACT_PRE_PROBE)
5602 return;
5603
5604 snd_hda_override_wcaps(codec, 0x03, 0);
5605 }
5606
5607 static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
5608 const struct hda_fixup *fix, int action)
5609 {
5610 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5611 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
5612 }
5613
5614 /* for hda_fixup_thinkpad_acpi() */
5615 #include "thinkpad_helper.c"
5616
5617 static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
5618 const struct hda_fixup *fix, int action)
5619 {
5620 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
5621 hda_fixup_thinkpad_acpi(codec, fix, action);
5622 }
5623
5624 /* for dell wmi mic mute led */
5625 #include "dell_wmi_helper.c"
5626
5627 enum {
5628 ALC269_FIXUP_SONY_VAIO,
5629 ALC275_FIXUP_SONY_VAIO_GPIO2,
5630 ALC269_FIXUP_DELL_M101Z,
5631 ALC269_FIXUP_SKU_IGNORE,
5632 ALC269_FIXUP_ASUS_G73JW,
5633 ALC269_FIXUP_LENOVO_EAPD,
5634 ALC275_FIXUP_SONY_HWEQ,
5635 ALC275_FIXUP_SONY_DISABLE_AAMIX,
5636 ALC271_FIXUP_DMIC,
5637 ALC269_FIXUP_PCM_44K,
5638 ALC269_FIXUP_STEREO_DMIC,
5639 ALC269_FIXUP_HEADSET_MIC,
5640 ALC269_FIXUP_QUANTA_MUTE,
5641 ALC269_FIXUP_LIFEBOOK,
5642 ALC269_FIXUP_LIFEBOOK_EXTMIC,
5643 ALC269_FIXUP_LIFEBOOK_HP_PIN,
5644 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
5645 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
5646 ALC269_FIXUP_AMIC,
5647 ALC269_FIXUP_DMIC,
5648 ALC269VB_FIXUP_AMIC,
5649 ALC269VB_FIXUP_DMIC,
5650 ALC269_FIXUP_HP_MUTE_LED,
5651 ALC269_FIXUP_HP_MUTE_LED_MIC1,
5652 ALC269_FIXUP_HP_MUTE_LED_MIC2,
5653 ALC269_FIXUP_HP_MUTE_LED_MIC3,
5654 ALC269_FIXUP_HP_GPIO_LED,
5655 ALC269_FIXUP_HP_GPIO_MIC1_LED,
5656 ALC269_FIXUP_HP_LINE1_MIC1_LED,
5657 ALC269_FIXUP_INV_DMIC,
5658 ALC269_FIXUP_LENOVO_DOCK,
5659 ALC269_FIXUP_NO_SHUTUP,
5660 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
5661 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
5662 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
5663 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
5664 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
5665 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
5666 ALC269_FIXUP_HEADSET_MODE,
5667 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
5668 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
5669 ALC269_FIXUP_ASUS_X101_FUNC,
5670 ALC269_FIXUP_ASUS_X101_VERB,
5671 ALC269_FIXUP_ASUS_X101,
5672 ALC271_FIXUP_AMIC_MIC2,
5673 ALC271_FIXUP_HP_GATE_MIC_JACK,
5674 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
5675 ALC269_FIXUP_ACER_AC700,
5676 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
5677 ALC269VB_FIXUP_ASUS_ZENBOOK,
5678 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
5679 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
5680 ALC269VB_FIXUP_ORDISSIMO_EVE2,
5681 ALC283_FIXUP_CHROME_BOOK,
5682 ALC283_FIXUP_SENSE_COMBO_JACK,
5683 ALC282_FIXUP_ASUS_TX300,
5684 ALC283_FIXUP_INT_MIC,
5685 ALC290_FIXUP_MONO_SPEAKERS,
5686 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
5687 ALC290_FIXUP_SUBWOOFER,
5688 ALC290_FIXUP_SUBWOOFER_HSJACK,
5689 ALC269_FIXUP_THINKPAD_ACPI,
5690 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
5691 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
5692 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
5693 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5694 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
5695 ALC255_FIXUP_HEADSET_MODE,
5696 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
5697 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
5698 ALC292_FIXUP_TPT440_DOCK,
5699 ALC292_FIXUP_TPT440,
5700 ALC283_FIXUP_HEADSET_MIC,
5701 ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED,
5702 ALC282_FIXUP_ASPIRE_V5_PINS,
5703 ALC280_FIXUP_HP_GPIO4,
5704 ALC286_FIXUP_HP_GPIO_LED,
5705 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
5706 ALC280_FIXUP_HP_DOCK_PINS,
5707 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
5708 ALC280_FIXUP_HP_9480M,
5709 ALC288_FIXUP_DELL_HEADSET_MODE,
5710 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
5711 ALC288_FIXUP_DELL_XPS_13_GPIO6,
5712 ALC288_FIXUP_DELL_XPS_13,
5713 ALC288_FIXUP_DISABLE_AAMIX,
5714 ALC292_FIXUP_DELL_E7X,
5715 ALC292_FIXUP_DISABLE_AAMIX,
5716 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
5717 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
5718 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
5719 ALC275_FIXUP_DELL_XPS,
5720 ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE,
5721 ALC293_FIXUP_LENOVO_SPK_NOISE,
5722 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
5723 ALC255_FIXUP_DELL_SPK_NOISE,
5724 ALC225_FIXUP_DISABLE_MIC_VREF,
5725 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
5726 ALC295_FIXUP_DISABLE_DAC3,
5727 ALC280_FIXUP_HP_HEADSET_MIC,
5728 ALC221_FIXUP_HP_FRONT_MIC,
5729 ALC292_FIXUP_TPT460,
5730 ALC298_FIXUP_SPK_VOLUME,
5731 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
5732 ALC269_FIXUP_ATIV_BOOK_8,
5733 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
5734 ALC256_FIXUP_ASUS_HEADSET_MODE,
5735 ALC256_FIXUP_ASUS_MIC,
5736 ALC256_FIXUP_ASUS_AIO_GPIO2,
5737 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
5738 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
5739 ALC233_FIXUP_LENOVO_MULTI_CODECS,
5740 ALC294_FIXUP_LENOVO_MIC_LOCATION,
5741 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
5742 ALC700_FIXUP_INTEL_REFERENCE,
5743 ALC274_FIXUP_DELL_BIND_DACS,
5744 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
5745 ALC298_FIXUP_TPT470_DOCK,
5746 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
5747 ALC255_FIXUP_DELL_HEADSET_MIC,
5748 ALC256_FIXUP_HUAWEI_MBXP_PINS,
5749 ALC221_FIXUP_HP_HEADSET_MIC,
5750 ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
5751 ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
5752 ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
5753 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
5754 ALC294_FIXUP_ASUS_MIC,
5755 ALC294_FIXUP_ASUS_HEADSET_MIC,
5756 ALC294_FIXUP_ASUS_SPK,
5757 ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
5758 ALC225_FIXUP_WYSE_AUTO_MUTE,
5759 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
5760 ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
5761 ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
5762 ALC299_FIXUP_PREDATOR_SPK,
5763 ALC294_FIXUP_ASUS_INTSPK_HEADSET_MIC,
5764 ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
5765 };
5766
5767 static const struct hda_fixup alc269_fixups[] = {
5768 [ALC269_FIXUP_SONY_VAIO] = {
5769 .type = HDA_FIXUP_PINCTLS,
5770 .v.pins = (const struct hda_pintbl[]) {
5771 {0x19, PIN_VREFGRD},
5772 {}
5773 }
5774 },
5775 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
5776 .type = HDA_FIXUP_VERBS,
5777 .v.verbs = (const struct hda_verb[]) {
5778 {0x01, AC_VERB_SET_GPIO_MASK, 0x04},
5779 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04},
5780 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5781 { }
5782 },
5783 .chained = true,
5784 .chain_id = ALC269_FIXUP_SONY_VAIO
5785 },
5786 [ALC269_FIXUP_DELL_M101Z] = {
5787 .type = HDA_FIXUP_VERBS,
5788 .v.verbs = (const struct hda_verb[]) {
5789 /* Enables internal speaker */
5790 {0x20, AC_VERB_SET_COEF_INDEX, 13},
5791 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
5792 {}
5793 }
5794 },
5795 [ALC269_FIXUP_SKU_IGNORE] = {
5796 .type = HDA_FIXUP_FUNC,
5797 .v.func = alc_fixup_sku_ignore,
5798 },
5799 [ALC269_FIXUP_ASUS_G73JW] = {
5800 .type = HDA_FIXUP_PINS,
5801 .v.pins = (const struct hda_pintbl[]) {
5802 { 0x17, 0x99130111 }, /* subwoofer */
5803 { }
5804 }
5805 },
5806 [ALC269_FIXUP_LENOVO_EAPD] = {
5807 .type = HDA_FIXUP_VERBS,
5808 .v.verbs = (const struct hda_verb[]) {
5809 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
5810 {}
5811 }
5812 },
5813 [ALC275_FIXUP_SONY_HWEQ] = {
5814 .type = HDA_FIXUP_FUNC,
5815 .v.func = alc269_fixup_hweq,
5816 .chained = true,
5817 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
5818 },
5819 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
5820 .type = HDA_FIXUP_FUNC,
5821 .v.func = alc_fixup_disable_aamix,
5822 .chained = true,
5823 .chain_id = ALC269_FIXUP_SONY_VAIO
5824 },
5825 [ALC271_FIXUP_DMIC] = {
5826 .type = HDA_FIXUP_FUNC,
5827 .v.func = alc271_fixup_dmic,
5828 },
5829 [ALC269_FIXUP_PCM_44K] = {
5830 .type = HDA_FIXUP_FUNC,
5831 .v.func = alc269_fixup_pcm_44k,
5832 .chained = true,
5833 .chain_id = ALC269_FIXUP_QUANTA_MUTE
5834 },
5835 [ALC269_FIXUP_STEREO_DMIC] = {
5836 .type = HDA_FIXUP_FUNC,
5837 .v.func = alc269_fixup_stereo_dmic,
5838 },
5839 [ALC269_FIXUP_HEADSET_MIC] = {
5840 .type = HDA_FIXUP_FUNC,
5841 .v.func = alc269_fixup_headset_mic,
5842 },
5843 [ALC269_FIXUP_QUANTA_MUTE] = {
5844 .type = HDA_FIXUP_FUNC,
5845 .v.func = alc269_fixup_quanta_mute,
5846 },
5847 [ALC269_FIXUP_LIFEBOOK] = {
5848 .type = HDA_FIXUP_PINS,
5849 .v.pins = (const struct hda_pintbl[]) {
5850 { 0x1a, 0x2101103f }, /* dock line-out */
5851 { 0x1b, 0x23a11040 }, /* dock mic-in */
5852 { }
5853 },
5854 .chained = true,
5855 .chain_id = ALC269_FIXUP_QUANTA_MUTE
5856 },
5857 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
5858 .type = HDA_FIXUP_PINS,
5859 .v.pins = (const struct hda_pintbl[]) {
5860 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
5861 { }
5862 },
5863 },
5864 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
5865 .type = HDA_FIXUP_PINS,
5866 .v.pins = (const struct hda_pintbl[]) {
5867 { 0x21, 0x0221102f }, /* HP out */
5868 { }
5869 },
5870 },
5871 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
5872 .type = HDA_FIXUP_FUNC,
5873 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
5874 },
5875 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
5876 .type = HDA_FIXUP_FUNC,
5877 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
5878 },
5879 [ALC269_FIXUP_AMIC] = {
5880 .type = HDA_FIXUP_PINS,
5881 .v.pins = (const struct hda_pintbl[]) {
5882 { 0x14, 0x99130110 }, /* speaker */
5883 { 0x15, 0x0121401f }, /* HP out */
5884 { 0x18, 0x01a19c20 }, /* mic */
5885 { 0x19, 0x99a3092f }, /* int-mic */
5886 { }
5887 },
5888 },
5889 [ALC269_FIXUP_DMIC] = {
5890 .type = HDA_FIXUP_PINS,
5891 .v.pins = (const struct hda_pintbl[]) {
5892 { 0x12, 0x99a3092f }, /* int-mic */
5893 { 0x14, 0x99130110 }, /* speaker */
5894 { 0x15, 0x0121401f }, /* HP out */
5895 { 0x18, 0x01a19c20 }, /* mic */
5896 { }
5897 },
5898 },
5899 [ALC269VB_FIXUP_AMIC] = {
5900 .type = HDA_FIXUP_PINS,
5901 .v.pins = (const struct hda_pintbl[]) {
5902 { 0x14, 0x99130110 }, /* speaker */
5903 { 0x18, 0x01a19c20 }, /* mic */
5904 { 0x19, 0x99a3092f }, /* int-mic */
5905 { 0x21, 0x0121401f }, /* HP out */
5906 { }
5907 },
5908 },
5909 [ALC269VB_FIXUP_DMIC] = {
5910 .type = HDA_FIXUP_PINS,
5911 .v.pins = (const struct hda_pintbl[]) {
5912 { 0x12, 0x99a3092f }, /* int-mic */
5913 { 0x14, 0x99130110 }, /* speaker */
5914 { 0x18, 0x01a19c20 }, /* mic */
5915 { 0x21, 0x0121401f }, /* HP out */
5916 { }
5917 },
5918 },
5919 [ALC269_FIXUP_HP_MUTE_LED] = {
5920 .type = HDA_FIXUP_FUNC,
5921 .v.func = alc269_fixup_hp_mute_led,
5922 },
5923 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
5924 .type = HDA_FIXUP_FUNC,
5925 .v.func = alc269_fixup_hp_mute_led_mic1,
5926 },
5927 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
5928 .type = HDA_FIXUP_FUNC,
5929 .v.func = alc269_fixup_hp_mute_led_mic2,
5930 },
5931 [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
5932 .type = HDA_FIXUP_FUNC,
5933 .v.func = alc269_fixup_hp_mute_led_mic3,
5934 },
5935 [ALC269_FIXUP_HP_GPIO_LED] = {
5936 .type = HDA_FIXUP_FUNC,
5937 .v.func = alc269_fixup_hp_gpio_led,
5938 },
5939 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
5940 .type = HDA_FIXUP_FUNC,
5941 .v.func = alc269_fixup_hp_gpio_mic1_led,
5942 },
5943 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
5944 .type = HDA_FIXUP_FUNC,
5945 .v.func = alc269_fixup_hp_line1_mic1_led,
5946 },
5947 [ALC269_FIXUP_INV_DMIC] = {
5948 .type = HDA_FIXUP_FUNC,
5949 .v.func = alc_fixup_inv_dmic,
5950 },
5951 [ALC269_FIXUP_NO_SHUTUP] = {
5952 .type = HDA_FIXUP_FUNC,
5953 .v.func = alc_fixup_no_shutup,
5954 },
5955 [ALC269_FIXUP_LENOVO_DOCK] = {
5956 .type = HDA_FIXUP_PINS,
5957 .v.pins = (const struct hda_pintbl[]) {
5958 { 0x19, 0x23a11040 }, /* dock mic */
5959 { 0x1b, 0x2121103f }, /* dock headphone */
5960 { }
5961 },
5962 .chained = true,
5963 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
5964 },
5965 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
5966 .type = HDA_FIXUP_FUNC,
5967 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
5968 .chained = true,
5969 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
5970 },
5971 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
5972 .type = HDA_FIXUP_PINS,
5973 .v.pins = (const struct hda_pintbl[]) {
5974 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5975 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5976 { }
5977 },
5978 .chained = true,
5979 .chain_id = ALC269_FIXUP_HEADSET_MODE
5980 },
5981 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
5982 .type = HDA_FIXUP_PINS,
5983 .v.pins = (const struct hda_pintbl[]) {
5984 { 0x16, 0x21014020 }, /* dock line out */
5985 { 0x19, 0x21a19030 }, /* dock mic */
5986 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5987 { }
5988 },
5989 .chained = true,
5990 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
5991 },
5992 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
5993 .type = HDA_FIXUP_PINS,
5994 .v.pins = (const struct hda_pintbl[]) {
5995 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5996 { }
5997 },
5998 .chained = true,
5999 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6000 },
6001 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
6002 .type = HDA_FIXUP_PINS,
6003 .v.pins = (const struct hda_pintbl[]) {
6004 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6005 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6006 { }
6007 },
6008 .chained = true,
6009 .chain_id = ALC269_FIXUP_HEADSET_MODE
6010 },
6011 [ALC269_FIXUP_HEADSET_MODE] = {
6012 .type = HDA_FIXUP_FUNC,
6013 .v.func = alc_fixup_headset_mode,
6014 .chained = true,
6015 .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
6016 },
6017 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
6018 .type = HDA_FIXUP_FUNC,
6019 .v.func = alc_fixup_headset_mode_no_hp_mic,
6020 },
6021 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
6022 .type = HDA_FIXUP_PINS,
6023 .v.pins = (const struct hda_pintbl[]) {
6024 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
6025 { }
6026 },
6027 .chained = true,
6028 .chain_id = ALC269_FIXUP_HEADSET_MODE,
6029 },
6030 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
6031 .type = HDA_FIXUP_PINS,
6032 .v.pins = (const struct hda_pintbl[]) {
6033 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6034 { }
6035 },
6036 .chained = true,
6037 .chain_id = ALC269_FIXUP_HEADSET_MIC
6038 },
6039 [ALC256_FIXUP_HUAWEI_MBXP_PINS] = {
6040 .type = HDA_FIXUP_PINS,
6041 .v.pins = (const struct hda_pintbl[]) {
6042 {0x12, 0x90a60130},
6043 {0x13, 0x40000000},
6044 {0x14, 0x90170110},
6045 {0x18, 0x411111f0},
6046 {0x19, 0x04a11040},
6047 {0x1a, 0x411111f0},
6048 {0x1b, 0x90170112},
6049 {0x1d, 0x40759a05},
6050 {0x1e, 0x411111f0},
6051 {0x21, 0x04211020},
6052 { }
6053 },
6054 },
6055 [ALC269_FIXUP_ASUS_X101_FUNC] = {
6056 .type = HDA_FIXUP_FUNC,
6057 .v.func = alc269_fixup_x101_headset_mic,
6058 },
6059 [ALC269_FIXUP_ASUS_X101_VERB] = {
6060 .type = HDA_FIXUP_VERBS,
6061 .v.verbs = (const struct hda_verb[]) {
6062 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6063 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
6064 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
6065 { }
6066 },
6067 .chained = true,
6068 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
6069 },
6070 [ALC269_FIXUP_ASUS_X101] = {
6071 .type = HDA_FIXUP_PINS,
6072 .v.pins = (const struct hda_pintbl[]) {
6073 { 0x18, 0x04a1182c }, /* Headset mic */
6074 { }
6075 },
6076 .chained = true,
6077 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
6078 },
6079 [ALC271_FIXUP_AMIC_MIC2] = {
6080 .type = HDA_FIXUP_PINS,
6081 .v.pins = (const struct hda_pintbl[]) {
6082 { 0x14, 0x99130110 }, /* speaker */
6083 { 0x19, 0x01a19c20 }, /* mic */
6084 { 0x1b, 0x99a7012f }, /* int-mic */
6085 { 0x21, 0x0121401f }, /* HP out */
6086 { }
6087 },
6088 },
6089 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
6090 .type = HDA_FIXUP_FUNC,
6091 .v.func = alc271_hp_gate_mic_jack,
6092 .chained = true,
6093 .chain_id = ALC271_FIXUP_AMIC_MIC2,
6094 },
6095 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
6096 .type = HDA_FIXUP_FUNC,
6097 .v.func = alc269_fixup_limit_int_mic_boost,
6098 .chained = true,
6099 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
6100 },
6101 [ALC269_FIXUP_ACER_AC700] = {
6102 .type = HDA_FIXUP_PINS,
6103 .v.pins = (const struct hda_pintbl[]) {
6104 { 0x12, 0x99a3092f }, /* int-mic */
6105 { 0x14, 0x99130110 }, /* speaker */
6106 { 0x18, 0x03a11c20 }, /* mic */
6107 { 0x1e, 0x0346101e }, /* SPDIF1 */
6108 { 0x21, 0x0321101f }, /* HP out */
6109 { }
6110 },
6111 .chained = true,
6112 .chain_id = ALC271_FIXUP_DMIC,
6113 },
6114 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
6115 .type = HDA_FIXUP_FUNC,
6116 .v.func = alc269_fixup_limit_int_mic_boost,
6117 .chained = true,
6118 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
6119 },
6120 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
6121 .type = HDA_FIXUP_FUNC,
6122 .v.func = alc269_fixup_limit_int_mic_boost,
6123 .chained = true,
6124 .chain_id = ALC269VB_FIXUP_DMIC,
6125 },
6126 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
6127 .type = HDA_FIXUP_VERBS,
6128 .v.verbs = (const struct hda_verb[]) {
6129 /* class-D output amp +5dB */
6130 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
6131 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
6132 {}
6133 },
6134 .chained = true,
6135 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
6136 },
6137 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
6138 .type = HDA_FIXUP_FUNC,
6139 .v.func = alc269_fixup_limit_int_mic_boost,
6140 .chained = true,
6141 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
6142 },
6143 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
6144 .type = HDA_FIXUP_PINS,
6145 .v.pins = (const struct hda_pintbl[]) {
6146 { 0x12, 0x99a3092f }, /* int-mic */
6147 { 0x18, 0x03a11d20 }, /* mic */
6148 { 0x19, 0x411111f0 }, /* Unused bogus pin */
6149 { }
6150 },
6151 },
6152 [ALC283_FIXUP_CHROME_BOOK] = {
6153 .type = HDA_FIXUP_FUNC,
6154 .v.func = alc283_fixup_chromebook,
6155 },
6156 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
6157 .type = HDA_FIXUP_FUNC,
6158 .v.func = alc283_fixup_sense_combo_jack,
6159 .chained = true,
6160 .chain_id = ALC283_FIXUP_CHROME_BOOK,
6161 },
6162 [ALC282_FIXUP_ASUS_TX300] = {
6163 .type = HDA_FIXUP_FUNC,
6164 .v.func = alc282_fixup_asus_tx300,
6165 },
6166 [ALC283_FIXUP_INT_MIC] = {
6167 .type = HDA_FIXUP_VERBS,
6168 .v.verbs = (const struct hda_verb[]) {
6169 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
6170 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
6171 { }
6172 },
6173 .chained = true,
6174 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
6175 },
6176 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
6177 .type = HDA_FIXUP_PINS,
6178 .v.pins = (const struct hda_pintbl[]) {
6179 { 0x17, 0x90170112 }, /* subwoofer */
6180 { }
6181 },
6182 .chained = true,
6183 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6184 },
6185 [ALC290_FIXUP_SUBWOOFER] = {
6186 .type = HDA_FIXUP_PINS,
6187 .v.pins = (const struct hda_pintbl[]) {
6188 { 0x17, 0x90170112 }, /* subwoofer */
6189 { }
6190 },
6191 .chained = true,
6192 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
6193 },
6194 [ALC290_FIXUP_MONO_SPEAKERS] = {
6195 .type = HDA_FIXUP_FUNC,
6196 .v.func = alc290_fixup_mono_speakers,
6197 },
6198 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
6199 .type = HDA_FIXUP_FUNC,
6200 .v.func = alc290_fixup_mono_speakers,
6201 .chained = true,
6202 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
6203 },
6204 [ALC269_FIXUP_THINKPAD_ACPI] = {
6205 .type = HDA_FIXUP_FUNC,
6206 .v.func = alc_fixup_thinkpad_acpi,
6207 .chained = true,
6208 .chain_id = ALC269_FIXUP_SKU_IGNORE,
6209 },
6210 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
6211 .type = HDA_FIXUP_FUNC,
6212 .v.func = alc_fixup_inv_dmic,
6213 .chained = true,
6214 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
6215 },
6216 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
6217 .type = HDA_FIXUP_PINS,
6218 .v.pins = (const struct hda_pintbl[]) {
6219 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6220 { }
6221 },
6222 .chained = true,
6223 .chain_id = ALC255_FIXUP_HEADSET_MODE
6224 },
6225 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
6226 .type = HDA_FIXUP_PINS,
6227 .v.pins = (const struct hda_pintbl[]) {
6228 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6229 { }
6230 },
6231 .chained = true,
6232 .chain_id = ALC255_FIXUP_HEADSET_MODE
6233 },
6234 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6235 .type = HDA_FIXUP_PINS,
6236 .v.pins = (const struct hda_pintbl[]) {
6237 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6238 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6239 { }
6240 },
6241 .chained = true,
6242 .chain_id = ALC255_FIXUP_HEADSET_MODE
6243 },
6244 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
6245 .type = HDA_FIXUP_PINS,
6246 .v.pins = (const struct hda_pintbl[]) {
6247 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6248 { }
6249 },
6250 .chained = true,
6251 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
6252 },
6253 [ALC255_FIXUP_HEADSET_MODE] = {
6254 .type = HDA_FIXUP_FUNC,
6255 .v.func = alc_fixup_headset_mode_alc255,
6256 .chained = true,
6257 .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
6258 },
6259 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
6260 .type = HDA_FIXUP_FUNC,
6261 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
6262 },
6263 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6264 .type = HDA_FIXUP_PINS,
6265 .v.pins = (const struct hda_pintbl[]) {
6266 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6267 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6268 { }
6269 },
6270 .chained = true,
6271 .chain_id = ALC269_FIXUP_HEADSET_MODE
6272 },
6273 [ALC292_FIXUP_TPT440_DOCK] = {
6274 .type = HDA_FIXUP_FUNC,
6275 .v.func = alc_fixup_tpt440_dock,
6276 .chained = true,
6277 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
6278 },
6279 [ALC292_FIXUP_TPT440] = {
6280 .type = HDA_FIXUP_FUNC,
6281 .v.func = alc_fixup_disable_aamix,
6282 .chained = true,
6283 .chain_id = ALC292_FIXUP_TPT440_DOCK,
6284 },
6285 [ALC283_FIXUP_HEADSET_MIC] = {
6286 .type = HDA_FIXUP_PINS,
6287 .v.pins = (const struct hda_pintbl[]) {
6288 { 0x19, 0x04a110f0 },
6289 { },
6290 },
6291 },
6292 [ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED] = {
6293 .type = HDA_FIXUP_FUNC,
6294 .v.func = alc_fixup_dell_wmi,
6295 },
6296 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
6297 .type = HDA_FIXUP_PINS,
6298 .v.pins = (const struct hda_pintbl[]) {
6299 { 0x12, 0x90a60130 },
6300 { 0x14, 0x90170110 },
6301 { 0x17, 0x40000008 },
6302 { 0x18, 0x411111f0 },
6303 { 0x19, 0x01a1913c },
6304 { 0x1a, 0x411111f0 },
6305 { 0x1b, 0x411111f0 },
6306 { 0x1d, 0x40f89b2d },
6307 { 0x1e, 0x411111f0 },
6308 { 0x21, 0x0321101f },
6309 { },
6310 },
6311 },
6312 [ALC280_FIXUP_HP_GPIO4] = {
6313 .type = HDA_FIXUP_FUNC,
6314 .v.func = alc280_fixup_hp_gpio4,
6315 },
6316 [ALC286_FIXUP_HP_GPIO_LED] = {
6317 .type = HDA_FIXUP_FUNC,
6318 .v.func = alc286_fixup_hp_gpio_led,
6319 },
6320 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
6321 .type = HDA_FIXUP_FUNC,
6322 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
6323 },
6324 [ALC280_FIXUP_HP_DOCK_PINS] = {
6325 .type = HDA_FIXUP_PINS,
6326 .v.pins = (const struct hda_pintbl[]) {
6327 { 0x1b, 0x21011020 }, /* line-out */
6328 { 0x1a, 0x01a1903c }, /* headset mic */
6329 { 0x18, 0x2181103f }, /* line-in */
6330 { },
6331 },
6332 .chained = true,
6333 .chain_id = ALC280_FIXUP_HP_GPIO4
6334 },
6335 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
6336 .type = HDA_FIXUP_PINS,
6337 .v.pins = (const struct hda_pintbl[]) {
6338 { 0x1b, 0x21011020 }, /* line-out */
6339 { 0x18, 0x2181103f }, /* line-in */
6340 { },
6341 },
6342 .chained = true,
6343 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
6344 },
6345 [ALC280_FIXUP_HP_9480M] = {
6346 .type = HDA_FIXUP_FUNC,
6347 .v.func = alc280_fixup_hp_9480m,
6348 },
6349 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
6350 .type = HDA_FIXUP_FUNC,
6351 .v.func = alc_fixup_headset_mode_dell_alc288,
6352 .chained = true,
6353 .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
6354 },
6355 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6356 .type = HDA_FIXUP_PINS,
6357 .v.pins = (const struct hda_pintbl[]) {
6358 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6359 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6360 { }
6361 },
6362 .chained = true,
6363 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
6364 },
6365 [ALC288_FIXUP_DELL_XPS_13_GPIO6] = {
6366 .type = HDA_FIXUP_VERBS,
6367 .v.verbs = (const struct hda_verb[]) {
6368 {0x01, AC_VERB_SET_GPIO_MASK, 0x40},
6369 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x40},
6370 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6371 { }
6372 },
6373 .chained = true,
6374 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
6375 },
6376 [ALC288_FIXUP_DISABLE_AAMIX] = {
6377 .type = HDA_FIXUP_FUNC,
6378 .v.func = alc_fixup_disable_aamix,
6379 .chained = true,
6380 .chain_id = ALC288_FIXUP_DELL_XPS_13_GPIO6
6381 },
6382 [ALC288_FIXUP_DELL_XPS_13] = {
6383 .type = HDA_FIXUP_FUNC,
6384 .v.func = alc_fixup_dell_xps13,
6385 .chained = true,
6386 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
6387 },
6388 [ALC292_FIXUP_DISABLE_AAMIX] = {
6389 .type = HDA_FIXUP_FUNC,
6390 .v.func = alc_fixup_disable_aamix,
6391 .chained = true,
6392 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
6393 },
6394 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
6395 .type = HDA_FIXUP_FUNC,
6396 .v.func = alc_fixup_disable_aamix,
6397 .chained = true,
6398 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
6399 },
6400 [ALC292_FIXUP_DELL_E7X] = {
6401 .type = HDA_FIXUP_FUNC,
6402 .v.func = alc_fixup_dell_xps13,
6403 .chained = true,
6404 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
6405 },
6406 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6407 .type = HDA_FIXUP_PINS,
6408 .v.pins = (const struct hda_pintbl[]) {
6409 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6410 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6411 { }
6412 },
6413 .chained = true,
6414 .chain_id = ALC269_FIXUP_HEADSET_MODE
6415 },
6416 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
6417 .type = HDA_FIXUP_PINS,
6418 .v.pins = (const struct hda_pintbl[]) {
6419 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6420 { }
6421 },
6422 .chained = true,
6423 .chain_id = ALC269_FIXUP_HEADSET_MODE
6424 },
6425 [ALC275_FIXUP_DELL_XPS] = {
6426 .type = HDA_FIXUP_VERBS,
6427 .v.verbs = (const struct hda_verb[]) {
6428 /* Enables internal speaker */
6429 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
6430 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
6431 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
6432 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
6433 {}
6434 }
6435 },
6436 [ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE] = {
6437 .type = HDA_FIXUP_VERBS,
6438 .v.verbs = (const struct hda_verb[]) {
6439 /* Disable pass-through path for FRONT 14h */
6440 {0x20, AC_VERB_SET_COEF_INDEX, 0x36},
6441 {0x20, AC_VERB_SET_PROC_COEF, 0x1737},
6442 {}
6443 },
6444 .chained = true,
6445 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6446 },
6447 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
6448 .type = HDA_FIXUP_FUNC,
6449 .v.func = alc_fixup_disable_aamix,
6450 .chained = true,
6451 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
6452 },
6453 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
6454 .type = HDA_FIXUP_FUNC,
6455 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
6456 },
6457 [ALC255_FIXUP_DELL_SPK_NOISE] = {
6458 .type = HDA_FIXUP_FUNC,
6459 .v.func = alc_fixup_disable_aamix,
6460 .chained = true,
6461 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6462 },
6463 [ALC225_FIXUP_DISABLE_MIC_VREF] = {
6464 .type = HDA_FIXUP_FUNC,
6465 .v.func = alc_fixup_disable_mic_vref,
6466 .chained = true,
6467 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
6468 },
6469 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6470 .type = HDA_FIXUP_VERBS,
6471 .v.verbs = (const struct hda_verb[]) {
6472 /* Disable pass-through path for FRONT 14h */
6473 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
6474 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
6475 {}
6476 },
6477 .chained = true,
6478 .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
6479 },
6480 [ALC280_FIXUP_HP_HEADSET_MIC] = {
6481 .type = HDA_FIXUP_FUNC,
6482 .v.func = alc_fixup_disable_aamix,
6483 .chained = true,
6484 .chain_id = ALC269_FIXUP_HEADSET_MIC,
6485 },
6486 [ALC221_FIXUP_HP_FRONT_MIC] = {
6487 .type = HDA_FIXUP_PINS,
6488 .v.pins = (const struct hda_pintbl[]) {
6489 { 0x19, 0x02a19020 }, /* Front Mic */
6490 { }
6491 },
6492 },
6493 [ALC292_FIXUP_TPT460] = {
6494 .type = HDA_FIXUP_FUNC,
6495 .v.func = alc_fixup_tpt440_dock,
6496 .chained = true,
6497 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
6498 },
6499 [ALC298_FIXUP_SPK_VOLUME] = {
6500 .type = HDA_FIXUP_FUNC,
6501 .v.func = alc298_fixup_speaker_volume,
6502 .chained = true,
6503 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
6504 },
6505 [ALC295_FIXUP_DISABLE_DAC3] = {
6506 .type = HDA_FIXUP_FUNC,
6507 .v.func = alc295_fixup_disable_dac3,
6508 },
6509 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
6510 .type = HDA_FIXUP_PINS,
6511 .v.pins = (const struct hda_pintbl[]) {
6512 { 0x1b, 0x90170151 },
6513 { }
6514 },
6515 .chained = true,
6516 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6517 },
6518 [ALC269_FIXUP_ATIV_BOOK_8] = {
6519 .type = HDA_FIXUP_FUNC,
6520 .v.func = alc_fixup_auto_mute_via_amp,
6521 .chained = true,
6522 .chain_id = ALC269_FIXUP_NO_SHUTUP
6523 },
6524 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
6525 .type = HDA_FIXUP_PINS,
6526 .v.pins = (const struct hda_pintbl[]) {
6527 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6528 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6529 { }
6530 },
6531 .chained = true,
6532 .chain_id = ALC269_FIXUP_HEADSET_MODE
6533 },
6534 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
6535 .type = HDA_FIXUP_FUNC,
6536 .v.func = alc_fixup_headset_mode,
6537 },
6538 [ALC256_FIXUP_ASUS_MIC] = {
6539 .type = HDA_FIXUP_PINS,
6540 .v.pins = (const struct hda_pintbl[]) {
6541 { 0x13, 0x90a60160 }, /* use as internal mic */
6542 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
6543 { }
6544 },
6545 .chained = true,
6546 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
6547 },
6548 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
6549 .type = HDA_FIXUP_VERBS,
6550 .v.verbs = (const struct hda_verb[]) {
6551 /* Set up GPIO2 for the speaker amp */
6552 { 0x01, AC_VERB_SET_GPIO_MASK, 0x04 },
6553 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04 },
6554 { 0x01, AC_VERB_SET_GPIO_DATA, 0x04 },
6555 {}
6556 },
6557 },
6558 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
6559 .type = HDA_FIXUP_PINS,
6560 .v.pins = (const struct hda_pintbl[]) {
6561 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6562 { }
6563 },
6564 .chained = true,
6565 .chain_id = ALC269_FIXUP_HEADSET_MIC
6566 },
6567 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
6568 .type = HDA_FIXUP_VERBS,
6569 .v.verbs = (const struct hda_verb[]) {
6570 /* Enables internal speaker */
6571 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
6572 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
6573 {}
6574 },
6575 .chained = true,
6576 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
6577 },
6578 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
6579 .type = HDA_FIXUP_FUNC,
6580 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
6581 },
6582 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
6583 .type = HDA_FIXUP_PINS,
6584 .v.pins = (const struct hda_pintbl[]) {
6585 /* Change the mic location from front to right, otherwise there are
6586 two front mics with the same name, pulseaudio can't handle them.
6587 This is just a temporary workaround, after applying this fixup,
6588 there will be one "Front Mic" and one "Mic" in this machine.
6589 */
6590 { 0x1a, 0x04a19040 },
6591 { }
6592 },
6593 },
6594 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
6595 .type = HDA_FIXUP_PINS,
6596 .v.pins = (const struct hda_pintbl[]) {
6597 { 0x16, 0x0101102f }, /* Rear Headset HP */
6598 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
6599 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
6600 { 0x1b, 0x02011020 },
6601 { }
6602 },
6603 .chained = true,
6604 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6605 },
6606 [ALC700_FIXUP_INTEL_REFERENCE] = {
6607 .type = HDA_FIXUP_VERBS,
6608 .v.verbs = (const struct hda_verb[]) {
6609 /* Enables internal speaker */
6610 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
6611 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
6612 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
6613 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
6614 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
6615 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
6616 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
6617 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
6618 {}
6619 }
6620 },
6621 [ALC274_FIXUP_DELL_BIND_DACS] = {
6622 .type = HDA_FIXUP_FUNC,
6623 .v.func = alc274_fixup_bind_dacs,
6624 .chained = true,
6625 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
6626 },
6627 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
6628 .type = HDA_FIXUP_PINS,
6629 .v.pins = (const struct hda_pintbl[]) {
6630 { 0x1b, 0x0401102f },
6631 { }
6632 },
6633 .chained = true,
6634 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
6635 },
6636 [ALC298_FIXUP_TPT470_DOCK] = {
6637 .type = HDA_FIXUP_FUNC,
6638 .v.func = alc_fixup_tpt470_dock,
6639 .chained = true,
6640 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
6641 },
6642 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
6643 .type = HDA_FIXUP_PINS,
6644 .v.pins = (const struct hda_pintbl[]) {
6645 { 0x14, 0x0201101f },
6646 { }
6647 },
6648 .chained = true,
6649 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6650 },
6651 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
6652 .type = HDA_FIXUP_PINS,
6653 .v.pins = (const struct hda_pintbl[]) {
6654 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6655 { }
6656 },
6657 .chained = true,
6658 .chain_id = ALC269_FIXUP_HEADSET_MIC
6659 },
6660 [ALC221_FIXUP_HP_HEADSET_MIC] = {
6661 .type = HDA_FIXUP_PINS,
6662 .v.pins = (const struct hda_pintbl[]) {
6663 { 0x19, 0x0181313f},
6664 { }
6665 },
6666 .chained = true,
6667 .chain_id = ALC269_FIXUP_HEADSET_MIC
6668 },
6669 [ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
6670 .type = HDA_FIXUP_FUNC,
6671 .v.func = alc285_fixup_invalidate_dacs,
6672 .chained = true,
6673 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
6674 },
6675 [ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
6676 .type = HDA_FIXUP_VERBS,
6677 .v.verbs = (const struct hda_verb[]) {
6678 /* Disable PCBEEP-IN passthrough */
6679 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
6680 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
6681 { }
6682 },
6683 .chained = true,
6684 .chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
6685 },
6686 [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
6687 .type = HDA_FIXUP_PINS,
6688 .v.pins = (const struct hda_pintbl[]) {
6689 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6690 { }
6691 },
6692 .chained = true,
6693 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6694 },
6695 [ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
6696 .type = HDA_FIXUP_PINS,
6697 .v.pins = (const struct hda_pintbl[]) {
6698 { 0x16, 0x01011020 }, /* Rear Line out */
6699 { 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
6700 { }
6701 },
6702 .chained = true,
6703 .chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
6704 },
6705 [ALC225_FIXUP_WYSE_AUTO_MUTE] = {
6706 .type = HDA_FIXUP_FUNC,
6707 .v.func = alc_fixup_auto_mute_via_amp,
6708 .chained = true,
6709 .chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
6710 },
6711 [ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
6712 .type = HDA_FIXUP_FUNC,
6713 .v.func = alc_fixup_disable_mic_vref,
6714 .chained = true,
6715 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6716 },
6717 [ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
6718 .type = HDA_FIXUP_PINS,
6719 .v.pins = (const struct hda_pintbl[]) {
6720 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6721 { }
6722 },
6723 .chained = true,
6724 .chain_id = ALC269_FIXUP_HEADSET_MIC
6725 },
6726 [ALC294_FIXUP_ASUS_MIC] = {
6727 .type = HDA_FIXUP_PINS,
6728 .v.pins = (const struct hda_pintbl[]) {
6729 { 0x13, 0x90a60160 }, /* use as internal mic */
6730 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
6731 { }
6732 },
6733 .chained = true,
6734 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6735 },
6736 [ALC294_FIXUP_ASUS_HEADSET_MIC] = {
6737 .type = HDA_FIXUP_PINS,
6738 .v.pins = (const struct hda_pintbl[]) {
6739 { 0x19, 0x01a1103c }, /* use as headset mic */
6740 { }
6741 },
6742 .chained = true,
6743 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6744 },
6745 [ALC294_FIXUP_ASUS_SPK] = {
6746 .type = HDA_FIXUP_VERBS,
6747 .v.verbs = (const struct hda_verb[]) {
6748 /* Set EAPD high */
6749 { 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
6750 { 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
6751 { }
6752 },
6753 .chained = true,
6754 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
6755 },
6756 [ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
6757 .type = HDA_FIXUP_VERBS,
6758 .v.verbs = (const struct hda_verb[]) {
6759 { 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
6760 { 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
6761 { }
6762 },
6763 .chained = true,
6764 .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
6765 },
6766 [ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
6767 .type = HDA_FIXUP_PINS,
6768 .v.pins = (const struct hda_pintbl[]) {
6769 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
6770 { }
6771 },
6772 .chained = true,
6773 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
6774 },
6775 [ALC299_FIXUP_PREDATOR_SPK] = {
6776 .type = HDA_FIXUP_PINS,
6777 .v.pins = (const struct hda_pintbl[]) {
6778 { 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
6779 { }
6780 }
6781 },
6782 [ALC294_FIXUP_ASUS_INTSPK_HEADSET_MIC] = {
6783 .type = HDA_FIXUP_PINS,
6784 .v.pins = (const struct hda_pintbl[]) {
6785 { 0x14, 0x411111f0 }, /* disable confusing internal speaker */
6786 { 0x19, 0x04a11150 }, /* use as headset mic, without its own jack detect */
6787 { }
6788 },
6789 .chained = true,
6790 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6791 },
6792 [ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
6793 .type = HDA_FIXUP_PINS,
6794 .v.pins = (const struct hda_pintbl[]) {
6795 { 0x19, 0x04a11040 },
6796 { 0x21, 0x04211020 },
6797 { }
6798 },
6799 .chained = true,
6800 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
6801 },
6802 };
6803
6804 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
6805 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
6806 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
6807 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
6808 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
6809 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
6810 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
6811 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
6812 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
6813 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
6814 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
6815 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
6816 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
6817 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
6818 SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
6819 SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
6820 SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
6821 SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
6822 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
6823 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
6824 SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
6825 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
6826 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
6827 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
6828 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
6829 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
6830 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
6831 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
6832 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
6833 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
6834 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
6835 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
6836 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
6837 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
6838 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
6839 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
6840 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6841 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6842 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
6843 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
6844 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
6845 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
6846 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6847 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6848 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6849 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6850 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6851 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6852 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6853 SND_PCI_QUIRK(0x1028, 0x0704, "Dell XPS 13 9350", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
6854 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
6855 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
6856 SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
6857 SND_PCI_QUIRK(0x1028, 0x075b, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
6858 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
6859 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
6860 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
6861 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
6862 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
6863 SND_PCI_QUIRK(0x1028, 0x082a, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
6864 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
6865 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
6866 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
6867 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
6868 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
6869 SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
6870 SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
6871 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
6872 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6873 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6874 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
6875 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
6876 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
6877 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
6878 /* ALC282 */
6879 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6880 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6881 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6882 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6883 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6884 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6885 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6886 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6887 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6888 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6889 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6890 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6891 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
6892 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
6893 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
6894 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6895 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6896 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6897 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6898 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6899 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
6900 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6901 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6902 /* ALC290 */
6903 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6904 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6905 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6906 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6907 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6908 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6909 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6910 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6911 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6912 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
6913 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6914 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6915 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6916 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6917 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6918 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6919 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6920 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6921 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6922 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6923 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6924 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6925 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6926 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6927 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6928 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6929 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6930 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6931 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6932 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
6933 SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
6934 SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
6935 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
6936 SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
6937 SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
6938 SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
6939 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
6940 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
6941 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
6942 SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
6943 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
6944 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
6945 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
6946 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
6947 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
6948 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
6949 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
6950 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
6951 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
6952 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
6953 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
6954 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
6955 SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_INTSPK_HEADSET_MIC),
6956 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
6957 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
6958 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
6959 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
6960 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
6961 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
6962 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
6963 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
6964 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
6965 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
6966 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
6967 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
6968 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
6969 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
6970 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
6971 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
6972 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
6973 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
6974 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
6975 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
6976 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
6977 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
6978 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
6979 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
6980 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
6981 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
6982 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
6983 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
6984 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
6985 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
6986 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
6987 SND_PCI_QUIRK(0x1558, 0x1325, "System76 Darter Pro (darp5)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
6988 SND_PCI_QUIRK(0x1558, 0x8550, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
6989 SND_PCI_QUIRK(0x1558, 0x8551, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
6990 SND_PCI_QUIRK(0x1558, 0x8560, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
6991 SND_PCI_QUIRK(0x1558, 0x8561, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
6992 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
6993 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
6994 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
6995 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
6996 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
6997 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
6998 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK),
6999 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
7000 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
7001 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
7002 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
7003 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
7004 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
7005 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
7006 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
7007 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
7008 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
7009 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
7010 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
7011 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
7012 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
7013 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
7014 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7015 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7016 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
7017 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
7018 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
7019 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7020 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7021 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
7022 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7023 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7024 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7025 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
7026 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
7027 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
7028 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
7029 SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
7030 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
7031 SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
7032 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
7033 SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
7034 SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
7035 SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
7036 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
7037 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
7038 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
7039 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
7040 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
7041 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
7042 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
7043 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
7044 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
7045 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
7046 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
7047 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
7048 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
7049 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
7050 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
7051 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7052 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7053 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7054 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
7055 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7056 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7057 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
7058 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
7059 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MBXP", ALC256_FIXUP_HUAWEI_MBXP_PINS),
7060 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
7061 SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
7062
7063 #if 0
7064 /* Below is a quirk table taken from the old code.
7065 * Basically the device should work as is without the fixup table.
7066 * If BIOS doesn't give a proper info, enable the corresponding
7067 * fixup entry.
7068 */
7069 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
7070 ALC269_FIXUP_AMIC),
7071 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
7072 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
7073 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
7074 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
7075 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
7076 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
7077 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
7078 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
7079 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
7080 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
7081 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
7082 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
7083 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
7084 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
7085 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
7086 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
7087 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
7088 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
7089 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
7090 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
7091 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
7092 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
7093 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
7094 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
7095 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
7096 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
7097 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
7098 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
7099 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
7100 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
7101 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
7102 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
7103 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
7104 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
7105 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
7106 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
7107 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
7108 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
7109 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
7110 #endif
7111 {}
7112 };
7113
7114 static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
7115 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
7116 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
7117 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
7118 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
7119 {}
7120 };
7121
7122 static const struct hda_model_fixup alc269_fixup_models[] = {
7123 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
7124 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
7125 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
7126 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
7127 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
7128 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
7129 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
7130 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
7131 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
7132 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
7133 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
7134 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
7135 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
7136 {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
7137 {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
7138 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
7139 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
7140 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
7141 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
7142 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
7143 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
7144 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
7145 {}
7146 };
7147 #define ALC225_STANDARD_PINS \
7148 {0x21, 0x04211020}
7149
7150 #define ALC256_STANDARD_PINS \
7151 {0x12, 0x90a60140}, \
7152 {0x14, 0x90170110}, \
7153 {0x21, 0x02211020}
7154
7155 #define ALC282_STANDARD_PINS \
7156 {0x14, 0x90170110}
7157
7158 #define ALC290_STANDARD_PINS \
7159 {0x12, 0x99a30130}
7160
7161 #define ALC292_STANDARD_PINS \
7162 {0x14, 0x90170110}, \
7163 {0x15, 0x0221401f}
7164
7165 #define ALC295_STANDARD_PINS \
7166 {0x12, 0xb7a60130}, \
7167 {0x14, 0x90170110}, \
7168 {0x21, 0x04211020}
7169
7170 #define ALC298_STANDARD_PINS \
7171 {0x12, 0x90a60130}, \
7172 {0x21, 0x03211020}
7173
7174 static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
7175 SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
7176 {0x14, 0x01014020},
7177 {0x17, 0x90170110},
7178 {0x18, 0x02a11030},
7179 {0x19, 0x0181303F},
7180 {0x21, 0x0221102f}),
7181 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
7182 {0x12, 0x90a601c0},
7183 {0x14, 0x90171120},
7184 {0x21, 0x02211030}),
7185 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
7186 {0x14, 0x90170110},
7187 {0x1b, 0x90a70130},
7188 {0x21, 0x03211020}),
7189 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
7190 {0x1a, 0x90a70130},
7191 {0x1b, 0x90170110},
7192 {0x21, 0x03211020}),
7193 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7194 ALC225_STANDARD_PINS,
7195 {0x12, 0xb7a60130},
7196 {0x14, 0x901701a0}),
7197 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7198 ALC225_STANDARD_PINS,
7199 {0x12, 0xb7a60130},
7200 {0x14, 0x901701b0}),
7201 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7202 ALC225_STANDARD_PINS,
7203 {0x12, 0xb7a60150},
7204 {0x14, 0x901701a0}),
7205 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7206 ALC225_STANDARD_PINS,
7207 {0x12, 0xb7a60150},
7208 {0x14, 0x901701b0}),
7209 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7210 ALC225_STANDARD_PINS,
7211 {0x12, 0xb7a60130},
7212 {0x1b, 0x90170110}),
7213 SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7214 {0x1b, 0x01111010},
7215 {0x1e, 0x01451130},
7216 {0x21, 0x02211020}),
7217 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
7218 {0x12, 0x90a60140},
7219 {0x14, 0x90170110},
7220 {0x19, 0x02a11030},
7221 {0x21, 0x02211020}),
7222 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
7223 {0x14, 0x90170110},
7224 {0x19, 0x02a11030},
7225 {0x1a, 0x02a11040},
7226 {0x1b, 0x01014020},
7227 {0x21, 0x0221101f}),
7228 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
7229 {0x14, 0x90170110},
7230 {0x19, 0x02a11030},
7231 {0x1a, 0x02a11040},
7232 {0x1b, 0x01011020},
7233 {0x21, 0x0221101f}),
7234 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
7235 {0x14, 0x90170110},
7236 {0x19, 0x02a11020},
7237 {0x1a, 0x02a11030},
7238 {0x21, 0x0221101f}),
7239 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7240 {0x12, 0x90a60140},
7241 {0x14, 0x90170110},
7242 {0x21, 0x02211020}),
7243 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
7244 {0x12, 0x90a60140},
7245 {0x14, 0x90170110},
7246 {0x19, 0x02a11030},
7247 {0x21, 0x02211020}),
7248 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7249 {0x12, 0x90a60140},
7250 {0x14, 0x90170150},
7251 {0x21, 0x02211020}),
7252 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7253 {0x21, 0x02211020}),
7254 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7255 {0x12, 0x40000000},
7256 {0x14, 0x90170110},
7257 {0x21, 0x02211020}),
7258 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
7259 {0x14, 0x90170110},
7260 {0x21, 0x02211020}),
7261 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7262 {0x14, 0x90170130},
7263 {0x21, 0x02211040}),
7264 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7265 {0x12, 0x90a60140},
7266 {0x14, 0x90170110},
7267 {0x21, 0x02211020}),
7268 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7269 {0x12, 0x90a60160},
7270 {0x14, 0x90170120},
7271 {0x21, 0x02211030}),
7272 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7273 {0x14, 0x90170110},
7274 {0x1b, 0x02011020},
7275 {0x21, 0x0221101f}),
7276 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7277 {0x14, 0x90170110},
7278 {0x1b, 0x01011020},
7279 {0x21, 0x0221101f}),
7280 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7281 {0x14, 0x90170130},
7282 {0x1b, 0x01014020},
7283 {0x21, 0x0221103f}),
7284 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7285 {0x14, 0x90170130},
7286 {0x1b, 0x01011020},
7287 {0x21, 0x0221103f}),
7288 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7289 {0x14, 0x90170130},
7290 {0x1b, 0x02011020},
7291 {0x21, 0x0221103f}),
7292 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7293 {0x14, 0x90170150},
7294 {0x1b, 0x02011020},
7295 {0x21, 0x0221105f}),
7296 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7297 {0x14, 0x90170110},
7298 {0x1b, 0x01014020},
7299 {0x21, 0x0221101f}),
7300 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7301 {0x12, 0x90a60160},
7302 {0x14, 0x90170120},
7303 {0x17, 0x90170140},
7304 {0x21, 0x0321102f}),
7305 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7306 {0x12, 0x90a60160},
7307 {0x14, 0x90170130},
7308 {0x21, 0x02211040}),
7309 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7310 {0x12, 0x90a60160},
7311 {0x14, 0x90170140},
7312 {0x21, 0x02211050}),
7313 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7314 {0x12, 0x90a60170},
7315 {0x14, 0x90170120},
7316 {0x21, 0x02211030}),
7317 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7318 {0x12, 0x90a60170},
7319 {0x14, 0x90170130},
7320 {0x21, 0x02211040}),
7321 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7322 {0x12, 0x90a60170},
7323 {0x14, 0x90171130},
7324 {0x21, 0x02211040}),
7325 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7326 {0x12, 0x90a60170},
7327 {0x14, 0x90170140},
7328 {0x21, 0x02211050}),
7329 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7330 {0x12, 0x90a60180},
7331 {0x14, 0x90170130},
7332 {0x21, 0x02211040}),
7333 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7334 {0x12, 0x90a60180},
7335 {0x14, 0x90170120},
7336 {0x21, 0x02211030}),
7337 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7338 {0x1b, 0x01011020},
7339 {0x21, 0x02211010}),
7340 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7341 {0x12, 0x90a60130},
7342 {0x14, 0x90170110},
7343 {0x1b, 0x01011020},
7344 {0x21, 0x0221101f}),
7345 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7346 {0x12, 0x90a60160},
7347 {0x14, 0x90170120},
7348 {0x21, 0x02211030}),
7349 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7350 {0x12, 0x90a60170},
7351 {0x14, 0x90170120},
7352 {0x21, 0x02211030}),
7353 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell Inspiron 5468", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7354 {0x12, 0x90a60180},
7355 {0x14, 0x90170120},
7356 {0x21, 0x02211030}),
7357 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7358 {0x12, 0xb7a60130},
7359 {0x14, 0x90170110},
7360 {0x21, 0x02211020}),
7361 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7362 {0x12, 0x90a60130},
7363 {0x14, 0x90170110},
7364 {0x14, 0x01011020},
7365 {0x21, 0x0221101f}),
7366 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7367 ALC256_STANDARD_PINS),
7368 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7369 {0x14, 0x90170110},
7370 {0x1b, 0x01011020},
7371 {0x21, 0x0221101f}),
7372 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
7373 {0x14, 0x90170110},
7374 {0x1b, 0x90a70130},
7375 {0x21, 0x04211020}),
7376 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
7377 {0x14, 0x90170110},
7378 {0x1b, 0x90a70130},
7379 {0x21, 0x03211020}),
7380 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
7381 {0x12, 0x90a60130},
7382 {0x14, 0x90170110},
7383 {0x21, 0x03211020}),
7384 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
7385 {0x12, 0x90a60130},
7386 {0x14, 0x90170110},
7387 {0x21, 0x04211020}),
7388 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
7389 {0x1a, 0x90a70130},
7390 {0x1b, 0x90170110},
7391 {0x21, 0x03211020}),
7392 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
7393 {0x12, 0xb7a60130},
7394 {0x13, 0xb8a61140},
7395 {0x16, 0x90170110},
7396 {0x21, 0x04211020}),
7397 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
7398 {0x12, 0x90a60130},
7399 {0x14, 0x90170110},
7400 {0x15, 0x0421101f},
7401 {0x1a, 0x04a11020}),
7402 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
7403 {0x12, 0x90a60140},
7404 {0x14, 0x90170110},
7405 {0x15, 0x0421101f},
7406 {0x18, 0x02811030},
7407 {0x1a, 0x04a1103f},
7408 {0x1b, 0x02011020}),
7409 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7410 ALC282_STANDARD_PINS,
7411 {0x12, 0x99a30130},
7412 {0x19, 0x03a11020},
7413 {0x21, 0x0321101f}),
7414 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7415 ALC282_STANDARD_PINS,
7416 {0x12, 0x99a30130},
7417 {0x19, 0x03a11020},
7418 {0x21, 0x03211040}),
7419 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7420 ALC282_STANDARD_PINS,
7421 {0x12, 0x99a30130},
7422 {0x19, 0x03a11030},
7423 {0x21, 0x03211020}),
7424 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7425 ALC282_STANDARD_PINS,
7426 {0x12, 0x99a30130},
7427 {0x19, 0x04a11020},
7428 {0x21, 0x0421101f}),
7429 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
7430 ALC282_STANDARD_PINS,
7431 {0x12, 0x90a60140},
7432 {0x19, 0x04a11030},
7433 {0x21, 0x04211020}),
7434 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7435 ALC282_STANDARD_PINS,
7436 {0x12, 0x90a60130},
7437 {0x21, 0x0321101f}),
7438 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7439 {0x12, 0x90a60160},
7440 {0x14, 0x90170120},
7441 {0x21, 0x02211030}),
7442 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7443 ALC282_STANDARD_PINS,
7444 {0x12, 0x90a60130},
7445 {0x19, 0x03a11020},
7446 {0x21, 0x0321101f}),
7447 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
7448 {0x12, 0x90a60130},
7449 {0x14, 0x90170110},
7450 {0x19, 0x04a11040},
7451 {0x21, 0x04211020}),
7452 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL_XPS_13_GPIO6,
7453 {0x12, 0x90a60120},
7454 {0x14, 0x90170110},
7455 {0x21, 0x0321101f}),
7456 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7457 ALC290_STANDARD_PINS,
7458 {0x15, 0x04211040},
7459 {0x18, 0x90170112},
7460 {0x1a, 0x04a11020}),
7461 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7462 ALC290_STANDARD_PINS,
7463 {0x15, 0x04211040},
7464 {0x18, 0x90170110},
7465 {0x1a, 0x04a11020}),
7466 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7467 ALC290_STANDARD_PINS,
7468 {0x15, 0x0421101f},
7469 {0x1a, 0x04a11020}),
7470 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7471 ALC290_STANDARD_PINS,
7472 {0x15, 0x04211020},
7473 {0x1a, 0x04a11040}),
7474 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7475 ALC290_STANDARD_PINS,
7476 {0x14, 0x90170110},
7477 {0x15, 0x04211020},
7478 {0x1a, 0x04a11040}),
7479 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7480 ALC290_STANDARD_PINS,
7481 {0x14, 0x90170110},
7482 {0x15, 0x04211020},
7483 {0x1a, 0x04a11020}),
7484 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7485 ALC290_STANDARD_PINS,
7486 {0x14, 0x90170110},
7487 {0x15, 0x0421101f},
7488 {0x1a, 0x04a11020}),
7489 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
7490 ALC292_STANDARD_PINS,
7491 {0x12, 0x90a60140},
7492 {0x16, 0x01014020},
7493 {0x19, 0x01a19030}),
7494 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
7495 ALC292_STANDARD_PINS,
7496 {0x12, 0x90a60140},
7497 {0x16, 0x01014020},
7498 {0x18, 0x02a19031},
7499 {0x19, 0x01a1903e}),
7500 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
7501 ALC292_STANDARD_PINS,
7502 {0x12, 0x90a60140}),
7503 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
7504 ALC292_STANDARD_PINS,
7505 {0x13, 0x90a60140},
7506 {0x16, 0x21014020},
7507 {0x19, 0x21a19030}),
7508 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
7509 ALC292_STANDARD_PINS,
7510 {0x13, 0x90a60140}),
7511 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
7512 {0x14, 0x90170110},
7513 {0x1b, 0x90a70130},
7514 {0x21, 0x04211020}),
7515 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
7516 {0x12, 0x90a60130},
7517 {0x17, 0x90170110},
7518 {0x21, 0x03211020}),
7519 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
7520 {0x12, 0x90a60130},
7521 {0x17, 0x90170110},
7522 {0x21, 0x04211020}),
7523 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
7524 {0x12, 0x90a60130},
7525 {0x17, 0x90170110},
7526 {0x21, 0x03211020}),
7527 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
7528 {0x14, 0x90170110},
7529 {0x21, 0x04211020}),
7530 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
7531 {0x14, 0x90170110},
7532 {0x21, 0x04211030}),
7533 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7534 ALC295_STANDARD_PINS,
7535 {0x17, 0x21014020},
7536 {0x18, 0x21a19030}),
7537 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7538 ALC295_STANDARD_PINS,
7539 {0x17, 0x21014040},
7540 {0x18, 0x21a19050}),
7541 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7542 ALC295_STANDARD_PINS),
7543 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7544 ALC298_STANDARD_PINS,
7545 {0x17, 0x90170110}),
7546 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7547 ALC298_STANDARD_PINS,
7548 {0x17, 0x90170140}),
7549 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7550 ALC298_STANDARD_PINS,
7551 {0x17, 0x90170150}),
7552 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
7553 {0x12, 0xb7a60140},
7554 {0x13, 0xb7a60150},
7555 {0x17, 0x90170110},
7556 {0x1a, 0x03011020},
7557 {0x21, 0x03211030}),
7558 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
7559 ALC225_STANDARD_PINS,
7560 {0x12, 0xb7a60130},
7561 {0x17, 0x90170110}),
7562 SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
7563 {0x12, 0x90a60130},
7564 {0x17, 0x90170110},
7565 {0x21, 0x02211020}),
7566 {}
7567 };
7568
7569 /* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
7570 * more machines, don't need to match all valid pins, just need to match
7571 * all the pins defined in the tbl. Just because of this reason, it is possible
7572 * that a single machine matches multiple tbls, so there is one limitation:
7573 * at most one tbl is allowed to define for the same vendor and same codec
7574 */
7575 static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
7576 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
7577 {0x19, 0x40000000},
7578 {0x1b, 0x40000000}),
7579 {}
7580 };
7581
7582 static void alc269_fill_coef(struct hda_codec *codec)
7583 {
7584 struct alc_spec *spec = codec->spec;
7585 int val;
7586
7587 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
7588 return;
7589
7590 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
7591 alc_write_coef_idx(codec, 0xf, 0x960b);
7592 alc_write_coef_idx(codec, 0xe, 0x8817);
7593 }
7594
7595 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
7596 alc_write_coef_idx(codec, 0xf, 0x960b);
7597 alc_write_coef_idx(codec, 0xe, 0x8814);
7598 }
7599
7600 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
7601 /* Power up output pin */
7602 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
7603 }
7604
7605 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
7606 val = alc_read_coef_idx(codec, 0xd);
7607 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
7608 /* Capless ramp up clock control */
7609 alc_write_coef_idx(codec, 0xd, val | (1<<10));
7610 }
7611 val = alc_read_coef_idx(codec, 0x17);
7612 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
7613 /* Class D power on reset */
7614 alc_write_coef_idx(codec, 0x17, val | (1<<7));
7615 }
7616 }
7617
7618 /* HP */
7619 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
7620 }
7621
7622 /*
7623 */
7624 static int patch_alc269(struct hda_codec *codec)
7625 {
7626 struct alc_spec *spec;
7627 int err;
7628
7629 err = alc_alloc_spec(codec, 0x0b);
7630 if (err < 0)
7631 return err;
7632
7633 spec = codec->spec;
7634 spec->gen.shared_mic_vref_pin = 0x18;
7635 codec->power_save_node = 0;
7636
7637 #ifdef CONFIG_PM
7638 codec->patch_ops.suspend = alc269_suspend;
7639 codec->patch_ops.resume = alc269_resume;
7640 #endif
7641 spec->shutup = alc_default_shutup;
7642 spec->init_hook = alc_default_init;
7643
7644 snd_hda_pick_fixup(codec, alc269_fixup_models,
7645 alc269_fixup_tbl, alc269_fixups);
7646 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
7647 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
7648 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
7649 alc269_fixups);
7650 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
7651
7652 alc_auto_parse_customize_define(codec);
7653
7654 if (has_cdefine_beep(codec))
7655 spec->gen.beep_nid = 0x01;
7656
7657 switch (codec->core.vendor_id) {
7658 case 0x10ec0269:
7659 spec->codec_variant = ALC269_TYPE_ALC269VA;
7660 switch (alc_get_coef0(codec) & 0x00f0) {
7661 case 0x0010:
7662 if (codec->bus->pci &&
7663 codec->bus->pci->subsystem_vendor == 0x1025 &&
7664 spec->cdefine.platform_type == 1)
7665 err = alc_codec_rename(codec, "ALC271X");
7666 spec->codec_variant = ALC269_TYPE_ALC269VB;
7667 break;
7668 case 0x0020:
7669 if (codec->bus->pci &&
7670 codec->bus->pci->subsystem_vendor == 0x17aa &&
7671 codec->bus->pci->subsystem_device == 0x21f3)
7672 err = alc_codec_rename(codec, "ALC3202");
7673 spec->codec_variant = ALC269_TYPE_ALC269VC;
7674 break;
7675 case 0x0030:
7676 spec->codec_variant = ALC269_TYPE_ALC269VD;
7677 break;
7678 default:
7679 alc_fix_pll_init(codec, 0x20, 0x04, 15);
7680 }
7681 if (err < 0)
7682 goto error;
7683 spec->shutup = alc269_shutup;
7684 spec->init_hook = alc269_fill_coef;
7685 alc269_fill_coef(codec);
7686 break;
7687
7688 case 0x10ec0280:
7689 case 0x10ec0290:
7690 spec->codec_variant = ALC269_TYPE_ALC280;
7691 break;
7692 case 0x10ec0282:
7693 spec->codec_variant = ALC269_TYPE_ALC282;
7694 spec->shutup = alc282_shutup;
7695 spec->init_hook = alc282_init;
7696 break;
7697 case 0x10ec0233:
7698 case 0x10ec0283:
7699 spec->codec_variant = ALC269_TYPE_ALC283;
7700 spec->shutup = alc283_shutup;
7701 spec->init_hook = alc283_init;
7702 break;
7703 case 0x10ec0284:
7704 case 0x10ec0292:
7705 spec->codec_variant = ALC269_TYPE_ALC284;
7706 break;
7707 case 0x10ec0293:
7708 spec->codec_variant = ALC269_TYPE_ALC293;
7709 break;
7710 case 0x10ec0286:
7711 case 0x10ec0288:
7712 spec->codec_variant = ALC269_TYPE_ALC286;
7713 break;
7714 case 0x10ec0298:
7715 spec->codec_variant = ALC269_TYPE_ALC298;
7716 break;
7717 case 0x10ec0235:
7718 case 0x10ec0255:
7719 spec->codec_variant = ALC269_TYPE_ALC255;
7720 spec->shutup = alc256_shutup;
7721 spec->init_hook = alc256_init;
7722 break;
7723 case 0x10ec0236:
7724 case 0x10ec0256:
7725 spec->codec_variant = ALC269_TYPE_ALC256;
7726 spec->shutup = alc256_shutup;
7727 spec->init_hook = alc256_init;
7728 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
7729 break;
7730 case 0x10ec0257:
7731 spec->codec_variant = ALC269_TYPE_ALC257;
7732 spec->shutup = alc256_shutup;
7733 spec->init_hook = alc256_init;
7734 spec->gen.mixer_nid = 0;
7735 break;
7736 case 0x10ec0215:
7737 case 0x10ec0285:
7738 case 0x10ec0289:
7739 spec->codec_variant = ALC269_TYPE_ALC215;
7740 spec->gen.mixer_nid = 0;
7741 break;
7742 case 0x10ec0225:
7743 case 0x10ec0295:
7744 spec->codec_variant = ALC269_TYPE_ALC225;
7745 spec->gen.mixer_nid = 0; /* no loopback on ALC225 ALC295 */
7746 break;
7747 case 0x10ec0299:
7748 spec->codec_variant = ALC269_TYPE_ALC225;
7749 spec->shutup = alc225_shutup;
7750 spec->init_hook = alc225_init;
7751 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
7752 break;
7753 case 0x10ec0234:
7754 case 0x10ec0274:
7755 case 0x10ec0294:
7756 spec->codec_variant = ALC269_TYPE_ALC294;
7757 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
7758 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
7759 spec->init_hook = alc294_init;
7760 break;
7761 case 0x10ec0300:
7762 spec->codec_variant = ALC269_TYPE_ALC300;
7763 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
7764 break;
7765 case 0x10ec0623:
7766 spec->codec_variant = ALC269_TYPE_ALC623;
7767 break;
7768 case 0x10ec0700:
7769 case 0x10ec0701:
7770 case 0x10ec0703:
7771 case 0x10ec0711:
7772 spec->codec_variant = ALC269_TYPE_ALC700;
7773 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
7774 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
7775 spec->init_hook = alc294_init;
7776 break;
7777
7778 }
7779
7780 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
7781 spec->has_alc5505_dsp = 1;
7782 spec->init_hook = alc5505_dsp_init;
7783 }
7784
7785 /* automatic parse from the BIOS config */
7786 err = alc269_parse_auto_config(codec);
7787 if (err < 0)
7788 goto error;
7789
7790 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid)
7791 set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
7792
7793 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
7794
7795 return 0;
7796
7797 error:
7798 alc_free(codec);
7799 return err;
7800 }
7801
7802 /*
7803 * ALC861
7804 */
7805
7806 static int alc861_parse_auto_config(struct hda_codec *codec)
7807 {
7808 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
7809 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
7810 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
7811 }
7812
7813 /* Pin config fixes */
7814 enum {
7815 ALC861_FIXUP_FSC_AMILO_PI1505,
7816 ALC861_FIXUP_AMP_VREF_0F,
7817 ALC861_FIXUP_NO_JACK_DETECT,
7818 ALC861_FIXUP_ASUS_A6RP,
7819 ALC660_FIXUP_ASUS_W7J,
7820 };
7821
7822 /* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
7823 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
7824 const struct hda_fixup *fix, int action)
7825 {
7826 struct alc_spec *spec = codec->spec;
7827 unsigned int val;
7828
7829 if (action != HDA_FIXUP_ACT_INIT)
7830 return;
7831 val = snd_hda_codec_get_pin_target(codec, 0x0f);
7832 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
7833 val |= AC_PINCTL_IN_EN;
7834 val |= AC_PINCTL_VREF_50;
7835 snd_hda_set_pin_ctl(codec, 0x0f, val);
7836 spec->gen.keep_vref_in_automute = 1;
7837 }
7838
7839 /* suppress the jack-detection */
7840 static void alc_fixup_no_jack_detect(struct hda_codec *codec,
7841 const struct hda_fixup *fix, int action)
7842 {
7843 if (action == HDA_FIXUP_ACT_PRE_PROBE)
7844 codec->no_jack_detect = 1;
7845 }
7846
7847 static const struct hda_fixup alc861_fixups[] = {
7848 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
7849 .type = HDA_FIXUP_PINS,
7850 .v.pins = (const struct hda_pintbl[]) {
7851 { 0x0b, 0x0221101f }, /* HP */
7852 { 0x0f, 0x90170310 }, /* speaker */
7853 { }
7854 }
7855 },
7856 [ALC861_FIXUP_AMP_VREF_0F] = {
7857 .type = HDA_FIXUP_FUNC,
7858 .v.func = alc861_fixup_asus_amp_vref_0f,
7859 },
7860 [ALC861_FIXUP_NO_JACK_DETECT] = {
7861 .type = HDA_FIXUP_FUNC,
7862 .v.func = alc_fixup_no_jack_detect,
7863 },
7864 [ALC861_FIXUP_ASUS_A6RP] = {
7865 .type = HDA_FIXUP_FUNC,
7866 .v.func = alc861_fixup_asus_amp_vref_0f,
7867 .chained = true,
7868 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
7869 },
7870 [ALC660_FIXUP_ASUS_W7J] = {
7871 .type = HDA_FIXUP_VERBS,
7872 .v.verbs = (const struct hda_verb[]) {
7873 /* ASUS W7J needs a magic pin setup on unused NID 0x10
7874 * for enabling outputs
7875 */
7876 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
7877 { }
7878 },
7879 }
7880 };
7881
7882 static const struct snd_pci_quirk alc861_fixup_tbl[] = {
7883 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
7884 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
7885 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
7886 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
7887 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
7888 SND_PCI_QUIRK(0x1584, 0x2b01, "Haier W18", ALC861_FIXUP_AMP_VREF_0F),
7889 SND_PCI_QUIRK(0x1584, 0x0000, "Uniwill ECS M31EI", ALC861_FIXUP_AMP_VREF_0F),
7890 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
7891 {}
7892 };
7893
7894 /*
7895 */
7896 static int patch_alc861(struct hda_codec *codec)
7897 {
7898 struct alc_spec *spec;
7899 int err;
7900
7901 err = alc_alloc_spec(codec, 0x15);
7902 if (err < 0)
7903 return err;
7904
7905 spec = codec->spec;
7906 spec->gen.beep_nid = 0x23;
7907
7908 #ifdef CONFIG_PM
7909 spec->power_hook = alc_power_eapd;
7910 #endif
7911
7912 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
7913 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
7914
7915 /* automatic parse from the BIOS config */
7916 err = alc861_parse_auto_config(codec);
7917 if (err < 0)
7918 goto error;
7919
7920 if (!spec->gen.no_analog)
7921 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
7922
7923 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
7924
7925 return 0;
7926
7927 error:
7928 alc_free(codec);
7929 return err;
7930 }
7931
7932 /*
7933 * ALC861-VD support
7934 *
7935 * Based on ALC882
7936 *
7937 * In addition, an independent DAC
7938 */
7939 static int alc861vd_parse_auto_config(struct hda_codec *codec)
7940 {
7941 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
7942 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
7943 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
7944 }
7945
7946 enum {
7947 ALC660VD_FIX_ASUS_GPIO1,
7948 ALC861VD_FIX_DALLAS,
7949 };
7950
7951 /* exclude VREF80 */
7952 static void alc861vd_fixup_dallas(struct hda_codec *codec,
7953 const struct hda_fixup *fix, int action)
7954 {
7955 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
7956 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
7957 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
7958 }
7959 }
7960
7961 static const struct hda_fixup alc861vd_fixups[] = {
7962 [ALC660VD_FIX_ASUS_GPIO1] = {
7963 .type = HDA_FIXUP_VERBS,
7964 .v.verbs = (const struct hda_verb[]) {
7965 /* reset GPIO1 */
7966 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
7967 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
7968 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
7969 { }
7970 }
7971 },
7972 [ALC861VD_FIX_DALLAS] = {
7973 .type = HDA_FIXUP_FUNC,
7974 .v.func = alc861vd_fixup_dallas,
7975 },
7976 };
7977
7978 static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
7979 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
7980 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
7981 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
7982 {}
7983 };
7984
7985 /*
7986 */
7987 static int patch_alc861vd(struct hda_codec *codec)
7988 {
7989 struct alc_spec *spec;
7990 int err;
7991
7992 err = alc_alloc_spec(codec, 0x0b);
7993 if (err < 0)
7994 return err;
7995
7996 spec = codec->spec;
7997 spec->gen.beep_nid = 0x23;
7998
7999 spec->shutup = alc_eapd_shutup;
8000
8001 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
8002 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
8003
8004 /* automatic parse from the BIOS config */
8005 err = alc861vd_parse_auto_config(codec);
8006 if (err < 0)
8007 goto error;
8008
8009 if (!spec->gen.no_analog)
8010 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
8011
8012 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
8013
8014 return 0;
8015
8016 error:
8017 alc_free(codec);
8018 return err;
8019 }
8020
8021 /*
8022 * ALC662 support
8023 *
8024 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
8025 * configuration. Each pin widget can choose any input DACs and a mixer.
8026 * Each ADC is connected from a mixer of all inputs. This makes possible
8027 * 6-channel independent captures.
8028 *
8029 * In addition, an independent DAC for the multi-playback (not used in this
8030 * driver yet).
8031 */
8032
8033 /*
8034 * BIOS auto configuration
8035 */
8036
8037 static int alc662_parse_auto_config(struct hda_codec *codec)
8038 {
8039 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
8040 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
8041 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
8042 const hda_nid_t *ssids;
8043
8044 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
8045 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
8046 codec->core.vendor_id == 0x10ec0671)
8047 ssids = alc663_ssids;
8048 else
8049 ssids = alc662_ssids;
8050 return alc_parse_auto_config(codec, alc662_ignore, ssids);
8051 }
8052
8053 static void alc272_fixup_mario(struct hda_codec *codec,
8054 const struct hda_fixup *fix, int action)
8055 {
8056 if (action != HDA_FIXUP_ACT_PRE_PROBE)
8057 return;
8058 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
8059 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
8060 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
8061 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
8062 (0 << AC_AMPCAP_MUTE_SHIFT)))
8063 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
8064 }
8065
8066 static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
8067 { .channels = 2,
8068 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
8069 { .channels = 4,
8070 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
8071 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
8072 { }
8073 };
8074
8075 /* override the 2.1 chmap */
8076 static void alc_fixup_bass_chmap(struct hda_codec *codec,
8077 const struct hda_fixup *fix, int action)
8078 {
8079 if (action == HDA_FIXUP_ACT_BUILD) {
8080 struct alc_spec *spec = codec->spec;
8081 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
8082 }
8083 }
8084
8085 /* avoid D3 for keeping GPIO up */
8086 static unsigned int gpio_led_power_filter(struct hda_codec *codec,
8087 hda_nid_t nid,
8088 unsigned int power_state)
8089 {
8090 struct alc_spec *spec = codec->spec;
8091 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_led)
8092 return AC_PWRST_D0;
8093 return power_state;
8094 }
8095
8096 static void alc662_fixup_led_gpio1(struct hda_codec *codec,
8097 const struct hda_fixup *fix, int action)
8098 {
8099 struct alc_spec *spec = codec->spec;
8100 static const struct hda_verb gpio_init[] = {
8101 { 0x01, AC_VERB_SET_GPIO_MASK, 0x01 },
8102 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01 },
8103 {}
8104 };
8105
8106 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
8107 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
8108 spec->gpio_led = 0;
8109 spec->mute_led_polarity = 1;
8110 spec->gpio_mute_led_mask = 0x01;
8111 snd_hda_add_verbs(codec, gpio_init);
8112 codec->power_filter = gpio_led_power_filter;
8113 }
8114 }
8115
8116 static void alc662_usi_automute_hook(struct hda_codec *codec,
8117 struct hda_jack_callback *jack)
8118 {
8119 struct alc_spec *spec = codec->spec;
8120 int vref;
8121 msleep(200);
8122 snd_hda_gen_hp_automute(codec, jack);
8123
8124 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
8125 msleep(100);
8126 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8127 vref);
8128 }
8129
8130 static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
8131 const struct hda_fixup *fix, int action)
8132 {
8133 struct alc_spec *spec = codec->spec;
8134 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
8135 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
8136 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
8137 }
8138 }
8139
8140 static struct coef_fw alc668_coefs[] = {
8141 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
8142 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
8143 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
8144 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
8145 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
8146 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
8147 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
8148 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
8149 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
8150 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
8151 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
8152 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
8153 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
8154 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
8155 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
8156 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
8157 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
8158 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
8159 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
8160 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
8161 {}
8162 };
8163
8164 static void alc668_restore_default_value(struct hda_codec *codec)
8165 {
8166 alc_process_coef_fw(codec, alc668_coefs);
8167 }
8168
8169 enum {
8170 ALC662_FIXUP_ASPIRE,
8171 ALC662_FIXUP_LED_GPIO1,
8172 ALC662_FIXUP_IDEAPAD,
8173 ALC272_FIXUP_MARIO,
8174 ALC662_FIXUP_CZC_P10T,
8175 ALC662_FIXUP_SKU_IGNORE,
8176 ALC662_FIXUP_HP_RP5800,
8177 ALC662_FIXUP_ASUS_MODE1,
8178 ALC662_FIXUP_ASUS_MODE2,
8179 ALC662_FIXUP_ASUS_MODE3,
8180 ALC662_FIXUP_ASUS_MODE4,
8181 ALC662_FIXUP_ASUS_MODE5,
8182 ALC662_FIXUP_ASUS_MODE6,
8183 ALC662_FIXUP_ASUS_MODE7,
8184 ALC662_FIXUP_ASUS_MODE8,
8185 ALC662_FIXUP_NO_JACK_DETECT,
8186 ALC662_FIXUP_ZOTAC_Z68,
8187 ALC662_FIXUP_INV_DMIC,
8188 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
8189 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
8190 ALC662_FIXUP_HEADSET_MODE,
8191 ALC668_FIXUP_HEADSET_MODE,
8192 ALC662_FIXUP_BASS_MODE4_CHMAP,
8193 ALC662_FIXUP_BASS_16,
8194 ALC662_FIXUP_BASS_1A,
8195 ALC662_FIXUP_BASS_CHMAP,
8196 ALC668_FIXUP_AUTO_MUTE,
8197 ALC668_FIXUP_DELL_DISABLE_AAMIX,
8198 ALC668_FIXUP_DELL_XPS13,
8199 ALC662_FIXUP_ASUS_Nx50,
8200 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
8201 ALC668_FIXUP_ASUS_Nx51,
8202 ALC668_FIXUP_MIC_COEF,
8203 ALC668_FIXUP_ASUS_G751,
8204 ALC891_FIXUP_HEADSET_MODE,
8205 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
8206 ALC662_FIXUP_ACER_VERITON,
8207 ALC892_FIXUP_ASROCK_MOBO,
8208 ALC662_FIXUP_USI_FUNC,
8209 ALC662_FIXUP_USI_HEADSET_MODE,
8210 ALC662_FIXUP_LENOVO_MULTI_CODECS,
8211 };
8212
8213 static const struct hda_fixup alc662_fixups[] = {
8214 [ALC662_FIXUP_ASPIRE] = {
8215 .type = HDA_FIXUP_PINS,
8216 .v.pins = (const struct hda_pintbl[]) {
8217 { 0x15, 0x99130112 }, /* subwoofer */
8218 { }
8219 }
8220 },
8221 [ALC662_FIXUP_LED_GPIO1] = {
8222 .type = HDA_FIXUP_FUNC,
8223 .v.func = alc662_fixup_led_gpio1,
8224 },
8225 [ALC662_FIXUP_IDEAPAD] = {
8226 .type = HDA_FIXUP_PINS,
8227 .v.pins = (const struct hda_pintbl[]) {
8228 { 0x17, 0x99130112 }, /* subwoofer */
8229 { }
8230 },
8231 .chained = true,
8232 .chain_id = ALC662_FIXUP_LED_GPIO1,
8233 },
8234 [ALC272_FIXUP_MARIO] = {
8235 .type = HDA_FIXUP_FUNC,
8236 .v.func = alc272_fixup_mario,
8237 },
8238 [ALC662_FIXUP_CZC_P10T] = {
8239 .type = HDA_FIXUP_VERBS,
8240 .v.verbs = (const struct hda_verb[]) {
8241 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
8242 {}
8243 }
8244 },
8245 [ALC662_FIXUP_SKU_IGNORE] = {
8246 .type = HDA_FIXUP_FUNC,
8247 .v.func = alc_fixup_sku_ignore,
8248 },
8249 [ALC662_FIXUP_HP_RP5800] = {
8250 .type = HDA_FIXUP_PINS,
8251 .v.pins = (const struct hda_pintbl[]) {
8252 { 0x14, 0x0221201f }, /* HP out */
8253 { }
8254 },
8255 .chained = true,
8256 .chain_id = ALC662_FIXUP_SKU_IGNORE
8257 },
8258 [ALC662_FIXUP_ASUS_MODE1] = {
8259 .type = HDA_FIXUP_PINS,
8260 .v.pins = (const struct hda_pintbl[]) {
8261 { 0x14, 0x99130110 }, /* speaker */
8262 { 0x18, 0x01a19c20 }, /* mic */
8263 { 0x19, 0x99a3092f }, /* int-mic */
8264 { 0x21, 0x0121401f }, /* HP out */
8265 { }
8266 },
8267 .chained = true,
8268 .chain_id = ALC662_FIXUP_SKU_IGNORE
8269 },
8270 [ALC662_FIXUP_ASUS_MODE2] = {
8271 .type = HDA_FIXUP_PINS,
8272 .v.pins = (const struct hda_pintbl[]) {
8273 { 0x14, 0x99130110 }, /* speaker */
8274 { 0x18, 0x01a19820 }, /* mic */
8275 { 0x19, 0x99a3092f }, /* int-mic */
8276 { 0x1b, 0x0121401f }, /* HP out */
8277 { }
8278 },
8279 .chained = true,
8280 .chain_id = ALC662_FIXUP_SKU_IGNORE
8281 },
8282 [ALC662_FIXUP_ASUS_MODE3] = {
8283 .type = HDA_FIXUP_PINS,
8284 .v.pins = (const struct hda_pintbl[]) {
8285 { 0x14, 0x99130110 }, /* speaker */
8286 { 0x15, 0x0121441f }, /* HP */
8287 { 0x18, 0x01a19840 }, /* mic */
8288 { 0x19, 0x99a3094f }, /* int-mic */
8289 { 0x21, 0x01211420 }, /* HP2 */
8290 { }
8291 },
8292 .chained = true,
8293 .chain_id = ALC662_FIXUP_SKU_IGNORE
8294 },
8295 [ALC662_FIXUP_ASUS_MODE4] = {
8296 .type = HDA_FIXUP_PINS,
8297 .v.pins = (const struct hda_pintbl[]) {
8298 { 0x14, 0x99130110 }, /* speaker */
8299 { 0x16, 0x99130111 }, /* speaker */
8300 { 0x18, 0x01a19840 }, /* mic */
8301 { 0x19, 0x99a3094f }, /* int-mic */
8302 { 0x21, 0x0121441f }, /* HP */
8303 { }
8304 },
8305 .chained = true,
8306 .chain_id = ALC662_FIXUP_SKU_IGNORE
8307 },
8308 [ALC662_FIXUP_ASUS_MODE5] = {
8309 .type = HDA_FIXUP_PINS,
8310 .v.pins = (const struct hda_pintbl[]) {
8311 { 0x14, 0x99130110 }, /* speaker */
8312 { 0x15, 0x0121441f }, /* HP */
8313 { 0x16, 0x99130111 }, /* speaker */
8314 { 0x18, 0x01a19840 }, /* mic */
8315 { 0x19, 0x99a3094f }, /* int-mic */
8316 { }
8317 },
8318 .chained = true,
8319 .chain_id = ALC662_FIXUP_SKU_IGNORE
8320 },
8321 [ALC662_FIXUP_ASUS_MODE6] = {
8322 .type = HDA_FIXUP_PINS,
8323 .v.pins = (const struct hda_pintbl[]) {
8324 { 0x14, 0x99130110 }, /* speaker */
8325 { 0x15, 0x01211420 }, /* HP2 */
8326 { 0x18, 0x01a19840 }, /* mic */
8327 { 0x19, 0x99a3094f }, /* int-mic */
8328 { 0x1b, 0x0121441f }, /* HP */
8329 { }
8330 },
8331 .chained = true,
8332 .chain_id = ALC662_FIXUP_SKU_IGNORE
8333 },
8334 [ALC662_FIXUP_ASUS_MODE7] = {
8335 .type = HDA_FIXUP_PINS,
8336 .v.pins = (const struct hda_pintbl[]) {
8337 { 0x14, 0x99130110 }, /* speaker */
8338 { 0x17, 0x99130111 }, /* speaker */
8339 { 0x18, 0x01a19840 }, /* mic */
8340 { 0x19, 0x99a3094f }, /* int-mic */
8341 { 0x1b, 0x01214020 }, /* HP */
8342 { 0x21, 0x0121401f }, /* HP */
8343 { }
8344 },
8345 .chained = true,
8346 .chain_id = ALC662_FIXUP_SKU_IGNORE
8347 },
8348 [ALC662_FIXUP_ASUS_MODE8] = {
8349 .type = HDA_FIXUP_PINS,
8350 .v.pins = (const struct hda_pintbl[]) {
8351 { 0x14, 0x99130110 }, /* speaker */
8352 { 0x12, 0x99a30970 }, /* int-mic */
8353 { 0x15, 0x01214020 }, /* HP */
8354 { 0x17, 0x99130111 }, /* speaker */
8355 { 0x18, 0x01a19840 }, /* mic */
8356 { 0x21, 0x0121401f }, /* HP */
8357 { }
8358 },
8359 .chained = true,
8360 .chain_id = ALC662_FIXUP_SKU_IGNORE
8361 },
8362 [ALC662_FIXUP_NO_JACK_DETECT] = {
8363 .type = HDA_FIXUP_FUNC,
8364 .v.func = alc_fixup_no_jack_detect,
8365 },
8366 [ALC662_FIXUP_ZOTAC_Z68] = {
8367 .type = HDA_FIXUP_PINS,
8368 .v.pins = (const struct hda_pintbl[]) {
8369 { 0x1b, 0x02214020 }, /* Front HP */
8370 { }
8371 }
8372 },
8373 [ALC662_FIXUP_INV_DMIC] = {
8374 .type = HDA_FIXUP_FUNC,
8375 .v.func = alc_fixup_inv_dmic,
8376 },
8377 [ALC668_FIXUP_DELL_XPS13] = {
8378 .type = HDA_FIXUP_FUNC,
8379 .v.func = alc_fixup_dell_xps13,
8380 .chained = true,
8381 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
8382 },
8383 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
8384 .type = HDA_FIXUP_FUNC,
8385 .v.func = alc_fixup_disable_aamix,
8386 .chained = true,
8387 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
8388 },
8389 [ALC668_FIXUP_AUTO_MUTE] = {
8390 .type = HDA_FIXUP_FUNC,
8391 .v.func = alc_fixup_auto_mute_via_amp,
8392 .chained = true,
8393 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
8394 },
8395 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
8396 .type = HDA_FIXUP_PINS,
8397 .v.pins = (const struct hda_pintbl[]) {
8398 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
8399 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
8400 { }
8401 },
8402 .chained = true,
8403 .chain_id = ALC662_FIXUP_HEADSET_MODE
8404 },
8405 [ALC662_FIXUP_HEADSET_MODE] = {
8406 .type = HDA_FIXUP_FUNC,
8407 .v.func = alc_fixup_headset_mode_alc662,
8408 },
8409 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
8410 .type = HDA_FIXUP_PINS,
8411 .v.pins = (const struct hda_pintbl[]) {
8412 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
8413 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
8414 { }
8415 },
8416 .chained = true,
8417 .chain_id = ALC668_FIXUP_HEADSET_MODE
8418 },
8419 [ALC668_FIXUP_HEADSET_MODE] = {
8420 .type = HDA_FIXUP_FUNC,
8421 .v.func = alc_fixup_headset_mode_alc668,
8422 },
8423 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
8424 .type = HDA_FIXUP_FUNC,
8425 .v.func = alc_fixup_bass_chmap,
8426 .chained = true,
8427 .chain_id = ALC662_FIXUP_ASUS_MODE4
8428 },
8429 [ALC662_FIXUP_BASS_16] = {
8430 .type = HDA_FIXUP_PINS,
8431 .v.pins = (const struct hda_pintbl[]) {
8432 {0x16, 0x80106111}, /* bass speaker */
8433 {}
8434 },
8435 .chained = true,
8436 .chain_id = ALC662_FIXUP_BASS_CHMAP,
8437 },
8438 [ALC662_FIXUP_BASS_1A] = {
8439 .type = HDA_FIXUP_PINS,
8440 .v.pins = (const struct hda_pintbl[]) {
8441 {0x1a, 0x80106111}, /* bass speaker */
8442 {}
8443 },
8444 .chained = true,
8445 .chain_id = ALC662_FIXUP_BASS_CHMAP,
8446 },
8447 [ALC662_FIXUP_BASS_CHMAP] = {
8448 .type = HDA_FIXUP_FUNC,
8449 .v.func = alc_fixup_bass_chmap,
8450 },
8451 [ALC662_FIXUP_ASUS_Nx50] = {
8452 .type = HDA_FIXUP_FUNC,
8453 .v.func = alc_fixup_auto_mute_via_amp,
8454 .chained = true,
8455 .chain_id = ALC662_FIXUP_BASS_1A
8456 },
8457 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
8458 .type = HDA_FIXUP_FUNC,
8459 .v.func = alc_fixup_headset_mode_alc668,
8460 .chain_id = ALC662_FIXUP_BASS_CHMAP
8461 },
8462 [ALC668_FIXUP_ASUS_Nx51] = {
8463 .type = HDA_FIXUP_PINS,
8464 .v.pins = (const struct hda_pintbl[]) {
8465 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
8466 { 0x1a, 0x90170151 }, /* bass speaker */
8467 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
8468 {}
8469 },
8470 .chained = true,
8471 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
8472 },
8473 [ALC668_FIXUP_MIC_COEF] = {
8474 .type = HDA_FIXUP_VERBS,
8475 .v.verbs = (const struct hda_verb[]) {
8476 { 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
8477 { 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
8478 {}
8479 },
8480 },
8481 [ALC668_FIXUP_ASUS_G751] = {
8482 .type = HDA_FIXUP_PINS,
8483 .v.pins = (const struct hda_pintbl[]) {
8484 { 0x16, 0x0421101f }, /* HP */
8485 {}
8486 },
8487 .chained = true,
8488 .chain_id = ALC668_FIXUP_MIC_COEF
8489 },
8490 [ALC891_FIXUP_HEADSET_MODE] = {
8491 .type = HDA_FIXUP_FUNC,
8492 .v.func = alc_fixup_headset_mode,
8493 },
8494 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
8495 .type = HDA_FIXUP_PINS,
8496 .v.pins = (const struct hda_pintbl[]) {
8497 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
8498 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
8499 { }
8500 },
8501 .chained = true,
8502 .chain_id = ALC891_FIXUP_HEADSET_MODE
8503 },
8504 [ALC662_FIXUP_ACER_VERITON] = {
8505 .type = HDA_FIXUP_PINS,
8506 .v.pins = (const struct hda_pintbl[]) {
8507 { 0x15, 0x50170120 }, /* no internal speaker */
8508 { }
8509 }
8510 },
8511 [ALC892_FIXUP_ASROCK_MOBO] = {
8512 .type = HDA_FIXUP_PINS,
8513 .v.pins = (const struct hda_pintbl[]) {
8514 { 0x15, 0x40f000f0 }, /* disabled */
8515 { 0x16, 0x40f000f0 }, /* disabled */
8516 { }
8517 }
8518 },
8519 [ALC662_FIXUP_USI_FUNC] = {
8520 .type = HDA_FIXUP_FUNC,
8521 .v.func = alc662_fixup_usi_headset_mic,
8522 },
8523 [ALC662_FIXUP_USI_HEADSET_MODE] = {
8524 .type = HDA_FIXUP_PINS,
8525 .v.pins = (const struct hda_pintbl[]) {
8526 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
8527 { 0x18, 0x01a1903d },
8528 { }
8529 },
8530 .chained = true,
8531 .chain_id = ALC662_FIXUP_USI_FUNC
8532 },
8533 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
8534 .type = HDA_FIXUP_FUNC,
8535 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
8536 },
8537 };
8538
8539 static const struct snd_pci_quirk alc662_fixup_tbl[] = {
8540 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
8541 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
8542 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
8543 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
8544 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
8545 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
8546 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
8547 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
8548 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8549 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8550 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
8551 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
8552 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
8553 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8554 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8555 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8556 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8557 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8558 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
8559 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
8560 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
8561 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
8562 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
8563 SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
8564 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
8565 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
8566 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
8567 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
8568 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
8569 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
8570 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
8571 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
8572 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
8573 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
8574 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
8575 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
8576 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
8577 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
8578 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
8579 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
8580 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
8581 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
8582
8583 #if 0
8584 /* Below is a quirk table taken from the old code.
8585 * Basically the device should work as is without the fixup table.
8586 * If BIOS doesn't give a proper info, enable the corresponding
8587 * fixup entry.
8588 */
8589 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
8590 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
8591 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
8592 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
8593 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8594 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8595 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8596 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
8597 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
8598 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8599 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
8600 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
8601 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
8602 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
8603 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
8604 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8605 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
8606 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
8607 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8608 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
8609 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
8610 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8611 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
8612 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
8613 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
8614 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8615 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
8616 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
8617 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8618 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
8619 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8620 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8621 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
8622 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
8623 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
8624 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
8625 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
8626 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
8627 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
8628 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8629 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
8630 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
8631 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8632 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
8633 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
8634 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
8635 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
8636 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
8637 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8638 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
8639 #endif
8640 {}
8641 };
8642
8643 static const struct hda_model_fixup alc662_fixup_models[] = {
8644 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
8645 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
8646 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
8647 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
8648 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
8649 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
8650 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
8651 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
8652 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
8653 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
8654 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
8655 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
8656 {}
8657 };
8658
8659 static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
8660 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
8661 {0x17, 0x02211010},
8662 {0x18, 0x01a19030},
8663 {0x1a, 0x01813040},
8664 {0x21, 0x01014020}),
8665 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
8666 {0x16, 0x01813030},
8667 {0x17, 0x02211010},
8668 {0x18, 0x01a19040},
8669 {0x21, 0x01014020}),
8670 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
8671 {0x14, 0x01014010},
8672 {0x18, 0x01a19020},
8673 {0x1a, 0x0181302f},
8674 {0x1b, 0x0221401f}),
8675 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8676 {0x12, 0x99a30130},
8677 {0x14, 0x90170110},
8678 {0x15, 0x0321101f},
8679 {0x16, 0x03011020}),
8680 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8681 {0x12, 0x99a30140},
8682 {0x14, 0x90170110},
8683 {0x15, 0x0321101f},
8684 {0x16, 0x03011020}),
8685 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8686 {0x12, 0x99a30150},
8687 {0x14, 0x90170110},
8688 {0x15, 0x0321101f},
8689 {0x16, 0x03011020}),
8690 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8691 {0x14, 0x90170110},
8692 {0x15, 0x0321101f},
8693 {0x16, 0x03011020}),
8694 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
8695 {0x12, 0x90a60130},
8696 {0x14, 0x90170110},
8697 {0x15, 0x0321101f}),
8698 {}
8699 };
8700
8701 /*
8702 */
8703 static int patch_alc662(struct hda_codec *codec)
8704 {
8705 struct alc_spec *spec;
8706 int err;
8707
8708 err = alc_alloc_spec(codec, 0x0b);
8709 if (err < 0)
8710 return err;
8711
8712 spec = codec->spec;
8713
8714 spec->shutup = alc_eapd_shutup;
8715
8716 /* handle multiple HPs as is */
8717 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
8718
8719 alc_fix_pll_init(codec, 0x20, 0x04, 15);
8720
8721 switch (codec->core.vendor_id) {
8722 case 0x10ec0668:
8723 spec->init_hook = alc668_restore_default_value;
8724 break;
8725 }
8726
8727 snd_hda_pick_fixup(codec, alc662_fixup_models,
8728 alc662_fixup_tbl, alc662_fixups);
8729 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
8730 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
8731
8732 alc_auto_parse_customize_define(codec);
8733
8734 if (has_cdefine_beep(codec))
8735 spec->gen.beep_nid = 0x01;
8736
8737 if ((alc_get_coef0(codec) & (1 << 14)) &&
8738 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
8739 spec->cdefine.platform_type == 1) {
8740 err = alc_codec_rename(codec, "ALC272X");
8741 if (err < 0)
8742 goto error;
8743 }
8744
8745 /* automatic parse from the BIOS config */
8746 err = alc662_parse_auto_config(codec);
8747 if (err < 0)
8748 goto error;
8749
8750 if (!spec->gen.no_analog && spec->gen.beep_nid) {
8751 switch (codec->core.vendor_id) {
8752 case 0x10ec0662:
8753 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
8754 break;
8755 case 0x10ec0272:
8756 case 0x10ec0663:
8757 case 0x10ec0665:
8758 case 0x10ec0668:
8759 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
8760 break;
8761 case 0x10ec0273:
8762 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
8763 break;
8764 }
8765 }
8766
8767 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
8768
8769 return 0;
8770
8771 error:
8772 alc_free(codec);
8773 return err;
8774 }
8775
8776 /*
8777 * ALC680 support
8778 */
8779
8780 static int alc680_parse_auto_config(struct hda_codec *codec)
8781 {
8782 return alc_parse_auto_config(codec, NULL, NULL);
8783 }
8784
8785 /*
8786 */
8787 static int patch_alc680(struct hda_codec *codec)
8788 {
8789 int err;
8790
8791 /* ALC680 has no aa-loopback mixer */
8792 err = alc_alloc_spec(codec, 0);
8793 if (err < 0)
8794 return err;
8795
8796 /* automatic parse from the BIOS config */
8797 err = alc680_parse_auto_config(codec);
8798 if (err < 0) {
8799 alc_free(codec);
8800 return err;
8801 }
8802
8803 return 0;
8804 }
8805
8806 /*
8807 * patch entries
8808 */
8809 static const struct hda_device_id snd_hda_id_realtek[] = {
8810 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
8811 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
8812 HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
8813 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
8814 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
8815 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
8816 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
8817 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
8818 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
8819 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
8820 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
8821 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
8822 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
8823 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
8824 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
8825 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
8826 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
8827 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
8828 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
8829 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
8830 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
8831 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
8832 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
8833 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
8834 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
8835 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
8836 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
8837 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
8838 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
8839 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
8840 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
8841 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
8842 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
8843 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
8844 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
8845 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
8846 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
8847 HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
8848 HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
8849 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
8850 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
8851 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
8852 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
8853 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
8854 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
8855 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
8856 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
8857 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
8858 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
8859 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
8860 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
8861 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
8862 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
8863 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
8864 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
8865 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
8866 HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
8867 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
8868 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
8869 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
8870 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
8871 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
8872 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
8873 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
8874 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
8875 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
8876 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
8877 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
8878 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
8879 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
8880 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
8881 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
8882 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
8883 {} /* terminator */
8884 };
8885 MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
8886
8887 MODULE_LICENSE("GPL");
8888 MODULE_DESCRIPTION("Realtek HD-audio codec");
8889
8890 static struct hda_codec_driver realtek_driver = {
8891 .id = snd_hda_id_realtek,
8892 };
8893
8894 module_hda_codec_driver(realtek_driver);