net: dsa: mt7530: set CPU port to fallback mode
[linux/fpc-iii.git] / sound / pci / hda / patch_realtek.c
blobb06f7d52faad34b67237870d38a785287ccd1f45
1 /*
2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for Realtek ALC codecs
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>
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.
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.
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
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"
41 /* keep halting ALC5505 DSP, for power saving */
42 #define HALT_REALTEK_ALC5505
44 /* extra amp-initialization sequence types */
45 enum {
46 ALC_INIT_UNDEFINED,
47 ALC_INIT_NONE,
48 ALC_INIT_DEFAULT,
51 enum {
52 ALC_HEADSET_MODE_UNKNOWN,
53 ALC_HEADSET_MODE_UNPLUGGED,
54 ALC_HEADSET_MODE_HEADSET,
55 ALC_HEADSET_MODE_MIC,
56 ALC_HEADSET_MODE_HEADPHONE,
59 enum {
60 ALC_HEADSET_TYPE_UNKNOWN,
61 ALC_HEADSET_TYPE_CTIA,
62 ALC_HEADSET_TYPE_OMTP,
65 enum {
66 ALC_KEY_MICMUTE_INDEX,
69 struct alc_customize_define {
70 unsigned int sku_cfg;
71 unsigned char port_connectivity;
72 unsigned char check_sum;
73 unsigned char customization;
74 unsigned char external_amp;
75 unsigned int enable_pcbeep:1;
76 unsigned int platform_type:1;
77 unsigned int swap:1;
78 unsigned int override:1;
79 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
82 struct alc_spec {
83 struct hda_gen_spec gen; /* must be at head */
85 /* codec parameterization */
86 struct alc_customize_define cdefine;
87 unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
89 /* GPIO bits */
90 unsigned int gpio_mask;
91 unsigned int gpio_dir;
92 unsigned int gpio_data;
93 bool gpio_write_delay; /* add a delay before writing gpio_data */
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;
100 unsigned int gpio_mute_led_mask;
101 unsigned int gpio_mic_led_mask;
103 hda_nid_t headset_mic_pin;
104 hda_nid_t headphone_mic_pin;
105 int current_headset_mode;
106 int current_headset_type;
108 /* hooks */
109 void (*init_hook)(struct hda_codec *codec);
110 #ifdef CONFIG_PM
111 void (*power_hook)(struct hda_codec *codec);
112 #endif
113 void (*shutup)(struct hda_codec *codec);
114 void (*reboot_notify)(struct hda_codec *codec);
116 int init_amp;
117 int codec_variant; /* flag for other variants */
118 unsigned int has_alc5505_dsp:1;
119 unsigned int no_depop_delay:1;
120 unsigned int done_hp_init:1;
121 unsigned int no_shutup_pins:1;
123 /* for PLL fix */
124 hda_nid_t pll_nid;
125 unsigned int pll_coef_idx, pll_coef_bit;
126 unsigned int coef0;
127 struct input_dev *kb_dev;
128 u8 alc_mute_keycode_map[1];
132 * COEF access helper functions
135 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
136 unsigned int coef_idx)
138 unsigned int val;
140 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
141 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
142 return val;
145 #define alc_read_coef_idx(codec, coef_idx) \
146 alc_read_coefex_idx(codec, 0x20, coef_idx)
148 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
149 unsigned int coef_idx, unsigned int coef_val)
151 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
152 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
155 #define alc_write_coef_idx(codec, coef_idx, coef_val) \
156 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
158 static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
159 unsigned int coef_idx, unsigned int mask,
160 unsigned int bits_set)
162 unsigned int val = alc_read_coefex_idx(codec, nid, coef_idx);
164 if (val != -1)
165 alc_write_coefex_idx(codec, nid, coef_idx,
166 (val & ~mask) | bits_set);
169 #define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
170 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
172 /* a special bypass for COEF 0; read the cached value at the second time */
173 static unsigned int alc_get_coef0(struct hda_codec *codec)
175 struct alc_spec *spec = codec->spec;
177 if (!spec->coef0)
178 spec->coef0 = alc_read_coef_idx(codec, 0);
179 return spec->coef0;
182 /* coef writes/updates batch */
183 struct coef_fw {
184 unsigned char nid;
185 unsigned char idx;
186 unsigned short mask;
187 unsigned short val;
190 #define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
191 { .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
192 #define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
193 #define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
194 #define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
196 static void alc_process_coef_fw(struct hda_codec *codec,
197 const struct coef_fw *fw)
199 for (; fw->nid; fw++) {
200 if (fw->mask == (unsigned short)-1)
201 alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
202 else
203 alc_update_coefex_idx(codec, fw->nid, fw->idx,
204 fw->mask, fw->val);
209 * GPIO setup tables, used in initialization
212 /* Enable GPIO mask and set output */
213 static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
215 struct alc_spec *spec = codec->spec;
217 spec->gpio_mask |= mask;
218 spec->gpio_dir |= mask;
219 spec->gpio_data |= mask;
222 static void alc_write_gpio_data(struct hda_codec *codec)
224 struct alc_spec *spec = codec->spec;
226 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
227 spec->gpio_data);
230 static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
231 bool on)
233 struct alc_spec *spec = codec->spec;
234 unsigned int oldval = spec->gpio_data;
236 if (on)
237 spec->gpio_data |= mask;
238 else
239 spec->gpio_data &= ~mask;
240 if (oldval != spec->gpio_data)
241 alc_write_gpio_data(codec);
244 static void alc_write_gpio(struct hda_codec *codec)
246 struct alc_spec *spec = codec->spec;
248 if (!spec->gpio_mask)
249 return;
251 snd_hda_codec_write(codec, codec->core.afg, 0,
252 AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
253 snd_hda_codec_write(codec, codec->core.afg, 0,
254 AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir);
255 if (spec->gpio_write_delay)
256 msleep(1);
257 alc_write_gpio_data(codec);
260 static void alc_fixup_gpio(struct hda_codec *codec, int action,
261 unsigned int mask)
263 if (action == HDA_FIXUP_ACT_PRE_PROBE)
264 alc_setup_gpio(codec, mask);
267 static void alc_fixup_gpio1(struct hda_codec *codec,
268 const struct hda_fixup *fix, int action)
270 alc_fixup_gpio(codec, action, 0x01);
273 static void alc_fixup_gpio2(struct hda_codec *codec,
274 const struct hda_fixup *fix, int action)
276 alc_fixup_gpio(codec, action, 0x02);
279 static void alc_fixup_gpio3(struct hda_codec *codec,
280 const struct hda_fixup *fix, int action)
282 alc_fixup_gpio(codec, action, 0x03);
285 static void alc_fixup_gpio4(struct hda_codec *codec,
286 const struct hda_fixup *fix, int action)
288 alc_fixup_gpio(codec, action, 0x04);
292 * Fix hardware PLL issue
293 * On some codecs, the analog PLL gating control must be off while
294 * the default value is 1.
296 static void alc_fix_pll(struct hda_codec *codec)
298 struct alc_spec *spec = codec->spec;
300 if (spec->pll_nid)
301 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
302 1 << spec->pll_coef_bit, 0);
305 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
306 unsigned int coef_idx, unsigned int coef_bit)
308 struct alc_spec *spec = codec->spec;
309 spec->pll_nid = nid;
310 spec->pll_coef_idx = coef_idx;
311 spec->pll_coef_bit = coef_bit;
312 alc_fix_pll(codec);
315 /* update the master volume per volume-knob's unsol event */
316 static void alc_update_knob_master(struct hda_codec *codec,
317 struct hda_jack_callback *jack)
319 unsigned int val;
320 struct snd_kcontrol *kctl;
321 struct snd_ctl_elem_value *uctl;
323 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
324 if (!kctl)
325 return;
326 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
327 if (!uctl)
328 return;
329 val = snd_hda_codec_read(codec, jack->nid, 0,
330 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
331 val &= HDA_AMP_VOLMASK;
332 uctl->value.integer.value[0] = val;
333 uctl->value.integer.value[1] = val;
334 kctl->put(kctl, uctl);
335 kfree(uctl);
338 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
340 /* For some reason, the res given from ALC880 is broken.
341 Here we adjust it properly. */
342 snd_hda_jack_unsol_event(codec, res >> 2);
345 /* Change EAPD to verb control */
346 static void alc_fill_eapd_coef(struct hda_codec *codec)
348 int coef;
350 coef = alc_get_coef0(codec);
352 switch (codec->core.vendor_id) {
353 case 0x10ec0262:
354 alc_update_coef_idx(codec, 0x7, 0, 1<<5);
355 break;
356 case 0x10ec0267:
357 case 0x10ec0268:
358 alc_update_coef_idx(codec, 0x7, 0, 1<<13);
359 break;
360 case 0x10ec0269:
361 if ((coef & 0x00f0) == 0x0010)
362 alc_update_coef_idx(codec, 0xd, 0, 1<<14);
363 if ((coef & 0x00f0) == 0x0020)
364 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
365 if ((coef & 0x00f0) == 0x0030)
366 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
367 break;
368 case 0x10ec0280:
369 case 0x10ec0284:
370 case 0x10ec0290:
371 case 0x10ec0292:
372 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
373 break;
374 case 0x10ec0225:
375 case 0x10ec0295:
376 case 0x10ec0299:
377 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
378 /* fallthrough */
379 case 0x10ec0215:
380 case 0x10ec0233:
381 case 0x10ec0235:
382 case 0x10ec0236:
383 case 0x10ec0245:
384 case 0x10ec0255:
385 case 0x10ec0256:
386 case 0x10ec0257:
387 case 0x10ec0282:
388 case 0x10ec0283:
389 case 0x10ec0286:
390 case 0x10ec0287:
391 case 0x10ec0288:
392 case 0x10ec0285:
393 case 0x10ec0298:
394 case 0x10ec0289:
395 case 0x10ec0300:
396 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
397 break;
398 case 0x10ec0275:
399 alc_update_coef_idx(codec, 0xe, 0, 1<<0);
400 break;
401 case 0x10ec0293:
402 alc_update_coef_idx(codec, 0xa, 1<<13, 0);
403 break;
404 case 0x10ec0234:
405 case 0x10ec0274:
406 case 0x10ec0294:
407 case 0x10ec0700:
408 case 0x10ec0701:
409 case 0x10ec0703:
410 case 0x10ec0711:
411 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
412 break;
413 case 0x10ec0662:
414 if ((coef & 0x00f0) == 0x0030)
415 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
416 break;
417 case 0x10ec0272:
418 case 0x10ec0273:
419 case 0x10ec0663:
420 case 0x10ec0665:
421 case 0x10ec0670:
422 case 0x10ec0671:
423 case 0x10ec0672:
424 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
425 break;
426 case 0x10ec0222:
427 case 0x10ec0623:
428 alc_update_coef_idx(codec, 0x19, 1<<13, 0);
429 break;
430 case 0x10ec0668:
431 alc_update_coef_idx(codec, 0x7, 3<<13, 0);
432 break;
433 case 0x10ec0867:
434 alc_update_coef_idx(codec, 0x4, 1<<10, 0);
435 break;
436 case 0x10ec0888:
437 if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
438 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
439 break;
440 case 0x10ec0892:
441 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
442 break;
443 case 0x10ec0899:
444 case 0x10ec0900:
445 case 0x10ec0b00:
446 case 0x10ec1168:
447 case 0x10ec1220:
448 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
449 break;
453 /* additional initialization for ALC888 variants */
454 static void alc888_coef_init(struct hda_codec *codec)
456 switch (alc_get_coef0(codec) & 0x00f0) {
457 /* alc888-VA */
458 case 0x00:
459 /* alc888-VB */
460 case 0x10:
461 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
462 break;
466 /* turn on/off EAPD control (only if available) */
467 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
469 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
470 return;
471 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
472 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
473 on ? 2 : 0);
476 /* turn on/off EAPD controls of the codec */
477 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
479 /* We currently only handle front, HP */
480 static hda_nid_t pins[] = {
481 0x0f, 0x10, 0x14, 0x15, 0x17, 0
483 hda_nid_t *p;
484 for (p = pins; *p; p++)
485 set_eapd(codec, *p, on);
488 static int find_ext_mic_pin(struct hda_codec *codec);
490 static void alc_headset_mic_no_shutup(struct hda_codec *codec)
492 const struct hda_pincfg *pin;
493 int mic_pin = find_ext_mic_pin(codec);
494 int i;
496 /* don't shut up pins when unloading the driver; otherwise it breaks
497 * the default pin setup at the next load of the driver
499 if (codec->bus->shutdown)
500 return;
502 snd_array_for_each(&codec->init_pins, i, pin) {
503 /* use read here for syncing after issuing each verb */
504 if (pin->nid != mic_pin)
505 snd_hda_codec_read(codec, pin->nid, 0,
506 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
509 codec->pins_shutup = 1;
512 static void alc_shutup_pins(struct hda_codec *codec)
514 struct alc_spec *spec = codec->spec;
516 switch (codec->core.vendor_id) {
517 case 0x10ec0283:
518 case 0x10ec0286:
519 case 0x10ec0288:
520 case 0x10ec0298:
521 alc_headset_mic_no_shutup(codec);
522 break;
523 default:
524 if (!spec->no_shutup_pins)
525 snd_hda_shutup_pins(codec);
526 break;
530 /* generic shutup callback;
531 * just turning off EAPD and a little pause for avoiding pop-noise
533 static void alc_eapd_shutup(struct hda_codec *codec)
535 struct alc_spec *spec = codec->spec;
537 alc_auto_setup_eapd(codec, false);
538 if (!spec->no_depop_delay)
539 msleep(200);
540 alc_shutup_pins(codec);
543 /* generic EAPD initialization */
544 static void alc_auto_init_amp(struct hda_codec *codec, int type)
546 alc_fill_eapd_coef(codec);
547 alc_auto_setup_eapd(codec, true);
548 alc_write_gpio(codec);
549 switch (type) {
550 case ALC_INIT_DEFAULT:
551 switch (codec->core.vendor_id) {
552 case 0x10ec0260:
553 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
554 break;
555 case 0x10ec0880:
556 case 0x10ec0882:
557 case 0x10ec0883:
558 case 0x10ec0885:
559 alc_update_coef_idx(codec, 7, 0, 0x2030);
560 break;
561 case 0x10ec0888:
562 alc888_coef_init(codec);
563 break;
565 break;
569 /* get a primary headphone pin if available */
570 static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
572 if (spec->gen.autocfg.hp_pins[0])
573 return spec->gen.autocfg.hp_pins[0];
574 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
575 return spec->gen.autocfg.line_out_pins[0];
576 return 0;
580 * Realtek SSID verification
583 /* Could be any non-zero and even value. When used as fixup, tells
584 * the driver to ignore any present sku defines.
586 #define ALC_FIXUP_SKU_IGNORE (2)
588 static void alc_fixup_sku_ignore(struct hda_codec *codec,
589 const struct hda_fixup *fix, int action)
591 struct alc_spec *spec = codec->spec;
592 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
593 spec->cdefine.fixup = 1;
594 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
598 static void alc_fixup_no_depop_delay(struct hda_codec *codec,
599 const struct hda_fixup *fix, int action)
601 struct alc_spec *spec = codec->spec;
603 if (action == HDA_FIXUP_ACT_PROBE) {
604 spec->no_depop_delay = 1;
605 codec->depop_delay = 0;
609 static int alc_auto_parse_customize_define(struct hda_codec *codec)
611 unsigned int ass, tmp, i;
612 unsigned nid = 0;
613 struct alc_spec *spec = codec->spec;
615 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
617 if (spec->cdefine.fixup) {
618 ass = spec->cdefine.sku_cfg;
619 if (ass == ALC_FIXUP_SKU_IGNORE)
620 return -1;
621 goto do_sku;
624 if (!codec->bus->pci)
625 return -1;
626 ass = codec->core.subsystem_id & 0xffff;
627 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
628 goto do_sku;
630 nid = 0x1d;
631 if (codec->core.vendor_id == 0x10ec0260)
632 nid = 0x17;
633 ass = snd_hda_codec_get_pincfg(codec, nid);
635 if (!(ass & 1)) {
636 codec_info(codec, "%s: SKU not ready 0x%08x\n",
637 codec->core.chip_name, ass);
638 return -1;
641 /* check sum */
642 tmp = 0;
643 for (i = 1; i < 16; i++) {
644 if ((ass >> i) & 1)
645 tmp++;
647 if (((ass >> 16) & 0xf) != tmp)
648 return -1;
650 spec->cdefine.port_connectivity = ass >> 30;
651 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
652 spec->cdefine.check_sum = (ass >> 16) & 0xf;
653 spec->cdefine.customization = ass >> 8;
654 do_sku:
655 spec->cdefine.sku_cfg = ass;
656 spec->cdefine.external_amp = (ass & 0x38) >> 3;
657 spec->cdefine.platform_type = (ass & 0x4) >> 2;
658 spec->cdefine.swap = (ass & 0x2) >> 1;
659 spec->cdefine.override = ass & 0x1;
661 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
662 nid, spec->cdefine.sku_cfg);
663 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
664 spec->cdefine.port_connectivity);
665 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
666 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
667 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
668 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
669 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
670 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
671 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
673 return 0;
676 /* return the position of NID in the list, or -1 if not found */
677 static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
679 int i;
680 for (i = 0; i < nums; i++)
681 if (list[i] == nid)
682 return i;
683 return -1;
685 /* return true if the given NID is found in the list */
686 static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
688 return find_idx_in_nid_list(nid, list, nums) >= 0;
691 /* check subsystem ID and set up device-specific initialization;
692 * return 1 if initialized, 0 if invalid SSID
694 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
695 * 31 ~ 16 : Manufacture ID
696 * 15 ~ 8 : SKU ID
697 * 7 ~ 0 : Assembly ID
698 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
700 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
702 unsigned int ass, tmp, i;
703 unsigned nid;
704 struct alc_spec *spec = codec->spec;
706 if (spec->cdefine.fixup) {
707 ass = spec->cdefine.sku_cfg;
708 if (ass == ALC_FIXUP_SKU_IGNORE)
709 return 0;
710 goto do_sku;
713 ass = codec->core.subsystem_id & 0xffff;
714 if (codec->bus->pci &&
715 ass != codec->bus->pci->subsystem_device && (ass & 1))
716 goto do_sku;
718 /* invalid SSID, check the special NID pin defcfg instead */
720 * 31~30 : port connectivity
721 * 29~21 : reserve
722 * 20 : PCBEEP input
723 * 19~16 : Check sum (15:1)
724 * 15~1 : Custom
725 * 0 : override
727 nid = 0x1d;
728 if (codec->core.vendor_id == 0x10ec0260)
729 nid = 0x17;
730 ass = snd_hda_codec_get_pincfg(codec, nid);
731 codec_dbg(codec,
732 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
733 ass, nid);
734 if (!(ass & 1))
735 return 0;
736 if ((ass >> 30) != 1) /* no physical connection */
737 return 0;
739 /* check sum */
740 tmp = 0;
741 for (i = 1; i < 16; i++) {
742 if ((ass >> i) & 1)
743 tmp++;
745 if (((ass >> 16) & 0xf) != tmp)
746 return 0;
747 do_sku:
748 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
749 ass & 0xffff, codec->core.vendor_id);
751 * 0 : override
752 * 1 : Swap Jack
753 * 2 : 0 --> Desktop, 1 --> Laptop
754 * 3~5 : External Amplifier control
755 * 7~6 : Reserved
757 tmp = (ass & 0x38) >> 3; /* external Amp control */
758 if (spec->init_amp == ALC_INIT_UNDEFINED) {
759 switch (tmp) {
760 case 1:
761 alc_setup_gpio(codec, 0x01);
762 break;
763 case 3:
764 alc_setup_gpio(codec, 0x02);
765 break;
766 case 7:
767 alc_setup_gpio(codec, 0x03);
768 break;
769 case 5:
770 default:
771 spec->init_amp = ALC_INIT_DEFAULT;
772 break;
776 /* is laptop or Desktop and enable the function "Mute internal speaker
777 * when the external headphone out jack is plugged"
779 if (!(ass & 0x8000))
780 return 1;
782 * 10~8 : Jack location
783 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
784 * 14~13: Resvered
785 * 15 : 1 --> enable the function "Mute internal speaker
786 * when the external headphone out jack is plugged"
788 if (!alc_get_hp_pin(spec)) {
789 hda_nid_t nid;
790 tmp = (ass >> 11) & 0x3; /* HP to chassis */
791 nid = ports[tmp];
792 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
793 spec->gen.autocfg.line_outs))
794 return 1;
795 spec->gen.autocfg.hp_pins[0] = nid;
797 return 1;
800 /* Check the validity of ALC subsystem-id
801 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
802 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
804 if (!alc_subsystem_id(codec, ports)) {
805 struct alc_spec *spec = codec->spec;
806 if (spec->init_amp == ALC_INIT_UNDEFINED) {
807 codec_dbg(codec,
808 "realtek: Enable default setup for auto mode as fallback\n");
809 spec->init_amp = ALC_INIT_DEFAULT;
817 static void alc_fixup_inv_dmic(struct hda_codec *codec,
818 const struct hda_fixup *fix, int action)
820 struct alc_spec *spec = codec->spec;
822 spec->gen.inv_dmic_split = 1;
826 static int alc_build_controls(struct hda_codec *codec)
828 int err;
830 err = snd_hda_gen_build_controls(codec);
831 if (err < 0)
832 return err;
834 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
835 return 0;
840 * Common callbacks
843 static int alc_init(struct hda_codec *codec)
845 struct alc_spec *spec = codec->spec;
847 if (spec->init_hook)
848 spec->init_hook(codec);
850 spec->gen.skip_verbs = 1; /* applied in below */
851 snd_hda_gen_init(codec);
852 alc_fix_pll(codec);
853 alc_auto_init_amp(codec, spec->init_amp);
854 snd_hda_apply_verbs(codec); /* apply verbs here after own init */
856 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
858 return 0;
861 static inline void alc_shutup(struct hda_codec *codec)
863 struct alc_spec *spec = codec->spec;
865 if (!snd_hda_get_bool_hint(codec, "shutup"))
866 return; /* disabled explicitly by hints */
868 if (spec && spec->shutup)
869 spec->shutup(codec);
870 else
871 alc_shutup_pins(codec);
874 static void alc_reboot_notify(struct hda_codec *codec)
876 struct alc_spec *spec = codec->spec;
878 if (spec && spec->reboot_notify)
879 spec->reboot_notify(codec);
880 else
881 alc_shutup(codec);
884 #define alc_free snd_hda_gen_free
886 #ifdef CONFIG_PM
887 static void alc_power_eapd(struct hda_codec *codec)
889 alc_auto_setup_eapd(codec, false);
892 static int alc_suspend(struct hda_codec *codec)
894 struct alc_spec *spec = codec->spec;
895 alc_shutup(codec);
896 if (spec && spec->power_hook)
897 spec->power_hook(codec);
898 return 0;
900 #endif
902 #ifdef CONFIG_PM
903 static int alc_resume(struct hda_codec *codec)
905 struct alc_spec *spec = codec->spec;
907 if (!spec->no_depop_delay)
908 msleep(150); /* to avoid pop noise */
909 codec->patch_ops.init(codec);
910 regcache_sync(codec->core.regmap);
911 hda_call_check_power_status(codec, 0x01);
912 return 0;
914 #endif
918 static const struct hda_codec_ops alc_patch_ops = {
919 .build_controls = alc_build_controls,
920 .build_pcms = snd_hda_gen_build_pcms,
921 .init = alc_init,
922 .free = alc_free,
923 .unsol_event = snd_hda_jack_unsol_event,
924 #ifdef CONFIG_PM
925 .resume = alc_resume,
926 .suspend = alc_suspend,
927 .check_power_status = snd_hda_gen_check_power_status,
928 #endif
929 .reboot_notify = alc_reboot_notify,
933 #define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
936 * Rename codecs appropriately from COEF value or subvendor id
938 struct alc_codec_rename_table {
939 unsigned int vendor_id;
940 unsigned short coef_mask;
941 unsigned short coef_bits;
942 const char *name;
945 struct alc_codec_rename_pci_table {
946 unsigned int codec_vendor_id;
947 unsigned short pci_subvendor;
948 unsigned short pci_subdevice;
949 const char *name;
952 static struct alc_codec_rename_table rename_tbl[] = {
953 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
954 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
955 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
956 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
957 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
958 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
959 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
960 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
961 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
962 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
963 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
964 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
965 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
966 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
967 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
968 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
969 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
970 { } /* terminator */
973 static struct alc_codec_rename_pci_table rename_pci_tbl[] = {
974 { 0x10ec0280, 0x1028, 0, "ALC3220" },
975 { 0x10ec0282, 0x1028, 0, "ALC3221" },
976 { 0x10ec0283, 0x1028, 0, "ALC3223" },
977 { 0x10ec0288, 0x1028, 0, "ALC3263" },
978 { 0x10ec0292, 0x1028, 0, "ALC3226" },
979 { 0x10ec0293, 0x1028, 0, "ALC3235" },
980 { 0x10ec0255, 0x1028, 0, "ALC3234" },
981 { 0x10ec0668, 0x1028, 0, "ALC3661" },
982 { 0x10ec0275, 0x1028, 0, "ALC3260" },
983 { 0x10ec0899, 0x1028, 0, "ALC3861" },
984 { 0x10ec0298, 0x1028, 0, "ALC3266" },
985 { 0x10ec0236, 0x1028, 0, "ALC3204" },
986 { 0x10ec0256, 0x1028, 0, "ALC3246" },
987 { 0x10ec0225, 0x1028, 0, "ALC3253" },
988 { 0x10ec0295, 0x1028, 0, "ALC3254" },
989 { 0x10ec0299, 0x1028, 0, "ALC3271" },
990 { 0x10ec0670, 0x1025, 0, "ALC669X" },
991 { 0x10ec0676, 0x1025, 0, "ALC679X" },
992 { 0x10ec0282, 0x1043, 0, "ALC3229" },
993 { 0x10ec0233, 0x1043, 0, "ALC3236" },
994 { 0x10ec0280, 0x103c, 0, "ALC3228" },
995 { 0x10ec0282, 0x103c, 0, "ALC3227" },
996 { 0x10ec0286, 0x103c, 0, "ALC3242" },
997 { 0x10ec0290, 0x103c, 0, "ALC3241" },
998 { 0x10ec0668, 0x103c, 0, "ALC3662" },
999 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
1000 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
1001 { } /* terminator */
1004 static int alc_codec_rename_from_preset(struct hda_codec *codec)
1006 const struct alc_codec_rename_table *p;
1007 const struct alc_codec_rename_pci_table *q;
1009 for (p = rename_tbl; p->vendor_id; p++) {
1010 if (p->vendor_id != codec->core.vendor_id)
1011 continue;
1012 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
1013 return alc_codec_rename(codec, p->name);
1016 if (!codec->bus->pci)
1017 return 0;
1018 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
1019 if (q->codec_vendor_id != codec->core.vendor_id)
1020 continue;
1021 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1022 continue;
1023 if (!q->pci_subdevice ||
1024 q->pci_subdevice == codec->bus->pci->subsystem_device)
1025 return alc_codec_rename(codec, q->name);
1028 return 0;
1033 * Digital-beep handlers
1035 #ifdef CONFIG_SND_HDA_INPUT_BEEP
1037 /* additional beep mixers; private_value will be overwritten */
1038 static const struct snd_kcontrol_new alc_beep_mixer[] = {
1039 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1040 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1043 /* set up and create beep controls */
1044 static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1045 int idx, int dir)
1047 struct snd_kcontrol_new *knew;
1048 unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1049 int i;
1051 for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1052 knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1053 &alc_beep_mixer[i]);
1054 if (!knew)
1055 return -ENOMEM;
1056 knew->private_value = beep_amp;
1058 return 0;
1061 static const struct snd_pci_quirk beep_white_list[] = {
1062 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
1063 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
1064 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
1065 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
1066 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1067 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1068 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
1069 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
1070 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
1071 /* blacklist -- no beep available */
1072 SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
1073 SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
1077 static inline int has_cdefine_beep(struct hda_codec *codec)
1079 struct alc_spec *spec = codec->spec;
1080 const struct snd_pci_quirk *q;
1081 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list);
1082 if (q)
1083 return q->value;
1084 return spec->cdefine.enable_pcbeep;
1086 #else
1087 #define set_beep_amp(spec, nid, idx, dir) 0
1088 #define has_cdefine_beep(codec) 0
1089 #endif
1091 /* parse the BIOS configuration and set up the alc_spec */
1092 /* return 1 if successful, 0 if the proper config is not found,
1093 * or a negative error code
1095 static int alc_parse_auto_config(struct hda_codec *codec,
1096 const hda_nid_t *ignore_nids,
1097 const hda_nid_t *ssid_nids)
1099 struct alc_spec *spec = codec->spec;
1100 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
1101 int err;
1103 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1104 spec->parse_flags);
1105 if (err < 0)
1106 return err;
1108 if (ssid_nids)
1109 alc_ssid_check(codec, ssid_nids);
1111 err = snd_hda_gen_parse_auto_config(codec, cfg);
1112 if (err < 0)
1113 return err;
1115 return 1;
1118 /* common preparation job for alc_spec */
1119 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1121 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1122 int err;
1124 if (!spec)
1125 return -ENOMEM;
1126 codec->spec = spec;
1127 snd_hda_gen_spec_init(&spec->gen);
1128 spec->gen.mixer_nid = mixer_nid;
1129 spec->gen.own_eapd_ctl = 1;
1130 codec->single_adc_amp = 1;
1131 /* FIXME: do we need this for all Realtek codec models? */
1132 codec->spdif_status_reset = 1;
1133 codec->patch_ops = alc_patch_ops;
1135 err = alc_codec_rename_from_preset(codec);
1136 if (err < 0) {
1137 kfree(spec);
1138 return err;
1140 return 0;
1143 static int alc880_parse_auto_config(struct hda_codec *codec)
1145 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
1146 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
1147 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1151 * ALC880 fix-ups
1153 enum {
1154 ALC880_FIXUP_GPIO1,
1155 ALC880_FIXUP_GPIO2,
1156 ALC880_FIXUP_MEDION_RIM,
1157 ALC880_FIXUP_LG,
1158 ALC880_FIXUP_LG_LW25,
1159 ALC880_FIXUP_W810,
1160 ALC880_FIXUP_EAPD_COEF,
1161 ALC880_FIXUP_TCL_S700,
1162 ALC880_FIXUP_VOL_KNOB,
1163 ALC880_FIXUP_FUJITSU,
1164 ALC880_FIXUP_F1734,
1165 ALC880_FIXUP_UNIWILL,
1166 ALC880_FIXUP_UNIWILL_DIG,
1167 ALC880_FIXUP_Z71V,
1168 ALC880_FIXUP_ASUS_W5A,
1169 ALC880_FIXUP_3ST_BASE,
1170 ALC880_FIXUP_3ST,
1171 ALC880_FIXUP_3ST_DIG,
1172 ALC880_FIXUP_5ST_BASE,
1173 ALC880_FIXUP_5ST,
1174 ALC880_FIXUP_5ST_DIG,
1175 ALC880_FIXUP_6ST_BASE,
1176 ALC880_FIXUP_6ST,
1177 ALC880_FIXUP_6ST_DIG,
1178 ALC880_FIXUP_6ST_AUTOMUTE,
1181 /* enable the volume-knob widget support on NID 0x21 */
1182 static void alc880_fixup_vol_knob(struct hda_codec *codec,
1183 const struct hda_fixup *fix, int action)
1185 if (action == HDA_FIXUP_ACT_PROBE)
1186 snd_hda_jack_detect_enable_callback(codec, 0x21,
1187 alc_update_knob_master);
1190 static const struct hda_fixup alc880_fixups[] = {
1191 [ALC880_FIXUP_GPIO1] = {
1192 .type = HDA_FIXUP_FUNC,
1193 .v.func = alc_fixup_gpio1,
1195 [ALC880_FIXUP_GPIO2] = {
1196 .type = HDA_FIXUP_FUNC,
1197 .v.func = alc_fixup_gpio2,
1199 [ALC880_FIXUP_MEDION_RIM] = {
1200 .type = HDA_FIXUP_VERBS,
1201 .v.verbs = (const struct hda_verb[]) {
1202 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1203 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1206 .chained = true,
1207 .chain_id = ALC880_FIXUP_GPIO2,
1209 [ALC880_FIXUP_LG] = {
1210 .type = HDA_FIXUP_PINS,
1211 .v.pins = (const struct hda_pintbl[]) {
1212 /* disable bogus unused pins */
1213 { 0x16, 0x411111f0 },
1214 { 0x18, 0x411111f0 },
1215 { 0x1a, 0x411111f0 },
1219 [ALC880_FIXUP_LG_LW25] = {
1220 .type = HDA_FIXUP_PINS,
1221 .v.pins = (const struct hda_pintbl[]) {
1222 { 0x1a, 0x0181344f }, /* line-in */
1223 { 0x1b, 0x0321403f }, /* headphone */
1227 [ALC880_FIXUP_W810] = {
1228 .type = HDA_FIXUP_PINS,
1229 .v.pins = (const struct hda_pintbl[]) {
1230 /* disable bogus unused pins */
1231 { 0x17, 0x411111f0 },
1234 .chained = true,
1235 .chain_id = ALC880_FIXUP_GPIO2,
1237 [ALC880_FIXUP_EAPD_COEF] = {
1238 .type = HDA_FIXUP_VERBS,
1239 .v.verbs = (const struct hda_verb[]) {
1240 /* change to EAPD mode */
1241 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1242 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1246 [ALC880_FIXUP_TCL_S700] = {
1247 .type = HDA_FIXUP_VERBS,
1248 .v.verbs = (const struct hda_verb[]) {
1249 /* change to EAPD mode */
1250 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1251 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1254 .chained = true,
1255 .chain_id = ALC880_FIXUP_GPIO2,
1257 [ALC880_FIXUP_VOL_KNOB] = {
1258 .type = HDA_FIXUP_FUNC,
1259 .v.func = alc880_fixup_vol_knob,
1261 [ALC880_FIXUP_FUJITSU] = {
1262 /* override all pins as BIOS on old Amilo is broken */
1263 .type = HDA_FIXUP_PINS,
1264 .v.pins = (const struct hda_pintbl[]) {
1265 { 0x14, 0x0121401f }, /* HP */
1266 { 0x15, 0x99030120 }, /* speaker */
1267 { 0x16, 0x99030130 }, /* bass speaker */
1268 { 0x17, 0x411111f0 }, /* N/A */
1269 { 0x18, 0x411111f0 }, /* N/A */
1270 { 0x19, 0x01a19950 }, /* mic-in */
1271 { 0x1a, 0x411111f0 }, /* N/A */
1272 { 0x1b, 0x411111f0 }, /* N/A */
1273 { 0x1c, 0x411111f0 }, /* N/A */
1274 { 0x1d, 0x411111f0 }, /* N/A */
1275 { 0x1e, 0x01454140 }, /* SPDIF out */
1278 .chained = true,
1279 .chain_id = ALC880_FIXUP_VOL_KNOB,
1281 [ALC880_FIXUP_F1734] = {
1282 /* almost compatible with FUJITSU, but no bass and SPDIF */
1283 .type = HDA_FIXUP_PINS,
1284 .v.pins = (const struct hda_pintbl[]) {
1285 { 0x14, 0x0121401f }, /* HP */
1286 { 0x15, 0x99030120 }, /* speaker */
1287 { 0x16, 0x411111f0 }, /* N/A */
1288 { 0x17, 0x411111f0 }, /* N/A */
1289 { 0x18, 0x411111f0 }, /* N/A */
1290 { 0x19, 0x01a19950 }, /* mic-in */
1291 { 0x1a, 0x411111f0 }, /* N/A */
1292 { 0x1b, 0x411111f0 }, /* N/A */
1293 { 0x1c, 0x411111f0 }, /* N/A */
1294 { 0x1d, 0x411111f0 }, /* N/A */
1295 { 0x1e, 0x411111f0 }, /* N/A */
1298 .chained = true,
1299 .chain_id = ALC880_FIXUP_VOL_KNOB,
1301 [ALC880_FIXUP_UNIWILL] = {
1302 /* need to fix HP and speaker pins to be parsed correctly */
1303 .type = HDA_FIXUP_PINS,
1304 .v.pins = (const struct hda_pintbl[]) {
1305 { 0x14, 0x0121411f }, /* HP */
1306 { 0x15, 0x99030120 }, /* speaker */
1307 { 0x16, 0x99030130 }, /* bass speaker */
1311 [ALC880_FIXUP_UNIWILL_DIG] = {
1312 .type = HDA_FIXUP_PINS,
1313 .v.pins = (const struct hda_pintbl[]) {
1314 /* disable bogus unused pins */
1315 { 0x17, 0x411111f0 },
1316 { 0x19, 0x411111f0 },
1317 { 0x1b, 0x411111f0 },
1318 { 0x1f, 0x411111f0 },
1322 [ALC880_FIXUP_Z71V] = {
1323 .type = HDA_FIXUP_PINS,
1324 .v.pins = (const struct hda_pintbl[]) {
1325 /* set up the whole pins as BIOS is utterly broken */
1326 { 0x14, 0x99030120 }, /* speaker */
1327 { 0x15, 0x0121411f }, /* HP */
1328 { 0x16, 0x411111f0 }, /* N/A */
1329 { 0x17, 0x411111f0 }, /* N/A */
1330 { 0x18, 0x01a19950 }, /* mic-in */
1331 { 0x19, 0x411111f0 }, /* N/A */
1332 { 0x1a, 0x01813031 }, /* line-in */
1333 { 0x1b, 0x411111f0 }, /* N/A */
1334 { 0x1c, 0x411111f0 }, /* N/A */
1335 { 0x1d, 0x411111f0 }, /* N/A */
1336 { 0x1e, 0x0144111e }, /* SPDIF */
1340 [ALC880_FIXUP_ASUS_W5A] = {
1341 .type = HDA_FIXUP_PINS,
1342 .v.pins = (const struct hda_pintbl[]) {
1343 /* set up the whole pins as BIOS is utterly broken */
1344 { 0x14, 0x0121411f }, /* HP */
1345 { 0x15, 0x411111f0 }, /* N/A */
1346 { 0x16, 0x411111f0 }, /* N/A */
1347 { 0x17, 0x411111f0 }, /* N/A */
1348 { 0x18, 0x90a60160 }, /* mic */
1349 { 0x19, 0x411111f0 }, /* N/A */
1350 { 0x1a, 0x411111f0 }, /* N/A */
1351 { 0x1b, 0x411111f0 }, /* N/A */
1352 { 0x1c, 0x411111f0 }, /* N/A */
1353 { 0x1d, 0x411111f0 }, /* N/A */
1354 { 0x1e, 0xb743111e }, /* SPDIF out */
1357 .chained = true,
1358 .chain_id = ALC880_FIXUP_GPIO1,
1360 [ALC880_FIXUP_3ST_BASE] = {
1361 .type = HDA_FIXUP_PINS,
1362 .v.pins = (const struct hda_pintbl[]) {
1363 { 0x14, 0x01014010 }, /* line-out */
1364 { 0x15, 0x411111f0 }, /* N/A */
1365 { 0x16, 0x411111f0 }, /* N/A */
1366 { 0x17, 0x411111f0 }, /* N/A */
1367 { 0x18, 0x01a19c30 }, /* mic-in */
1368 { 0x19, 0x0121411f }, /* HP */
1369 { 0x1a, 0x01813031 }, /* line-in */
1370 { 0x1b, 0x02a19c40 }, /* front-mic */
1371 { 0x1c, 0x411111f0 }, /* N/A */
1372 { 0x1d, 0x411111f0 }, /* N/A */
1373 /* 0x1e is filled in below */
1374 { 0x1f, 0x411111f0 }, /* N/A */
1378 [ALC880_FIXUP_3ST] = {
1379 .type = HDA_FIXUP_PINS,
1380 .v.pins = (const struct hda_pintbl[]) {
1381 { 0x1e, 0x411111f0 }, /* N/A */
1384 .chained = true,
1385 .chain_id = ALC880_FIXUP_3ST_BASE,
1387 [ALC880_FIXUP_3ST_DIG] = {
1388 .type = HDA_FIXUP_PINS,
1389 .v.pins = (const struct hda_pintbl[]) {
1390 { 0x1e, 0x0144111e }, /* SPDIF */
1393 .chained = true,
1394 .chain_id = ALC880_FIXUP_3ST_BASE,
1396 [ALC880_FIXUP_5ST_BASE] = {
1397 .type = HDA_FIXUP_PINS,
1398 .v.pins = (const struct hda_pintbl[]) {
1399 { 0x14, 0x01014010 }, /* front */
1400 { 0x15, 0x411111f0 }, /* N/A */
1401 { 0x16, 0x01011411 }, /* CLFE */
1402 { 0x17, 0x01016412 }, /* surr */
1403 { 0x18, 0x01a19c30 }, /* mic-in */
1404 { 0x19, 0x0121411f }, /* HP */
1405 { 0x1a, 0x01813031 }, /* line-in */
1406 { 0x1b, 0x02a19c40 }, /* front-mic */
1407 { 0x1c, 0x411111f0 }, /* N/A */
1408 { 0x1d, 0x411111f0 }, /* N/A */
1409 /* 0x1e is filled in below */
1410 { 0x1f, 0x411111f0 }, /* N/A */
1414 [ALC880_FIXUP_5ST] = {
1415 .type = HDA_FIXUP_PINS,
1416 .v.pins = (const struct hda_pintbl[]) {
1417 { 0x1e, 0x411111f0 }, /* N/A */
1420 .chained = true,
1421 .chain_id = ALC880_FIXUP_5ST_BASE,
1423 [ALC880_FIXUP_5ST_DIG] = {
1424 .type = HDA_FIXUP_PINS,
1425 .v.pins = (const struct hda_pintbl[]) {
1426 { 0x1e, 0x0144111e }, /* SPDIF */
1429 .chained = true,
1430 .chain_id = ALC880_FIXUP_5ST_BASE,
1432 [ALC880_FIXUP_6ST_BASE] = {
1433 .type = HDA_FIXUP_PINS,
1434 .v.pins = (const struct hda_pintbl[]) {
1435 { 0x14, 0x01014010 }, /* front */
1436 { 0x15, 0x01016412 }, /* surr */
1437 { 0x16, 0x01011411 }, /* CLFE */
1438 { 0x17, 0x01012414 }, /* side */
1439 { 0x18, 0x01a19c30 }, /* mic-in */
1440 { 0x19, 0x02a19c40 }, /* front-mic */
1441 { 0x1a, 0x01813031 }, /* line-in */
1442 { 0x1b, 0x0121411f }, /* HP */
1443 { 0x1c, 0x411111f0 }, /* N/A */
1444 { 0x1d, 0x411111f0 }, /* N/A */
1445 /* 0x1e is filled in below */
1446 { 0x1f, 0x411111f0 }, /* N/A */
1450 [ALC880_FIXUP_6ST] = {
1451 .type = HDA_FIXUP_PINS,
1452 .v.pins = (const struct hda_pintbl[]) {
1453 { 0x1e, 0x411111f0 }, /* N/A */
1456 .chained = true,
1457 .chain_id = ALC880_FIXUP_6ST_BASE,
1459 [ALC880_FIXUP_6ST_DIG] = {
1460 .type = HDA_FIXUP_PINS,
1461 .v.pins = (const struct hda_pintbl[]) {
1462 { 0x1e, 0x0144111e }, /* SPDIF */
1465 .chained = true,
1466 .chain_id = ALC880_FIXUP_6ST_BASE,
1468 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1469 .type = HDA_FIXUP_PINS,
1470 .v.pins = (const struct hda_pintbl[]) {
1471 { 0x1b, 0x0121401f }, /* HP with jack detect */
1474 .chained_before = true,
1475 .chain_id = ALC880_FIXUP_6ST_BASE,
1479 static const struct snd_pci_quirk alc880_fixup_tbl[] = {
1480 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
1481 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
1482 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
1483 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
1484 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
1485 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
1486 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
1487 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
1488 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
1489 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
1490 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
1491 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
1492 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
1493 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
1494 SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
1495 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
1496 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
1497 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
1498 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1499 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1500 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
1501 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
1502 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
1504 /* Below is the copied entries from alc880_quirks.c.
1505 * It's not quite sure whether BIOS sets the correct pin-config table
1506 * on these machines, thus they are kept to be compatible with
1507 * the old static quirks. Once when it's confirmed to work without
1508 * these overrides, it'd be better to remove.
1510 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1511 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1512 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1513 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1514 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1515 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1516 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1517 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1518 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1519 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1520 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1521 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1522 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1523 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1524 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1525 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1526 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1527 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1528 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1529 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1530 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1531 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1532 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1533 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1534 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1535 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1536 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1537 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1538 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1539 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1540 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1541 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1542 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1543 /* default Intel */
1544 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1545 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1546 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1550 static const struct hda_model_fixup alc880_fixup_models[] = {
1551 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1552 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1553 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1554 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1555 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1556 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
1557 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
1563 * OK, here we have finally the patch for ALC880
1565 static int patch_alc880(struct hda_codec *codec)
1567 struct alc_spec *spec;
1568 int err;
1570 err = alc_alloc_spec(codec, 0x0b);
1571 if (err < 0)
1572 return err;
1574 spec = codec->spec;
1575 spec->gen.need_dac_fix = 1;
1576 spec->gen.beep_nid = 0x01;
1578 codec->patch_ops.unsol_event = alc880_unsol_event;
1580 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
1581 alc880_fixups);
1582 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1584 /* automatic parse from the BIOS config */
1585 err = alc880_parse_auto_config(codec);
1586 if (err < 0)
1587 goto error;
1589 if (!spec->gen.no_analog) {
1590 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1591 if (err < 0)
1592 goto error;
1595 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1597 return 0;
1599 error:
1600 alc_free(codec);
1601 return err;
1606 * ALC260 support
1608 static int alc260_parse_auto_config(struct hda_codec *codec)
1610 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
1611 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1612 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
1616 * Pin config fixes
1618 enum {
1619 ALC260_FIXUP_HP_DC5750,
1620 ALC260_FIXUP_HP_PIN_0F,
1621 ALC260_FIXUP_COEF,
1622 ALC260_FIXUP_GPIO1,
1623 ALC260_FIXUP_GPIO1_TOGGLE,
1624 ALC260_FIXUP_REPLACER,
1625 ALC260_FIXUP_HP_B1900,
1626 ALC260_FIXUP_KN1,
1627 ALC260_FIXUP_FSC_S7020,
1628 ALC260_FIXUP_FSC_S7020_JWSE,
1629 ALC260_FIXUP_VAIO_PINS,
1632 static void alc260_gpio1_automute(struct hda_codec *codec)
1634 struct alc_spec *spec = codec->spec;
1636 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
1639 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1640 const struct hda_fixup *fix, int action)
1642 struct alc_spec *spec = codec->spec;
1643 if (action == HDA_FIXUP_ACT_PROBE) {
1644 /* although the machine has only one output pin, we need to
1645 * toggle GPIO1 according to the jack state
1647 spec->gen.automute_hook = alc260_gpio1_automute;
1648 spec->gen.detect_hp = 1;
1649 spec->gen.automute_speaker = 1;
1650 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
1651 snd_hda_jack_detect_enable_callback(codec, 0x0f,
1652 snd_hda_gen_hp_automute);
1653 alc_setup_gpio(codec, 0x01);
1657 static void alc260_fixup_kn1(struct hda_codec *codec,
1658 const struct hda_fixup *fix, int action)
1660 struct alc_spec *spec = codec->spec;
1661 static const struct hda_pintbl pincfgs[] = {
1662 { 0x0f, 0x02214000 }, /* HP/speaker */
1663 { 0x12, 0x90a60160 }, /* int mic */
1664 { 0x13, 0x02a19000 }, /* ext mic */
1665 { 0x18, 0x01446000 }, /* SPDIF out */
1666 /* disable bogus I/O pins */
1667 { 0x10, 0x411111f0 },
1668 { 0x11, 0x411111f0 },
1669 { 0x14, 0x411111f0 },
1670 { 0x15, 0x411111f0 },
1671 { 0x16, 0x411111f0 },
1672 { 0x17, 0x411111f0 },
1673 { 0x19, 0x411111f0 },
1677 switch (action) {
1678 case HDA_FIXUP_ACT_PRE_PROBE:
1679 snd_hda_apply_pincfgs(codec, pincfgs);
1680 spec->init_amp = ALC_INIT_NONE;
1681 break;
1685 static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1686 const struct hda_fixup *fix, int action)
1688 struct alc_spec *spec = codec->spec;
1689 if (action == HDA_FIXUP_ACT_PRE_PROBE)
1690 spec->init_amp = ALC_INIT_NONE;
1693 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1694 const struct hda_fixup *fix, int action)
1696 struct alc_spec *spec = codec->spec;
1697 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1698 spec->gen.add_jack_modes = 1;
1699 spec->gen.hp_mic = 1;
1703 static const struct hda_fixup alc260_fixups[] = {
1704 [ALC260_FIXUP_HP_DC5750] = {
1705 .type = HDA_FIXUP_PINS,
1706 .v.pins = (const struct hda_pintbl[]) {
1707 { 0x11, 0x90130110 }, /* speaker */
1711 [ALC260_FIXUP_HP_PIN_0F] = {
1712 .type = HDA_FIXUP_PINS,
1713 .v.pins = (const struct hda_pintbl[]) {
1714 { 0x0f, 0x01214000 }, /* HP */
1718 [ALC260_FIXUP_COEF] = {
1719 .type = HDA_FIXUP_VERBS,
1720 .v.verbs = (const struct hda_verb[]) {
1721 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1722 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
1726 [ALC260_FIXUP_GPIO1] = {
1727 .type = HDA_FIXUP_FUNC,
1728 .v.func = alc_fixup_gpio1,
1730 [ALC260_FIXUP_GPIO1_TOGGLE] = {
1731 .type = HDA_FIXUP_FUNC,
1732 .v.func = alc260_fixup_gpio1_toggle,
1733 .chained = true,
1734 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1736 [ALC260_FIXUP_REPLACER] = {
1737 .type = HDA_FIXUP_VERBS,
1738 .v.verbs = (const struct hda_verb[]) {
1739 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1740 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
1743 .chained = true,
1744 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1746 [ALC260_FIXUP_HP_B1900] = {
1747 .type = HDA_FIXUP_FUNC,
1748 .v.func = alc260_fixup_gpio1_toggle,
1749 .chained = true,
1750 .chain_id = ALC260_FIXUP_COEF,
1752 [ALC260_FIXUP_KN1] = {
1753 .type = HDA_FIXUP_FUNC,
1754 .v.func = alc260_fixup_kn1,
1756 [ALC260_FIXUP_FSC_S7020] = {
1757 .type = HDA_FIXUP_FUNC,
1758 .v.func = alc260_fixup_fsc_s7020,
1760 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1761 .type = HDA_FIXUP_FUNC,
1762 .v.func = alc260_fixup_fsc_s7020_jwse,
1763 .chained = true,
1764 .chain_id = ALC260_FIXUP_FSC_S7020,
1766 [ALC260_FIXUP_VAIO_PINS] = {
1767 .type = HDA_FIXUP_PINS,
1768 .v.pins = (const struct hda_pintbl[]) {
1769 /* Pin configs are missing completely on some VAIOs */
1770 { 0x0f, 0x01211020 },
1771 { 0x10, 0x0001003f },
1772 { 0x11, 0x411111f0 },
1773 { 0x12, 0x01a15930 },
1774 { 0x13, 0x411111f0 },
1775 { 0x14, 0x411111f0 },
1776 { 0x15, 0x411111f0 },
1777 { 0x16, 0x411111f0 },
1778 { 0x17, 0x411111f0 },
1779 { 0x18, 0x411111f0 },
1780 { 0x19, 0x411111f0 },
1786 static const struct snd_pci_quirk alc260_fixup_tbl[] = {
1787 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
1788 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
1789 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
1790 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
1791 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
1792 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
1793 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
1794 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
1795 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
1796 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
1797 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
1798 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
1802 static const struct hda_model_fixup alc260_fixup_models[] = {
1803 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1804 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1805 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1806 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1812 static int patch_alc260(struct hda_codec *codec)
1814 struct alc_spec *spec;
1815 int err;
1817 err = alc_alloc_spec(codec, 0x07);
1818 if (err < 0)
1819 return err;
1821 spec = codec->spec;
1822 /* as quite a few machines require HP amp for speaker outputs,
1823 * it's easier to enable it unconditionally; even if it's unneeded,
1824 * it's almost harmless.
1826 spec->gen.prefer_hp_amp = 1;
1827 spec->gen.beep_nid = 0x01;
1829 spec->shutup = alc_eapd_shutup;
1831 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1832 alc260_fixups);
1833 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1835 /* automatic parse from the BIOS config */
1836 err = alc260_parse_auto_config(codec);
1837 if (err < 0)
1838 goto error;
1840 if (!spec->gen.no_analog) {
1841 err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1842 if (err < 0)
1843 goto error;
1846 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1848 return 0;
1850 error:
1851 alc_free(codec);
1852 return err;
1857 * ALC882/883/885/888/889 support
1859 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1860 * configuration. Each pin widget can choose any input DACs and a mixer.
1861 * Each ADC is connected from a mixer of all inputs. This makes possible
1862 * 6-channel independent captures.
1864 * In addition, an independent DAC for the multi-playback (not used in this
1865 * driver yet).
1869 * Pin config fixes
1871 enum {
1872 ALC882_FIXUP_ABIT_AW9D_MAX,
1873 ALC882_FIXUP_LENOVO_Y530,
1874 ALC882_FIXUP_PB_M5210,
1875 ALC882_FIXUP_ACER_ASPIRE_7736,
1876 ALC882_FIXUP_ASUS_W90V,
1877 ALC889_FIXUP_CD,
1878 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
1879 ALC889_FIXUP_VAIO_TT,
1880 ALC888_FIXUP_EEE1601,
1881 ALC882_FIXUP_EAPD,
1882 ALC883_FIXUP_EAPD,
1883 ALC883_FIXUP_ACER_EAPD,
1884 ALC882_FIXUP_GPIO1,
1885 ALC882_FIXUP_GPIO2,
1886 ALC882_FIXUP_GPIO3,
1887 ALC889_FIXUP_COEF,
1888 ALC882_FIXUP_ASUS_W2JC,
1889 ALC882_FIXUP_ACER_ASPIRE_4930G,
1890 ALC882_FIXUP_ACER_ASPIRE_8930G,
1891 ALC882_FIXUP_ASPIRE_8930G_VERBS,
1892 ALC885_FIXUP_MACPRO_GPIO,
1893 ALC889_FIXUP_DAC_ROUTE,
1894 ALC889_FIXUP_MBP_VREF,
1895 ALC889_FIXUP_IMAC91_VREF,
1896 ALC889_FIXUP_MBA11_VREF,
1897 ALC889_FIXUP_MBA21_VREF,
1898 ALC889_FIXUP_MP11_VREF,
1899 ALC889_FIXUP_MP41_VREF,
1900 ALC882_FIXUP_INV_DMIC,
1901 ALC882_FIXUP_NO_PRIMARY_HP,
1902 ALC887_FIXUP_ASUS_BASS,
1903 ALC887_FIXUP_BASS_CHMAP,
1904 ALC1220_FIXUP_GB_DUAL_CODECS,
1905 ALC1220_FIXUP_CLEVO_P950,
1906 ALC1220_FIXUP_CLEVO_PB51ED,
1907 ALC1220_FIXUP_CLEVO_PB51ED_PINS,
1910 static void alc889_fixup_coef(struct hda_codec *codec,
1911 const struct hda_fixup *fix, int action)
1913 if (action != HDA_FIXUP_ACT_INIT)
1914 return;
1915 alc_update_coef_idx(codec, 7, 0, 0x2030);
1918 /* set up GPIO at initialization */
1919 static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
1920 const struct hda_fixup *fix, int action)
1922 struct alc_spec *spec = codec->spec;
1924 spec->gpio_write_delay = true;
1925 alc_fixup_gpio3(codec, fix, action);
1928 /* Fix the connection of some pins for ALC889:
1929 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
1930 * work correctly (bko#42740)
1932 static void alc889_fixup_dac_route(struct hda_codec *codec,
1933 const struct hda_fixup *fix, int action)
1935 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1936 /* fake the connections during parsing the tree */
1937 hda_nid_t conn1[2] = { 0x0c, 0x0d };
1938 hda_nid_t conn2[2] = { 0x0e, 0x0f };
1939 snd_hda_override_conn_list(codec, 0x14, 2, conn1);
1940 snd_hda_override_conn_list(codec, 0x15, 2, conn1);
1941 snd_hda_override_conn_list(codec, 0x18, 2, conn2);
1942 snd_hda_override_conn_list(codec, 0x1a, 2, conn2);
1943 } else if (action == HDA_FIXUP_ACT_PROBE) {
1944 /* restore the connections */
1945 hda_nid_t conn[5] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
1946 snd_hda_override_conn_list(codec, 0x14, 5, conn);
1947 snd_hda_override_conn_list(codec, 0x15, 5, conn);
1948 snd_hda_override_conn_list(codec, 0x18, 5, conn);
1949 snd_hda_override_conn_list(codec, 0x1a, 5, conn);
1953 /* Set VREF on HP pin */
1954 static void alc889_fixup_mbp_vref(struct hda_codec *codec,
1955 const struct hda_fixup *fix, int action)
1957 struct alc_spec *spec = codec->spec;
1958 static hda_nid_t nids[3] = { 0x14, 0x15, 0x19 };
1959 int i;
1961 if (action != HDA_FIXUP_ACT_INIT)
1962 return;
1963 for (i = 0; i < ARRAY_SIZE(nids); i++) {
1964 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
1965 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
1966 continue;
1967 val = snd_hda_codec_get_pin_target(codec, nids[i]);
1968 val |= AC_PINCTL_VREF_80;
1969 snd_hda_set_pin_ctl(codec, nids[i], val);
1970 spec->gen.keep_vref_in_automute = 1;
1971 break;
1975 static void alc889_fixup_mac_pins(struct hda_codec *codec,
1976 const hda_nid_t *nids, int num_nids)
1978 struct alc_spec *spec = codec->spec;
1979 int i;
1981 for (i = 0; i < num_nids; i++) {
1982 unsigned int val;
1983 val = snd_hda_codec_get_pin_target(codec, nids[i]);
1984 val |= AC_PINCTL_VREF_50;
1985 snd_hda_set_pin_ctl(codec, nids[i], val);
1987 spec->gen.keep_vref_in_automute = 1;
1990 /* Set VREF on speaker pins on imac91 */
1991 static void alc889_fixup_imac91_vref(struct hda_codec *codec,
1992 const struct hda_fixup *fix, int action)
1994 static hda_nid_t nids[2] = { 0x18, 0x1a };
1996 if (action == HDA_FIXUP_ACT_INIT)
1997 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2000 /* Set VREF on speaker pins on mba11 */
2001 static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2002 const struct hda_fixup *fix, int action)
2004 static hda_nid_t nids[1] = { 0x18 };
2006 if (action == HDA_FIXUP_ACT_INIT)
2007 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2010 /* Set VREF on speaker pins on mba21 */
2011 static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2012 const struct hda_fixup *fix, int action)
2014 static hda_nid_t nids[2] = { 0x18, 0x19 };
2016 if (action == HDA_FIXUP_ACT_INIT)
2017 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2020 /* Don't take HP output as primary
2021 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2022 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
2024 static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
2025 const struct hda_fixup *fix, int action)
2027 struct alc_spec *spec = codec->spec;
2028 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2029 spec->gen.no_primary_hp = 1;
2030 spec->gen.no_multi_io = 1;
2034 static void alc_fixup_bass_chmap(struct hda_codec *codec,
2035 const struct hda_fixup *fix, int action);
2037 /* For dual-codec configuration, we need to disable some features to avoid
2038 * conflicts of kctls and PCM streams
2040 static void alc_fixup_dual_codecs(struct hda_codec *codec,
2041 const struct hda_fixup *fix, int action)
2043 struct alc_spec *spec = codec->spec;
2045 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2046 return;
2047 /* disable vmaster */
2048 spec->gen.suppress_vmaster = 1;
2049 /* auto-mute and auto-mic switch don't work with multiple codecs */
2050 spec->gen.suppress_auto_mute = 1;
2051 spec->gen.suppress_auto_mic = 1;
2052 /* disable aamix as well */
2053 spec->gen.mixer_nid = 0;
2054 /* add location prefix to avoid conflicts */
2055 codec->force_pin_prefix = 1;
2058 static void rename_ctl(struct hda_codec *codec, const char *oldname,
2059 const char *newname)
2061 struct snd_kcontrol *kctl;
2063 kctl = snd_hda_find_mixer_ctl(codec, oldname);
2064 if (kctl)
2065 strcpy(kctl->id.name, newname);
2068 static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2069 const struct hda_fixup *fix,
2070 int action)
2072 alc_fixup_dual_codecs(codec, fix, action);
2073 switch (action) {
2074 case HDA_FIXUP_ACT_PRE_PROBE:
2075 /* override card longname to provide a unique UCM profile */
2076 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2077 break;
2078 case HDA_FIXUP_ACT_BUILD:
2079 /* rename Capture controls depending on the codec */
2080 rename_ctl(codec, "Capture Volume",
2081 codec->addr == 0 ?
2082 "Rear-Panel Capture Volume" :
2083 "Front-Panel Capture Volume");
2084 rename_ctl(codec, "Capture Switch",
2085 codec->addr == 0 ?
2086 "Rear-Panel Capture Switch" :
2087 "Front-Panel Capture Switch");
2088 break;
2092 static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2093 const struct hda_fixup *fix,
2094 int action)
2096 hda_nid_t conn1[1] = { 0x0c };
2098 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2099 return;
2101 alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2102 /* We therefore want to make sure 0x14 (front headphone) and
2103 * 0x1b (speakers) use the stereo DAC 0x02
2105 snd_hda_override_conn_list(codec, 0x14, 1, conn1);
2106 snd_hda_override_conn_list(codec, 0x1b, 1, conn1);
2109 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2110 const struct hda_fixup *fix, int action);
2112 static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
2113 const struct hda_fixup *fix,
2114 int action)
2116 alc1220_fixup_clevo_p950(codec, fix, action);
2117 alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2120 static const struct hda_fixup alc882_fixups[] = {
2121 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
2122 .type = HDA_FIXUP_PINS,
2123 .v.pins = (const struct hda_pintbl[]) {
2124 { 0x15, 0x01080104 }, /* side */
2125 { 0x16, 0x01011012 }, /* rear */
2126 { 0x17, 0x01016011 }, /* clfe */
2130 [ALC882_FIXUP_LENOVO_Y530] = {
2131 .type = HDA_FIXUP_PINS,
2132 .v.pins = (const struct hda_pintbl[]) {
2133 { 0x15, 0x99130112 }, /* rear int speakers */
2134 { 0x16, 0x99130111 }, /* subwoofer */
2138 [ALC882_FIXUP_PB_M5210] = {
2139 .type = HDA_FIXUP_PINCTLS,
2140 .v.pins = (const struct hda_pintbl[]) {
2141 { 0x19, PIN_VREF50 },
2145 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
2146 .type = HDA_FIXUP_FUNC,
2147 .v.func = alc_fixup_sku_ignore,
2149 [ALC882_FIXUP_ASUS_W90V] = {
2150 .type = HDA_FIXUP_PINS,
2151 .v.pins = (const struct hda_pintbl[]) {
2152 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
2156 [ALC889_FIXUP_CD] = {
2157 .type = HDA_FIXUP_PINS,
2158 .v.pins = (const struct hda_pintbl[]) {
2159 { 0x1c, 0x993301f0 }, /* CD */
2163 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2164 .type = HDA_FIXUP_PINS,
2165 .v.pins = (const struct hda_pintbl[]) {
2166 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2169 .chained = true,
2170 .chain_id = ALC889_FIXUP_CD,
2172 [ALC889_FIXUP_VAIO_TT] = {
2173 .type = HDA_FIXUP_PINS,
2174 .v.pins = (const struct hda_pintbl[]) {
2175 { 0x17, 0x90170111 }, /* hidden surround speaker */
2179 [ALC888_FIXUP_EEE1601] = {
2180 .type = HDA_FIXUP_VERBS,
2181 .v.verbs = (const struct hda_verb[]) {
2182 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2183 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
2187 [ALC882_FIXUP_EAPD] = {
2188 .type = HDA_FIXUP_VERBS,
2189 .v.verbs = (const struct hda_verb[]) {
2190 /* change to EAPD mode */
2191 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2192 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2196 [ALC883_FIXUP_EAPD] = {
2197 .type = HDA_FIXUP_VERBS,
2198 .v.verbs = (const struct hda_verb[]) {
2199 /* change to EAPD mode */
2200 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2201 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2205 [ALC883_FIXUP_ACER_EAPD] = {
2206 .type = HDA_FIXUP_VERBS,
2207 .v.verbs = (const struct hda_verb[]) {
2208 /* eanable EAPD on Acer laptops */
2209 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2210 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2214 [ALC882_FIXUP_GPIO1] = {
2215 .type = HDA_FIXUP_FUNC,
2216 .v.func = alc_fixup_gpio1,
2218 [ALC882_FIXUP_GPIO2] = {
2219 .type = HDA_FIXUP_FUNC,
2220 .v.func = alc_fixup_gpio2,
2222 [ALC882_FIXUP_GPIO3] = {
2223 .type = HDA_FIXUP_FUNC,
2224 .v.func = alc_fixup_gpio3,
2226 [ALC882_FIXUP_ASUS_W2JC] = {
2227 .type = HDA_FIXUP_FUNC,
2228 .v.func = alc_fixup_gpio1,
2229 .chained = true,
2230 .chain_id = ALC882_FIXUP_EAPD,
2232 [ALC889_FIXUP_COEF] = {
2233 .type = HDA_FIXUP_FUNC,
2234 .v.func = alc889_fixup_coef,
2236 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
2237 .type = HDA_FIXUP_PINS,
2238 .v.pins = (const struct hda_pintbl[]) {
2239 { 0x16, 0x99130111 }, /* CLFE speaker */
2240 { 0x17, 0x99130112 }, /* surround speaker */
2243 .chained = true,
2244 .chain_id = ALC882_FIXUP_GPIO1,
2246 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
2247 .type = HDA_FIXUP_PINS,
2248 .v.pins = (const struct hda_pintbl[]) {
2249 { 0x16, 0x99130111 }, /* CLFE speaker */
2250 { 0x1b, 0x99130112 }, /* surround speaker */
2253 .chained = true,
2254 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2256 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2257 /* additional init verbs for Acer Aspire 8930G */
2258 .type = HDA_FIXUP_VERBS,
2259 .v.verbs = (const struct hda_verb[]) {
2260 /* Enable all DACs */
2261 /* DAC DISABLE/MUTE 1? */
2262 /* setting bits 1-5 disables DAC nids 0x02-0x06
2263 * apparently. Init=0x38 */
2264 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2265 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2266 /* DAC DISABLE/MUTE 2? */
2267 /* some bit here disables the other DACs.
2268 * Init=0x4900 */
2269 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2270 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2271 /* DMIC fix
2272 * This laptop has a stereo digital microphone.
2273 * The mics are only 1cm apart which makes the stereo
2274 * useless. However, either the mic or the ALC889
2275 * makes the signal become a difference/sum signal
2276 * instead of standard stereo, which is annoying.
2277 * So instead we flip this bit which makes the
2278 * codec replicate the sum signal to both channels,
2279 * turning it into a normal mono mic.
2281 /* DMIC_CONTROL? Init value = 0x0001 */
2282 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2283 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2284 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2285 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2288 .chained = true,
2289 .chain_id = ALC882_FIXUP_GPIO1,
2291 [ALC885_FIXUP_MACPRO_GPIO] = {
2292 .type = HDA_FIXUP_FUNC,
2293 .v.func = alc885_fixup_macpro_gpio,
2295 [ALC889_FIXUP_DAC_ROUTE] = {
2296 .type = HDA_FIXUP_FUNC,
2297 .v.func = alc889_fixup_dac_route,
2299 [ALC889_FIXUP_MBP_VREF] = {
2300 .type = HDA_FIXUP_FUNC,
2301 .v.func = alc889_fixup_mbp_vref,
2302 .chained = true,
2303 .chain_id = ALC882_FIXUP_GPIO1,
2305 [ALC889_FIXUP_IMAC91_VREF] = {
2306 .type = HDA_FIXUP_FUNC,
2307 .v.func = alc889_fixup_imac91_vref,
2308 .chained = true,
2309 .chain_id = ALC882_FIXUP_GPIO1,
2311 [ALC889_FIXUP_MBA11_VREF] = {
2312 .type = HDA_FIXUP_FUNC,
2313 .v.func = alc889_fixup_mba11_vref,
2314 .chained = true,
2315 .chain_id = ALC889_FIXUP_MBP_VREF,
2317 [ALC889_FIXUP_MBA21_VREF] = {
2318 .type = HDA_FIXUP_FUNC,
2319 .v.func = alc889_fixup_mba21_vref,
2320 .chained = true,
2321 .chain_id = ALC889_FIXUP_MBP_VREF,
2323 [ALC889_FIXUP_MP11_VREF] = {
2324 .type = HDA_FIXUP_FUNC,
2325 .v.func = alc889_fixup_mba11_vref,
2326 .chained = true,
2327 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2329 [ALC889_FIXUP_MP41_VREF] = {
2330 .type = HDA_FIXUP_FUNC,
2331 .v.func = alc889_fixup_mbp_vref,
2332 .chained = true,
2333 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2335 [ALC882_FIXUP_INV_DMIC] = {
2336 .type = HDA_FIXUP_FUNC,
2337 .v.func = alc_fixup_inv_dmic,
2339 [ALC882_FIXUP_NO_PRIMARY_HP] = {
2340 .type = HDA_FIXUP_FUNC,
2341 .v.func = alc882_fixup_no_primary_hp,
2343 [ALC887_FIXUP_ASUS_BASS] = {
2344 .type = HDA_FIXUP_PINS,
2345 .v.pins = (const struct hda_pintbl[]) {
2346 {0x16, 0x99130130}, /* bass speaker */
2349 .chained = true,
2350 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2352 [ALC887_FIXUP_BASS_CHMAP] = {
2353 .type = HDA_FIXUP_FUNC,
2354 .v.func = alc_fixup_bass_chmap,
2356 [ALC1220_FIXUP_GB_DUAL_CODECS] = {
2357 .type = HDA_FIXUP_FUNC,
2358 .v.func = alc1220_fixup_gb_dual_codecs,
2360 [ALC1220_FIXUP_CLEVO_P950] = {
2361 .type = HDA_FIXUP_FUNC,
2362 .v.func = alc1220_fixup_clevo_p950,
2364 [ALC1220_FIXUP_CLEVO_PB51ED] = {
2365 .type = HDA_FIXUP_FUNC,
2366 .v.func = alc1220_fixup_clevo_pb51ed,
2368 [ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
2369 .type = HDA_FIXUP_PINS,
2370 .v.pins = (const struct hda_pintbl[]) {
2371 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2374 .chained = true,
2375 .chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
2379 static const struct snd_pci_quirk alc882_fixup_tbl[] = {
2380 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2381 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2382 SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2383 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2384 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2385 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2386 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
2387 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2388 ALC882_FIXUP_ACER_ASPIRE_4930G),
2389 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2390 ALC882_FIXUP_ACER_ASPIRE_4930G),
2391 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2392 ALC882_FIXUP_ACER_ASPIRE_8930G),
2393 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2394 ALC882_FIXUP_ACER_ASPIRE_8930G),
2395 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2396 ALC882_FIXUP_ACER_ASPIRE_4930G),
2397 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2398 ALC882_FIXUP_ACER_ASPIRE_4930G),
2399 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2400 ALC882_FIXUP_ACER_ASPIRE_4930G),
2401 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
2402 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2403 ALC882_FIXUP_ACER_ASPIRE_4930G),
2404 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
2405 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
2406 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
2407 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
2408 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
2409 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
2410 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
2411 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
2412 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
2413 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
2414 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
2415 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
2416 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2417 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
2419 /* All Apple entries are in codec SSIDs */
2420 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2421 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2422 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2423 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
2424 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2425 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
2426 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2427 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
2428 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
2429 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
2430 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
2431 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2432 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2433 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
2434 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2435 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2436 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
2437 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
2438 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
2439 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2440 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
2441 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
2443 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
2444 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
2445 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2446 SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_CLEVO_P950),
2447 SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_CLEVO_P950),
2448 SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
2449 SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
2450 SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
2451 SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
2452 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
2453 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2454 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
2455 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
2456 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
2457 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2458 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
2459 SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2460 SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
2461 SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2462 SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2463 SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2464 SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2465 SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2466 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2467 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
2468 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
2469 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
2473 static const struct hda_model_fixup alc882_fixup_models[] = {
2474 {.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2475 {.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2476 {.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2477 {.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2478 {.id = ALC889_FIXUP_CD, .name = "cd"},
2479 {.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2480 {.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2481 {.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2482 {.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2483 {.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2484 {.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2485 {.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2486 {.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2487 {.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2488 {.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
2489 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2490 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2491 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
2492 {.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2493 {.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2494 {.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2495 {.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2496 {.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2497 {.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2498 {.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2499 {.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
2500 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
2501 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
2502 {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
2503 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
2504 {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
2509 * BIOS auto configuration
2511 /* almost identical with ALC880 parser... */
2512 static int alc882_parse_auto_config(struct hda_codec *codec)
2514 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
2515 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2516 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
2521 static int patch_alc882(struct hda_codec *codec)
2523 struct alc_spec *spec;
2524 int err;
2526 err = alc_alloc_spec(codec, 0x0b);
2527 if (err < 0)
2528 return err;
2530 spec = codec->spec;
2532 switch (codec->core.vendor_id) {
2533 case 0x10ec0882:
2534 case 0x10ec0885:
2535 case 0x10ec0900:
2536 case 0x10ec0b00:
2537 case 0x10ec1220:
2538 break;
2539 default:
2540 /* ALC883 and variants */
2541 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2542 break;
2545 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
2546 alc882_fixups);
2547 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2549 alc_auto_parse_customize_define(codec);
2551 if (has_cdefine_beep(codec))
2552 spec->gen.beep_nid = 0x01;
2554 /* automatic parse from the BIOS config */
2555 err = alc882_parse_auto_config(codec);
2556 if (err < 0)
2557 goto error;
2559 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2560 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2561 if (err < 0)
2562 goto error;
2565 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2567 return 0;
2569 error:
2570 alc_free(codec);
2571 return err;
2576 * ALC262 support
2578 static int alc262_parse_auto_config(struct hda_codec *codec)
2580 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
2581 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2582 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
2586 * Pin config fixes
2588 enum {
2589 ALC262_FIXUP_FSC_H270,
2590 ALC262_FIXUP_FSC_S7110,
2591 ALC262_FIXUP_HP_Z200,
2592 ALC262_FIXUP_TYAN,
2593 ALC262_FIXUP_LENOVO_3000,
2594 ALC262_FIXUP_BENQ,
2595 ALC262_FIXUP_BENQ_T31,
2596 ALC262_FIXUP_INV_DMIC,
2597 ALC262_FIXUP_INTEL_BAYLEYBAY,
2600 static const struct hda_fixup alc262_fixups[] = {
2601 [ALC262_FIXUP_FSC_H270] = {
2602 .type = HDA_FIXUP_PINS,
2603 .v.pins = (const struct hda_pintbl[]) {
2604 { 0x14, 0x99130110 }, /* speaker */
2605 { 0x15, 0x0221142f }, /* front HP */
2606 { 0x1b, 0x0121141f }, /* rear HP */
2610 [ALC262_FIXUP_FSC_S7110] = {
2611 .type = HDA_FIXUP_PINS,
2612 .v.pins = (const struct hda_pintbl[]) {
2613 { 0x15, 0x90170110 }, /* speaker */
2616 .chained = true,
2617 .chain_id = ALC262_FIXUP_BENQ,
2619 [ALC262_FIXUP_HP_Z200] = {
2620 .type = HDA_FIXUP_PINS,
2621 .v.pins = (const struct hda_pintbl[]) {
2622 { 0x16, 0x99130120 }, /* internal speaker */
2626 [ALC262_FIXUP_TYAN] = {
2627 .type = HDA_FIXUP_PINS,
2628 .v.pins = (const struct hda_pintbl[]) {
2629 { 0x14, 0x1993e1f0 }, /* int AUX */
2633 [ALC262_FIXUP_LENOVO_3000] = {
2634 .type = HDA_FIXUP_PINCTLS,
2635 .v.pins = (const struct hda_pintbl[]) {
2636 { 0x19, PIN_VREF50 },
2639 .chained = true,
2640 .chain_id = ALC262_FIXUP_BENQ,
2642 [ALC262_FIXUP_BENQ] = {
2643 .type = HDA_FIXUP_VERBS,
2644 .v.verbs = (const struct hda_verb[]) {
2645 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2646 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2650 [ALC262_FIXUP_BENQ_T31] = {
2651 .type = HDA_FIXUP_VERBS,
2652 .v.verbs = (const struct hda_verb[]) {
2653 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2654 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2658 [ALC262_FIXUP_INV_DMIC] = {
2659 .type = HDA_FIXUP_FUNC,
2660 .v.func = alc_fixup_inv_dmic,
2662 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2663 .type = HDA_FIXUP_FUNC,
2664 .v.func = alc_fixup_no_depop_delay,
2668 static const struct snd_pci_quirk alc262_fixup_tbl[] = {
2669 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
2670 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
2671 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
2672 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
2673 SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
2674 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
2675 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
2676 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2677 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
2678 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
2682 static const struct hda_model_fixup alc262_fixup_models[] = {
2683 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
2684 {.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2685 {.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2686 {.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2687 {.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2688 {.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2689 {.id = ALC262_FIXUP_BENQ, .name = "benq"},
2690 {.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2691 {.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
2697 static int patch_alc262(struct hda_codec *codec)
2699 struct alc_spec *spec;
2700 int err;
2702 err = alc_alloc_spec(codec, 0x0b);
2703 if (err < 0)
2704 return err;
2706 spec = codec->spec;
2707 spec->gen.shared_mic_vref_pin = 0x18;
2709 spec->shutup = alc_eapd_shutup;
2711 #if 0
2712 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2713 * under-run
2715 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
2716 #endif
2717 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2719 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
2720 alc262_fixups);
2721 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2723 alc_auto_parse_customize_define(codec);
2725 if (has_cdefine_beep(codec))
2726 spec->gen.beep_nid = 0x01;
2728 /* automatic parse from the BIOS config */
2729 err = alc262_parse_auto_config(codec);
2730 if (err < 0)
2731 goto error;
2733 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2734 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2735 if (err < 0)
2736 goto error;
2739 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2741 return 0;
2743 error:
2744 alc_free(codec);
2745 return err;
2749 * ALC268
2751 /* bind Beep switches of both NID 0x0f and 0x10 */
2752 static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2753 struct snd_ctl_elem_value *ucontrol)
2755 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2756 unsigned long pval;
2757 int err;
2759 mutex_lock(&codec->control_mutex);
2760 pval = kcontrol->private_value;
2761 kcontrol->private_value = (pval & ~0xff) | 0x0f;
2762 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2763 if (err >= 0) {
2764 kcontrol->private_value = (pval & ~0xff) | 0x10;
2765 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2767 kcontrol->private_value = pval;
2768 mutex_unlock(&codec->control_mutex);
2769 return err;
2772 static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2773 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
2775 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2776 .name = "Beep Playback Switch",
2777 .subdevice = HDA_SUBDEV_AMP_FLAG,
2778 .info = snd_hda_mixer_amp_switch_info,
2779 .get = snd_hda_mixer_amp_switch_get,
2780 .put = alc268_beep_switch_put,
2781 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
2785 /* set PCBEEP vol = 0, mute connections */
2786 static const struct hda_verb alc268_beep_init_verbs[] = {
2787 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2788 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2789 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2793 enum {
2794 ALC268_FIXUP_INV_DMIC,
2795 ALC268_FIXUP_HP_EAPD,
2796 ALC268_FIXUP_SPDIF,
2799 static const struct hda_fixup alc268_fixups[] = {
2800 [ALC268_FIXUP_INV_DMIC] = {
2801 .type = HDA_FIXUP_FUNC,
2802 .v.func = alc_fixup_inv_dmic,
2804 [ALC268_FIXUP_HP_EAPD] = {
2805 .type = HDA_FIXUP_VERBS,
2806 .v.verbs = (const struct hda_verb[]) {
2807 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
2811 [ALC268_FIXUP_SPDIF] = {
2812 .type = HDA_FIXUP_PINS,
2813 .v.pins = (const struct hda_pintbl[]) {
2814 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
2820 static const struct hda_model_fixup alc268_fixup_models[] = {
2821 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
2822 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
2823 {.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
2827 static const struct snd_pci_quirk alc268_fixup_tbl[] = {
2828 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
2829 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
2830 /* below is codec SSID since multiple Toshiba laptops have the
2831 * same PCI SSID 1179:ff00
2833 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
2838 * BIOS auto configuration
2840 static int alc268_parse_auto_config(struct hda_codec *codec)
2842 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2843 return alc_parse_auto_config(codec, NULL, alc268_ssids);
2848 static int patch_alc268(struct hda_codec *codec)
2850 struct alc_spec *spec;
2851 int i, err;
2853 /* ALC268 has no aa-loopback mixer */
2854 err = alc_alloc_spec(codec, 0);
2855 if (err < 0)
2856 return err;
2858 spec = codec->spec;
2859 spec->gen.beep_nid = 0x01;
2861 spec->shutup = alc_eapd_shutup;
2863 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
2864 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2866 /* automatic parse from the BIOS config */
2867 err = alc268_parse_auto_config(codec);
2868 if (err < 0)
2869 goto error;
2871 if (err > 0 && !spec->gen.no_analog &&
2872 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
2873 for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
2874 if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
2875 &alc268_beep_mixer[i])) {
2876 err = -ENOMEM;
2877 goto error;
2880 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
2881 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
2882 /* override the amp caps for beep generator */
2883 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
2884 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
2885 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
2886 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
2887 (0 << AC_AMPCAP_MUTE_SHIFT));
2890 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2892 return 0;
2894 error:
2895 alc_free(codec);
2896 return err;
2900 * ALC269
2903 static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
2904 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
2907 static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
2908 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
2911 /* different alc269-variants */
2912 enum {
2913 ALC269_TYPE_ALC269VA,
2914 ALC269_TYPE_ALC269VB,
2915 ALC269_TYPE_ALC269VC,
2916 ALC269_TYPE_ALC269VD,
2917 ALC269_TYPE_ALC280,
2918 ALC269_TYPE_ALC282,
2919 ALC269_TYPE_ALC283,
2920 ALC269_TYPE_ALC284,
2921 ALC269_TYPE_ALC293,
2922 ALC269_TYPE_ALC286,
2923 ALC269_TYPE_ALC298,
2924 ALC269_TYPE_ALC255,
2925 ALC269_TYPE_ALC256,
2926 ALC269_TYPE_ALC257,
2927 ALC269_TYPE_ALC215,
2928 ALC269_TYPE_ALC225,
2929 ALC269_TYPE_ALC294,
2930 ALC269_TYPE_ALC300,
2931 ALC269_TYPE_ALC623,
2932 ALC269_TYPE_ALC700,
2936 * BIOS auto configuration
2938 static int alc269_parse_auto_config(struct hda_codec *codec)
2940 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
2941 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
2942 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2943 struct alc_spec *spec = codec->spec;
2944 const hda_nid_t *ssids;
2946 switch (spec->codec_variant) {
2947 case ALC269_TYPE_ALC269VA:
2948 case ALC269_TYPE_ALC269VC:
2949 case ALC269_TYPE_ALC280:
2950 case ALC269_TYPE_ALC284:
2951 case ALC269_TYPE_ALC293:
2952 ssids = alc269va_ssids;
2953 break;
2954 case ALC269_TYPE_ALC269VB:
2955 case ALC269_TYPE_ALC269VD:
2956 case ALC269_TYPE_ALC282:
2957 case ALC269_TYPE_ALC283:
2958 case ALC269_TYPE_ALC286:
2959 case ALC269_TYPE_ALC298:
2960 case ALC269_TYPE_ALC255:
2961 case ALC269_TYPE_ALC256:
2962 case ALC269_TYPE_ALC257:
2963 case ALC269_TYPE_ALC215:
2964 case ALC269_TYPE_ALC225:
2965 case ALC269_TYPE_ALC294:
2966 case ALC269_TYPE_ALC300:
2967 case ALC269_TYPE_ALC623:
2968 case ALC269_TYPE_ALC700:
2969 ssids = alc269_ssids;
2970 break;
2971 default:
2972 ssids = alc269_ssids;
2973 break;
2976 return alc_parse_auto_config(codec, alc269_ignore, ssids);
2979 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
2981 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
2984 static void alc269_shutup(struct hda_codec *codec)
2986 struct alc_spec *spec = codec->spec;
2988 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
2989 alc269vb_toggle_power_output(codec, 0);
2990 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
2991 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
2992 msleep(150);
2994 alc_shutup_pins(codec);
2997 static struct coef_fw alc282_coefs[] = {
2998 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
2999 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3000 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3001 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3002 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3003 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3004 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3005 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3006 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3007 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3008 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3009 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3010 WRITE_COEF(0x34, 0xa0c0), /* ANC */
3011 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3012 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3013 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3014 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3015 WRITE_COEF(0x63, 0x2902), /* PLL */
3016 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3017 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3018 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3019 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3020 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3021 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3022 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3023 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3024 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3025 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3026 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3030 static void alc282_restore_default_value(struct hda_codec *codec)
3032 alc_process_coef_fw(codec, alc282_coefs);
3035 static void alc282_init(struct hda_codec *codec)
3037 struct alc_spec *spec = codec->spec;
3038 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3039 bool hp_pin_sense;
3040 int coef78;
3042 alc282_restore_default_value(codec);
3044 if (!hp_pin)
3045 return;
3046 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3047 coef78 = alc_read_coef_idx(codec, 0x78);
3049 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3050 /* Headphone capless set to high power mode */
3051 alc_write_coef_idx(codec, 0x78, 0x9004);
3053 if (hp_pin_sense)
3054 msleep(2);
3056 snd_hda_codec_write(codec, hp_pin, 0,
3057 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3059 if (hp_pin_sense)
3060 msleep(85);
3062 snd_hda_codec_write(codec, hp_pin, 0,
3063 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3065 if (hp_pin_sense)
3066 msleep(100);
3068 /* Headphone capless set to normal mode */
3069 alc_write_coef_idx(codec, 0x78, coef78);
3072 static void alc282_shutup(struct hda_codec *codec)
3074 struct alc_spec *spec = codec->spec;
3075 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3076 bool hp_pin_sense;
3077 int coef78;
3079 if (!hp_pin) {
3080 alc269_shutup(codec);
3081 return;
3084 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3085 coef78 = alc_read_coef_idx(codec, 0x78);
3086 alc_write_coef_idx(codec, 0x78, 0x9004);
3088 if (hp_pin_sense)
3089 msleep(2);
3091 snd_hda_codec_write(codec, hp_pin, 0,
3092 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3094 if (hp_pin_sense)
3095 msleep(85);
3097 if (!spec->no_shutup_pins)
3098 snd_hda_codec_write(codec, hp_pin, 0,
3099 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3101 if (hp_pin_sense)
3102 msleep(100);
3104 alc_auto_setup_eapd(codec, false);
3105 alc_shutup_pins(codec);
3106 alc_write_coef_idx(codec, 0x78, coef78);
3109 static struct coef_fw alc283_coefs[] = {
3110 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3111 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3112 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3113 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3114 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3115 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3116 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3117 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3118 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3119 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3120 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3121 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3122 WRITE_COEF(0x22, 0xa0c0), /* ANC */
3123 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3124 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3125 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3126 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3127 WRITE_COEF(0x2e, 0x2902), /* PLL */
3128 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3129 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3130 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3131 WRITE_COEF(0x36, 0x0), /* capless control 5 */
3132 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3133 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3134 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3135 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3136 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3137 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3138 WRITE_COEF(0x49, 0x0), /* test mode */
3139 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3140 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3141 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
3142 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
3146 static void alc283_restore_default_value(struct hda_codec *codec)
3148 alc_process_coef_fw(codec, alc283_coefs);
3151 static void alc283_init(struct hda_codec *codec)
3153 struct alc_spec *spec = codec->spec;
3154 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3155 bool hp_pin_sense;
3157 alc283_restore_default_value(codec);
3159 if (!hp_pin)
3160 return;
3162 msleep(30);
3163 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3165 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3166 /* Headphone capless set to high power mode */
3167 alc_write_coef_idx(codec, 0x43, 0x9004);
3169 snd_hda_codec_write(codec, hp_pin, 0,
3170 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3172 if (hp_pin_sense)
3173 msleep(85);
3175 snd_hda_codec_write(codec, hp_pin, 0,
3176 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3178 if (hp_pin_sense)
3179 msleep(85);
3180 /* Index 0x46 Combo jack auto switch control 2 */
3181 /* 3k pull low control for Headset jack. */
3182 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3183 /* Headphone capless set to normal mode */
3184 alc_write_coef_idx(codec, 0x43, 0x9614);
3187 static void alc283_shutup(struct hda_codec *codec)
3189 struct alc_spec *spec = codec->spec;
3190 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3191 bool hp_pin_sense;
3193 if (!hp_pin) {
3194 alc269_shutup(codec);
3195 return;
3198 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3200 alc_write_coef_idx(codec, 0x43, 0x9004);
3202 /*depop hp during suspend*/
3203 alc_write_coef_idx(codec, 0x06, 0x2100);
3205 snd_hda_codec_write(codec, hp_pin, 0,
3206 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3208 if (hp_pin_sense)
3209 msleep(100);
3211 if (!spec->no_shutup_pins)
3212 snd_hda_codec_write(codec, hp_pin, 0,
3213 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3215 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3217 if (hp_pin_sense)
3218 msleep(100);
3219 alc_auto_setup_eapd(codec, false);
3220 alc_shutup_pins(codec);
3221 alc_write_coef_idx(codec, 0x43, 0x9614);
3224 static void alc256_init(struct hda_codec *codec)
3226 struct alc_spec *spec = codec->spec;
3227 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3228 bool hp_pin_sense;
3230 if (!hp_pin)
3231 return;
3233 msleep(30);
3235 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3237 if (hp_pin_sense)
3238 msleep(2);
3240 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3242 snd_hda_codec_write(codec, hp_pin, 0,
3243 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3245 if (hp_pin_sense)
3246 msleep(85);
3248 snd_hda_codec_write(codec, hp_pin, 0,
3249 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3251 if (hp_pin_sense)
3252 msleep(100);
3254 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3255 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3256 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3257 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
3259 * Expose headphone mic (or possibly Line In on some machines) instead
3260 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3261 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3262 * this register.
3264 alc_write_coef_idx(codec, 0x36, 0x5757);
3267 static void alc256_shutup(struct hda_codec *codec)
3269 struct alc_spec *spec = codec->spec;
3270 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3271 bool hp_pin_sense;
3273 if (!hp_pin) {
3274 alc269_shutup(codec);
3275 return;
3278 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3280 if (hp_pin_sense)
3281 msleep(2);
3283 snd_hda_codec_write(codec, hp_pin, 0,
3284 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3286 if (hp_pin_sense)
3287 msleep(85);
3289 /* 3k pull low control for Headset jack. */
3290 /* NOTE: call this before clearing the pin, otherwise codec stalls */
3291 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3293 if (!spec->no_shutup_pins)
3294 snd_hda_codec_write(codec, hp_pin, 0,
3295 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3297 if (hp_pin_sense)
3298 msleep(100);
3300 alc_auto_setup_eapd(codec, false);
3301 alc_shutup_pins(codec);
3304 static void alc225_init(struct hda_codec *codec)
3306 struct alc_spec *spec = codec->spec;
3307 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3308 bool hp1_pin_sense, hp2_pin_sense;
3310 if (!hp_pin)
3311 return;
3313 msleep(30);
3315 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3316 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3318 if (hp1_pin_sense || hp2_pin_sense)
3319 msleep(2);
3321 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3323 if (hp1_pin_sense)
3324 snd_hda_codec_write(codec, hp_pin, 0,
3325 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3326 if (hp2_pin_sense)
3327 snd_hda_codec_write(codec, 0x16, 0,
3328 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3330 if (hp1_pin_sense || hp2_pin_sense)
3331 msleep(85);
3333 if (hp1_pin_sense)
3334 snd_hda_codec_write(codec, hp_pin, 0,
3335 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3336 if (hp2_pin_sense)
3337 snd_hda_codec_write(codec, 0x16, 0,
3338 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3340 if (hp1_pin_sense || hp2_pin_sense)
3341 msleep(100);
3343 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3344 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3347 static void alc225_shutup(struct hda_codec *codec)
3349 struct alc_spec *spec = codec->spec;
3350 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3351 bool hp1_pin_sense, hp2_pin_sense;
3353 if (!hp_pin) {
3354 alc269_shutup(codec);
3355 return;
3358 /* 3k pull low control for Headset jack. */
3359 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3361 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3362 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3364 if (hp1_pin_sense || hp2_pin_sense)
3365 msleep(2);
3367 if (hp1_pin_sense)
3368 snd_hda_codec_write(codec, hp_pin, 0,
3369 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3370 if (hp2_pin_sense)
3371 snd_hda_codec_write(codec, 0x16, 0,
3372 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3374 if (hp1_pin_sense || hp2_pin_sense)
3375 msleep(85);
3377 if (hp1_pin_sense)
3378 snd_hda_codec_write(codec, hp_pin, 0,
3379 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3380 if (hp2_pin_sense)
3381 snd_hda_codec_write(codec, 0x16, 0,
3382 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3384 if (hp1_pin_sense || hp2_pin_sense)
3385 msleep(100);
3387 alc_auto_setup_eapd(codec, false);
3388 alc_shutup_pins(codec);
3391 static void alc_default_init(struct hda_codec *codec)
3393 struct alc_spec *spec = codec->spec;
3394 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3395 bool hp_pin_sense;
3397 if (!hp_pin)
3398 return;
3400 msleep(30);
3402 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3404 if (hp_pin_sense)
3405 msleep(2);
3407 snd_hda_codec_write(codec, hp_pin, 0,
3408 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3410 if (hp_pin_sense)
3411 msleep(85);
3413 snd_hda_codec_write(codec, hp_pin, 0,
3414 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3416 if (hp_pin_sense)
3417 msleep(100);
3420 static void alc_default_shutup(struct hda_codec *codec)
3422 struct alc_spec *spec = codec->spec;
3423 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3424 bool hp_pin_sense;
3426 if (!hp_pin) {
3427 alc269_shutup(codec);
3428 return;
3431 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3433 if (hp_pin_sense)
3434 msleep(2);
3436 snd_hda_codec_write(codec, hp_pin, 0,
3437 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3439 if (hp_pin_sense)
3440 msleep(85);
3442 if (!spec->no_shutup_pins)
3443 snd_hda_codec_write(codec, hp_pin, 0,
3444 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3446 if (hp_pin_sense)
3447 msleep(100);
3449 alc_auto_setup_eapd(codec, false);
3450 alc_shutup_pins(codec);
3453 static void alc294_hp_init(struct hda_codec *codec)
3455 struct alc_spec *spec = codec->spec;
3456 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3457 int i, val;
3459 if (!hp_pin)
3460 return;
3462 snd_hda_codec_write(codec, hp_pin, 0,
3463 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3465 msleep(100);
3467 if (!spec->no_shutup_pins)
3468 snd_hda_codec_write(codec, hp_pin, 0,
3469 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3471 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3472 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3474 /* Wait for depop procedure finish */
3475 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3476 for (i = 0; i < 20 && val & 0x0080; i++) {
3477 msleep(50);
3478 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3480 /* Set HP depop to auto mode */
3481 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3482 msleep(50);
3485 static void alc294_init(struct hda_codec *codec)
3487 struct alc_spec *spec = codec->spec;
3489 /* required only at boot or S4 resume time */
3490 if (!spec->done_hp_init ||
3491 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
3492 alc294_hp_init(codec);
3493 spec->done_hp_init = true;
3495 alc_default_init(codec);
3498 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3499 unsigned int val)
3501 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3502 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3503 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3506 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3508 unsigned int val;
3510 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3511 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3512 & 0xffff;
3513 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3514 << 16;
3515 return val;
3518 static void alc5505_dsp_halt(struct hda_codec *codec)
3520 unsigned int val;
3522 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3523 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3524 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3525 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3526 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3527 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3528 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3529 val = alc5505_coef_get(codec, 0x6220);
3530 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3533 static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3535 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3536 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3537 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3538 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3539 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3540 alc5505_coef_set(codec, 0x880c, 0x00000004);
3543 static void alc5505_dsp_init(struct hda_codec *codec)
3545 unsigned int val;
3547 alc5505_dsp_halt(codec);
3548 alc5505_dsp_back_from_halt(codec);
3549 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3550 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3551 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3552 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3553 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3554 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3555 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3556 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3557 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3558 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3559 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3560 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3561 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3563 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3564 if (val <= 3)
3565 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3566 else
3567 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3569 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3570 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3571 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3572 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3573 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3574 alc5505_coef_set(codec, 0x880c, 0x00000003);
3575 alc5505_coef_set(codec, 0x880c, 0x00000010);
3577 #ifdef HALT_REALTEK_ALC5505
3578 alc5505_dsp_halt(codec);
3579 #endif
3582 #ifdef HALT_REALTEK_ALC5505
3583 #define alc5505_dsp_suspend(codec) /* NOP */
3584 #define alc5505_dsp_resume(codec) /* NOP */
3585 #else
3586 #define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
3587 #define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
3588 #endif
3590 #ifdef CONFIG_PM
3591 static int alc269_suspend(struct hda_codec *codec)
3593 struct alc_spec *spec = codec->spec;
3595 if (spec->has_alc5505_dsp)
3596 alc5505_dsp_suspend(codec);
3597 return alc_suspend(codec);
3600 static int alc269_resume(struct hda_codec *codec)
3602 struct alc_spec *spec = codec->spec;
3604 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3605 alc269vb_toggle_power_output(codec, 0);
3606 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3607 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
3608 msleep(150);
3611 codec->patch_ops.init(codec);
3613 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3614 alc269vb_toggle_power_output(codec, 1);
3615 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3616 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
3617 msleep(200);
3620 regcache_sync(codec->core.regmap);
3621 hda_call_check_power_status(codec, 0x01);
3623 /* on some machine, the BIOS will clear the codec gpio data when enter
3624 * suspend, and won't restore the data after resume, so we restore it
3625 * in the driver.
3627 if (spec->gpio_data)
3628 alc_write_gpio_data(codec);
3630 if (spec->has_alc5505_dsp)
3631 alc5505_dsp_resume(codec);
3633 return 0;
3635 #endif /* CONFIG_PM */
3637 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
3638 const struct hda_fixup *fix, int action)
3640 struct alc_spec *spec = codec->spec;
3642 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3643 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
3646 static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
3647 const struct hda_fixup *fix,
3648 int action)
3650 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
3651 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
3653 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
3654 snd_hda_codec_set_pincfg(codec, 0x19,
3655 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
3656 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
3659 static void alc269_fixup_hweq(struct hda_codec *codec,
3660 const struct hda_fixup *fix, int action)
3662 if (action == HDA_FIXUP_ACT_INIT)
3663 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
3666 static void alc269_fixup_headset_mic(struct hda_codec *codec,
3667 const struct hda_fixup *fix, int action)
3669 struct alc_spec *spec = codec->spec;
3671 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3672 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3675 static void alc271_fixup_dmic(struct hda_codec *codec,
3676 const struct hda_fixup *fix, int action)
3678 static const struct hda_verb verbs[] = {
3679 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
3680 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
3683 unsigned int cfg;
3685 if (strcmp(codec->core.chip_name, "ALC271X") &&
3686 strcmp(codec->core.chip_name, "ALC269VB"))
3687 return;
3688 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
3689 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
3690 snd_hda_sequence_write(codec, verbs);
3693 static void alc269_fixup_pcm_44k(struct hda_codec *codec,
3694 const struct hda_fixup *fix, int action)
3696 struct alc_spec *spec = codec->spec;
3698 if (action != HDA_FIXUP_ACT_PROBE)
3699 return;
3701 /* Due to a hardware problem on Lenovo Ideadpad, we need to
3702 * fix the sample rate of analog I/O to 44.1kHz
3704 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
3705 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
3708 static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
3709 const struct hda_fixup *fix, int action)
3711 /* The digital-mic unit sends PDM (differential signal) instead of
3712 * the standard PCM, thus you can't record a valid mono stream as is.
3713 * Below is a workaround specific to ALC269 to control the dmic
3714 * signal source as mono.
3716 if (action == HDA_FIXUP_ACT_INIT)
3717 alc_update_coef_idx(codec, 0x07, 0, 0x80);
3720 static void alc269_quanta_automute(struct hda_codec *codec)
3722 snd_hda_gen_update_outputs(codec);
3724 alc_write_coef_idx(codec, 0x0c, 0x680);
3725 alc_write_coef_idx(codec, 0x0c, 0x480);
3728 static void alc269_fixup_quanta_mute(struct hda_codec *codec,
3729 const struct hda_fixup *fix, int action)
3731 struct alc_spec *spec = codec->spec;
3732 if (action != HDA_FIXUP_ACT_PROBE)
3733 return;
3734 spec->gen.automute_hook = alc269_quanta_automute;
3737 static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
3738 struct hda_jack_callback *jack)
3740 struct alc_spec *spec = codec->spec;
3741 int vref;
3742 msleep(200);
3743 snd_hda_gen_hp_automute(codec, jack);
3745 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
3746 msleep(100);
3747 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3748 vref);
3749 msleep(500);
3750 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3751 vref);
3754 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
3755 const struct hda_fixup *fix, int action)
3757 struct alc_spec *spec = codec->spec;
3758 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3759 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3760 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
3765 /* update mute-LED according to the speaker mute state via mic VREF pin */
3766 static void alc269_fixup_mic_mute_hook(void *private_data, int enabled)
3768 struct hda_codec *codec = private_data;
3769 struct alc_spec *spec = codec->spec;
3770 unsigned int pinval;
3772 if (spec->mute_led_polarity)
3773 enabled = !enabled;
3774 pinval = snd_hda_codec_get_pin_target(codec, spec->mute_led_nid);
3775 pinval &= ~AC_PINCTL_VREFEN;
3776 pinval |= enabled ? AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80;
3777 if (spec->mute_led_nid) {
3778 /* temporarily power up/down for setting VREF */
3779 snd_hda_power_up_pm(codec);
3780 snd_hda_set_pin_ctl_cache(codec, spec->mute_led_nid, pinval);
3781 snd_hda_power_down_pm(codec);
3785 /* Make sure the led works even in runtime suspend */
3786 static unsigned int led_power_filter(struct hda_codec *codec,
3787 hda_nid_t nid,
3788 unsigned int power_state)
3790 struct alc_spec *spec = codec->spec;
3792 if (power_state != AC_PWRST_D3 || nid == 0 ||
3793 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
3794 return power_state;
3796 /* Set pin ctl again, it might have just been set to 0 */
3797 snd_hda_set_pin_ctl(codec, nid,
3798 snd_hda_codec_get_pin_target(codec, nid));
3800 return snd_hda_gen_path_power_filter(codec, nid, power_state);
3803 static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
3804 const struct hda_fixup *fix, int action)
3806 struct alc_spec *spec = codec->spec;
3807 const struct dmi_device *dev = NULL;
3809 if (action != HDA_FIXUP_ACT_PRE_PROBE)
3810 return;
3812 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
3813 int pol, pin;
3814 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
3815 continue;
3816 if (pin < 0x0a || pin >= 0x10)
3817 break;
3818 spec->mute_led_polarity = pol;
3819 spec->mute_led_nid = pin - 0x0a + 0x18;
3820 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3821 spec->gen.vmaster_mute_enum = 1;
3822 codec->power_filter = led_power_filter;
3823 codec_dbg(codec,
3824 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
3825 spec->mute_led_polarity);
3826 break;
3830 static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
3831 const struct hda_fixup *fix,
3832 int action, hda_nid_t pin)
3834 struct alc_spec *spec = codec->spec;
3836 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3837 spec->mute_led_polarity = 0;
3838 spec->mute_led_nid = pin;
3839 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3840 spec->gen.vmaster_mute_enum = 1;
3841 codec->power_filter = led_power_filter;
3845 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
3846 const struct hda_fixup *fix, int action)
3848 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
3851 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
3852 const struct hda_fixup *fix, int action)
3854 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
3857 static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
3858 const struct hda_fixup *fix, int action)
3860 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
3863 /* update LED status via GPIO */
3864 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
3865 bool enabled)
3867 struct alc_spec *spec = codec->spec;
3869 if (spec->mute_led_polarity)
3870 enabled = !enabled;
3871 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
3874 /* turn on/off mute LED via GPIO per vmaster hook */
3875 static void alc_fixup_gpio_mute_hook(void *private_data, int enabled)
3877 struct hda_codec *codec = private_data;
3878 struct alc_spec *spec = codec->spec;
3880 alc_update_gpio_led(codec, spec->gpio_mute_led_mask, enabled);
3883 /* turn on/off mic-mute LED via GPIO per capture hook */
3884 static void alc_gpio_micmute_update(struct hda_codec *codec)
3886 struct alc_spec *spec = codec->spec;
3888 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
3889 spec->gen.micmute_led.led_value);
3892 /* setup mute and mic-mute GPIO bits, add hooks appropriately */
3893 static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
3894 int action,
3895 unsigned int mute_mask,
3896 unsigned int micmute_mask)
3898 struct alc_spec *spec = codec->spec;
3900 alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
3902 if (action != HDA_FIXUP_ACT_PRE_PROBE)
3903 return;
3904 if (mute_mask) {
3905 spec->gpio_mute_led_mask = mute_mask;
3906 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
3908 if (micmute_mask) {
3909 spec->gpio_mic_led_mask = micmute_mask;
3910 snd_hda_gen_add_micmute_led(codec, alc_gpio_micmute_update);
3914 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
3915 const struct hda_fixup *fix, int action)
3917 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
3920 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
3921 const struct hda_fixup *fix, int action)
3923 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
3926 /* turn on/off mic-mute LED per capture hook */
3927 static void alc_cap_micmute_update(struct hda_codec *codec)
3929 struct alc_spec *spec = codec->spec;
3930 unsigned int pinval;
3932 if (!spec->cap_mute_led_nid)
3933 return;
3934 pinval = snd_hda_codec_get_pin_target(codec, spec->cap_mute_led_nid);
3935 pinval &= ~AC_PINCTL_VREFEN;
3936 if (spec->gen.micmute_led.led_value)
3937 pinval |= AC_PINCTL_VREF_80;
3938 else
3939 pinval |= AC_PINCTL_VREF_HIZ;
3940 snd_hda_set_pin_ctl_cache(codec, spec->cap_mute_led_nid, pinval);
3943 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
3944 const struct hda_fixup *fix, int action)
3946 struct alc_spec *spec = codec->spec;
3948 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
3949 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3950 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to
3951 * enable headphone amp
3953 spec->gpio_mask |= 0x10;
3954 spec->gpio_dir |= 0x10;
3955 spec->cap_mute_led_nid = 0x18;
3956 snd_hda_gen_add_micmute_led(codec, alc_cap_micmute_update);
3957 codec->power_filter = led_power_filter;
3961 static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
3962 const struct hda_fixup *fix, int action)
3964 struct alc_spec *spec = codec->spec;
3966 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
3967 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3968 spec->cap_mute_led_nid = 0x18;
3969 snd_hda_gen_add_micmute_led(codec, alc_cap_micmute_update);
3970 codec->power_filter = led_power_filter;
3974 #if IS_REACHABLE(CONFIG_INPUT)
3975 static void gpio2_mic_hotkey_event(struct hda_codec *codec,
3976 struct hda_jack_callback *event)
3978 struct alc_spec *spec = codec->spec;
3980 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
3981 send both key on and key off event for every interrupt. */
3982 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
3983 input_sync(spec->kb_dev);
3984 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
3985 input_sync(spec->kb_dev);
3988 static int alc_register_micmute_input_device(struct hda_codec *codec)
3990 struct alc_spec *spec = codec->spec;
3991 int i;
3993 spec->kb_dev = input_allocate_device();
3994 if (!spec->kb_dev) {
3995 codec_err(codec, "Out of memory (input_allocate_device)\n");
3996 return -ENOMEM;
3999 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
4001 spec->kb_dev->name = "Microphone Mute Button";
4002 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
4003 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
4004 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
4005 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
4006 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
4007 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
4009 if (input_register_device(spec->kb_dev)) {
4010 codec_err(codec, "input_register_device failed\n");
4011 input_free_device(spec->kb_dev);
4012 spec->kb_dev = NULL;
4013 return -ENOMEM;
4016 return 0;
4019 /* GPIO1 = set according to SKU external amp
4020 * GPIO2 = mic mute hotkey
4021 * GPIO3 = mute LED
4022 * GPIO4 = mic mute LED
4024 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4025 const struct hda_fixup *fix, int action)
4027 struct alc_spec *spec = codec->spec;
4029 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4030 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4031 spec->init_amp = ALC_INIT_DEFAULT;
4032 if (alc_register_micmute_input_device(codec) != 0)
4033 return;
4035 spec->gpio_mask |= 0x06;
4036 spec->gpio_dir |= 0x02;
4037 spec->gpio_data |= 0x02;
4038 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
4039 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
4040 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
4041 gpio2_mic_hotkey_event);
4042 return;
4045 if (!spec->kb_dev)
4046 return;
4048 switch (action) {
4049 case HDA_FIXUP_ACT_FREE:
4050 input_unregister_device(spec->kb_dev);
4051 spec->kb_dev = NULL;
4055 /* Line2 = mic mute hotkey
4056 * GPIO2 = mic mute LED
4058 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4059 const struct hda_fixup *fix, int action)
4061 struct alc_spec *spec = codec->spec;
4063 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4064 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4065 spec->init_amp = ALC_INIT_DEFAULT;
4066 if (alc_register_micmute_input_device(codec) != 0)
4067 return;
4069 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4070 gpio2_mic_hotkey_event);
4071 return;
4074 if (!spec->kb_dev)
4075 return;
4077 switch (action) {
4078 case HDA_FIXUP_ACT_FREE:
4079 input_unregister_device(spec->kb_dev);
4080 spec->kb_dev = NULL;
4083 #else /* INPUT */
4084 #define alc280_fixup_hp_gpio2_mic_hotkey NULL
4085 #define alc233_fixup_lenovo_line2_mic_hotkey NULL
4086 #endif /* INPUT */
4088 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4089 const struct hda_fixup *fix, int action)
4091 struct alc_spec *spec = codec->spec;
4093 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
4094 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4095 spec->cap_mute_led_nid = 0x18;
4096 snd_hda_gen_add_micmute_led(codec, alc_cap_micmute_update);
4100 static struct coef_fw alc225_pre_hsmode[] = {
4101 UPDATE_COEF(0x4a, 1<<8, 0),
4102 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4103 UPDATE_COEF(0x63, 3<<14, 3<<14),
4104 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4105 UPDATE_COEF(0x4a, 3<<10, 3<<10),
4106 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4107 UPDATE_COEF(0x4a, 3<<10, 0),
4111 static void alc_headset_mode_unplugged(struct hda_codec *codec)
4113 static struct coef_fw coef0255[] = {
4114 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
4115 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4116 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4117 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4118 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4121 static struct coef_fw coef0256[] = {
4122 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
4123 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4124 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4125 WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
4126 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4129 static struct coef_fw coef0233[] = {
4130 WRITE_COEF(0x1b, 0x0c0b),
4131 WRITE_COEF(0x45, 0xc429),
4132 UPDATE_COEF(0x35, 0x4000, 0),
4133 WRITE_COEF(0x06, 0x2104),
4134 WRITE_COEF(0x1a, 0x0001),
4135 WRITE_COEF(0x26, 0x0004),
4136 WRITE_COEF(0x32, 0x42a3),
4139 static struct coef_fw coef0288[] = {
4140 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4141 UPDATE_COEF(0x50, 0x2000, 0x2000),
4142 UPDATE_COEF(0x56, 0x0006, 0x0006),
4143 UPDATE_COEF(0x66, 0x0008, 0),
4144 UPDATE_COEF(0x67, 0x2000, 0),
4147 static struct coef_fw coef0298[] = {
4148 UPDATE_COEF(0x19, 0x1300, 0x0300),
4151 static struct coef_fw coef0292[] = {
4152 WRITE_COEF(0x76, 0x000e),
4153 WRITE_COEF(0x6c, 0x2400),
4154 WRITE_COEF(0x18, 0x7308),
4155 WRITE_COEF(0x6b, 0xc429),
4158 static struct coef_fw coef0293[] = {
4159 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
4160 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
4161 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
4162 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
4163 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
4164 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4167 static struct coef_fw coef0668[] = {
4168 WRITE_COEF(0x15, 0x0d40),
4169 WRITE_COEF(0xb7, 0x802b),
4172 static struct coef_fw coef0225[] = {
4173 UPDATE_COEF(0x63, 3<<14, 0),
4176 static struct coef_fw coef0274[] = {
4177 UPDATE_COEF(0x4a, 0x0100, 0),
4178 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
4179 UPDATE_COEF(0x6b, 0xf000, 0x5000),
4180 UPDATE_COEF(0x4a, 0x0010, 0),
4181 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
4182 WRITE_COEF(0x45, 0x5289),
4183 UPDATE_COEF(0x4a, 0x0c00, 0),
4187 switch (codec->core.vendor_id) {
4188 case 0x10ec0255:
4189 alc_process_coef_fw(codec, coef0255);
4190 break;
4191 case 0x10ec0236:
4192 case 0x10ec0256:
4193 alc_process_coef_fw(codec, coef0256);
4194 break;
4195 case 0x10ec0234:
4196 case 0x10ec0274:
4197 case 0x10ec0294:
4198 alc_process_coef_fw(codec, coef0274);
4199 break;
4200 case 0x10ec0233:
4201 case 0x10ec0283:
4202 alc_process_coef_fw(codec, coef0233);
4203 break;
4204 case 0x10ec0286:
4205 case 0x10ec0288:
4206 alc_process_coef_fw(codec, coef0288);
4207 break;
4208 case 0x10ec0298:
4209 alc_process_coef_fw(codec, coef0298);
4210 alc_process_coef_fw(codec, coef0288);
4211 break;
4212 case 0x10ec0292:
4213 alc_process_coef_fw(codec, coef0292);
4214 break;
4215 case 0x10ec0293:
4216 alc_process_coef_fw(codec, coef0293);
4217 break;
4218 case 0x10ec0668:
4219 alc_process_coef_fw(codec, coef0668);
4220 break;
4221 case 0x10ec0215:
4222 case 0x10ec0225:
4223 case 0x10ec0285:
4224 case 0x10ec0295:
4225 case 0x10ec0289:
4226 case 0x10ec0299:
4227 alc_process_coef_fw(codec, alc225_pre_hsmode);
4228 alc_process_coef_fw(codec, coef0225);
4229 break;
4230 case 0x10ec0867:
4231 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4232 break;
4234 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
4238 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
4239 hda_nid_t mic_pin)
4241 static struct coef_fw coef0255[] = {
4242 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
4243 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4246 static struct coef_fw coef0256[] = {
4247 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
4248 WRITE_COEFEX(0x57, 0x03, 0x09a3),
4249 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4252 static struct coef_fw coef0233[] = {
4253 UPDATE_COEF(0x35, 0, 1<<14),
4254 WRITE_COEF(0x06, 0x2100),
4255 WRITE_COEF(0x1a, 0x0021),
4256 WRITE_COEF(0x26, 0x008c),
4259 static struct coef_fw coef0288[] = {
4260 UPDATE_COEF(0x4f, 0x00c0, 0),
4261 UPDATE_COEF(0x50, 0x2000, 0),
4262 UPDATE_COEF(0x56, 0x0006, 0),
4263 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4264 UPDATE_COEF(0x66, 0x0008, 0x0008),
4265 UPDATE_COEF(0x67, 0x2000, 0x2000),
4268 static struct coef_fw coef0292[] = {
4269 WRITE_COEF(0x19, 0xa208),
4270 WRITE_COEF(0x2e, 0xacf0),
4273 static struct coef_fw coef0293[] = {
4274 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
4275 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
4276 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4279 static struct coef_fw coef0688[] = {
4280 WRITE_COEF(0xb7, 0x802b),
4281 WRITE_COEF(0xb5, 0x1040),
4282 UPDATE_COEF(0xc3, 0, 1<<12),
4285 static struct coef_fw coef0225[] = {
4286 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
4287 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4288 UPDATE_COEF(0x63, 3<<14, 0),
4291 static struct coef_fw coef0274[] = {
4292 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
4293 UPDATE_COEF(0x4a, 0x0010, 0),
4294 UPDATE_COEF(0x6b, 0xf000, 0),
4298 switch (codec->core.vendor_id) {
4299 case 0x10ec0255:
4300 alc_write_coef_idx(codec, 0x45, 0xc489);
4301 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4302 alc_process_coef_fw(codec, coef0255);
4303 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4304 break;
4305 case 0x10ec0236:
4306 case 0x10ec0256:
4307 alc_write_coef_idx(codec, 0x45, 0xc489);
4308 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4309 alc_process_coef_fw(codec, coef0256);
4310 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4311 break;
4312 case 0x10ec0234:
4313 case 0x10ec0274:
4314 case 0x10ec0294:
4315 alc_write_coef_idx(codec, 0x45, 0x4689);
4316 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4317 alc_process_coef_fw(codec, coef0274);
4318 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4319 break;
4320 case 0x10ec0233:
4321 case 0x10ec0283:
4322 alc_write_coef_idx(codec, 0x45, 0xc429);
4323 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4324 alc_process_coef_fw(codec, coef0233);
4325 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4326 break;
4327 case 0x10ec0286:
4328 case 0x10ec0288:
4329 case 0x10ec0298:
4330 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4331 alc_process_coef_fw(codec, coef0288);
4332 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4333 break;
4334 case 0x10ec0292:
4335 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4336 alc_process_coef_fw(codec, coef0292);
4337 break;
4338 case 0x10ec0293:
4339 /* Set to TRS mode */
4340 alc_write_coef_idx(codec, 0x45, 0xc429);
4341 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4342 alc_process_coef_fw(codec, coef0293);
4343 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4344 break;
4345 case 0x10ec0867:
4346 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
4347 /* fallthru */
4348 case 0x10ec0221:
4349 case 0x10ec0662:
4350 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4351 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4352 break;
4353 case 0x10ec0668:
4354 alc_write_coef_idx(codec, 0x11, 0x0001);
4355 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4356 alc_process_coef_fw(codec, coef0688);
4357 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4358 break;
4359 case 0x10ec0215:
4360 case 0x10ec0225:
4361 case 0x10ec0285:
4362 case 0x10ec0295:
4363 case 0x10ec0289:
4364 case 0x10ec0299:
4365 alc_process_coef_fw(codec, alc225_pre_hsmode);
4366 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
4367 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4368 alc_process_coef_fw(codec, coef0225);
4369 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4370 break;
4372 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
4375 static void alc_headset_mode_default(struct hda_codec *codec)
4377 static struct coef_fw coef0225[] = {
4378 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
4379 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
4380 UPDATE_COEF(0x49, 3<<8, 0<<8),
4381 UPDATE_COEF(0x4a, 3<<4, 3<<4),
4382 UPDATE_COEF(0x63, 3<<14, 0),
4383 UPDATE_COEF(0x67, 0xf000, 0x3000),
4386 static struct coef_fw coef0255[] = {
4387 WRITE_COEF(0x45, 0xc089),
4388 WRITE_COEF(0x45, 0xc489),
4389 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4390 WRITE_COEF(0x49, 0x0049),
4393 static struct coef_fw coef0256[] = {
4394 WRITE_COEF(0x45, 0xc489),
4395 WRITE_COEFEX(0x57, 0x03, 0x0da3),
4396 WRITE_COEF(0x49, 0x0049),
4397 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4398 WRITE_COEF(0x06, 0x6100),
4401 static struct coef_fw coef0233[] = {
4402 WRITE_COEF(0x06, 0x2100),
4403 WRITE_COEF(0x32, 0x4ea3),
4406 static struct coef_fw coef0288[] = {
4407 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
4408 UPDATE_COEF(0x50, 0x2000, 0x2000),
4409 UPDATE_COEF(0x56, 0x0006, 0x0006),
4410 UPDATE_COEF(0x66, 0x0008, 0),
4411 UPDATE_COEF(0x67, 0x2000, 0),
4414 static struct coef_fw coef0292[] = {
4415 WRITE_COEF(0x76, 0x000e),
4416 WRITE_COEF(0x6c, 0x2400),
4417 WRITE_COEF(0x6b, 0xc429),
4418 WRITE_COEF(0x18, 0x7308),
4421 static struct coef_fw coef0293[] = {
4422 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4423 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
4424 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4427 static struct coef_fw coef0688[] = {
4428 WRITE_COEF(0x11, 0x0041),
4429 WRITE_COEF(0x15, 0x0d40),
4430 WRITE_COEF(0xb7, 0x802b),
4433 static struct coef_fw coef0274[] = {
4434 WRITE_COEF(0x45, 0x4289),
4435 UPDATE_COEF(0x4a, 0x0010, 0x0010),
4436 UPDATE_COEF(0x6b, 0x0f00, 0),
4437 UPDATE_COEF(0x49, 0x0300, 0x0300),
4441 switch (codec->core.vendor_id) {
4442 case 0x10ec0215:
4443 case 0x10ec0225:
4444 case 0x10ec0285:
4445 case 0x10ec0295:
4446 case 0x10ec0289:
4447 case 0x10ec0299:
4448 alc_process_coef_fw(codec, alc225_pre_hsmode);
4449 alc_process_coef_fw(codec, coef0225);
4450 break;
4451 case 0x10ec0255:
4452 alc_process_coef_fw(codec, coef0255);
4453 break;
4454 case 0x10ec0236:
4455 case 0x10ec0256:
4456 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
4457 alc_write_coef_idx(codec, 0x45, 0xc089);
4458 msleep(50);
4459 alc_process_coef_fw(codec, coef0256);
4460 break;
4461 case 0x10ec0234:
4462 case 0x10ec0274:
4463 case 0x10ec0294:
4464 alc_process_coef_fw(codec, coef0274);
4465 break;
4466 case 0x10ec0233:
4467 case 0x10ec0283:
4468 alc_process_coef_fw(codec, coef0233);
4469 break;
4470 case 0x10ec0286:
4471 case 0x10ec0288:
4472 case 0x10ec0298:
4473 alc_process_coef_fw(codec, coef0288);
4474 break;
4475 case 0x10ec0292:
4476 alc_process_coef_fw(codec, coef0292);
4477 break;
4478 case 0x10ec0293:
4479 alc_process_coef_fw(codec, coef0293);
4480 break;
4481 case 0x10ec0668:
4482 alc_process_coef_fw(codec, coef0688);
4483 break;
4484 case 0x10ec0867:
4485 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4486 break;
4488 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
4491 /* Iphone type */
4492 static void alc_headset_mode_ctia(struct hda_codec *codec)
4494 int val;
4496 static struct coef_fw coef0255[] = {
4497 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
4498 WRITE_COEF(0x1b, 0x0c2b),
4499 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4502 static struct coef_fw coef0256[] = {
4503 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
4504 WRITE_COEF(0x1b, 0x0e6b),
4507 static struct coef_fw coef0233[] = {
4508 WRITE_COEF(0x45, 0xd429),
4509 WRITE_COEF(0x1b, 0x0c2b),
4510 WRITE_COEF(0x32, 0x4ea3),
4513 static struct coef_fw coef0288[] = {
4514 UPDATE_COEF(0x50, 0x2000, 0x2000),
4515 UPDATE_COEF(0x56, 0x0006, 0x0006),
4516 UPDATE_COEF(0x66, 0x0008, 0),
4517 UPDATE_COEF(0x67, 0x2000, 0),
4520 static struct coef_fw coef0292[] = {
4521 WRITE_COEF(0x6b, 0xd429),
4522 WRITE_COEF(0x76, 0x0008),
4523 WRITE_COEF(0x18, 0x7388),
4526 static struct coef_fw coef0293[] = {
4527 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
4528 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
4531 static struct coef_fw coef0688[] = {
4532 WRITE_COEF(0x11, 0x0001),
4533 WRITE_COEF(0x15, 0x0d60),
4534 WRITE_COEF(0xc3, 0x0000),
4537 static struct coef_fw coef0225_1[] = {
4538 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
4539 UPDATE_COEF(0x63, 3<<14, 2<<14),
4542 static struct coef_fw coef0225_2[] = {
4543 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
4544 UPDATE_COEF(0x63, 3<<14, 1<<14),
4548 switch (codec->core.vendor_id) {
4549 case 0x10ec0255:
4550 alc_process_coef_fw(codec, coef0255);
4551 break;
4552 case 0x10ec0236:
4553 case 0x10ec0256:
4554 alc_process_coef_fw(codec, coef0256);
4555 break;
4556 case 0x10ec0234:
4557 case 0x10ec0274:
4558 case 0x10ec0294:
4559 alc_write_coef_idx(codec, 0x45, 0xd689);
4560 break;
4561 case 0x10ec0233:
4562 case 0x10ec0283:
4563 alc_process_coef_fw(codec, coef0233);
4564 break;
4565 case 0x10ec0298:
4566 val = alc_read_coef_idx(codec, 0x50);
4567 if (val & (1 << 12)) {
4568 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
4569 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4570 msleep(300);
4571 } else {
4572 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
4573 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4574 msleep(300);
4576 break;
4577 case 0x10ec0286:
4578 case 0x10ec0288:
4579 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4580 msleep(300);
4581 alc_process_coef_fw(codec, coef0288);
4582 break;
4583 case 0x10ec0292:
4584 alc_process_coef_fw(codec, coef0292);
4585 break;
4586 case 0x10ec0293:
4587 alc_process_coef_fw(codec, coef0293);
4588 break;
4589 case 0x10ec0668:
4590 alc_process_coef_fw(codec, coef0688);
4591 break;
4592 case 0x10ec0215:
4593 case 0x10ec0225:
4594 case 0x10ec0285:
4595 case 0x10ec0295:
4596 case 0x10ec0289:
4597 case 0x10ec0299:
4598 val = alc_read_coef_idx(codec, 0x45);
4599 if (val & (1 << 9))
4600 alc_process_coef_fw(codec, coef0225_2);
4601 else
4602 alc_process_coef_fw(codec, coef0225_1);
4603 break;
4604 case 0x10ec0867:
4605 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4606 break;
4608 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
4611 /* Nokia type */
4612 static void alc_headset_mode_omtp(struct hda_codec *codec)
4614 static struct coef_fw coef0255[] = {
4615 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
4616 WRITE_COEF(0x1b, 0x0c2b),
4617 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4620 static struct coef_fw coef0256[] = {
4621 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
4622 WRITE_COEF(0x1b, 0x0e6b),
4625 static struct coef_fw coef0233[] = {
4626 WRITE_COEF(0x45, 0xe429),
4627 WRITE_COEF(0x1b, 0x0c2b),
4628 WRITE_COEF(0x32, 0x4ea3),
4631 static struct coef_fw coef0288[] = {
4632 UPDATE_COEF(0x50, 0x2000, 0x2000),
4633 UPDATE_COEF(0x56, 0x0006, 0x0006),
4634 UPDATE_COEF(0x66, 0x0008, 0),
4635 UPDATE_COEF(0x67, 0x2000, 0),
4638 static struct coef_fw coef0292[] = {
4639 WRITE_COEF(0x6b, 0xe429),
4640 WRITE_COEF(0x76, 0x0008),
4641 WRITE_COEF(0x18, 0x7388),
4644 static struct coef_fw coef0293[] = {
4645 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
4646 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
4649 static struct coef_fw coef0688[] = {
4650 WRITE_COEF(0x11, 0x0001),
4651 WRITE_COEF(0x15, 0x0d50),
4652 WRITE_COEF(0xc3, 0x0000),
4655 static struct coef_fw coef0225[] = {
4656 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
4657 UPDATE_COEF(0x63, 3<<14, 2<<14),
4661 switch (codec->core.vendor_id) {
4662 case 0x10ec0255:
4663 alc_process_coef_fw(codec, coef0255);
4664 break;
4665 case 0x10ec0236:
4666 case 0x10ec0256:
4667 alc_process_coef_fw(codec, coef0256);
4668 break;
4669 case 0x10ec0234:
4670 case 0x10ec0274:
4671 case 0x10ec0294:
4672 alc_write_coef_idx(codec, 0x45, 0xe689);
4673 break;
4674 case 0x10ec0233:
4675 case 0x10ec0283:
4676 alc_process_coef_fw(codec, coef0233);
4677 break;
4678 case 0x10ec0298:
4679 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
4680 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
4681 msleep(300);
4682 break;
4683 case 0x10ec0286:
4684 case 0x10ec0288:
4685 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
4686 msleep(300);
4687 alc_process_coef_fw(codec, coef0288);
4688 break;
4689 case 0x10ec0292:
4690 alc_process_coef_fw(codec, coef0292);
4691 break;
4692 case 0x10ec0293:
4693 alc_process_coef_fw(codec, coef0293);
4694 break;
4695 case 0x10ec0668:
4696 alc_process_coef_fw(codec, coef0688);
4697 break;
4698 case 0x10ec0215:
4699 case 0x10ec0225:
4700 case 0x10ec0285:
4701 case 0x10ec0295:
4702 case 0x10ec0289:
4703 case 0x10ec0299:
4704 alc_process_coef_fw(codec, coef0225);
4705 break;
4707 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
4710 static void alc_determine_headset_type(struct hda_codec *codec)
4712 int val;
4713 bool is_ctia = false;
4714 struct alc_spec *spec = codec->spec;
4715 static struct coef_fw coef0255[] = {
4716 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
4717 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
4718 conteol) */
4721 static struct coef_fw coef0288[] = {
4722 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
4725 static struct coef_fw coef0298[] = {
4726 UPDATE_COEF(0x50, 0x2000, 0x2000),
4727 UPDATE_COEF(0x56, 0x0006, 0x0006),
4728 UPDATE_COEF(0x66, 0x0008, 0),
4729 UPDATE_COEF(0x67, 0x2000, 0),
4730 UPDATE_COEF(0x19, 0x1300, 0x1300),
4733 static struct coef_fw coef0293[] = {
4734 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
4735 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
4738 static struct coef_fw coef0688[] = {
4739 WRITE_COEF(0x11, 0x0001),
4740 WRITE_COEF(0xb7, 0x802b),
4741 WRITE_COEF(0x15, 0x0d60),
4742 WRITE_COEF(0xc3, 0x0c00),
4745 static struct coef_fw coef0274[] = {
4746 UPDATE_COEF(0x4a, 0x0010, 0),
4747 UPDATE_COEF(0x4a, 0x8000, 0),
4748 WRITE_COEF(0x45, 0xd289),
4749 UPDATE_COEF(0x49, 0x0300, 0x0300),
4753 switch (codec->core.vendor_id) {
4754 case 0x10ec0255:
4755 alc_process_coef_fw(codec, coef0255);
4756 msleep(300);
4757 val = alc_read_coef_idx(codec, 0x46);
4758 is_ctia = (val & 0x0070) == 0x0070;
4759 break;
4760 case 0x10ec0236:
4761 case 0x10ec0256:
4762 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
4763 alc_write_coef_idx(codec, 0x06, 0x6104);
4764 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
4766 snd_hda_codec_write(codec, 0x21, 0,
4767 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
4768 msleep(80);
4769 snd_hda_codec_write(codec, 0x21, 0,
4770 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4772 alc_process_coef_fw(codec, coef0255);
4773 msleep(300);
4774 val = alc_read_coef_idx(codec, 0x46);
4775 is_ctia = (val & 0x0070) == 0x0070;
4777 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
4778 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4780 snd_hda_codec_write(codec, 0x21, 0,
4781 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
4782 msleep(80);
4783 snd_hda_codec_write(codec, 0x21, 0,
4784 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
4785 break;
4786 case 0x10ec0234:
4787 case 0x10ec0274:
4788 case 0x10ec0294:
4789 alc_process_coef_fw(codec, coef0274);
4790 msleep(80);
4791 val = alc_read_coef_idx(codec, 0x46);
4792 is_ctia = (val & 0x00f0) == 0x00f0;
4793 break;
4794 case 0x10ec0233:
4795 case 0x10ec0283:
4796 alc_write_coef_idx(codec, 0x45, 0xd029);
4797 msleep(300);
4798 val = alc_read_coef_idx(codec, 0x46);
4799 is_ctia = (val & 0x0070) == 0x0070;
4800 break;
4801 case 0x10ec0298:
4802 snd_hda_codec_write(codec, 0x21, 0,
4803 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
4804 msleep(100);
4805 snd_hda_codec_write(codec, 0x21, 0,
4806 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4807 msleep(200);
4809 val = alc_read_coef_idx(codec, 0x50);
4810 if (val & (1 << 12)) {
4811 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
4812 alc_process_coef_fw(codec, coef0288);
4813 msleep(350);
4814 val = alc_read_coef_idx(codec, 0x50);
4815 is_ctia = (val & 0x0070) == 0x0070;
4816 } else {
4817 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
4818 alc_process_coef_fw(codec, coef0288);
4819 msleep(350);
4820 val = alc_read_coef_idx(codec, 0x50);
4821 is_ctia = (val & 0x0070) == 0x0070;
4823 alc_process_coef_fw(codec, coef0298);
4824 snd_hda_codec_write(codec, 0x21, 0,
4825 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
4826 msleep(75);
4827 snd_hda_codec_write(codec, 0x21, 0,
4828 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
4829 break;
4830 case 0x10ec0286:
4831 case 0x10ec0288:
4832 alc_process_coef_fw(codec, coef0288);
4833 msleep(350);
4834 val = alc_read_coef_idx(codec, 0x50);
4835 is_ctia = (val & 0x0070) == 0x0070;
4836 break;
4837 case 0x10ec0292:
4838 alc_write_coef_idx(codec, 0x6b, 0xd429);
4839 msleep(300);
4840 val = alc_read_coef_idx(codec, 0x6c);
4841 is_ctia = (val & 0x001c) == 0x001c;
4842 break;
4843 case 0x10ec0293:
4844 alc_process_coef_fw(codec, coef0293);
4845 msleep(300);
4846 val = alc_read_coef_idx(codec, 0x46);
4847 is_ctia = (val & 0x0070) == 0x0070;
4848 break;
4849 case 0x10ec0668:
4850 alc_process_coef_fw(codec, coef0688);
4851 msleep(300);
4852 val = alc_read_coef_idx(codec, 0xbe);
4853 is_ctia = (val & 0x1c02) == 0x1c02;
4854 break;
4855 case 0x10ec0215:
4856 case 0x10ec0225:
4857 case 0x10ec0285:
4858 case 0x10ec0295:
4859 case 0x10ec0289:
4860 case 0x10ec0299:
4861 snd_hda_codec_write(codec, 0x21, 0,
4862 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
4863 msleep(80);
4864 snd_hda_codec_write(codec, 0x21, 0,
4865 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4867 alc_process_coef_fw(codec, alc225_pre_hsmode);
4868 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
4869 val = alc_read_coef_idx(codec, 0x45);
4870 if (val & (1 << 9)) {
4871 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
4872 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
4873 msleep(800);
4874 val = alc_read_coef_idx(codec, 0x46);
4875 is_ctia = (val & 0x00f0) == 0x00f0;
4876 } else {
4877 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
4878 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
4879 msleep(800);
4880 val = alc_read_coef_idx(codec, 0x46);
4881 is_ctia = (val & 0x00f0) == 0x00f0;
4883 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
4884 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
4885 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
4887 snd_hda_codec_write(codec, 0x21, 0,
4888 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
4889 msleep(80);
4890 snd_hda_codec_write(codec, 0x21, 0,
4891 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
4892 break;
4893 case 0x10ec0867:
4894 is_ctia = true;
4895 break;
4898 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
4899 is_ctia ? "yes" : "no");
4900 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
4903 static void alc_update_headset_mode(struct hda_codec *codec)
4905 struct alc_spec *spec = codec->spec;
4907 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
4908 hda_nid_t hp_pin = alc_get_hp_pin(spec);
4910 int new_headset_mode;
4912 if (!snd_hda_jack_detect(codec, hp_pin))
4913 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
4914 else if (mux_pin == spec->headset_mic_pin)
4915 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
4916 else if (mux_pin == spec->headphone_mic_pin)
4917 new_headset_mode = ALC_HEADSET_MODE_MIC;
4918 else
4919 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
4921 if (new_headset_mode == spec->current_headset_mode) {
4922 snd_hda_gen_update_outputs(codec);
4923 return;
4926 switch (new_headset_mode) {
4927 case ALC_HEADSET_MODE_UNPLUGGED:
4928 alc_headset_mode_unplugged(codec);
4929 spec->gen.hp_jack_present = false;
4930 break;
4931 case ALC_HEADSET_MODE_HEADSET:
4932 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
4933 alc_determine_headset_type(codec);
4934 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
4935 alc_headset_mode_ctia(codec);
4936 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
4937 alc_headset_mode_omtp(codec);
4938 spec->gen.hp_jack_present = true;
4939 break;
4940 case ALC_HEADSET_MODE_MIC:
4941 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
4942 spec->gen.hp_jack_present = false;
4943 break;
4944 case ALC_HEADSET_MODE_HEADPHONE:
4945 alc_headset_mode_default(codec);
4946 spec->gen.hp_jack_present = true;
4947 break;
4949 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
4950 snd_hda_set_pin_ctl_cache(codec, hp_pin,
4951 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
4952 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
4953 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
4954 PIN_VREFHIZ);
4956 spec->current_headset_mode = new_headset_mode;
4958 snd_hda_gen_update_outputs(codec);
4961 static void alc_update_headset_mode_hook(struct hda_codec *codec,
4962 struct snd_kcontrol *kcontrol,
4963 struct snd_ctl_elem_value *ucontrol)
4965 alc_update_headset_mode(codec);
4968 static void alc_update_headset_jack_cb(struct hda_codec *codec,
4969 struct hda_jack_callback *jack)
4971 struct alc_spec *spec = codec->spec;
4972 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
4973 snd_hda_gen_hp_automute(codec, jack);
4976 static void alc_probe_headset_mode(struct hda_codec *codec)
4978 int i;
4979 struct alc_spec *spec = codec->spec;
4980 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
4982 /* Find mic pins */
4983 for (i = 0; i < cfg->num_inputs; i++) {
4984 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
4985 spec->headset_mic_pin = cfg->inputs[i].pin;
4986 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
4987 spec->headphone_mic_pin = cfg->inputs[i].pin;
4990 WARN_ON(spec->gen.cap_sync_hook);
4991 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
4992 spec->gen.automute_hook = alc_update_headset_mode;
4993 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
4996 static void alc_fixup_headset_mode(struct hda_codec *codec,
4997 const struct hda_fixup *fix, int action)
4999 struct alc_spec *spec = codec->spec;
5001 switch (action) {
5002 case HDA_FIXUP_ACT_PRE_PROBE:
5003 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
5004 break;
5005 case HDA_FIXUP_ACT_PROBE:
5006 alc_probe_headset_mode(codec);
5007 break;
5008 case HDA_FIXUP_ACT_INIT:
5009 spec->current_headset_mode = 0;
5010 alc_update_headset_mode(codec);
5011 break;
5015 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
5016 const struct hda_fixup *fix, int action)
5018 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5019 struct alc_spec *spec = codec->spec;
5020 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5022 else
5023 alc_fixup_headset_mode(codec, fix, action);
5026 static void alc255_set_default_jack_type(struct hda_codec *codec)
5028 /* Set to iphone type */
5029 static struct coef_fw alc255fw[] = {
5030 WRITE_COEF(0x1b, 0x880b),
5031 WRITE_COEF(0x45, 0xd089),
5032 WRITE_COEF(0x1b, 0x080b),
5033 WRITE_COEF(0x46, 0x0004),
5034 WRITE_COEF(0x1b, 0x0c0b),
5037 static struct coef_fw alc256fw[] = {
5038 WRITE_COEF(0x1b, 0x884b),
5039 WRITE_COEF(0x45, 0xd089),
5040 WRITE_COEF(0x1b, 0x084b),
5041 WRITE_COEF(0x46, 0x0004),
5042 WRITE_COEF(0x1b, 0x0c4b),
5045 switch (codec->core.vendor_id) {
5046 case 0x10ec0255:
5047 alc_process_coef_fw(codec, alc255fw);
5048 break;
5049 case 0x10ec0236:
5050 case 0x10ec0256:
5051 alc_process_coef_fw(codec, alc256fw);
5052 break;
5054 msleep(30);
5057 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
5058 const struct hda_fixup *fix, int action)
5060 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5061 alc255_set_default_jack_type(codec);
5063 alc_fixup_headset_mode(codec, fix, action);
5066 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
5067 const struct hda_fixup *fix, int action)
5069 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5070 struct alc_spec *spec = codec->spec;
5071 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5072 alc255_set_default_jack_type(codec);
5074 else
5075 alc_fixup_headset_mode(codec, fix, action);
5078 static void alc288_update_headset_jack_cb(struct hda_codec *codec,
5079 struct hda_jack_callback *jack)
5081 struct alc_spec *spec = codec->spec;
5083 alc_update_headset_jack_cb(codec, jack);
5084 /* Headset Mic enable or disable, only for Dell Dino */
5085 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
5088 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5089 const struct hda_fixup *fix, int action)
5091 alc_fixup_headset_mode(codec, fix, action);
5092 if (action == HDA_FIXUP_ACT_PROBE) {
5093 struct alc_spec *spec = codec->spec;
5094 /* toggled via hp_automute_hook */
5095 spec->gpio_mask |= 0x40;
5096 spec->gpio_dir |= 0x40;
5097 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
5101 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5102 const struct hda_fixup *fix, int action)
5104 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5105 struct alc_spec *spec = codec->spec;
5106 spec->gen.auto_mute_via_amp = 1;
5110 static void alc_fixup_no_shutup(struct hda_codec *codec,
5111 const struct hda_fixup *fix, int action)
5113 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5114 struct alc_spec *spec = codec->spec;
5115 spec->no_shutup_pins = 1;
5119 static void alc_fixup_disable_aamix(struct hda_codec *codec,
5120 const struct hda_fixup *fix, int action)
5122 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5123 struct alc_spec *spec = codec->spec;
5124 /* Disable AA-loopback as it causes white noise */
5125 spec->gen.mixer_nid = 0;
5129 /* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
5130 static void alc_fixup_tpt440_dock(struct hda_codec *codec,
5131 const struct hda_fixup *fix, int action)
5133 static const struct hda_pintbl pincfgs[] = {
5134 { 0x16, 0x21211010 }, /* dock headphone */
5135 { 0x19, 0x21a11010 }, /* dock mic */
5138 struct alc_spec *spec = codec->spec;
5140 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5141 spec->reboot_notify = snd_hda_gen_reboot_notify; /* reduce noise */
5142 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5143 codec->power_save_node = 0; /* avoid click noises */
5144 snd_hda_apply_pincfgs(codec, pincfgs);
5148 static void alc_fixup_tpt470_dock(struct hda_codec *codec,
5149 const struct hda_fixup *fix, int action)
5151 static const struct hda_pintbl pincfgs[] = {
5152 { 0x17, 0x21211010 }, /* dock headphone */
5153 { 0x19, 0x21a11010 }, /* dock mic */
5156 struct alc_spec *spec = codec->spec;
5158 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5159 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5160 snd_hda_apply_pincfgs(codec, pincfgs);
5161 } else if (action == HDA_FIXUP_ACT_INIT) {
5162 /* Enable DOCK device */
5163 snd_hda_codec_write(codec, 0x17, 0,
5164 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5165 /* Enable DOCK device */
5166 snd_hda_codec_write(codec, 0x19, 0,
5167 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5171 static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
5172 const struct hda_fixup *fix, int action)
5174 /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
5175 * the speaker output becomes too low by some reason on Thinkpads with
5176 * ALC298 codec
5178 static hda_nid_t preferred_pairs[] = {
5179 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
5182 struct alc_spec *spec = codec->spec;
5184 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5185 spec->gen.preferred_dacs = preferred_pairs;
5188 static void alc_shutup_dell_xps13(struct hda_codec *codec)
5190 struct alc_spec *spec = codec->spec;
5191 int hp_pin = alc_get_hp_pin(spec);
5193 /* Prevent pop noises when headphones are plugged in */
5194 snd_hda_codec_write(codec, hp_pin, 0,
5195 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5196 msleep(20);
5199 static void alc_fixup_dell_xps13(struct hda_codec *codec,
5200 const struct hda_fixup *fix, int action)
5202 struct alc_spec *spec = codec->spec;
5203 struct hda_input_mux *imux = &spec->gen.input_mux;
5204 int i;
5206 switch (action) {
5207 case HDA_FIXUP_ACT_PRE_PROBE:
5208 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
5209 * it causes a click noise at start up
5211 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
5212 spec->shutup = alc_shutup_dell_xps13;
5213 break;
5214 case HDA_FIXUP_ACT_PROBE:
5215 /* Make the internal mic the default input source. */
5216 for (i = 0; i < imux->num_items; i++) {
5217 if (spec->gen.imux_pins[i] == 0x12) {
5218 spec->gen.cur_mux[0] = i;
5219 break;
5222 break;
5226 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
5227 const struct hda_fixup *fix, int action)
5229 struct alc_spec *spec = codec->spec;
5231 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5232 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5233 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
5235 /* Disable boost for mic-in permanently. (This code is only called
5236 from quirks that guarantee that the headphone is at NID 0x1b.) */
5237 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
5238 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
5239 } else
5240 alc_fixup_headset_mode(codec, fix, action);
5243 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
5244 const struct hda_fixup *fix, int action)
5246 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5247 alc_write_coef_idx(codec, 0xc4, 0x8000);
5248 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
5249 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
5251 alc_fixup_headset_mode(codec, fix, action);
5254 /* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
5255 static int find_ext_mic_pin(struct hda_codec *codec)
5257 struct alc_spec *spec = codec->spec;
5258 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5259 hda_nid_t nid;
5260 unsigned int defcfg;
5261 int i;
5263 for (i = 0; i < cfg->num_inputs; i++) {
5264 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5265 continue;
5266 nid = cfg->inputs[i].pin;
5267 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5268 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
5269 continue;
5270 return nid;
5273 return 0;
5276 static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
5277 const struct hda_fixup *fix,
5278 int action)
5280 struct alc_spec *spec = codec->spec;
5282 if (action == HDA_FIXUP_ACT_PROBE) {
5283 int mic_pin = find_ext_mic_pin(codec);
5284 int hp_pin = alc_get_hp_pin(spec);
5286 if (snd_BUG_ON(!mic_pin || !hp_pin))
5287 return;
5288 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
5292 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
5293 const struct hda_fixup *fix,
5294 int action)
5296 struct alc_spec *spec = codec->spec;
5297 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5298 int i;
5300 /* The mic boosts on level 2 and 3 are too noisy
5301 on the internal mic input.
5302 Therefore limit the boost to 0 or 1. */
5304 if (action != HDA_FIXUP_ACT_PROBE)
5305 return;
5307 for (i = 0; i < cfg->num_inputs; i++) {
5308 hda_nid_t nid = cfg->inputs[i].pin;
5309 unsigned int defcfg;
5310 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5311 continue;
5312 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5313 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
5314 continue;
5316 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
5317 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
5318 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
5319 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
5320 (0 << AC_AMPCAP_MUTE_SHIFT));
5324 static void alc283_hp_automute_hook(struct hda_codec *codec,
5325 struct hda_jack_callback *jack)
5327 struct alc_spec *spec = codec->spec;
5328 int vref;
5330 msleep(200);
5331 snd_hda_gen_hp_automute(codec, jack);
5333 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
5335 msleep(600);
5336 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5337 vref);
5340 static void alc283_fixup_chromebook(struct hda_codec *codec,
5341 const struct hda_fixup *fix, int action)
5343 struct alc_spec *spec = codec->spec;
5345 switch (action) {
5346 case HDA_FIXUP_ACT_PRE_PROBE:
5347 snd_hda_override_wcaps(codec, 0x03, 0);
5348 /* Disable AA-loopback as it causes white noise */
5349 spec->gen.mixer_nid = 0;
5350 break;
5351 case HDA_FIXUP_ACT_INIT:
5352 /* MIC2-VREF control */
5353 /* Set to manual mode */
5354 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
5355 /* Enable Line1 input control by verb */
5356 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
5357 break;
5361 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
5362 const struct hda_fixup *fix, int action)
5364 struct alc_spec *spec = codec->spec;
5366 switch (action) {
5367 case HDA_FIXUP_ACT_PRE_PROBE:
5368 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
5369 break;
5370 case HDA_FIXUP_ACT_INIT:
5371 /* MIC2-VREF control */
5372 /* Set to manual mode */
5373 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
5374 break;
5378 /* mute tablet speaker pin (0x14) via dock plugging in addition */
5379 static void asus_tx300_automute(struct hda_codec *codec)
5381 struct alc_spec *spec = codec->spec;
5382 snd_hda_gen_update_outputs(codec);
5383 if (snd_hda_jack_detect(codec, 0x1b))
5384 spec->gen.mute_bits |= (1ULL << 0x14);
5387 static void alc282_fixup_asus_tx300(struct hda_codec *codec,
5388 const struct hda_fixup *fix, int action)
5390 struct alc_spec *spec = codec->spec;
5391 static const struct hda_pintbl dock_pins[] = {
5392 { 0x1b, 0x21114000 }, /* dock speaker pin */
5396 switch (action) {
5397 case HDA_FIXUP_ACT_PRE_PROBE:
5398 spec->init_amp = ALC_INIT_DEFAULT;
5399 /* TX300 needs to set up GPIO2 for the speaker amp */
5400 alc_setup_gpio(codec, 0x04);
5401 snd_hda_apply_pincfgs(codec, dock_pins);
5402 spec->gen.auto_mute_via_amp = 1;
5403 spec->gen.automute_hook = asus_tx300_automute;
5404 snd_hda_jack_detect_enable_callback(codec, 0x1b,
5405 snd_hda_gen_hp_automute);
5406 break;
5407 case HDA_FIXUP_ACT_PROBE:
5408 spec->init_amp = ALC_INIT_DEFAULT;
5409 break;
5410 case HDA_FIXUP_ACT_BUILD:
5411 /* this is a bit tricky; give more sane names for the main
5412 * (tablet) speaker and the dock speaker, respectively
5414 rename_ctl(codec, "Speaker Playback Switch",
5415 "Dock Speaker Playback Switch");
5416 rename_ctl(codec, "Bass Speaker Playback Switch",
5417 "Speaker Playback Switch");
5418 break;
5422 static void alc290_fixup_mono_speakers(struct hda_codec *codec,
5423 const struct hda_fixup *fix, int action)
5425 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5426 /* DAC node 0x03 is giving mono output. We therefore want to
5427 make sure 0x14 (front speaker) and 0x15 (headphones) use the
5428 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
5429 hda_nid_t conn1[2] = { 0x0c };
5430 snd_hda_override_conn_list(codec, 0x14, 1, conn1);
5431 snd_hda_override_conn_list(codec, 0x15, 1, conn1);
5435 static void alc298_fixup_speaker_volume(struct hda_codec *codec,
5436 const struct hda_fixup *fix, int action)
5438 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5439 /* The speaker is routed to the Node 0x06 by a mistake, as a result
5440 we can't adjust the speaker's volume since this node does not has
5441 Amp-out capability. we change the speaker's route to:
5442 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
5443 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
5444 speaker's volume now. */
5446 hda_nid_t conn1[1] = { 0x0c };
5447 snd_hda_override_conn_list(codec, 0x17, 1, conn1);
5451 /* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
5452 static void alc295_fixup_disable_dac3(struct hda_codec *codec,
5453 const struct hda_fixup *fix, int action)
5455 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5456 hda_nid_t conn[2] = { 0x02, 0x03 };
5457 snd_hda_override_conn_list(codec, 0x17, 2, conn);
5461 /* force NID 0x17 (Bass Speaker) to DAC1 to share it with the main speaker */
5462 static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
5463 const struct hda_fixup *fix, int action)
5465 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5466 hda_nid_t conn[1] = { 0x02 };
5467 snd_hda_override_conn_list(codec, 0x17, 1, conn);
5471 /* Hook to update amp GPIO4 for automute */
5472 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
5473 struct hda_jack_callback *jack)
5475 struct alc_spec *spec = codec->spec;
5477 snd_hda_gen_hp_automute(codec, jack);
5478 /* mute_led_polarity is set to 0, so we pass inverted value here */
5479 alc_update_gpio_led(codec, 0x10, !spec->gen.hp_jack_present);
5482 /* Manage GPIOs for HP EliteBook Folio 9480m.
5484 * GPIO4 is the headphone amplifier power control
5485 * GPIO3 is the audio output mute indicator LED
5488 static void alc280_fixup_hp_9480m(struct hda_codec *codec,
5489 const struct hda_fixup *fix,
5490 int action)
5492 struct alc_spec *spec = codec->spec;
5494 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
5495 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5496 /* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
5497 spec->gpio_mask |= 0x10;
5498 spec->gpio_dir |= 0x10;
5499 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
5503 static void alc275_fixup_gpio4_off(struct hda_codec *codec,
5504 const struct hda_fixup *fix,
5505 int action)
5507 struct alc_spec *spec = codec->spec;
5509 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5510 spec->gpio_mask |= 0x04;
5511 spec->gpio_dir |= 0x04;
5512 /* set data bit low */
5516 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
5517 const struct hda_fixup *fix,
5518 int action)
5520 alc_fixup_dual_codecs(codec, fix, action);
5521 switch (action) {
5522 case HDA_FIXUP_ACT_PRE_PROBE:
5523 /* override card longname to provide a unique UCM profile */
5524 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
5525 break;
5526 case HDA_FIXUP_ACT_BUILD:
5527 /* rename Capture controls depending on the codec */
5528 rename_ctl(codec, "Capture Volume",
5529 codec->addr == 0 ?
5530 "Rear-Panel Capture Volume" :
5531 "Front-Panel Capture Volume");
5532 rename_ctl(codec, "Capture Switch",
5533 codec->addr == 0 ?
5534 "Rear-Panel Capture Switch" :
5535 "Front-Panel Capture Switch");
5536 break;
5540 static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
5541 const struct hda_fixup *fix, int action)
5543 if (action != HDA_FIXUP_ACT_PRE_PROBE)
5544 return;
5546 codec->power_save_node = 1;
5549 /* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
5550 static void alc274_fixup_bind_dacs(struct hda_codec *codec,
5551 const struct hda_fixup *fix, int action)
5553 struct alc_spec *spec = codec->spec;
5554 static hda_nid_t preferred_pairs[] = {
5555 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
5559 if (action != HDA_FIXUP_ACT_PRE_PROBE)
5560 return;
5562 spec->gen.preferred_dacs = preferred_pairs;
5563 spec->gen.auto_mute_via_amp = 1;
5564 codec->power_save_node = 0;
5567 /* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */
5568 static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
5569 const struct hda_fixup *fix, int action)
5571 if (action != HDA_FIXUP_ACT_PRE_PROBE)
5572 return;
5574 snd_hda_override_wcaps(codec, 0x03, 0);
5577 static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
5578 const struct hda_fixup *fix, int action)
5580 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5581 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
5584 /* for hda_fixup_thinkpad_acpi() */
5585 #include "thinkpad_helper.c"
5587 static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
5588 const struct hda_fixup *fix, int action)
5590 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
5591 hda_fixup_thinkpad_acpi(codec, fix, action);
5594 /* for dell wmi mic mute led */
5595 #include "dell_wmi_helper.c"
5597 /* for alc295_fixup_hp_top_speakers */
5598 #include "hp_x360_helper.c"
5600 enum {
5601 ALC269_FIXUP_SONY_VAIO,
5602 ALC275_FIXUP_SONY_VAIO_GPIO2,
5603 ALC269_FIXUP_DELL_M101Z,
5604 ALC269_FIXUP_SKU_IGNORE,
5605 ALC269_FIXUP_ASUS_G73JW,
5606 ALC269_FIXUP_LENOVO_EAPD,
5607 ALC275_FIXUP_SONY_HWEQ,
5608 ALC275_FIXUP_SONY_DISABLE_AAMIX,
5609 ALC271_FIXUP_DMIC,
5610 ALC269_FIXUP_PCM_44K,
5611 ALC269_FIXUP_STEREO_DMIC,
5612 ALC269_FIXUP_HEADSET_MIC,
5613 ALC269_FIXUP_QUANTA_MUTE,
5614 ALC269_FIXUP_LIFEBOOK,
5615 ALC269_FIXUP_LIFEBOOK_EXTMIC,
5616 ALC269_FIXUP_LIFEBOOK_HP_PIN,
5617 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
5618 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
5619 ALC269_FIXUP_AMIC,
5620 ALC269_FIXUP_DMIC,
5621 ALC269VB_FIXUP_AMIC,
5622 ALC269VB_FIXUP_DMIC,
5623 ALC269_FIXUP_HP_MUTE_LED,
5624 ALC269_FIXUP_HP_MUTE_LED_MIC1,
5625 ALC269_FIXUP_HP_MUTE_LED_MIC2,
5626 ALC269_FIXUP_HP_MUTE_LED_MIC3,
5627 ALC269_FIXUP_HP_GPIO_LED,
5628 ALC269_FIXUP_HP_GPIO_MIC1_LED,
5629 ALC269_FIXUP_HP_LINE1_MIC1_LED,
5630 ALC269_FIXUP_INV_DMIC,
5631 ALC269_FIXUP_LENOVO_DOCK,
5632 ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
5633 ALC269_FIXUP_NO_SHUTUP,
5634 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
5635 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
5636 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
5637 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
5638 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
5639 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
5640 ALC269_FIXUP_HEADSET_MODE,
5641 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
5642 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
5643 ALC269_FIXUP_ASUS_X101_FUNC,
5644 ALC269_FIXUP_ASUS_X101_VERB,
5645 ALC269_FIXUP_ASUS_X101,
5646 ALC271_FIXUP_AMIC_MIC2,
5647 ALC271_FIXUP_HP_GATE_MIC_JACK,
5648 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
5649 ALC269_FIXUP_ACER_AC700,
5650 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
5651 ALC269VB_FIXUP_ASUS_ZENBOOK,
5652 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
5653 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
5654 ALC269VB_FIXUP_ORDISSIMO_EVE2,
5655 ALC283_FIXUP_CHROME_BOOK,
5656 ALC283_FIXUP_SENSE_COMBO_JACK,
5657 ALC282_FIXUP_ASUS_TX300,
5658 ALC283_FIXUP_INT_MIC,
5659 ALC290_FIXUP_MONO_SPEAKERS,
5660 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
5661 ALC290_FIXUP_SUBWOOFER,
5662 ALC290_FIXUP_SUBWOOFER_HSJACK,
5663 ALC269_FIXUP_THINKPAD_ACPI,
5664 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
5665 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
5666 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
5667 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5668 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
5669 ALC255_FIXUP_HEADSET_MODE,
5670 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
5671 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
5672 ALC292_FIXUP_TPT440_DOCK,
5673 ALC292_FIXUP_TPT440,
5674 ALC283_FIXUP_HEADSET_MIC,
5675 ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED,
5676 ALC282_FIXUP_ASPIRE_V5_PINS,
5677 ALC280_FIXUP_HP_GPIO4,
5678 ALC286_FIXUP_HP_GPIO_LED,
5679 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
5680 ALC280_FIXUP_HP_DOCK_PINS,
5681 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
5682 ALC280_FIXUP_HP_9480M,
5683 ALC288_FIXUP_DELL_HEADSET_MODE,
5684 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
5685 ALC288_FIXUP_DELL_XPS_13,
5686 ALC288_FIXUP_DISABLE_AAMIX,
5687 ALC292_FIXUP_DELL_E7X,
5688 ALC292_FIXUP_DISABLE_AAMIX,
5689 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
5690 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
5691 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
5692 ALC275_FIXUP_DELL_XPS,
5693 ALC293_FIXUP_LENOVO_SPK_NOISE,
5694 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
5695 ALC255_FIXUP_DELL_SPK_NOISE,
5696 ALC225_FIXUP_DISABLE_MIC_VREF,
5697 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
5698 ALC295_FIXUP_DISABLE_DAC3,
5699 ALC285_FIXUP_SPEAKER2_TO_DAC1,
5700 ALC280_FIXUP_HP_HEADSET_MIC,
5701 ALC221_FIXUP_HP_FRONT_MIC,
5702 ALC292_FIXUP_TPT460,
5703 ALC298_FIXUP_SPK_VOLUME,
5704 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
5705 ALC269_FIXUP_ATIV_BOOK_8,
5706 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
5707 ALC256_FIXUP_ASUS_HEADSET_MODE,
5708 ALC256_FIXUP_ASUS_MIC,
5709 ALC256_FIXUP_ASUS_AIO_GPIO2,
5710 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
5711 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
5712 ALC233_FIXUP_LENOVO_MULTI_CODECS,
5713 ALC233_FIXUP_ACER_HEADSET_MIC,
5714 ALC294_FIXUP_LENOVO_MIC_LOCATION,
5715 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
5716 ALC225_FIXUP_S3_POP_NOISE,
5717 ALC700_FIXUP_INTEL_REFERENCE,
5718 ALC274_FIXUP_DELL_BIND_DACS,
5719 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
5720 ALC298_FIXUP_TPT470_DOCK_FIX,
5721 ALC298_FIXUP_TPT470_DOCK,
5722 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
5723 ALC255_FIXUP_DELL_HEADSET_MIC,
5724 ALC256_FIXUP_HUAWEI_MBXP_PINS,
5725 ALC295_FIXUP_HP_X360,
5726 ALC221_FIXUP_HP_HEADSET_MIC,
5727 ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
5728 ALC295_FIXUP_HP_AUTO_MUTE,
5729 ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
5730 ALC294_FIXUP_ASUS_MIC,
5731 ALC294_FIXUP_ASUS_HEADSET_MIC,
5732 ALC294_FIXUP_ASUS_SPK,
5733 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
5734 ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
5735 ALC255_FIXUP_ACER_HEADSET_MIC,
5736 ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
5737 ALC225_FIXUP_WYSE_AUTO_MUTE,
5738 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
5739 ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
5740 ALC256_FIXUP_ASUS_HEADSET_MIC,
5741 ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
5742 ALC299_FIXUP_PREDATOR_SPK,
5743 ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
5744 ALC289_FIXUP_DELL_SPK2,
5745 ALC289_FIXUP_DUAL_SPK,
5746 ALC294_FIXUP_SPK2_TO_DAC1,
5747 ALC294_FIXUP_ASUS_DUAL_SPK,
5751 static const struct hda_fixup alc269_fixups[] = {
5752 [ALC269_FIXUP_SONY_VAIO] = {
5753 .type = HDA_FIXUP_PINCTLS,
5754 .v.pins = (const struct hda_pintbl[]) {
5755 {0x19, PIN_VREFGRD},
5759 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
5760 .type = HDA_FIXUP_FUNC,
5761 .v.func = alc275_fixup_gpio4_off,
5762 .chained = true,
5763 .chain_id = ALC269_FIXUP_SONY_VAIO
5765 [ALC269_FIXUP_DELL_M101Z] = {
5766 .type = HDA_FIXUP_VERBS,
5767 .v.verbs = (const struct hda_verb[]) {
5768 /* Enables internal speaker */
5769 {0x20, AC_VERB_SET_COEF_INDEX, 13},
5770 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
5774 [ALC269_FIXUP_SKU_IGNORE] = {
5775 .type = HDA_FIXUP_FUNC,
5776 .v.func = alc_fixup_sku_ignore,
5778 [ALC269_FIXUP_ASUS_G73JW] = {
5779 .type = HDA_FIXUP_PINS,
5780 .v.pins = (const struct hda_pintbl[]) {
5781 { 0x17, 0x99130111 }, /* subwoofer */
5785 [ALC269_FIXUP_LENOVO_EAPD] = {
5786 .type = HDA_FIXUP_VERBS,
5787 .v.verbs = (const struct hda_verb[]) {
5788 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
5792 [ALC275_FIXUP_SONY_HWEQ] = {
5793 .type = HDA_FIXUP_FUNC,
5794 .v.func = alc269_fixup_hweq,
5795 .chained = true,
5796 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
5798 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
5799 .type = HDA_FIXUP_FUNC,
5800 .v.func = alc_fixup_disable_aamix,
5801 .chained = true,
5802 .chain_id = ALC269_FIXUP_SONY_VAIO
5804 [ALC271_FIXUP_DMIC] = {
5805 .type = HDA_FIXUP_FUNC,
5806 .v.func = alc271_fixup_dmic,
5808 [ALC269_FIXUP_PCM_44K] = {
5809 .type = HDA_FIXUP_FUNC,
5810 .v.func = alc269_fixup_pcm_44k,
5811 .chained = true,
5812 .chain_id = ALC269_FIXUP_QUANTA_MUTE
5814 [ALC269_FIXUP_STEREO_DMIC] = {
5815 .type = HDA_FIXUP_FUNC,
5816 .v.func = alc269_fixup_stereo_dmic,
5818 [ALC269_FIXUP_HEADSET_MIC] = {
5819 .type = HDA_FIXUP_FUNC,
5820 .v.func = alc269_fixup_headset_mic,
5822 [ALC269_FIXUP_QUANTA_MUTE] = {
5823 .type = HDA_FIXUP_FUNC,
5824 .v.func = alc269_fixup_quanta_mute,
5826 [ALC269_FIXUP_LIFEBOOK] = {
5827 .type = HDA_FIXUP_PINS,
5828 .v.pins = (const struct hda_pintbl[]) {
5829 { 0x1a, 0x2101103f }, /* dock line-out */
5830 { 0x1b, 0x23a11040 }, /* dock mic-in */
5833 .chained = true,
5834 .chain_id = ALC269_FIXUP_QUANTA_MUTE
5836 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
5837 .type = HDA_FIXUP_PINS,
5838 .v.pins = (const struct hda_pintbl[]) {
5839 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
5843 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
5844 .type = HDA_FIXUP_PINS,
5845 .v.pins = (const struct hda_pintbl[]) {
5846 { 0x21, 0x0221102f }, /* HP out */
5850 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
5851 .type = HDA_FIXUP_FUNC,
5852 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
5854 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
5855 .type = HDA_FIXUP_FUNC,
5856 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
5858 [ALC269_FIXUP_AMIC] = {
5859 .type = HDA_FIXUP_PINS,
5860 .v.pins = (const struct hda_pintbl[]) {
5861 { 0x14, 0x99130110 }, /* speaker */
5862 { 0x15, 0x0121401f }, /* HP out */
5863 { 0x18, 0x01a19c20 }, /* mic */
5864 { 0x19, 0x99a3092f }, /* int-mic */
5868 [ALC269_FIXUP_DMIC] = {
5869 .type = HDA_FIXUP_PINS,
5870 .v.pins = (const struct hda_pintbl[]) {
5871 { 0x12, 0x99a3092f }, /* int-mic */
5872 { 0x14, 0x99130110 }, /* speaker */
5873 { 0x15, 0x0121401f }, /* HP out */
5874 { 0x18, 0x01a19c20 }, /* mic */
5878 [ALC269VB_FIXUP_AMIC] = {
5879 .type = HDA_FIXUP_PINS,
5880 .v.pins = (const struct hda_pintbl[]) {
5881 { 0x14, 0x99130110 }, /* speaker */
5882 { 0x18, 0x01a19c20 }, /* mic */
5883 { 0x19, 0x99a3092f }, /* int-mic */
5884 { 0x21, 0x0121401f }, /* HP out */
5888 [ALC269VB_FIXUP_DMIC] = {
5889 .type = HDA_FIXUP_PINS,
5890 .v.pins = (const struct hda_pintbl[]) {
5891 { 0x12, 0x99a3092f }, /* int-mic */
5892 { 0x14, 0x99130110 }, /* speaker */
5893 { 0x18, 0x01a19c20 }, /* mic */
5894 { 0x21, 0x0121401f }, /* HP out */
5898 [ALC269_FIXUP_HP_MUTE_LED] = {
5899 .type = HDA_FIXUP_FUNC,
5900 .v.func = alc269_fixup_hp_mute_led,
5902 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
5903 .type = HDA_FIXUP_FUNC,
5904 .v.func = alc269_fixup_hp_mute_led_mic1,
5906 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
5907 .type = HDA_FIXUP_FUNC,
5908 .v.func = alc269_fixup_hp_mute_led_mic2,
5910 [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
5911 .type = HDA_FIXUP_FUNC,
5912 .v.func = alc269_fixup_hp_mute_led_mic3,
5913 .chained = true,
5914 .chain_id = ALC295_FIXUP_HP_AUTO_MUTE
5916 [ALC269_FIXUP_HP_GPIO_LED] = {
5917 .type = HDA_FIXUP_FUNC,
5918 .v.func = alc269_fixup_hp_gpio_led,
5920 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
5921 .type = HDA_FIXUP_FUNC,
5922 .v.func = alc269_fixup_hp_gpio_mic1_led,
5924 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
5925 .type = HDA_FIXUP_FUNC,
5926 .v.func = alc269_fixup_hp_line1_mic1_led,
5928 [ALC269_FIXUP_INV_DMIC] = {
5929 .type = HDA_FIXUP_FUNC,
5930 .v.func = alc_fixup_inv_dmic,
5932 [ALC269_FIXUP_NO_SHUTUP] = {
5933 .type = HDA_FIXUP_FUNC,
5934 .v.func = alc_fixup_no_shutup,
5936 [ALC269_FIXUP_LENOVO_DOCK] = {
5937 .type = HDA_FIXUP_PINS,
5938 .v.pins = (const struct hda_pintbl[]) {
5939 { 0x19, 0x23a11040 }, /* dock mic */
5940 { 0x1b, 0x2121103f }, /* dock headphone */
5943 .chained = true,
5944 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
5946 [ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
5947 .type = HDA_FIXUP_FUNC,
5948 .v.func = alc269_fixup_limit_int_mic_boost,
5949 .chained = true,
5950 .chain_id = ALC269_FIXUP_LENOVO_DOCK,
5952 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
5953 .type = HDA_FIXUP_FUNC,
5954 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
5955 .chained = true,
5956 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
5958 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
5959 .type = HDA_FIXUP_PINS,
5960 .v.pins = (const struct hda_pintbl[]) {
5961 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5962 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5965 .chained = true,
5966 .chain_id = ALC269_FIXUP_HEADSET_MODE
5968 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
5969 .type = HDA_FIXUP_PINS,
5970 .v.pins = (const struct hda_pintbl[]) {
5971 { 0x16, 0x21014020 }, /* dock line out */
5972 { 0x19, 0x21a19030 }, /* dock mic */
5973 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5976 .chained = true,
5977 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
5979 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
5980 .type = HDA_FIXUP_PINS,
5981 .v.pins = (const struct hda_pintbl[]) {
5982 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5985 .chained = true,
5986 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
5988 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
5989 .type = HDA_FIXUP_PINS,
5990 .v.pins = (const struct hda_pintbl[]) {
5991 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5992 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5995 .chained = true,
5996 .chain_id = ALC269_FIXUP_HEADSET_MODE
5998 [ALC269_FIXUP_HEADSET_MODE] = {
5999 .type = HDA_FIXUP_FUNC,
6000 .v.func = alc_fixup_headset_mode,
6001 .chained = true,
6002 .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
6004 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
6005 .type = HDA_FIXUP_FUNC,
6006 .v.func = alc_fixup_headset_mode_no_hp_mic,
6008 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
6009 .type = HDA_FIXUP_PINS,
6010 .v.pins = (const struct hda_pintbl[]) {
6011 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
6014 .chained = true,
6015 .chain_id = ALC269_FIXUP_HEADSET_MODE,
6017 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
6018 .type = HDA_FIXUP_PINS,
6019 .v.pins = (const struct hda_pintbl[]) {
6020 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6023 .chained = true,
6024 .chain_id = ALC269_FIXUP_HEADSET_MIC
6026 [ALC256_FIXUP_HUAWEI_MBXP_PINS] = {
6027 .type = HDA_FIXUP_PINS,
6028 .v.pins = (const struct hda_pintbl[]) {
6029 {0x12, 0x90a60130},
6030 {0x13, 0x40000000},
6031 {0x14, 0x90170110},
6032 {0x18, 0x411111f0},
6033 {0x19, 0x04a11040},
6034 {0x1a, 0x411111f0},
6035 {0x1b, 0x90170112},
6036 {0x1d, 0x40759a05},
6037 {0x1e, 0x411111f0},
6038 {0x21, 0x04211020},
6042 [ALC269_FIXUP_ASUS_X101_FUNC] = {
6043 .type = HDA_FIXUP_FUNC,
6044 .v.func = alc269_fixup_x101_headset_mic,
6046 [ALC269_FIXUP_ASUS_X101_VERB] = {
6047 .type = HDA_FIXUP_VERBS,
6048 .v.verbs = (const struct hda_verb[]) {
6049 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6050 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
6051 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
6054 .chained = true,
6055 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
6057 [ALC269_FIXUP_ASUS_X101] = {
6058 .type = HDA_FIXUP_PINS,
6059 .v.pins = (const struct hda_pintbl[]) {
6060 { 0x18, 0x04a1182c }, /* Headset mic */
6063 .chained = true,
6064 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
6066 [ALC271_FIXUP_AMIC_MIC2] = {
6067 .type = HDA_FIXUP_PINS,
6068 .v.pins = (const struct hda_pintbl[]) {
6069 { 0x14, 0x99130110 }, /* speaker */
6070 { 0x19, 0x01a19c20 }, /* mic */
6071 { 0x1b, 0x99a7012f }, /* int-mic */
6072 { 0x21, 0x0121401f }, /* HP out */
6076 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
6077 .type = HDA_FIXUP_FUNC,
6078 .v.func = alc271_hp_gate_mic_jack,
6079 .chained = true,
6080 .chain_id = ALC271_FIXUP_AMIC_MIC2,
6082 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
6083 .type = HDA_FIXUP_FUNC,
6084 .v.func = alc269_fixup_limit_int_mic_boost,
6085 .chained = true,
6086 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
6088 [ALC269_FIXUP_ACER_AC700] = {
6089 .type = HDA_FIXUP_PINS,
6090 .v.pins = (const struct hda_pintbl[]) {
6091 { 0x12, 0x99a3092f }, /* int-mic */
6092 { 0x14, 0x99130110 }, /* speaker */
6093 { 0x18, 0x03a11c20 }, /* mic */
6094 { 0x1e, 0x0346101e }, /* SPDIF1 */
6095 { 0x21, 0x0321101f }, /* HP out */
6098 .chained = true,
6099 .chain_id = ALC271_FIXUP_DMIC,
6101 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
6102 .type = HDA_FIXUP_FUNC,
6103 .v.func = alc269_fixup_limit_int_mic_boost,
6104 .chained = true,
6105 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
6107 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
6108 .type = HDA_FIXUP_FUNC,
6109 .v.func = alc269_fixup_limit_int_mic_boost,
6110 .chained = true,
6111 .chain_id = ALC269VB_FIXUP_DMIC,
6113 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
6114 .type = HDA_FIXUP_VERBS,
6115 .v.verbs = (const struct hda_verb[]) {
6116 /* class-D output amp +5dB */
6117 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
6118 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
6121 .chained = true,
6122 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
6124 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
6125 .type = HDA_FIXUP_FUNC,
6126 .v.func = alc269_fixup_limit_int_mic_boost,
6127 .chained = true,
6128 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
6130 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
6131 .type = HDA_FIXUP_PINS,
6132 .v.pins = (const struct hda_pintbl[]) {
6133 { 0x12, 0x99a3092f }, /* int-mic */
6134 { 0x18, 0x03a11d20 }, /* mic */
6135 { 0x19, 0x411111f0 }, /* Unused bogus pin */
6139 [ALC283_FIXUP_CHROME_BOOK] = {
6140 .type = HDA_FIXUP_FUNC,
6141 .v.func = alc283_fixup_chromebook,
6143 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
6144 .type = HDA_FIXUP_FUNC,
6145 .v.func = alc283_fixup_sense_combo_jack,
6146 .chained = true,
6147 .chain_id = ALC283_FIXUP_CHROME_BOOK,
6149 [ALC282_FIXUP_ASUS_TX300] = {
6150 .type = HDA_FIXUP_FUNC,
6151 .v.func = alc282_fixup_asus_tx300,
6153 [ALC283_FIXUP_INT_MIC] = {
6154 .type = HDA_FIXUP_VERBS,
6155 .v.verbs = (const struct hda_verb[]) {
6156 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
6157 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
6160 .chained = true,
6161 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
6163 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
6164 .type = HDA_FIXUP_PINS,
6165 .v.pins = (const struct hda_pintbl[]) {
6166 { 0x17, 0x90170112 }, /* subwoofer */
6169 .chained = true,
6170 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6172 [ALC290_FIXUP_SUBWOOFER] = {
6173 .type = HDA_FIXUP_PINS,
6174 .v.pins = (const struct hda_pintbl[]) {
6175 { 0x17, 0x90170112 }, /* subwoofer */
6178 .chained = true,
6179 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
6181 [ALC290_FIXUP_MONO_SPEAKERS] = {
6182 .type = HDA_FIXUP_FUNC,
6183 .v.func = alc290_fixup_mono_speakers,
6185 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
6186 .type = HDA_FIXUP_FUNC,
6187 .v.func = alc290_fixup_mono_speakers,
6188 .chained = true,
6189 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
6191 [ALC269_FIXUP_THINKPAD_ACPI] = {
6192 .type = HDA_FIXUP_FUNC,
6193 .v.func = alc_fixup_thinkpad_acpi,
6194 .chained = true,
6195 .chain_id = ALC269_FIXUP_SKU_IGNORE,
6197 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
6198 .type = HDA_FIXUP_FUNC,
6199 .v.func = alc_fixup_inv_dmic,
6200 .chained = true,
6201 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
6203 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
6204 .type = HDA_FIXUP_PINS,
6205 .v.pins = (const struct hda_pintbl[]) {
6206 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6209 .chained = true,
6210 .chain_id = ALC255_FIXUP_HEADSET_MODE
6212 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
6213 .type = HDA_FIXUP_PINS,
6214 .v.pins = (const struct hda_pintbl[]) {
6215 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6218 .chained = true,
6219 .chain_id = ALC255_FIXUP_HEADSET_MODE
6221 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6222 .type = HDA_FIXUP_PINS,
6223 .v.pins = (const struct hda_pintbl[]) {
6224 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6225 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6228 .chained = true,
6229 .chain_id = ALC255_FIXUP_HEADSET_MODE
6231 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
6232 .type = HDA_FIXUP_PINS,
6233 .v.pins = (const struct hda_pintbl[]) {
6234 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6237 .chained = true,
6238 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
6240 [ALC255_FIXUP_HEADSET_MODE] = {
6241 .type = HDA_FIXUP_FUNC,
6242 .v.func = alc_fixup_headset_mode_alc255,
6243 .chained = true,
6244 .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
6246 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
6247 .type = HDA_FIXUP_FUNC,
6248 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
6250 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6251 .type = HDA_FIXUP_PINS,
6252 .v.pins = (const struct hda_pintbl[]) {
6253 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6254 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6257 .chained = true,
6258 .chain_id = ALC269_FIXUP_HEADSET_MODE
6260 [ALC292_FIXUP_TPT440_DOCK] = {
6261 .type = HDA_FIXUP_FUNC,
6262 .v.func = alc_fixup_tpt440_dock,
6263 .chained = true,
6264 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
6266 [ALC292_FIXUP_TPT440] = {
6267 .type = HDA_FIXUP_FUNC,
6268 .v.func = alc_fixup_disable_aamix,
6269 .chained = true,
6270 .chain_id = ALC292_FIXUP_TPT440_DOCK,
6272 [ALC283_FIXUP_HEADSET_MIC] = {
6273 .type = HDA_FIXUP_PINS,
6274 .v.pins = (const struct hda_pintbl[]) {
6275 { 0x19, 0x04a110f0 },
6276 { },
6279 [ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED] = {
6280 .type = HDA_FIXUP_FUNC,
6281 .v.func = alc_fixup_dell_wmi,
6283 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
6284 .type = HDA_FIXUP_PINS,
6285 .v.pins = (const struct hda_pintbl[]) {
6286 { 0x12, 0x90a60130 },
6287 { 0x14, 0x90170110 },
6288 { 0x17, 0x40000008 },
6289 { 0x18, 0x411111f0 },
6290 { 0x19, 0x01a1913c },
6291 { 0x1a, 0x411111f0 },
6292 { 0x1b, 0x411111f0 },
6293 { 0x1d, 0x40f89b2d },
6294 { 0x1e, 0x411111f0 },
6295 { 0x21, 0x0321101f },
6296 { },
6299 [ALC280_FIXUP_HP_GPIO4] = {
6300 .type = HDA_FIXUP_FUNC,
6301 .v.func = alc280_fixup_hp_gpio4,
6303 [ALC286_FIXUP_HP_GPIO_LED] = {
6304 .type = HDA_FIXUP_FUNC,
6305 .v.func = alc286_fixup_hp_gpio_led,
6307 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
6308 .type = HDA_FIXUP_FUNC,
6309 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
6311 [ALC280_FIXUP_HP_DOCK_PINS] = {
6312 .type = HDA_FIXUP_PINS,
6313 .v.pins = (const struct hda_pintbl[]) {
6314 { 0x1b, 0x21011020 }, /* line-out */
6315 { 0x1a, 0x01a1903c }, /* headset mic */
6316 { 0x18, 0x2181103f }, /* line-in */
6317 { },
6319 .chained = true,
6320 .chain_id = ALC280_FIXUP_HP_GPIO4
6322 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
6323 .type = HDA_FIXUP_PINS,
6324 .v.pins = (const struct hda_pintbl[]) {
6325 { 0x1b, 0x21011020 }, /* line-out */
6326 { 0x18, 0x2181103f }, /* line-in */
6327 { },
6329 .chained = true,
6330 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
6332 [ALC280_FIXUP_HP_9480M] = {
6333 .type = HDA_FIXUP_FUNC,
6334 .v.func = alc280_fixup_hp_9480m,
6336 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
6337 .type = HDA_FIXUP_FUNC,
6338 .v.func = alc_fixup_headset_mode_dell_alc288,
6339 .chained = true,
6340 .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
6342 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6343 .type = HDA_FIXUP_PINS,
6344 .v.pins = (const struct hda_pintbl[]) {
6345 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6346 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6349 .chained = true,
6350 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
6352 [ALC288_FIXUP_DISABLE_AAMIX] = {
6353 .type = HDA_FIXUP_FUNC,
6354 .v.func = alc_fixup_disable_aamix,
6355 .chained = true,
6356 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
6358 [ALC288_FIXUP_DELL_XPS_13] = {
6359 .type = HDA_FIXUP_FUNC,
6360 .v.func = alc_fixup_dell_xps13,
6361 .chained = true,
6362 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
6364 [ALC292_FIXUP_DISABLE_AAMIX] = {
6365 .type = HDA_FIXUP_FUNC,
6366 .v.func = alc_fixup_disable_aamix,
6367 .chained = true,
6368 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
6370 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
6371 .type = HDA_FIXUP_FUNC,
6372 .v.func = alc_fixup_disable_aamix,
6373 .chained = true,
6374 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
6376 [ALC292_FIXUP_DELL_E7X] = {
6377 .type = HDA_FIXUP_FUNC,
6378 .v.func = alc_fixup_dell_xps13,
6379 .chained = true,
6380 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
6382 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6383 .type = HDA_FIXUP_PINS,
6384 .v.pins = (const struct hda_pintbl[]) {
6385 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6386 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6389 .chained = true,
6390 .chain_id = ALC269_FIXUP_HEADSET_MODE
6392 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
6393 .type = HDA_FIXUP_PINS,
6394 .v.pins = (const struct hda_pintbl[]) {
6395 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6398 .chained = true,
6399 .chain_id = ALC269_FIXUP_HEADSET_MODE
6401 [ALC275_FIXUP_DELL_XPS] = {
6402 .type = HDA_FIXUP_VERBS,
6403 .v.verbs = (const struct hda_verb[]) {
6404 /* Enables internal speaker */
6405 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
6406 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
6407 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
6408 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
6412 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
6413 .type = HDA_FIXUP_FUNC,
6414 .v.func = alc_fixup_disable_aamix,
6415 .chained = true,
6416 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
6418 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
6419 .type = HDA_FIXUP_FUNC,
6420 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
6422 [ALC255_FIXUP_DELL_SPK_NOISE] = {
6423 .type = HDA_FIXUP_FUNC,
6424 .v.func = alc_fixup_disable_aamix,
6425 .chained = true,
6426 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6428 [ALC225_FIXUP_DISABLE_MIC_VREF] = {
6429 .type = HDA_FIXUP_FUNC,
6430 .v.func = alc_fixup_disable_mic_vref,
6431 .chained = true,
6432 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
6434 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6435 .type = HDA_FIXUP_VERBS,
6436 .v.verbs = (const struct hda_verb[]) {
6437 /* Disable pass-through path for FRONT 14h */
6438 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
6439 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
6442 .chained = true,
6443 .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
6445 [ALC280_FIXUP_HP_HEADSET_MIC] = {
6446 .type = HDA_FIXUP_FUNC,
6447 .v.func = alc_fixup_disable_aamix,
6448 .chained = true,
6449 .chain_id = ALC269_FIXUP_HEADSET_MIC,
6451 [ALC221_FIXUP_HP_FRONT_MIC] = {
6452 .type = HDA_FIXUP_PINS,
6453 .v.pins = (const struct hda_pintbl[]) {
6454 { 0x19, 0x02a19020 }, /* Front Mic */
6458 [ALC292_FIXUP_TPT460] = {
6459 .type = HDA_FIXUP_FUNC,
6460 .v.func = alc_fixup_tpt440_dock,
6461 .chained = true,
6462 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
6464 [ALC298_FIXUP_SPK_VOLUME] = {
6465 .type = HDA_FIXUP_FUNC,
6466 .v.func = alc298_fixup_speaker_volume,
6467 .chained = true,
6468 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
6470 [ALC295_FIXUP_DISABLE_DAC3] = {
6471 .type = HDA_FIXUP_FUNC,
6472 .v.func = alc295_fixup_disable_dac3,
6474 [ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
6475 .type = HDA_FIXUP_FUNC,
6476 .v.func = alc285_fixup_speaker2_to_dac1,
6477 .chained = true,
6478 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
6480 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
6481 .type = HDA_FIXUP_PINS,
6482 .v.pins = (const struct hda_pintbl[]) {
6483 { 0x1b, 0x90170151 },
6486 .chained = true,
6487 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6489 [ALC269_FIXUP_ATIV_BOOK_8] = {
6490 .type = HDA_FIXUP_FUNC,
6491 .v.func = alc_fixup_auto_mute_via_amp,
6492 .chained = true,
6493 .chain_id = ALC269_FIXUP_NO_SHUTUP
6495 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
6496 .type = HDA_FIXUP_PINS,
6497 .v.pins = (const struct hda_pintbl[]) {
6498 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6499 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6502 .chained = true,
6503 .chain_id = ALC269_FIXUP_HEADSET_MODE
6505 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
6506 .type = HDA_FIXUP_FUNC,
6507 .v.func = alc_fixup_headset_mode,
6509 [ALC256_FIXUP_ASUS_MIC] = {
6510 .type = HDA_FIXUP_PINS,
6511 .v.pins = (const struct hda_pintbl[]) {
6512 { 0x13, 0x90a60160 }, /* use as internal mic */
6513 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
6516 .chained = true,
6517 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
6519 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
6520 .type = HDA_FIXUP_FUNC,
6521 /* Set up GPIO2 for the speaker amp */
6522 .v.func = alc_fixup_gpio4,
6524 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
6525 .type = HDA_FIXUP_PINS,
6526 .v.pins = (const struct hda_pintbl[]) {
6527 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6530 .chained = true,
6531 .chain_id = ALC269_FIXUP_HEADSET_MIC
6533 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
6534 .type = HDA_FIXUP_VERBS,
6535 .v.verbs = (const struct hda_verb[]) {
6536 /* Enables internal speaker */
6537 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
6538 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
6541 .chained = true,
6542 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
6544 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
6545 .type = HDA_FIXUP_FUNC,
6546 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
6548 [ALC233_FIXUP_ACER_HEADSET_MIC] = {
6549 .type = HDA_FIXUP_VERBS,
6550 .v.verbs = (const struct hda_verb[]) {
6551 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
6552 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
6555 .chained = true,
6556 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
6558 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
6559 .type = HDA_FIXUP_PINS,
6560 .v.pins = (const struct hda_pintbl[]) {
6561 /* Change the mic location from front to right, otherwise there are
6562 two front mics with the same name, pulseaudio can't handle them.
6563 This is just a temporary workaround, after applying this fixup,
6564 there will be one "Front Mic" and one "Mic" in this machine.
6566 { 0x1a, 0x04a19040 },
6570 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
6571 .type = HDA_FIXUP_PINS,
6572 .v.pins = (const struct hda_pintbl[]) {
6573 { 0x16, 0x0101102f }, /* Rear Headset HP */
6574 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
6575 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
6576 { 0x1b, 0x02011020 },
6579 .chained = true,
6580 .chain_id = ALC225_FIXUP_S3_POP_NOISE
6582 [ALC225_FIXUP_S3_POP_NOISE] = {
6583 .type = HDA_FIXUP_FUNC,
6584 .v.func = alc225_fixup_s3_pop_noise,
6585 .chained = true,
6586 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6588 [ALC700_FIXUP_INTEL_REFERENCE] = {
6589 .type = HDA_FIXUP_VERBS,
6590 .v.verbs = (const struct hda_verb[]) {
6591 /* Enables internal speaker */
6592 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
6593 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
6594 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
6595 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
6596 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
6597 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
6598 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
6599 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
6603 [ALC274_FIXUP_DELL_BIND_DACS] = {
6604 .type = HDA_FIXUP_FUNC,
6605 .v.func = alc274_fixup_bind_dacs,
6606 .chained = true,
6607 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
6609 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
6610 .type = HDA_FIXUP_PINS,
6611 .v.pins = (const struct hda_pintbl[]) {
6612 { 0x1b, 0x0401102f },
6615 .chained = true,
6616 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
6618 [ALC298_FIXUP_TPT470_DOCK_FIX] = {
6619 .type = HDA_FIXUP_FUNC,
6620 .v.func = alc_fixup_tpt470_dock,
6621 .chained = true,
6622 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
6624 [ALC298_FIXUP_TPT470_DOCK] = {
6625 .type = HDA_FIXUP_FUNC,
6626 .v.func = alc_fixup_tpt470_dacs,
6627 .chained = true,
6628 .chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
6630 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
6631 .type = HDA_FIXUP_PINS,
6632 .v.pins = (const struct hda_pintbl[]) {
6633 { 0x14, 0x0201101f },
6636 .chained = true,
6637 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6639 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
6640 .type = HDA_FIXUP_PINS,
6641 .v.pins = (const struct hda_pintbl[]) {
6642 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6645 .chained = true,
6646 .chain_id = ALC269_FIXUP_HEADSET_MIC
6648 [ALC295_FIXUP_HP_X360] = {
6649 .type = HDA_FIXUP_FUNC,
6650 .v.func = alc295_fixup_hp_top_speakers,
6651 .chained = true,
6652 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
6654 [ALC221_FIXUP_HP_HEADSET_MIC] = {
6655 .type = HDA_FIXUP_PINS,
6656 .v.pins = (const struct hda_pintbl[]) {
6657 { 0x19, 0x0181313f},
6660 .chained = true,
6661 .chain_id = ALC269_FIXUP_HEADSET_MIC
6663 [ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
6664 .type = HDA_FIXUP_FUNC,
6665 .v.func = alc285_fixup_invalidate_dacs,
6666 .chained = true,
6667 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
6669 [ALC295_FIXUP_HP_AUTO_MUTE] = {
6670 .type = HDA_FIXUP_FUNC,
6671 .v.func = alc_fixup_auto_mute_via_amp,
6673 [ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
6674 .type = HDA_FIXUP_PINS,
6675 .v.pins = (const struct hda_pintbl[]) {
6676 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6679 .chained = true,
6680 .chain_id = ALC269_FIXUP_HEADSET_MIC
6682 [ALC294_FIXUP_ASUS_MIC] = {
6683 .type = HDA_FIXUP_PINS,
6684 .v.pins = (const struct hda_pintbl[]) {
6685 { 0x13, 0x90a60160 }, /* use as internal mic */
6686 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
6689 .chained = true,
6690 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6692 [ALC294_FIXUP_ASUS_HEADSET_MIC] = {
6693 .type = HDA_FIXUP_PINS,
6694 .v.pins = (const struct hda_pintbl[]) {
6695 { 0x19, 0x01a1103c }, /* use as headset mic */
6698 .chained = true,
6699 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6701 [ALC294_FIXUP_ASUS_SPK] = {
6702 .type = HDA_FIXUP_VERBS,
6703 .v.verbs = (const struct hda_verb[]) {
6704 /* Set EAPD high */
6705 { 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
6706 { 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
6709 .chained = true,
6710 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
6712 [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
6713 .type = HDA_FIXUP_PINS,
6714 .v.pins = (const struct hda_pintbl[]) {
6715 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6718 .chained = true,
6719 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6721 [ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
6722 .type = HDA_FIXUP_VERBS,
6723 .v.verbs = (const struct hda_verb[]) {
6724 /* Disable PCBEEP-IN passthrough */
6725 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
6726 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
6729 .chained = true,
6730 .chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
6732 [ALC255_FIXUP_ACER_HEADSET_MIC] = {
6733 .type = HDA_FIXUP_PINS,
6734 .v.pins = (const struct hda_pintbl[]) {
6735 { 0x19, 0x03a11130 },
6736 { 0x1a, 0x90a60140 }, /* use as internal mic */
6739 .chained = true,
6740 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
6742 [ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
6743 .type = HDA_FIXUP_PINS,
6744 .v.pins = (const struct hda_pintbl[]) {
6745 { 0x16, 0x01011020 }, /* Rear Line out */
6746 { 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
6749 .chained = true,
6750 .chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
6752 [ALC225_FIXUP_WYSE_AUTO_MUTE] = {
6753 .type = HDA_FIXUP_FUNC,
6754 .v.func = alc_fixup_auto_mute_via_amp,
6755 .chained = true,
6756 .chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
6758 [ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
6759 .type = HDA_FIXUP_FUNC,
6760 .v.func = alc_fixup_disable_mic_vref,
6761 .chained = true,
6762 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6764 [ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
6765 .type = HDA_FIXUP_VERBS,
6766 .v.verbs = (const struct hda_verb[]) {
6767 { 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
6768 { 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
6771 .chained = true,
6772 .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
6774 [ALC256_FIXUP_ASUS_HEADSET_MIC] = {
6775 .type = HDA_FIXUP_PINS,
6776 .v.pins = (const struct hda_pintbl[]) {
6777 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
6780 .chained = true,
6781 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
6783 [ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
6784 .type = HDA_FIXUP_PINS,
6785 .v.pins = (const struct hda_pintbl[]) {
6786 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
6789 .chained = true,
6790 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
6792 [ALC299_FIXUP_PREDATOR_SPK] = {
6793 .type = HDA_FIXUP_PINS,
6794 .v.pins = (const struct hda_pintbl[]) {
6795 { 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
6799 [ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
6800 .type = HDA_FIXUP_PINS,
6801 .v.pins = (const struct hda_pintbl[]) {
6802 { 0x19, 0x04a11040 },
6803 { 0x21, 0x04211020 },
6806 .chained = true,
6807 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
6809 [ALC289_FIXUP_DELL_SPK2] = {
6810 .type = HDA_FIXUP_PINS,
6811 .v.pins = (const struct hda_pintbl[]) {
6812 { 0x17, 0x90170130 }, /* bass spk */
6815 .chained = true,
6816 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
6818 [ALC289_FIXUP_DUAL_SPK] = {
6819 .type = HDA_FIXUP_FUNC,
6820 .v.func = alc285_fixup_speaker2_to_dac1,
6821 .chained = true,
6822 .chain_id = ALC289_FIXUP_DELL_SPK2
6824 [ALC294_FIXUP_SPK2_TO_DAC1] = {
6825 .type = HDA_FIXUP_FUNC,
6826 .v.func = alc285_fixup_speaker2_to_dac1,
6827 .chained = true,
6828 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
6830 [ALC294_FIXUP_ASUS_DUAL_SPK] = {
6831 .type = HDA_FIXUP_FUNC,
6832 /* The GPIO must be pulled to initialize the AMP */
6833 .v.func = alc_fixup_gpio4,
6834 .chained = true,
6835 .chain_id = ALC294_FIXUP_SPK2_TO_DAC1
6840 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
6841 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
6842 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
6843 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
6844 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
6845 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
6846 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
6847 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
6848 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
6849 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
6850 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
6851 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
6852 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
6853 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
6854 SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
6855 SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
6856 SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
6857 SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
6858 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
6859 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
6860 SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
6861 SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
6862 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
6863 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
6864 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
6865 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
6866 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
6867 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
6868 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
6869 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
6870 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
6871 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
6872 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
6873 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
6874 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
6875 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
6876 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
6877 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
6878 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6879 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6880 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
6881 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
6882 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
6883 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
6884 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6885 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6886 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6887 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6888 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6889 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6890 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6891 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
6892 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
6893 SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
6894 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
6895 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
6896 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
6897 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
6898 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
6899 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
6900 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
6901 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
6902 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
6903 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
6904 SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
6905 SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
6906 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
6907 SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
6908 SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
6909 SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
6910 SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
6911 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6912 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6913 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
6914 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
6915 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
6916 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
6917 /* ALC282 */
6918 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6919 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6920 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6921 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6922 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6923 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6924 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6925 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6926 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6927 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6928 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6929 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6930 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
6931 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
6932 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
6933 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6934 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6935 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6936 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6937 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6938 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
6939 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6940 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6941 /* ALC290 */
6942 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6943 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6944 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6945 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6946 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6947 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6948 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6949 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6950 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6951 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
6952 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6953 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6954 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6955 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6956 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6957 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6958 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6959 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6960 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6961 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6962 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6963 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6964 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6965 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6966 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6967 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6968 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6969 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6970 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6971 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
6972 SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
6973 SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
6974 SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
6975 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
6976 SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
6977 SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
6978 SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
6979 SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
6980 SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
6981 SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
6982 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
6983 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
6984 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
6985 SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
6986 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
6987 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
6988 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
6989 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
6990 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
6991 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
6992 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
6993 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
6994 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
6995 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
6996 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
6997 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
6998 SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
6999 SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
7000 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
7001 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
7002 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
7003 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
7004 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
7005 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
7006 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
7007 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
7008 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
7009 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
7010 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
7011 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
7012 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
7013 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
7014 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
7015 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
7016 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
7017 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
7018 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
7019 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
7020 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
7021 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
7022 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
7023 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
7024 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
7025 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
7026 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
7027 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
7028 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
7029 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
7030 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
7031 SND_PCI_QUIRK(0x1558, 0x1325, "System76 Darter Pro (darp5)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7032 SND_PCI_QUIRK(0x1558, 0x8550, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7033 SND_PCI_QUIRK(0x1558, 0x8551, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7034 SND_PCI_QUIRK(0x1558, 0x8560, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
7035 SND_PCI_QUIRK(0x1558, 0x8561, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
7036 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
7037 SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
7038 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
7039 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
7040 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
7041 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
7042 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
7043 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
7044 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
7045 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
7046 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
7047 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
7048 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
7049 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
7050 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
7051 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
7052 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
7053 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
7054 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
7055 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
7056 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
7057 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
7058 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
7059 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7060 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7061 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
7062 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
7063 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
7064 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7065 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7066 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
7067 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7068 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7069 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7070 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
7071 SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Yoga 7th", ALC285_FIXUP_SPEAKER2_TO_DAC1),
7072 SND_PCI_QUIRK(0x17aa, 0x2293, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_SPEAKER2_TO_DAC1),
7073 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
7074 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
7075 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
7076 SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
7077 SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
7078 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
7079 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
7080 SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
7081 SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
7082 SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
7083 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
7084 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
7085 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
7086 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
7087 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
7088 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
7089 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
7090 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
7091 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
7092 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
7093 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
7094 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
7095 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
7096 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
7097 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
7098 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7099 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7100 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7101 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
7102 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7103 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7104 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
7105 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
7106 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MBXP", ALC256_FIXUP_HUAWEI_MBXP_PINS),
7107 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
7108 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
7109 SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
7111 #if 0
7112 /* Below is a quirk table taken from the old code.
7113 * Basically the device should work as is without the fixup table.
7114 * If BIOS doesn't give a proper info, enable the corresponding
7115 * fixup entry.
7117 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
7118 ALC269_FIXUP_AMIC),
7119 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
7120 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
7121 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
7122 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
7123 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
7124 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
7125 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
7126 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
7127 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
7128 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
7129 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
7130 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
7131 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
7132 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
7133 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
7134 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
7135 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
7136 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
7137 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
7138 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
7139 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
7140 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
7141 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
7142 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
7143 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
7144 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
7145 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
7146 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
7147 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
7148 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
7149 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
7150 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
7151 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
7152 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
7153 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
7154 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
7155 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
7156 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
7157 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
7158 #endif
7162 static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
7163 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
7164 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
7165 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
7166 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
7170 static const struct hda_model_fixup alc269_fixup_models[] = {
7171 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
7172 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
7173 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
7174 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
7175 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
7176 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
7177 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
7178 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
7179 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
7180 {.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
7181 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
7182 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
7183 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
7184 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
7185 {.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
7186 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
7187 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
7188 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
7189 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
7190 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
7191 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
7192 {.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
7193 {.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
7194 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
7195 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
7196 {.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
7197 {.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
7198 {.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
7199 {.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
7200 {.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
7201 {.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
7202 {.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
7203 {.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
7204 {.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
7205 {.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
7206 {.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
7207 {.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
7208 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
7209 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
7210 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
7211 {.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
7212 {.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
7213 {.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
7214 {.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
7215 {.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
7216 {.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
7217 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
7218 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
7219 {.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
7220 {.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
7221 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
7222 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
7223 {.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
7224 {.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
7225 {.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
7226 {.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
7227 {.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
7228 {.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
7229 {.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
7230 {.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
7231 {.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
7232 {.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
7233 {.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
7234 {.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
7235 {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
7236 {.id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED, .name = "alc255-dell-mute"},
7237 {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
7238 {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
7239 {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
7240 {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
7241 {.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
7242 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
7243 {.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
7244 {.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
7245 {.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
7246 {.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
7247 {.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
7248 {.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
7249 {.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
7250 {.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
7251 {.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
7252 {.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
7253 {.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
7254 {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
7255 {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
7256 {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
7257 {.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
7258 {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
7259 {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
7260 {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
7261 {.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
7262 {.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
7263 {.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
7264 {.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
7265 {.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
7266 {.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
7267 {.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
7268 {.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
7269 {.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
7270 {.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
7271 {.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
7272 {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
7273 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
7274 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
7275 {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
7276 {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
7279 #define ALC225_STANDARD_PINS \
7280 {0x21, 0x04211020}
7282 #define ALC256_STANDARD_PINS \
7283 {0x12, 0x90a60140}, \
7284 {0x14, 0x90170110}, \
7285 {0x21, 0x02211020}
7287 #define ALC282_STANDARD_PINS \
7288 {0x14, 0x90170110}
7290 #define ALC290_STANDARD_PINS \
7291 {0x12, 0x99a30130}
7293 #define ALC292_STANDARD_PINS \
7294 {0x14, 0x90170110}, \
7295 {0x15, 0x0221401f}
7297 #define ALC295_STANDARD_PINS \
7298 {0x12, 0xb7a60130}, \
7299 {0x14, 0x90170110}, \
7300 {0x21, 0x04211020}
7302 #define ALC298_STANDARD_PINS \
7303 {0x12, 0x90a60130}, \
7304 {0x21, 0x03211020}
7306 static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
7307 SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
7308 {0x14, 0x01014020},
7309 {0x17, 0x90170110},
7310 {0x18, 0x02a11030},
7311 {0x19, 0x0181303F},
7312 {0x21, 0x0221102f}),
7313 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
7314 {0x12, 0x90a601c0},
7315 {0x14, 0x90171120},
7316 {0x21, 0x02211030}),
7317 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
7318 {0x14, 0x90170110},
7319 {0x1b, 0x90a70130},
7320 {0x21, 0x03211020}),
7321 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
7322 {0x1a, 0x90a70130},
7323 {0x1b, 0x90170110},
7324 {0x21, 0x03211020}),
7325 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7326 ALC225_STANDARD_PINS,
7327 {0x12, 0xb7a60130},
7328 {0x14, 0x901701a0}),
7329 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7330 ALC225_STANDARD_PINS,
7331 {0x12, 0xb7a60130},
7332 {0x14, 0x901701b0}),
7333 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7334 ALC225_STANDARD_PINS,
7335 {0x12, 0xb7a60150},
7336 {0x14, 0x901701a0}),
7337 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7338 ALC225_STANDARD_PINS,
7339 {0x12, 0xb7a60150},
7340 {0x14, 0x901701b0}),
7341 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7342 ALC225_STANDARD_PINS,
7343 {0x12, 0xb7a60130},
7344 {0x1b, 0x90170110}),
7345 SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7346 {0x1b, 0x01111010},
7347 {0x1e, 0x01451130},
7348 {0x21, 0x02211020}),
7349 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
7350 {0x12, 0x90a60140},
7351 {0x14, 0x90170110},
7352 {0x19, 0x02a11030},
7353 {0x21, 0x02211020}),
7354 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
7355 {0x14, 0x90170110},
7356 {0x19, 0x02a11030},
7357 {0x1a, 0x02a11040},
7358 {0x1b, 0x01014020},
7359 {0x21, 0x0221101f}),
7360 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
7361 {0x14, 0x90170110},
7362 {0x19, 0x02a11030},
7363 {0x1a, 0x02a11040},
7364 {0x1b, 0x01011020},
7365 {0x21, 0x0221101f}),
7366 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
7367 {0x14, 0x90170110},
7368 {0x19, 0x02a11020},
7369 {0x1a, 0x02a11030},
7370 {0x21, 0x0221101f}),
7371 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7372 {0x12, 0x90a60140},
7373 {0x14, 0x90170110},
7374 {0x21, 0x02211020}),
7375 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7376 {0x12, 0x90a60140},
7377 {0x14, 0x90170150},
7378 {0x21, 0x02211020}),
7379 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7380 {0x21, 0x02211020}),
7381 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7382 {0x12, 0x40000000},
7383 {0x14, 0x90170110},
7384 {0x21, 0x02211020}),
7385 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
7386 {0x14, 0x90170110},
7387 {0x21, 0x02211020}),
7388 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7389 {0x14, 0x90170130},
7390 {0x21, 0x02211040}),
7391 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7392 {0x12, 0x90a60140},
7393 {0x14, 0x90170110},
7394 {0x21, 0x02211020}),
7395 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7396 {0x12, 0x90a60160},
7397 {0x14, 0x90170120},
7398 {0x21, 0x02211030}),
7399 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7400 {0x14, 0x90170110},
7401 {0x1b, 0x02011020},
7402 {0x21, 0x0221101f}),
7403 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7404 {0x14, 0x90170110},
7405 {0x1b, 0x01011020},
7406 {0x21, 0x0221101f}),
7407 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7408 {0x14, 0x90170130},
7409 {0x1b, 0x01014020},
7410 {0x21, 0x0221103f}),
7411 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7412 {0x14, 0x90170130},
7413 {0x1b, 0x01011020},
7414 {0x21, 0x0221103f}),
7415 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7416 {0x14, 0x90170130},
7417 {0x1b, 0x02011020},
7418 {0x21, 0x0221103f}),
7419 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7420 {0x14, 0x90170150},
7421 {0x1b, 0x02011020},
7422 {0x21, 0x0221105f}),
7423 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7424 {0x14, 0x90170110},
7425 {0x1b, 0x01014020},
7426 {0x21, 0x0221101f}),
7427 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7428 {0x12, 0x90a60160},
7429 {0x14, 0x90170120},
7430 {0x17, 0x90170140},
7431 {0x21, 0x0321102f}),
7432 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7433 {0x12, 0x90a60160},
7434 {0x14, 0x90170130},
7435 {0x21, 0x02211040}),
7436 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7437 {0x12, 0x90a60160},
7438 {0x14, 0x90170140},
7439 {0x21, 0x02211050}),
7440 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7441 {0x12, 0x90a60170},
7442 {0x14, 0x90170120},
7443 {0x21, 0x02211030}),
7444 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7445 {0x12, 0x90a60170},
7446 {0x14, 0x90170130},
7447 {0x21, 0x02211040}),
7448 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7449 {0x12, 0x90a60170},
7450 {0x14, 0x90171130},
7451 {0x21, 0x02211040}),
7452 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7453 {0x12, 0x90a60170},
7454 {0x14, 0x90170140},
7455 {0x21, 0x02211050}),
7456 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7457 {0x12, 0x90a60180},
7458 {0x14, 0x90170130},
7459 {0x21, 0x02211040}),
7460 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7461 {0x12, 0x90a60180},
7462 {0x14, 0x90170120},
7463 {0x21, 0x02211030}),
7464 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7465 {0x1b, 0x01011020},
7466 {0x21, 0x02211010}),
7467 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7468 {0x12, 0x90a60130},
7469 {0x14, 0x90170110},
7470 {0x1b, 0x01011020},
7471 {0x21, 0x0221101f}),
7472 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7473 {0x12, 0x90a60160},
7474 {0x14, 0x90170120},
7475 {0x21, 0x02211030}),
7476 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7477 {0x12, 0x90a60170},
7478 {0x14, 0x90170120},
7479 {0x21, 0x02211030}),
7480 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell Inspiron 5468", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7481 {0x12, 0x90a60180},
7482 {0x14, 0x90170120},
7483 {0x21, 0x02211030}),
7484 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7485 {0x12, 0xb7a60130},
7486 {0x14, 0x90170110},
7487 {0x21, 0x02211020}),
7488 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7489 {0x12, 0x90a60130},
7490 {0x14, 0x90170110},
7491 {0x14, 0x01011020},
7492 {0x21, 0x0221101f}),
7493 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7494 ALC256_STANDARD_PINS),
7495 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7496 {0x14, 0x90170110},
7497 {0x1b, 0x01011020},
7498 {0x21, 0x0221101f}),
7499 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
7500 {0x14, 0x90170110},
7501 {0x1b, 0x90a70130},
7502 {0x21, 0x04211020}),
7503 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
7504 {0x14, 0x90170110},
7505 {0x1b, 0x90a70130},
7506 {0x21, 0x03211020}),
7507 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
7508 {0x12, 0x90a60130},
7509 {0x14, 0x90170110},
7510 {0x21, 0x03211020}),
7511 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
7512 {0x12, 0x90a60130},
7513 {0x14, 0x90170110},
7514 {0x21, 0x04211020}),
7515 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
7516 {0x1a, 0x90a70130},
7517 {0x1b, 0x90170110},
7518 {0x21, 0x03211020}),
7519 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
7520 {0x12, 0xb7a60130},
7521 {0x13, 0xb8a61140},
7522 {0x16, 0x90170110},
7523 {0x21, 0x04211020}),
7524 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
7525 {0x12, 0x90a60130},
7526 {0x14, 0x90170110},
7527 {0x15, 0x0421101f},
7528 {0x1a, 0x04a11020}),
7529 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
7530 {0x12, 0x90a60140},
7531 {0x14, 0x90170110},
7532 {0x15, 0x0421101f},
7533 {0x18, 0x02811030},
7534 {0x1a, 0x04a1103f},
7535 {0x1b, 0x02011020}),
7536 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7537 ALC282_STANDARD_PINS,
7538 {0x12, 0x99a30130},
7539 {0x19, 0x03a11020},
7540 {0x21, 0x0321101f}),
7541 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7542 ALC282_STANDARD_PINS,
7543 {0x12, 0x99a30130},
7544 {0x19, 0x03a11020},
7545 {0x21, 0x03211040}),
7546 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7547 ALC282_STANDARD_PINS,
7548 {0x12, 0x99a30130},
7549 {0x19, 0x03a11030},
7550 {0x21, 0x03211020}),
7551 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7552 ALC282_STANDARD_PINS,
7553 {0x12, 0x99a30130},
7554 {0x19, 0x04a11020},
7555 {0x21, 0x0421101f}),
7556 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
7557 ALC282_STANDARD_PINS,
7558 {0x12, 0x90a60140},
7559 {0x19, 0x04a11030},
7560 {0x21, 0x04211020}),
7561 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7562 ALC282_STANDARD_PINS,
7563 {0x12, 0x90a60130},
7564 {0x21, 0x0321101f}),
7565 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7566 {0x12, 0x90a60160},
7567 {0x14, 0x90170120},
7568 {0x21, 0x02211030}),
7569 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7570 ALC282_STANDARD_PINS,
7571 {0x12, 0x90a60130},
7572 {0x19, 0x03a11020},
7573 {0x21, 0x0321101f}),
7574 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
7575 {0x12, 0x90a60130},
7576 {0x14, 0x90170110},
7577 {0x19, 0x04a11040},
7578 {0x21, 0x04211020}),
7579 SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
7580 {0x12, 0x90a60130},
7581 {0x17, 0x90170110},
7582 {0x21, 0x02211020}),
7583 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
7584 {0x12, 0x90a60120},
7585 {0x14, 0x90170110},
7586 {0x21, 0x0321101f}),
7587 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
7588 {0x12, 0xb7a60130},
7589 {0x14, 0x90170110},
7590 {0x21, 0x04211020}),
7591 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7592 ALC290_STANDARD_PINS,
7593 {0x15, 0x04211040},
7594 {0x18, 0x90170112},
7595 {0x1a, 0x04a11020}),
7596 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7597 ALC290_STANDARD_PINS,
7598 {0x15, 0x04211040},
7599 {0x18, 0x90170110},
7600 {0x1a, 0x04a11020}),
7601 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7602 ALC290_STANDARD_PINS,
7603 {0x15, 0x0421101f},
7604 {0x1a, 0x04a11020}),
7605 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7606 ALC290_STANDARD_PINS,
7607 {0x15, 0x04211020},
7608 {0x1a, 0x04a11040}),
7609 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7610 ALC290_STANDARD_PINS,
7611 {0x14, 0x90170110},
7612 {0x15, 0x04211020},
7613 {0x1a, 0x04a11040}),
7614 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7615 ALC290_STANDARD_PINS,
7616 {0x14, 0x90170110},
7617 {0x15, 0x04211020},
7618 {0x1a, 0x04a11020}),
7619 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7620 ALC290_STANDARD_PINS,
7621 {0x14, 0x90170110},
7622 {0x15, 0x0421101f},
7623 {0x1a, 0x04a11020}),
7624 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
7625 ALC292_STANDARD_PINS,
7626 {0x12, 0x90a60140},
7627 {0x16, 0x01014020},
7628 {0x19, 0x01a19030}),
7629 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
7630 ALC292_STANDARD_PINS,
7631 {0x12, 0x90a60140},
7632 {0x16, 0x01014020},
7633 {0x18, 0x02a19031},
7634 {0x19, 0x01a1903e}),
7635 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
7636 ALC292_STANDARD_PINS,
7637 {0x12, 0x90a60140}),
7638 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
7639 ALC292_STANDARD_PINS,
7640 {0x13, 0x90a60140},
7641 {0x16, 0x21014020},
7642 {0x19, 0x21a19030}),
7643 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
7644 ALC292_STANDARD_PINS,
7645 {0x13, 0x90a60140}),
7646 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
7647 {0x14, 0x90170110},
7648 {0x1b, 0x90a70130},
7649 {0x21, 0x04211020}),
7650 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
7651 {0x12, 0x90a60130},
7652 {0x17, 0x90170110},
7653 {0x21, 0x03211020}),
7654 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
7655 {0x12, 0x90a60130},
7656 {0x17, 0x90170110},
7657 {0x21, 0x04211020}),
7658 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
7659 {0x12, 0x90a60130},
7660 {0x17, 0x90170110},
7661 {0x21, 0x03211020}),
7662 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
7663 {0x14, 0x90170110},
7664 {0x21, 0x04211020}),
7665 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
7666 {0x14, 0x90170110},
7667 {0x21, 0x04211030}),
7668 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7669 ALC295_STANDARD_PINS,
7670 {0x17, 0x21014020},
7671 {0x18, 0x21a19030}),
7672 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7673 ALC295_STANDARD_PINS,
7674 {0x17, 0x21014040},
7675 {0x18, 0x21a19050}),
7676 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7677 ALC295_STANDARD_PINS),
7678 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7679 ALC298_STANDARD_PINS,
7680 {0x17, 0x90170110}),
7681 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7682 ALC298_STANDARD_PINS,
7683 {0x17, 0x90170140}),
7684 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7685 ALC298_STANDARD_PINS,
7686 {0x17, 0x90170150}),
7687 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
7688 {0x12, 0xb7a60140},
7689 {0x13, 0xb7a60150},
7690 {0x17, 0x90170110},
7691 {0x1a, 0x03011020},
7692 {0x21, 0x03211030}),
7693 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
7694 ALC225_STANDARD_PINS,
7695 {0x12, 0xb7a60130},
7696 {0x17, 0x90170110}),
7700 static void alc269_fill_coef(struct hda_codec *codec)
7702 struct alc_spec *spec = codec->spec;
7703 int val;
7705 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
7706 return;
7708 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
7709 alc_write_coef_idx(codec, 0xf, 0x960b);
7710 alc_write_coef_idx(codec, 0xe, 0x8817);
7713 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
7714 alc_write_coef_idx(codec, 0xf, 0x960b);
7715 alc_write_coef_idx(codec, 0xe, 0x8814);
7718 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
7719 /* Power up output pin */
7720 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
7723 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
7724 val = alc_read_coef_idx(codec, 0xd);
7725 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
7726 /* Capless ramp up clock control */
7727 alc_write_coef_idx(codec, 0xd, val | (1<<10));
7729 val = alc_read_coef_idx(codec, 0x17);
7730 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
7731 /* Class D power on reset */
7732 alc_write_coef_idx(codec, 0x17, val | (1<<7));
7736 /* HP */
7737 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
7742 static int patch_alc269(struct hda_codec *codec)
7744 struct alc_spec *spec;
7745 int err;
7747 err = alc_alloc_spec(codec, 0x0b);
7748 if (err < 0)
7749 return err;
7751 spec = codec->spec;
7752 spec->gen.shared_mic_vref_pin = 0x18;
7753 codec->power_save_node = 0;
7755 #ifdef CONFIG_PM
7756 codec->patch_ops.suspend = alc269_suspend;
7757 codec->patch_ops.resume = alc269_resume;
7758 #endif
7759 spec->shutup = alc_default_shutup;
7760 spec->init_hook = alc_default_init;
7762 switch (codec->core.vendor_id) {
7763 case 0x10ec0269:
7764 spec->codec_variant = ALC269_TYPE_ALC269VA;
7765 switch (alc_get_coef0(codec) & 0x00f0) {
7766 case 0x0010:
7767 if (codec->bus->pci &&
7768 codec->bus->pci->subsystem_vendor == 0x1025 &&
7769 spec->cdefine.platform_type == 1)
7770 err = alc_codec_rename(codec, "ALC271X");
7771 spec->codec_variant = ALC269_TYPE_ALC269VB;
7772 break;
7773 case 0x0020:
7774 if (codec->bus->pci &&
7775 codec->bus->pci->subsystem_vendor == 0x17aa &&
7776 codec->bus->pci->subsystem_device == 0x21f3)
7777 err = alc_codec_rename(codec, "ALC3202");
7778 spec->codec_variant = ALC269_TYPE_ALC269VC;
7779 break;
7780 case 0x0030:
7781 spec->codec_variant = ALC269_TYPE_ALC269VD;
7782 break;
7783 default:
7784 alc_fix_pll_init(codec, 0x20, 0x04, 15);
7786 if (err < 0)
7787 goto error;
7788 spec->shutup = alc269_shutup;
7789 spec->init_hook = alc269_fill_coef;
7790 alc269_fill_coef(codec);
7791 break;
7793 case 0x10ec0280:
7794 case 0x10ec0290:
7795 spec->codec_variant = ALC269_TYPE_ALC280;
7796 break;
7797 case 0x10ec0282:
7798 spec->codec_variant = ALC269_TYPE_ALC282;
7799 spec->shutup = alc282_shutup;
7800 spec->init_hook = alc282_init;
7801 break;
7802 case 0x10ec0233:
7803 case 0x10ec0283:
7804 spec->codec_variant = ALC269_TYPE_ALC283;
7805 spec->shutup = alc283_shutup;
7806 spec->init_hook = alc283_init;
7807 break;
7808 case 0x10ec0284:
7809 case 0x10ec0292:
7810 spec->codec_variant = ALC269_TYPE_ALC284;
7811 break;
7812 case 0x10ec0293:
7813 spec->codec_variant = ALC269_TYPE_ALC293;
7814 break;
7815 case 0x10ec0286:
7816 case 0x10ec0288:
7817 spec->codec_variant = ALC269_TYPE_ALC286;
7818 break;
7819 case 0x10ec0298:
7820 spec->codec_variant = ALC269_TYPE_ALC298;
7821 break;
7822 case 0x10ec0235:
7823 case 0x10ec0255:
7824 spec->codec_variant = ALC269_TYPE_ALC255;
7825 spec->shutup = alc256_shutup;
7826 spec->init_hook = alc256_init;
7827 break;
7828 case 0x10ec0236:
7829 case 0x10ec0256:
7830 spec->codec_variant = ALC269_TYPE_ALC256;
7831 spec->shutup = alc256_shutup;
7832 spec->init_hook = alc256_init;
7833 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
7834 break;
7835 case 0x10ec0257:
7836 spec->codec_variant = ALC269_TYPE_ALC257;
7837 spec->shutup = alc256_shutup;
7838 spec->init_hook = alc256_init;
7839 spec->gen.mixer_nid = 0;
7840 break;
7841 case 0x10ec0215:
7842 case 0x10ec0245:
7843 case 0x10ec0285:
7844 case 0x10ec0287:
7845 case 0x10ec0289:
7846 spec->codec_variant = ALC269_TYPE_ALC215;
7847 spec->shutup = alc225_shutup;
7848 spec->init_hook = alc225_init;
7849 spec->gen.mixer_nid = 0;
7850 break;
7851 case 0x10ec0225:
7852 case 0x10ec0295:
7853 case 0x10ec0299:
7854 spec->codec_variant = ALC269_TYPE_ALC225;
7855 spec->shutup = alc225_shutup;
7856 spec->init_hook = alc225_init;
7857 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
7858 break;
7859 case 0x10ec0234:
7860 case 0x10ec0274:
7861 case 0x10ec0294:
7862 spec->codec_variant = ALC269_TYPE_ALC294;
7863 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
7864 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
7865 spec->init_hook = alc294_init;
7866 break;
7867 case 0x10ec0300:
7868 spec->codec_variant = ALC269_TYPE_ALC300;
7869 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
7870 break;
7871 case 0x10ec0623:
7872 spec->codec_variant = ALC269_TYPE_ALC623;
7873 break;
7874 case 0x10ec0700:
7875 case 0x10ec0701:
7876 case 0x10ec0703:
7877 case 0x10ec0711:
7878 spec->codec_variant = ALC269_TYPE_ALC700;
7879 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
7880 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
7881 spec->init_hook = alc294_init;
7882 break;
7886 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
7887 spec->has_alc5505_dsp = 1;
7888 spec->init_hook = alc5505_dsp_init;
7891 snd_hda_pick_fixup(codec, alc269_fixup_models,
7892 alc269_fixup_tbl, alc269_fixups);
7893 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups);
7894 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
7895 alc269_fixups);
7896 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
7898 alc_auto_parse_customize_define(codec);
7900 if (has_cdefine_beep(codec))
7901 spec->gen.beep_nid = 0x01;
7903 /* automatic parse from the BIOS config */
7904 err = alc269_parse_auto_config(codec);
7905 if (err < 0)
7906 goto error;
7908 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
7909 err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
7910 if (err < 0)
7911 goto error;
7914 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
7916 return 0;
7918 error:
7919 alc_free(codec);
7920 return err;
7924 * ALC861
7927 static int alc861_parse_auto_config(struct hda_codec *codec)
7929 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
7930 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
7931 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
7934 /* Pin config fixes */
7935 enum {
7936 ALC861_FIXUP_FSC_AMILO_PI1505,
7937 ALC861_FIXUP_AMP_VREF_0F,
7938 ALC861_FIXUP_NO_JACK_DETECT,
7939 ALC861_FIXUP_ASUS_A6RP,
7940 ALC660_FIXUP_ASUS_W7J,
7943 /* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
7944 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
7945 const struct hda_fixup *fix, int action)
7947 struct alc_spec *spec = codec->spec;
7948 unsigned int val;
7950 if (action != HDA_FIXUP_ACT_INIT)
7951 return;
7952 val = snd_hda_codec_get_pin_target(codec, 0x0f);
7953 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
7954 val |= AC_PINCTL_IN_EN;
7955 val |= AC_PINCTL_VREF_50;
7956 snd_hda_set_pin_ctl(codec, 0x0f, val);
7957 spec->gen.keep_vref_in_automute = 1;
7960 /* suppress the jack-detection */
7961 static void alc_fixup_no_jack_detect(struct hda_codec *codec,
7962 const struct hda_fixup *fix, int action)
7964 if (action == HDA_FIXUP_ACT_PRE_PROBE)
7965 codec->no_jack_detect = 1;
7968 static const struct hda_fixup alc861_fixups[] = {
7969 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
7970 .type = HDA_FIXUP_PINS,
7971 .v.pins = (const struct hda_pintbl[]) {
7972 { 0x0b, 0x0221101f }, /* HP */
7973 { 0x0f, 0x90170310 }, /* speaker */
7977 [ALC861_FIXUP_AMP_VREF_0F] = {
7978 .type = HDA_FIXUP_FUNC,
7979 .v.func = alc861_fixup_asus_amp_vref_0f,
7981 [ALC861_FIXUP_NO_JACK_DETECT] = {
7982 .type = HDA_FIXUP_FUNC,
7983 .v.func = alc_fixup_no_jack_detect,
7985 [ALC861_FIXUP_ASUS_A6RP] = {
7986 .type = HDA_FIXUP_FUNC,
7987 .v.func = alc861_fixup_asus_amp_vref_0f,
7988 .chained = true,
7989 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
7991 [ALC660_FIXUP_ASUS_W7J] = {
7992 .type = HDA_FIXUP_VERBS,
7993 .v.verbs = (const struct hda_verb[]) {
7994 /* ASUS W7J needs a magic pin setup on unused NID 0x10
7995 * for enabling outputs
7997 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8003 static const struct snd_pci_quirk alc861_fixup_tbl[] = {
8004 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
8005 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
8006 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
8007 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
8008 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
8009 SND_PCI_QUIRK(0x1584, 0x2b01, "Haier W18", ALC861_FIXUP_AMP_VREF_0F),
8010 SND_PCI_QUIRK(0x1584, 0x0000, "Uniwill ECS M31EI", ALC861_FIXUP_AMP_VREF_0F),
8011 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
8017 static int patch_alc861(struct hda_codec *codec)
8019 struct alc_spec *spec;
8020 int err;
8022 err = alc_alloc_spec(codec, 0x15);
8023 if (err < 0)
8024 return err;
8026 spec = codec->spec;
8027 spec->gen.beep_nid = 0x23;
8029 #ifdef CONFIG_PM
8030 spec->power_hook = alc_power_eapd;
8031 #endif
8033 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
8034 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
8036 /* automatic parse from the BIOS config */
8037 err = alc861_parse_auto_config(codec);
8038 if (err < 0)
8039 goto error;
8041 if (!spec->gen.no_analog) {
8042 err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
8043 if (err < 0)
8044 goto error;
8047 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
8049 return 0;
8051 error:
8052 alc_free(codec);
8053 return err;
8057 * ALC861-VD support
8059 * Based on ALC882
8061 * In addition, an independent DAC
8063 static int alc861vd_parse_auto_config(struct hda_codec *codec)
8065 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
8066 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
8067 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
8070 enum {
8071 ALC660VD_FIX_ASUS_GPIO1,
8072 ALC861VD_FIX_DALLAS,
8075 /* exclude VREF80 */
8076 static void alc861vd_fixup_dallas(struct hda_codec *codec,
8077 const struct hda_fixup *fix, int action)
8079 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
8080 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
8081 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
8085 /* reset GPIO1 */
8086 static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
8087 const struct hda_fixup *fix, int action)
8089 struct alc_spec *spec = codec->spec;
8091 if (action == HDA_FIXUP_ACT_PRE_PROBE)
8092 spec->gpio_mask |= 0x02;
8093 alc_fixup_gpio(codec, action, 0x01);
8096 static const struct hda_fixup alc861vd_fixups[] = {
8097 [ALC660VD_FIX_ASUS_GPIO1] = {
8098 .type = HDA_FIXUP_FUNC,
8099 .v.func = alc660vd_fixup_asus_gpio1,
8101 [ALC861VD_FIX_DALLAS] = {
8102 .type = HDA_FIXUP_FUNC,
8103 .v.func = alc861vd_fixup_dallas,
8107 static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
8108 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
8109 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
8110 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
8116 static int patch_alc861vd(struct hda_codec *codec)
8118 struct alc_spec *spec;
8119 int err;
8121 err = alc_alloc_spec(codec, 0x0b);
8122 if (err < 0)
8123 return err;
8125 spec = codec->spec;
8126 spec->gen.beep_nid = 0x23;
8128 spec->shutup = alc_eapd_shutup;
8130 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
8131 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
8133 /* automatic parse from the BIOS config */
8134 err = alc861vd_parse_auto_config(codec);
8135 if (err < 0)
8136 goto error;
8138 if (!spec->gen.no_analog) {
8139 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
8140 if (err < 0)
8141 goto error;
8144 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
8146 return 0;
8148 error:
8149 alc_free(codec);
8150 return err;
8154 * ALC662 support
8156 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
8157 * configuration. Each pin widget can choose any input DACs and a mixer.
8158 * Each ADC is connected from a mixer of all inputs. This makes possible
8159 * 6-channel independent captures.
8161 * In addition, an independent DAC for the multi-playback (not used in this
8162 * driver yet).
8166 * BIOS auto configuration
8169 static int alc662_parse_auto_config(struct hda_codec *codec)
8171 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
8172 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
8173 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
8174 const hda_nid_t *ssids;
8176 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
8177 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
8178 codec->core.vendor_id == 0x10ec0671)
8179 ssids = alc663_ssids;
8180 else
8181 ssids = alc662_ssids;
8182 return alc_parse_auto_config(codec, alc662_ignore, ssids);
8185 static void alc272_fixup_mario(struct hda_codec *codec,
8186 const struct hda_fixup *fix, int action)
8188 if (action != HDA_FIXUP_ACT_PRE_PROBE)
8189 return;
8190 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
8191 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
8192 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
8193 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
8194 (0 << AC_AMPCAP_MUTE_SHIFT)))
8195 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
8198 static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
8199 { .channels = 2,
8200 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
8201 { .channels = 4,
8202 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
8203 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
8207 /* override the 2.1 chmap */
8208 static void alc_fixup_bass_chmap(struct hda_codec *codec,
8209 const struct hda_fixup *fix, int action)
8211 if (action == HDA_FIXUP_ACT_BUILD) {
8212 struct alc_spec *spec = codec->spec;
8213 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
8217 /* avoid D3 for keeping GPIO up */
8218 static unsigned int gpio_led_power_filter(struct hda_codec *codec,
8219 hda_nid_t nid,
8220 unsigned int power_state)
8222 struct alc_spec *spec = codec->spec;
8223 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
8224 return AC_PWRST_D0;
8225 return power_state;
8228 static void alc662_fixup_led_gpio1(struct hda_codec *codec,
8229 const struct hda_fixup *fix, int action)
8231 struct alc_spec *spec = codec->spec;
8233 alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
8234 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
8235 spec->mute_led_polarity = 1;
8236 codec->power_filter = gpio_led_power_filter;
8240 static void alc662_usi_automute_hook(struct hda_codec *codec,
8241 struct hda_jack_callback *jack)
8243 struct alc_spec *spec = codec->spec;
8244 int vref;
8245 msleep(200);
8246 snd_hda_gen_hp_automute(codec, jack);
8248 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
8249 msleep(100);
8250 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8251 vref);
8254 static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
8255 const struct hda_fixup *fix, int action)
8257 struct alc_spec *spec = codec->spec;
8258 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
8259 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
8260 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
8264 static struct coef_fw alc668_coefs[] = {
8265 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
8266 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
8267 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
8268 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
8269 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
8270 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
8271 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
8272 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
8273 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
8274 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
8275 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
8276 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
8277 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
8278 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
8279 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
8280 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
8281 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
8282 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
8283 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
8284 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
8288 static void alc668_restore_default_value(struct hda_codec *codec)
8290 alc_process_coef_fw(codec, alc668_coefs);
8293 enum {
8294 ALC662_FIXUP_ASPIRE,
8295 ALC662_FIXUP_LED_GPIO1,
8296 ALC662_FIXUP_IDEAPAD,
8297 ALC272_FIXUP_MARIO,
8298 ALC662_FIXUP_CZC_P10T,
8299 ALC662_FIXUP_SKU_IGNORE,
8300 ALC662_FIXUP_HP_RP5800,
8301 ALC662_FIXUP_ASUS_MODE1,
8302 ALC662_FIXUP_ASUS_MODE2,
8303 ALC662_FIXUP_ASUS_MODE3,
8304 ALC662_FIXUP_ASUS_MODE4,
8305 ALC662_FIXUP_ASUS_MODE5,
8306 ALC662_FIXUP_ASUS_MODE6,
8307 ALC662_FIXUP_ASUS_MODE7,
8308 ALC662_FIXUP_ASUS_MODE8,
8309 ALC662_FIXUP_NO_JACK_DETECT,
8310 ALC662_FIXUP_ZOTAC_Z68,
8311 ALC662_FIXUP_INV_DMIC,
8312 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
8313 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
8314 ALC662_FIXUP_HEADSET_MODE,
8315 ALC668_FIXUP_HEADSET_MODE,
8316 ALC662_FIXUP_BASS_MODE4_CHMAP,
8317 ALC662_FIXUP_BASS_16,
8318 ALC662_FIXUP_BASS_1A,
8319 ALC662_FIXUP_BASS_CHMAP,
8320 ALC668_FIXUP_AUTO_MUTE,
8321 ALC668_FIXUP_DELL_DISABLE_AAMIX,
8322 ALC668_FIXUP_DELL_XPS13,
8323 ALC662_FIXUP_ASUS_Nx50,
8324 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
8325 ALC668_FIXUP_ASUS_Nx51,
8326 ALC668_FIXUP_MIC_COEF,
8327 ALC668_FIXUP_ASUS_G751,
8328 ALC891_FIXUP_HEADSET_MODE,
8329 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
8330 ALC662_FIXUP_ACER_VERITON,
8331 ALC892_FIXUP_ASROCK_MOBO,
8332 ALC662_FIXUP_USI_FUNC,
8333 ALC662_FIXUP_USI_HEADSET_MODE,
8334 ALC662_FIXUP_LENOVO_MULTI_CODECS,
8337 static const struct hda_fixup alc662_fixups[] = {
8338 [ALC662_FIXUP_ASPIRE] = {
8339 .type = HDA_FIXUP_PINS,
8340 .v.pins = (const struct hda_pintbl[]) {
8341 { 0x15, 0x99130112 }, /* subwoofer */
8345 [ALC662_FIXUP_LED_GPIO1] = {
8346 .type = HDA_FIXUP_FUNC,
8347 .v.func = alc662_fixup_led_gpio1,
8349 [ALC662_FIXUP_IDEAPAD] = {
8350 .type = HDA_FIXUP_PINS,
8351 .v.pins = (const struct hda_pintbl[]) {
8352 { 0x17, 0x99130112 }, /* subwoofer */
8355 .chained = true,
8356 .chain_id = ALC662_FIXUP_LED_GPIO1,
8358 [ALC272_FIXUP_MARIO] = {
8359 .type = HDA_FIXUP_FUNC,
8360 .v.func = alc272_fixup_mario,
8362 [ALC662_FIXUP_CZC_P10T] = {
8363 .type = HDA_FIXUP_VERBS,
8364 .v.verbs = (const struct hda_verb[]) {
8365 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
8369 [ALC662_FIXUP_SKU_IGNORE] = {
8370 .type = HDA_FIXUP_FUNC,
8371 .v.func = alc_fixup_sku_ignore,
8373 [ALC662_FIXUP_HP_RP5800] = {
8374 .type = HDA_FIXUP_PINS,
8375 .v.pins = (const struct hda_pintbl[]) {
8376 { 0x14, 0x0221201f }, /* HP out */
8379 .chained = true,
8380 .chain_id = ALC662_FIXUP_SKU_IGNORE
8382 [ALC662_FIXUP_ASUS_MODE1] = {
8383 .type = HDA_FIXUP_PINS,
8384 .v.pins = (const struct hda_pintbl[]) {
8385 { 0x14, 0x99130110 }, /* speaker */
8386 { 0x18, 0x01a19c20 }, /* mic */
8387 { 0x19, 0x99a3092f }, /* int-mic */
8388 { 0x21, 0x0121401f }, /* HP out */
8391 .chained = true,
8392 .chain_id = ALC662_FIXUP_SKU_IGNORE
8394 [ALC662_FIXUP_ASUS_MODE2] = {
8395 .type = HDA_FIXUP_PINS,
8396 .v.pins = (const struct hda_pintbl[]) {
8397 { 0x14, 0x99130110 }, /* speaker */
8398 { 0x18, 0x01a19820 }, /* mic */
8399 { 0x19, 0x99a3092f }, /* int-mic */
8400 { 0x1b, 0x0121401f }, /* HP out */
8403 .chained = true,
8404 .chain_id = ALC662_FIXUP_SKU_IGNORE
8406 [ALC662_FIXUP_ASUS_MODE3] = {
8407 .type = HDA_FIXUP_PINS,
8408 .v.pins = (const struct hda_pintbl[]) {
8409 { 0x14, 0x99130110 }, /* speaker */
8410 { 0x15, 0x0121441f }, /* HP */
8411 { 0x18, 0x01a19840 }, /* mic */
8412 { 0x19, 0x99a3094f }, /* int-mic */
8413 { 0x21, 0x01211420 }, /* HP2 */
8416 .chained = true,
8417 .chain_id = ALC662_FIXUP_SKU_IGNORE
8419 [ALC662_FIXUP_ASUS_MODE4] = {
8420 .type = HDA_FIXUP_PINS,
8421 .v.pins = (const struct hda_pintbl[]) {
8422 { 0x14, 0x99130110 }, /* speaker */
8423 { 0x16, 0x99130111 }, /* speaker */
8424 { 0x18, 0x01a19840 }, /* mic */
8425 { 0x19, 0x99a3094f }, /* int-mic */
8426 { 0x21, 0x0121441f }, /* HP */
8429 .chained = true,
8430 .chain_id = ALC662_FIXUP_SKU_IGNORE
8432 [ALC662_FIXUP_ASUS_MODE5] = {
8433 .type = HDA_FIXUP_PINS,
8434 .v.pins = (const struct hda_pintbl[]) {
8435 { 0x14, 0x99130110 }, /* speaker */
8436 { 0x15, 0x0121441f }, /* HP */
8437 { 0x16, 0x99130111 }, /* speaker */
8438 { 0x18, 0x01a19840 }, /* mic */
8439 { 0x19, 0x99a3094f }, /* int-mic */
8442 .chained = true,
8443 .chain_id = ALC662_FIXUP_SKU_IGNORE
8445 [ALC662_FIXUP_ASUS_MODE6] = {
8446 .type = HDA_FIXUP_PINS,
8447 .v.pins = (const struct hda_pintbl[]) {
8448 { 0x14, 0x99130110 }, /* speaker */
8449 { 0x15, 0x01211420 }, /* HP2 */
8450 { 0x18, 0x01a19840 }, /* mic */
8451 { 0x19, 0x99a3094f }, /* int-mic */
8452 { 0x1b, 0x0121441f }, /* HP */
8455 .chained = true,
8456 .chain_id = ALC662_FIXUP_SKU_IGNORE
8458 [ALC662_FIXUP_ASUS_MODE7] = {
8459 .type = HDA_FIXUP_PINS,
8460 .v.pins = (const struct hda_pintbl[]) {
8461 { 0x14, 0x99130110 }, /* speaker */
8462 { 0x17, 0x99130111 }, /* speaker */
8463 { 0x18, 0x01a19840 }, /* mic */
8464 { 0x19, 0x99a3094f }, /* int-mic */
8465 { 0x1b, 0x01214020 }, /* HP */
8466 { 0x21, 0x0121401f }, /* HP */
8469 .chained = true,
8470 .chain_id = ALC662_FIXUP_SKU_IGNORE
8472 [ALC662_FIXUP_ASUS_MODE8] = {
8473 .type = HDA_FIXUP_PINS,
8474 .v.pins = (const struct hda_pintbl[]) {
8475 { 0x14, 0x99130110 }, /* speaker */
8476 { 0x12, 0x99a30970 }, /* int-mic */
8477 { 0x15, 0x01214020 }, /* HP */
8478 { 0x17, 0x99130111 }, /* speaker */
8479 { 0x18, 0x01a19840 }, /* mic */
8480 { 0x21, 0x0121401f }, /* HP */
8483 .chained = true,
8484 .chain_id = ALC662_FIXUP_SKU_IGNORE
8486 [ALC662_FIXUP_NO_JACK_DETECT] = {
8487 .type = HDA_FIXUP_FUNC,
8488 .v.func = alc_fixup_no_jack_detect,
8490 [ALC662_FIXUP_ZOTAC_Z68] = {
8491 .type = HDA_FIXUP_PINS,
8492 .v.pins = (const struct hda_pintbl[]) {
8493 { 0x1b, 0x02214020 }, /* Front HP */
8497 [ALC662_FIXUP_INV_DMIC] = {
8498 .type = HDA_FIXUP_FUNC,
8499 .v.func = alc_fixup_inv_dmic,
8501 [ALC668_FIXUP_DELL_XPS13] = {
8502 .type = HDA_FIXUP_FUNC,
8503 .v.func = alc_fixup_dell_xps13,
8504 .chained = true,
8505 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
8507 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
8508 .type = HDA_FIXUP_FUNC,
8509 .v.func = alc_fixup_disable_aamix,
8510 .chained = true,
8511 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
8513 [ALC668_FIXUP_AUTO_MUTE] = {
8514 .type = HDA_FIXUP_FUNC,
8515 .v.func = alc_fixup_auto_mute_via_amp,
8516 .chained = true,
8517 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
8519 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
8520 .type = HDA_FIXUP_PINS,
8521 .v.pins = (const struct hda_pintbl[]) {
8522 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
8523 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
8526 .chained = true,
8527 .chain_id = ALC662_FIXUP_HEADSET_MODE
8529 [ALC662_FIXUP_HEADSET_MODE] = {
8530 .type = HDA_FIXUP_FUNC,
8531 .v.func = alc_fixup_headset_mode_alc662,
8533 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
8534 .type = HDA_FIXUP_PINS,
8535 .v.pins = (const struct hda_pintbl[]) {
8536 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
8537 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
8540 .chained = true,
8541 .chain_id = ALC668_FIXUP_HEADSET_MODE
8543 [ALC668_FIXUP_HEADSET_MODE] = {
8544 .type = HDA_FIXUP_FUNC,
8545 .v.func = alc_fixup_headset_mode_alc668,
8547 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
8548 .type = HDA_FIXUP_FUNC,
8549 .v.func = alc_fixup_bass_chmap,
8550 .chained = true,
8551 .chain_id = ALC662_FIXUP_ASUS_MODE4
8553 [ALC662_FIXUP_BASS_16] = {
8554 .type = HDA_FIXUP_PINS,
8555 .v.pins = (const struct hda_pintbl[]) {
8556 {0x16, 0x80106111}, /* bass speaker */
8559 .chained = true,
8560 .chain_id = ALC662_FIXUP_BASS_CHMAP,
8562 [ALC662_FIXUP_BASS_1A] = {
8563 .type = HDA_FIXUP_PINS,
8564 .v.pins = (const struct hda_pintbl[]) {
8565 {0x1a, 0x80106111}, /* bass speaker */
8568 .chained = true,
8569 .chain_id = ALC662_FIXUP_BASS_CHMAP,
8571 [ALC662_FIXUP_BASS_CHMAP] = {
8572 .type = HDA_FIXUP_FUNC,
8573 .v.func = alc_fixup_bass_chmap,
8575 [ALC662_FIXUP_ASUS_Nx50] = {
8576 .type = HDA_FIXUP_FUNC,
8577 .v.func = alc_fixup_auto_mute_via_amp,
8578 .chained = true,
8579 .chain_id = ALC662_FIXUP_BASS_1A
8581 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
8582 .type = HDA_FIXUP_FUNC,
8583 .v.func = alc_fixup_headset_mode_alc668,
8584 .chain_id = ALC662_FIXUP_BASS_CHMAP
8586 [ALC668_FIXUP_ASUS_Nx51] = {
8587 .type = HDA_FIXUP_PINS,
8588 .v.pins = (const struct hda_pintbl[]) {
8589 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
8590 { 0x1a, 0x90170151 }, /* bass speaker */
8591 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
8594 .chained = true,
8595 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
8597 [ALC668_FIXUP_MIC_COEF] = {
8598 .type = HDA_FIXUP_VERBS,
8599 .v.verbs = (const struct hda_verb[]) {
8600 { 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
8601 { 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
8605 [ALC668_FIXUP_ASUS_G751] = {
8606 .type = HDA_FIXUP_PINS,
8607 .v.pins = (const struct hda_pintbl[]) {
8608 { 0x16, 0x0421101f }, /* HP */
8611 .chained = true,
8612 .chain_id = ALC668_FIXUP_MIC_COEF
8614 [ALC891_FIXUP_HEADSET_MODE] = {
8615 .type = HDA_FIXUP_FUNC,
8616 .v.func = alc_fixup_headset_mode,
8618 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
8619 .type = HDA_FIXUP_PINS,
8620 .v.pins = (const struct hda_pintbl[]) {
8621 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
8622 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
8625 .chained = true,
8626 .chain_id = ALC891_FIXUP_HEADSET_MODE
8628 [ALC662_FIXUP_ACER_VERITON] = {
8629 .type = HDA_FIXUP_PINS,
8630 .v.pins = (const struct hda_pintbl[]) {
8631 { 0x15, 0x50170120 }, /* no internal speaker */
8635 [ALC892_FIXUP_ASROCK_MOBO] = {
8636 .type = HDA_FIXUP_PINS,
8637 .v.pins = (const struct hda_pintbl[]) {
8638 { 0x15, 0x40f000f0 }, /* disabled */
8639 { 0x16, 0x40f000f0 }, /* disabled */
8643 [ALC662_FIXUP_USI_FUNC] = {
8644 .type = HDA_FIXUP_FUNC,
8645 .v.func = alc662_fixup_usi_headset_mic,
8647 [ALC662_FIXUP_USI_HEADSET_MODE] = {
8648 .type = HDA_FIXUP_PINS,
8649 .v.pins = (const struct hda_pintbl[]) {
8650 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
8651 { 0x18, 0x01a1903d },
8654 .chained = true,
8655 .chain_id = ALC662_FIXUP_USI_FUNC
8657 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
8658 .type = HDA_FIXUP_FUNC,
8659 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
8663 static const struct snd_pci_quirk alc662_fixup_tbl[] = {
8664 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
8665 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
8666 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
8667 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
8668 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
8669 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
8670 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
8671 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
8672 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8673 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8674 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
8675 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
8676 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
8677 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8678 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8679 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8680 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8681 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8682 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
8683 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
8684 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
8685 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
8686 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
8687 SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
8688 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
8689 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
8690 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
8691 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
8692 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
8693 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
8694 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
8695 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
8696 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
8697 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
8698 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
8699 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
8700 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
8701 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
8702 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
8703 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
8704 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
8705 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
8707 #if 0
8708 /* Below is a quirk table taken from the old code.
8709 * Basically the device should work as is without the fixup table.
8710 * If BIOS doesn't give a proper info, enable the corresponding
8711 * fixup entry.
8713 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
8714 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
8715 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
8716 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
8717 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8718 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8719 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8720 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
8721 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
8722 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8723 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
8724 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
8725 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
8726 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
8727 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
8728 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8729 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
8730 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
8731 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8732 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
8733 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
8734 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8735 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
8736 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
8737 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
8738 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8739 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
8740 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
8741 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8742 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
8743 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8744 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8745 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
8746 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
8747 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
8748 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
8749 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
8750 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
8751 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
8752 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8753 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
8754 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
8755 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8756 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
8757 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
8758 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
8759 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
8760 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
8761 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8762 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
8763 #endif
8767 static const struct hda_model_fixup alc662_fixup_models[] = {
8768 {.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
8769 {.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
8770 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
8771 {.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
8772 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
8773 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
8774 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
8775 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
8776 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
8777 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
8778 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
8779 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
8780 {.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
8781 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
8782 {.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
8783 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
8784 {.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
8785 {.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
8786 {.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
8787 {.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
8788 {.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
8789 {.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
8790 {.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
8791 {.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
8792 {.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
8793 {.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
8794 {.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
8795 {.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
8796 {.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
8797 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
8801 static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
8802 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
8803 {0x17, 0x02211010},
8804 {0x18, 0x01a19030},
8805 {0x1a, 0x01813040},
8806 {0x21, 0x01014020}),
8807 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
8808 {0x16, 0x01813030},
8809 {0x17, 0x02211010},
8810 {0x18, 0x01a19040},
8811 {0x21, 0x01014020}),
8812 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
8813 {0x14, 0x01014010},
8814 {0x18, 0x01a19020},
8815 {0x1a, 0x0181302f},
8816 {0x1b, 0x0221401f}),
8817 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8818 {0x12, 0x99a30130},
8819 {0x14, 0x90170110},
8820 {0x15, 0x0321101f},
8821 {0x16, 0x03011020}),
8822 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8823 {0x12, 0x99a30140},
8824 {0x14, 0x90170110},
8825 {0x15, 0x0321101f},
8826 {0x16, 0x03011020}),
8827 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8828 {0x12, 0x99a30150},
8829 {0x14, 0x90170110},
8830 {0x15, 0x0321101f},
8831 {0x16, 0x03011020}),
8832 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8833 {0x14, 0x90170110},
8834 {0x15, 0x0321101f},
8835 {0x16, 0x03011020}),
8836 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
8837 {0x12, 0x90a60130},
8838 {0x14, 0x90170110},
8839 {0x15, 0x0321101f}),
8845 static int patch_alc662(struct hda_codec *codec)
8847 struct alc_spec *spec;
8848 int err;
8850 err = alc_alloc_spec(codec, 0x0b);
8851 if (err < 0)
8852 return err;
8854 spec = codec->spec;
8856 spec->shutup = alc_eapd_shutup;
8858 /* handle multiple HPs as is */
8859 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
8861 alc_fix_pll_init(codec, 0x20, 0x04, 15);
8863 switch (codec->core.vendor_id) {
8864 case 0x10ec0668:
8865 spec->init_hook = alc668_restore_default_value;
8866 break;
8869 snd_hda_pick_fixup(codec, alc662_fixup_models,
8870 alc662_fixup_tbl, alc662_fixups);
8871 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups);
8872 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
8874 alc_auto_parse_customize_define(codec);
8876 if (has_cdefine_beep(codec))
8877 spec->gen.beep_nid = 0x01;
8879 if ((alc_get_coef0(codec) & (1 << 14)) &&
8880 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
8881 spec->cdefine.platform_type == 1) {
8882 err = alc_codec_rename(codec, "ALC272X");
8883 if (err < 0)
8884 goto error;
8887 /* automatic parse from the BIOS config */
8888 err = alc662_parse_auto_config(codec);
8889 if (err < 0)
8890 goto error;
8892 if (!spec->gen.no_analog && spec->gen.beep_nid) {
8893 switch (codec->core.vendor_id) {
8894 case 0x10ec0662:
8895 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
8896 break;
8897 case 0x10ec0272:
8898 case 0x10ec0663:
8899 case 0x10ec0665:
8900 case 0x10ec0668:
8901 err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
8902 break;
8903 case 0x10ec0273:
8904 err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
8905 break;
8907 if (err < 0)
8908 goto error;
8911 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
8913 return 0;
8915 error:
8916 alc_free(codec);
8917 return err;
8921 * ALC680 support
8924 static int alc680_parse_auto_config(struct hda_codec *codec)
8926 return alc_parse_auto_config(codec, NULL, NULL);
8931 static int patch_alc680(struct hda_codec *codec)
8933 int err;
8935 /* ALC680 has no aa-loopback mixer */
8936 err = alc_alloc_spec(codec, 0);
8937 if (err < 0)
8938 return err;
8940 /* automatic parse from the BIOS config */
8941 err = alc680_parse_auto_config(codec);
8942 if (err < 0) {
8943 alc_free(codec);
8944 return err;
8947 return 0;
8951 * patch entries
8953 static const struct hda_device_id snd_hda_id_realtek[] = {
8954 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
8955 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
8956 HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
8957 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
8958 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
8959 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
8960 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
8961 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
8962 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
8963 HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
8964 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
8965 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
8966 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
8967 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
8968 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
8969 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
8970 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
8971 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
8972 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
8973 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
8974 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
8975 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
8976 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
8977 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
8978 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
8979 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
8980 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
8981 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
8982 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
8983 HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
8984 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
8985 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
8986 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
8987 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
8988 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
8989 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
8990 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
8991 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
8992 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
8993 HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
8994 HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
8995 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
8996 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
8997 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
8998 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
8999 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
9000 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
9001 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
9002 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
9003 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
9004 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
9005 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
9006 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
9007 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
9008 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
9009 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
9010 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
9011 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
9012 HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
9013 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
9014 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
9015 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
9016 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
9017 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
9018 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
9019 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
9020 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
9021 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
9022 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
9023 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
9024 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
9025 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
9026 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
9027 HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
9028 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
9029 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
9030 {} /* terminator */
9032 MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
9034 MODULE_LICENSE("GPL");
9035 MODULE_DESCRIPTION("Realtek HD-audio codec");
9037 static struct hda_codec_driver realtek_driver = {
9038 .id = snd_hda_id_realtek,
9041 module_hda_codec_driver(realtek_driver);