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"
39 #include "hda_generic.h"
41 /* keep halting ALC5505 DSP, for power saving */
42 #define HALT_REALTEK_ALC5505
44 /* extra amp-initialization sequence types */
54 ALC_HEADSET_MODE_UNKNOWN,
55 ALC_HEADSET_MODE_UNPLUGGED,
56 ALC_HEADSET_MODE_HEADSET,
58 ALC_HEADSET_MODE_HEADPHONE,
62 ALC_HEADSET_TYPE_UNKNOWN,
63 ALC_HEADSET_TYPE_CTIA,
64 ALC_HEADSET_TYPE_OMTP,
68 ALC_KEY_MICMUTE_INDEX,
71 struct alc_customize_define {
73 unsigned char port_connectivity;
74 unsigned char check_sum;
75 unsigned char customization;
76 unsigned char external_amp;
77 unsigned int enable_pcbeep:1;
78 unsigned int platform_type:1;
80 unsigned int override:1;
81 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
85 struct hda_gen_spec gen; /* must be at head */
87 /* codec parameterization */
88 const struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
89 unsigned int num_mixers;
90 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
92 struct alc_customize_define cdefine;
93 unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
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_led; /* used for alc269_fixup_hp_gpio_led() */
101 unsigned int gpio_mute_led_mask;
102 unsigned int gpio_mic_led_mask;
104 hda_nid_t headset_mic_pin;
105 hda_nid_t headphone_mic_pin;
106 int current_headset_mode;
107 int current_headset_type;
110 void (*init_hook)(struct hda_codec *codec);
112 void (*power_hook)(struct hda_codec *codec);
114 void (*shutup)(struct hda_codec *codec);
115 void (*reboot_notify)(struct hda_codec *codec);
118 int codec_variant; /* flag for other variants */
119 unsigned int has_alc5505_dsp:1;
120 unsigned int no_depop_delay:1;
121 unsigned int done_hp_init:1;
125 unsigned int pll_coef_idx, pll_coef_bit;
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)
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);
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);
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;
178 spec->coef0 = alc_read_coef_idx(codec, 0);
182 /* coef writes/updates batch */
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);
203 alc_update_coefex_idx(codec, fw->nid, fw->idx,
209 * Append the given mixer and verb elements for the later use
210 * The mixer array is referred in build_controls(), and init_verbs are
213 static void add_mixer(struct alc_spec *spec, const struct snd_kcontrol_new *mix)
215 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
217 spec->mixers[spec->num_mixers++] = mix;
221 * GPIO setup tables, used in initialization
223 /* Enable GPIO mask and set output */
224 static const struct hda_verb alc_gpio1_init_verbs[] = {
225 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
226 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
227 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
231 static const struct hda_verb alc_gpio2_init_verbs[] = {
232 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
233 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
234 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
238 static const struct hda_verb alc_gpio3_init_verbs[] = {
239 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
240 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
241 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
246 * Fix hardware PLL issue
247 * On some codecs, the analog PLL gating control must be off while
248 * the default value is 1.
250 static void alc_fix_pll(struct hda_codec *codec)
252 struct alc_spec *spec = codec->spec;
255 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
256 1 << spec->pll_coef_bit, 0);
259 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
260 unsigned int coef_idx, unsigned int coef_bit)
262 struct alc_spec *spec = codec->spec;
264 spec->pll_coef_idx = coef_idx;
265 spec->pll_coef_bit = coef_bit;
269 /* update the master volume per volume-knob's unsol event */
270 static void alc_update_knob_master(struct hda_codec *codec,
271 struct hda_jack_callback *jack)
274 struct snd_kcontrol *kctl;
275 struct snd_ctl_elem_value *uctl;
277 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
280 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
283 val = snd_hda_codec_read(codec, jack->nid, 0,
284 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
285 val &= HDA_AMP_VOLMASK;
286 uctl->value.integer.value[0] = val;
287 uctl->value.integer.value[1] = val;
288 kctl->put(kctl, uctl);
292 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
294 /* For some reason, the res given from ALC880 is broken.
295 Here we adjust it properly. */
296 snd_hda_jack_unsol_event(codec, res >> 2);
299 /* Change EAPD to verb control */
300 static void alc_fill_eapd_coef(struct hda_codec *codec)
304 coef = alc_get_coef0(codec);
306 switch (codec->core.vendor_id) {
308 alc_update_coef_idx(codec, 0x7, 0, 1<<5);
312 alc_update_coef_idx(codec, 0x7, 0, 1<<13);
315 if ((coef & 0x00f0) == 0x0010)
316 alc_update_coef_idx(codec, 0xd, 0, 1<<14);
317 if ((coef & 0x00f0) == 0x0020)
318 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
319 if ((coef & 0x00f0) == 0x0030)
320 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
326 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
331 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
349 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
352 alc_update_coef_idx(codec, 0xe, 0, 1<<0);
355 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
356 alc_write_coef_idx(codec, 0x8, 0x4ab7);
359 alc_update_coef_idx(codec, 0xa, 1<<13, 0);
368 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
371 if ((coef & 0x00f0) == 0x0030)
372 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
381 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
385 alc_update_coef_idx(codec, 0x19, 1<<13, 0);
388 alc_update_coef_idx(codec, 0x7, 3<<13, 0);
391 alc_update_coef_idx(codec, 0x4, 1<<10, 0);
394 if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
395 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
399 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
406 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
411 /* additional initialization for ALC888 variants */
412 static void alc888_coef_init(struct hda_codec *codec)
414 switch (alc_get_coef0(codec) & 0x00f0) {
419 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
424 /* turn on/off EAPD control (only if available) */
425 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
427 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
429 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
430 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
434 /* turn on/off EAPD controls of the codec */
435 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
437 /* We currently only handle front, HP */
438 static hda_nid_t pins[] = {
439 0x0f, 0x10, 0x14, 0x15, 0x17, 0
442 for (p = pins; *p; p++)
443 set_eapd(codec, *p, on);
446 /* generic shutup callback;
447 * just turning off EAPD and a little pause for avoiding pop-noise
449 static void alc_eapd_shutup(struct hda_codec *codec)
451 struct alc_spec *spec = codec->spec;
453 alc_auto_setup_eapd(codec, false);
454 if (!spec->no_depop_delay)
456 snd_hda_shutup_pins(codec);
459 /* generic EAPD initialization */
460 static void alc_auto_init_amp(struct hda_codec *codec, int type)
462 alc_fill_eapd_coef(codec);
463 alc_auto_setup_eapd(codec, true);
466 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
469 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
472 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
474 case ALC_INIT_DEFAULT:
475 switch (codec->core.vendor_id) {
477 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
483 alc_update_coef_idx(codec, 7, 0, 0x2030);
486 alc888_coef_init(codec);
495 * Realtek SSID verification
498 /* Could be any non-zero and even value. When used as fixup, tells
499 * the driver to ignore any present sku defines.
501 #define ALC_FIXUP_SKU_IGNORE (2)
503 static void alc_fixup_sku_ignore(struct hda_codec *codec,
504 const struct hda_fixup *fix, int action)
506 struct alc_spec *spec = codec->spec;
507 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
508 spec->cdefine.fixup = 1;
509 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
513 static void alc_fixup_no_depop_delay(struct hda_codec *codec,
514 const struct hda_fixup *fix, int action)
516 struct alc_spec *spec = codec->spec;
518 if (action == HDA_FIXUP_ACT_PROBE) {
519 spec->no_depop_delay = 1;
520 codec->depop_delay = 0;
524 static int alc_auto_parse_customize_define(struct hda_codec *codec)
526 unsigned int ass, tmp, i;
528 struct alc_spec *spec = codec->spec;
530 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
532 if (spec->cdefine.fixup) {
533 ass = spec->cdefine.sku_cfg;
534 if (ass == ALC_FIXUP_SKU_IGNORE)
539 if (!codec->bus->pci)
541 ass = codec->core.subsystem_id & 0xffff;
542 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
546 if (codec->core.vendor_id == 0x10ec0260)
548 ass = snd_hda_codec_get_pincfg(codec, nid);
551 codec_info(codec, "%s: SKU not ready 0x%08x\n",
552 codec->core.chip_name, ass);
558 for (i = 1; i < 16; i++) {
562 if (((ass >> 16) & 0xf) != tmp)
565 spec->cdefine.port_connectivity = ass >> 30;
566 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
567 spec->cdefine.check_sum = (ass >> 16) & 0xf;
568 spec->cdefine.customization = ass >> 8;
570 spec->cdefine.sku_cfg = ass;
571 spec->cdefine.external_amp = (ass & 0x38) >> 3;
572 spec->cdefine.platform_type = (ass & 0x4) >> 2;
573 spec->cdefine.swap = (ass & 0x2) >> 1;
574 spec->cdefine.override = ass & 0x1;
576 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
577 nid, spec->cdefine.sku_cfg);
578 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
579 spec->cdefine.port_connectivity);
580 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
581 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
582 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
583 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
584 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
585 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
586 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
591 /* return the position of NID in the list, or -1 if not found */
592 static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
595 for (i = 0; i < nums; i++)
600 /* return true if the given NID is found in the list */
601 static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
603 return find_idx_in_nid_list(nid, list, nums) >= 0;
606 /* check subsystem ID and set up device-specific initialization;
607 * return 1 if initialized, 0 if invalid SSID
609 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
610 * 31 ~ 16 : Manufacture ID
612 * 7 ~ 0 : Assembly ID
613 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
615 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
617 unsigned int ass, tmp, i;
619 struct alc_spec *spec = codec->spec;
621 if (spec->cdefine.fixup) {
622 ass = spec->cdefine.sku_cfg;
623 if (ass == ALC_FIXUP_SKU_IGNORE)
628 ass = codec->core.subsystem_id & 0xffff;
629 if (codec->bus->pci &&
630 ass != codec->bus->pci->subsystem_device && (ass & 1))
633 /* invalid SSID, check the special NID pin defcfg instead */
635 * 31~30 : port connectivity
638 * 19~16 : Check sum (15:1)
643 if (codec->core.vendor_id == 0x10ec0260)
645 ass = snd_hda_codec_get_pincfg(codec, nid);
647 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
651 if ((ass >> 30) != 1) /* no physical connection */
656 for (i = 1; i < 16; i++) {
660 if (((ass >> 16) & 0xf) != tmp)
663 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
664 ass & 0xffff, codec->core.vendor_id);
668 * 2 : 0 --> Desktop, 1 --> Laptop
669 * 3~5 : External Amplifier control
672 tmp = (ass & 0x38) >> 3; /* external Amp control */
675 spec->init_amp = ALC_INIT_GPIO1;
678 spec->init_amp = ALC_INIT_GPIO2;
681 spec->init_amp = ALC_INIT_GPIO3;
685 spec->init_amp = ALC_INIT_DEFAULT;
689 /* is laptop or Desktop and enable the function "Mute internal speaker
690 * when the external headphone out jack is plugged"
695 * 10~8 : Jack location
696 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
698 * 15 : 1 --> enable the function "Mute internal speaker
699 * when the external headphone out jack is plugged"
701 if (!spec->gen.autocfg.hp_pins[0] &&
702 !(spec->gen.autocfg.line_out_pins[0] &&
703 spec->gen.autocfg.line_out_type == AUTO_PIN_HP_OUT)) {
705 tmp = (ass >> 11) & 0x3; /* HP to chassis */
707 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
708 spec->gen.autocfg.line_outs))
710 spec->gen.autocfg.hp_pins[0] = nid;
715 /* Check the validity of ALC subsystem-id
716 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
717 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
719 if (!alc_subsystem_id(codec, ports)) {
720 struct alc_spec *spec = codec->spec;
722 "realtek: Enable default setup for auto mode as fallback\n");
723 spec->init_amp = ALC_INIT_DEFAULT;
730 static void alc_fixup_inv_dmic(struct hda_codec *codec,
731 const struct hda_fixup *fix, int action)
733 struct alc_spec *spec = codec->spec;
735 spec->gen.inv_dmic_split = 1;
739 #ifdef CONFIG_SND_HDA_INPUT_BEEP
740 /* additional beep mixers; the actual parameters are overwritten at build */
741 static const struct snd_kcontrol_new alc_beep_mixer[] = {
742 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
743 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
748 static int alc_build_controls(struct hda_codec *codec)
750 struct alc_spec *spec = codec->spec;
753 err = snd_hda_gen_build_controls(codec);
757 for (i = 0; i < spec->num_mixers; i++) {
758 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
763 #ifdef CONFIG_SND_HDA_INPUT_BEEP
764 /* create beep controls if needed */
765 if (spec->beep_amp) {
766 const struct snd_kcontrol_new *knew;
767 for (knew = alc_beep_mixer; knew->name; knew++) {
768 struct snd_kcontrol *kctl;
769 kctl = snd_ctl_new1(knew, codec);
772 kctl->private_value = spec->beep_amp;
773 err = snd_hda_ctl_add(codec, 0, kctl);
780 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
789 static int alc_init(struct hda_codec *codec)
791 struct alc_spec *spec = codec->spec;
794 spec->init_hook(codec);
796 spec->gen.skip_verbs = 1; /* applied in below */
797 snd_hda_gen_init(codec);
799 alc_auto_init_amp(codec, spec->init_amp);
800 snd_hda_apply_verbs(codec); /* apply verbs here after own init */
802 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
807 static inline void alc_shutup(struct hda_codec *codec)
809 struct alc_spec *spec = codec->spec;
811 if (spec && spec->shutup)
814 snd_hda_shutup_pins(codec);
817 static void alc_reboot_notify(struct hda_codec *codec)
819 struct alc_spec *spec = codec->spec;
821 if (spec && spec->reboot_notify)
822 spec->reboot_notify(codec);
827 #define alc_free snd_hda_gen_free
830 static void alc_power_eapd(struct hda_codec *codec)
832 alc_auto_setup_eapd(codec, false);
835 static int alc_suspend(struct hda_codec *codec)
837 struct alc_spec *spec = codec->spec;
839 if (spec && spec->power_hook)
840 spec->power_hook(codec);
846 static int alc_resume(struct hda_codec *codec)
848 struct alc_spec *spec = codec->spec;
850 if (!spec->no_depop_delay)
851 msleep(150); /* to avoid pop noise */
852 codec->patch_ops.init(codec);
853 regcache_sync(codec->core.regmap);
854 hda_call_check_power_status(codec, 0x01);
861 static const struct hda_codec_ops alc_patch_ops = {
862 .build_controls = alc_build_controls,
863 .build_pcms = snd_hda_gen_build_pcms,
866 .unsol_event = snd_hda_jack_unsol_event,
868 .resume = alc_resume,
869 .suspend = alc_suspend,
870 .check_power_status = snd_hda_gen_check_power_status,
872 .reboot_notify = alc_reboot_notify,
876 #define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
879 * Rename codecs appropriately from COEF value or subvendor id
881 struct alc_codec_rename_table {
882 unsigned int vendor_id;
883 unsigned short coef_mask;
884 unsigned short coef_bits;
888 struct alc_codec_rename_pci_table {
889 unsigned int codec_vendor_id;
890 unsigned short pci_subvendor;
891 unsigned short pci_subdevice;
895 static struct alc_codec_rename_table rename_tbl[] = {
896 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
897 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
898 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
899 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
900 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
901 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
902 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
903 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
904 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
905 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
906 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
907 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
908 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
909 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
910 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
911 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
912 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
916 static struct alc_codec_rename_pci_table rename_pci_tbl[] = {
917 { 0x10ec0280, 0x1028, 0, "ALC3220" },
918 { 0x10ec0282, 0x1028, 0, "ALC3221" },
919 { 0x10ec0283, 0x1028, 0, "ALC3223" },
920 { 0x10ec0288, 0x1028, 0, "ALC3263" },
921 { 0x10ec0292, 0x1028, 0, "ALC3226" },
922 { 0x10ec0293, 0x1028, 0, "ALC3235" },
923 { 0x10ec0255, 0x1028, 0, "ALC3234" },
924 { 0x10ec0668, 0x1028, 0, "ALC3661" },
925 { 0x10ec0275, 0x1028, 0, "ALC3260" },
926 { 0x10ec0899, 0x1028, 0, "ALC3861" },
927 { 0x10ec0298, 0x1028, 0, "ALC3266" },
928 { 0x10ec0236, 0x1028, 0, "ALC3204" },
929 { 0x10ec0256, 0x1028, 0, "ALC3246" },
930 { 0x10ec0225, 0x1028, 0, "ALC3253" },
931 { 0x10ec0295, 0x1028, 0, "ALC3254" },
932 { 0x10ec0299, 0x1028, 0, "ALC3271" },
933 { 0x10ec0670, 0x1025, 0, "ALC669X" },
934 { 0x10ec0676, 0x1025, 0, "ALC679X" },
935 { 0x10ec0282, 0x1043, 0, "ALC3229" },
936 { 0x10ec0233, 0x1043, 0, "ALC3236" },
937 { 0x10ec0280, 0x103c, 0, "ALC3228" },
938 { 0x10ec0282, 0x103c, 0, "ALC3227" },
939 { 0x10ec0286, 0x103c, 0, "ALC3242" },
940 { 0x10ec0290, 0x103c, 0, "ALC3241" },
941 { 0x10ec0668, 0x103c, 0, "ALC3662" },
942 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
943 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
947 static int alc_codec_rename_from_preset(struct hda_codec *codec)
949 const struct alc_codec_rename_table *p;
950 const struct alc_codec_rename_pci_table *q;
952 for (p = rename_tbl; p->vendor_id; p++) {
953 if (p->vendor_id != codec->core.vendor_id)
955 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
956 return alc_codec_rename(codec, p->name);
959 if (!codec->bus->pci)
961 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
962 if (q->codec_vendor_id != codec->core.vendor_id)
964 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
966 if (!q->pci_subdevice ||
967 q->pci_subdevice == codec->bus->pci->subsystem_device)
968 return alc_codec_rename(codec, q->name);
976 * Digital-beep handlers
978 #ifdef CONFIG_SND_HDA_INPUT_BEEP
979 #define set_beep_amp(spec, nid, idx, dir) \
980 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
982 static const struct snd_pci_quirk beep_white_list[] = {
983 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
984 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
985 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
986 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
987 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
988 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
989 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
990 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
991 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
992 /* blacklist -- no beep available */
993 SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
994 SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
998 static inline int has_cdefine_beep(struct hda_codec *codec)
1000 struct alc_spec *spec = codec->spec;
1001 const struct snd_pci_quirk *q;
1002 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list);
1005 return spec->cdefine.enable_pcbeep;
1008 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
1009 #define has_cdefine_beep(codec) 0
1012 /* parse the BIOS configuration and set up the alc_spec */
1013 /* return 1 if successful, 0 if the proper config is not found,
1014 * or a negative error code
1016 static int alc_parse_auto_config(struct hda_codec *codec,
1017 const hda_nid_t *ignore_nids,
1018 const hda_nid_t *ssid_nids)
1020 struct alc_spec *spec = codec->spec;
1021 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
1024 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1030 alc_ssid_check(codec, ssid_nids);
1032 err = snd_hda_gen_parse_auto_config(codec, cfg);
1039 /* common preparation job for alc_spec */
1040 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1042 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1048 snd_hda_gen_spec_init(&spec->gen);
1049 spec->gen.mixer_nid = mixer_nid;
1050 spec->gen.own_eapd_ctl = 1;
1051 codec->single_adc_amp = 1;
1052 /* FIXME: do we need this for all Realtek codec models? */
1053 codec->spdif_status_reset = 1;
1054 codec->patch_ops = alc_patch_ops;
1056 err = alc_codec_rename_from_preset(codec);
1064 static int alc880_parse_auto_config(struct hda_codec *codec)
1066 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
1067 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
1068 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1077 ALC880_FIXUP_MEDION_RIM,
1079 ALC880_FIXUP_LG_LW25,
1081 ALC880_FIXUP_EAPD_COEF,
1082 ALC880_FIXUP_TCL_S700,
1083 ALC880_FIXUP_VOL_KNOB,
1084 ALC880_FIXUP_FUJITSU,
1086 ALC880_FIXUP_UNIWILL,
1087 ALC880_FIXUP_UNIWILL_DIG,
1089 ALC880_FIXUP_ASUS_W5A,
1090 ALC880_FIXUP_3ST_BASE,
1092 ALC880_FIXUP_3ST_DIG,
1093 ALC880_FIXUP_5ST_BASE,
1095 ALC880_FIXUP_5ST_DIG,
1096 ALC880_FIXUP_6ST_BASE,
1098 ALC880_FIXUP_6ST_DIG,
1099 ALC880_FIXUP_6ST_AUTOMUTE,
1102 /* enable the volume-knob widget support on NID 0x21 */
1103 static void alc880_fixup_vol_knob(struct hda_codec *codec,
1104 const struct hda_fixup *fix, int action)
1106 if (action == HDA_FIXUP_ACT_PROBE)
1107 snd_hda_jack_detect_enable_callback(codec, 0x21,
1108 alc_update_knob_master);
1111 static const struct hda_fixup alc880_fixups[] = {
1112 [ALC880_FIXUP_GPIO1] = {
1113 .type = HDA_FIXUP_VERBS,
1114 .v.verbs = alc_gpio1_init_verbs,
1116 [ALC880_FIXUP_GPIO2] = {
1117 .type = HDA_FIXUP_VERBS,
1118 .v.verbs = alc_gpio2_init_verbs,
1120 [ALC880_FIXUP_MEDION_RIM] = {
1121 .type = HDA_FIXUP_VERBS,
1122 .v.verbs = (const struct hda_verb[]) {
1123 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1124 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1128 .chain_id = ALC880_FIXUP_GPIO2,
1130 [ALC880_FIXUP_LG] = {
1131 .type = HDA_FIXUP_PINS,
1132 .v.pins = (const struct hda_pintbl[]) {
1133 /* disable bogus unused pins */
1134 { 0x16, 0x411111f0 },
1135 { 0x18, 0x411111f0 },
1136 { 0x1a, 0x411111f0 },
1140 [ALC880_FIXUP_LG_LW25] = {
1141 .type = HDA_FIXUP_PINS,
1142 .v.pins = (const struct hda_pintbl[]) {
1143 { 0x1a, 0x0181344f }, /* line-in */
1144 { 0x1b, 0x0321403f }, /* headphone */
1148 [ALC880_FIXUP_W810] = {
1149 .type = HDA_FIXUP_PINS,
1150 .v.pins = (const struct hda_pintbl[]) {
1151 /* disable bogus unused pins */
1152 { 0x17, 0x411111f0 },
1156 .chain_id = ALC880_FIXUP_GPIO2,
1158 [ALC880_FIXUP_EAPD_COEF] = {
1159 .type = HDA_FIXUP_VERBS,
1160 .v.verbs = (const struct hda_verb[]) {
1161 /* change to EAPD mode */
1162 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1163 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1167 [ALC880_FIXUP_TCL_S700] = {
1168 .type = HDA_FIXUP_VERBS,
1169 .v.verbs = (const struct hda_verb[]) {
1170 /* change to EAPD mode */
1171 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1172 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1176 .chain_id = ALC880_FIXUP_GPIO2,
1178 [ALC880_FIXUP_VOL_KNOB] = {
1179 .type = HDA_FIXUP_FUNC,
1180 .v.func = alc880_fixup_vol_knob,
1182 [ALC880_FIXUP_FUJITSU] = {
1183 /* override all pins as BIOS on old Amilo is broken */
1184 .type = HDA_FIXUP_PINS,
1185 .v.pins = (const struct hda_pintbl[]) {
1186 { 0x14, 0x0121401f }, /* HP */
1187 { 0x15, 0x99030120 }, /* speaker */
1188 { 0x16, 0x99030130 }, /* bass speaker */
1189 { 0x17, 0x411111f0 }, /* N/A */
1190 { 0x18, 0x411111f0 }, /* N/A */
1191 { 0x19, 0x01a19950 }, /* mic-in */
1192 { 0x1a, 0x411111f0 }, /* N/A */
1193 { 0x1b, 0x411111f0 }, /* N/A */
1194 { 0x1c, 0x411111f0 }, /* N/A */
1195 { 0x1d, 0x411111f0 }, /* N/A */
1196 { 0x1e, 0x01454140 }, /* SPDIF out */
1200 .chain_id = ALC880_FIXUP_VOL_KNOB,
1202 [ALC880_FIXUP_F1734] = {
1203 /* almost compatible with FUJITSU, but no bass and SPDIF */
1204 .type = HDA_FIXUP_PINS,
1205 .v.pins = (const struct hda_pintbl[]) {
1206 { 0x14, 0x0121401f }, /* HP */
1207 { 0x15, 0x99030120 }, /* speaker */
1208 { 0x16, 0x411111f0 }, /* N/A */
1209 { 0x17, 0x411111f0 }, /* N/A */
1210 { 0x18, 0x411111f0 }, /* N/A */
1211 { 0x19, 0x01a19950 }, /* mic-in */
1212 { 0x1a, 0x411111f0 }, /* N/A */
1213 { 0x1b, 0x411111f0 }, /* N/A */
1214 { 0x1c, 0x411111f0 }, /* N/A */
1215 { 0x1d, 0x411111f0 }, /* N/A */
1216 { 0x1e, 0x411111f0 }, /* N/A */
1220 .chain_id = ALC880_FIXUP_VOL_KNOB,
1222 [ALC880_FIXUP_UNIWILL] = {
1223 /* need to fix HP and speaker pins to be parsed correctly */
1224 .type = HDA_FIXUP_PINS,
1225 .v.pins = (const struct hda_pintbl[]) {
1226 { 0x14, 0x0121411f }, /* HP */
1227 { 0x15, 0x99030120 }, /* speaker */
1228 { 0x16, 0x99030130 }, /* bass speaker */
1232 [ALC880_FIXUP_UNIWILL_DIG] = {
1233 .type = HDA_FIXUP_PINS,
1234 .v.pins = (const struct hda_pintbl[]) {
1235 /* disable bogus unused pins */
1236 { 0x17, 0x411111f0 },
1237 { 0x19, 0x411111f0 },
1238 { 0x1b, 0x411111f0 },
1239 { 0x1f, 0x411111f0 },
1243 [ALC880_FIXUP_Z71V] = {
1244 .type = HDA_FIXUP_PINS,
1245 .v.pins = (const struct hda_pintbl[]) {
1246 /* set up the whole pins as BIOS is utterly broken */
1247 { 0x14, 0x99030120 }, /* speaker */
1248 { 0x15, 0x0121411f }, /* HP */
1249 { 0x16, 0x411111f0 }, /* N/A */
1250 { 0x17, 0x411111f0 }, /* N/A */
1251 { 0x18, 0x01a19950 }, /* mic-in */
1252 { 0x19, 0x411111f0 }, /* N/A */
1253 { 0x1a, 0x01813031 }, /* line-in */
1254 { 0x1b, 0x411111f0 }, /* N/A */
1255 { 0x1c, 0x411111f0 }, /* N/A */
1256 { 0x1d, 0x411111f0 }, /* N/A */
1257 { 0x1e, 0x0144111e }, /* SPDIF */
1261 [ALC880_FIXUP_ASUS_W5A] = {
1262 .type = HDA_FIXUP_PINS,
1263 .v.pins = (const struct hda_pintbl[]) {
1264 /* set up the whole pins as BIOS is utterly broken */
1265 { 0x14, 0x0121411f }, /* HP */
1266 { 0x15, 0x411111f0 }, /* N/A */
1267 { 0x16, 0x411111f0 }, /* N/A */
1268 { 0x17, 0x411111f0 }, /* N/A */
1269 { 0x18, 0x90a60160 }, /* mic */
1270 { 0x19, 0x411111f0 }, /* N/A */
1271 { 0x1a, 0x411111f0 }, /* N/A */
1272 { 0x1b, 0x411111f0 }, /* N/A */
1273 { 0x1c, 0x411111f0 }, /* N/A */
1274 { 0x1d, 0x411111f0 }, /* N/A */
1275 { 0x1e, 0xb743111e }, /* SPDIF out */
1279 .chain_id = ALC880_FIXUP_GPIO1,
1281 [ALC880_FIXUP_3ST_BASE] = {
1282 .type = HDA_FIXUP_PINS,
1283 .v.pins = (const struct hda_pintbl[]) {
1284 { 0x14, 0x01014010 }, /* line-out */
1285 { 0x15, 0x411111f0 }, /* N/A */
1286 { 0x16, 0x411111f0 }, /* N/A */
1287 { 0x17, 0x411111f0 }, /* N/A */
1288 { 0x18, 0x01a19c30 }, /* mic-in */
1289 { 0x19, 0x0121411f }, /* HP */
1290 { 0x1a, 0x01813031 }, /* line-in */
1291 { 0x1b, 0x02a19c40 }, /* front-mic */
1292 { 0x1c, 0x411111f0 }, /* N/A */
1293 { 0x1d, 0x411111f0 }, /* N/A */
1294 /* 0x1e is filled in below */
1295 { 0x1f, 0x411111f0 }, /* N/A */
1299 [ALC880_FIXUP_3ST] = {
1300 .type = HDA_FIXUP_PINS,
1301 .v.pins = (const struct hda_pintbl[]) {
1302 { 0x1e, 0x411111f0 }, /* N/A */
1306 .chain_id = ALC880_FIXUP_3ST_BASE,
1308 [ALC880_FIXUP_3ST_DIG] = {
1309 .type = HDA_FIXUP_PINS,
1310 .v.pins = (const struct hda_pintbl[]) {
1311 { 0x1e, 0x0144111e }, /* SPDIF */
1315 .chain_id = ALC880_FIXUP_3ST_BASE,
1317 [ALC880_FIXUP_5ST_BASE] = {
1318 .type = HDA_FIXUP_PINS,
1319 .v.pins = (const struct hda_pintbl[]) {
1320 { 0x14, 0x01014010 }, /* front */
1321 { 0x15, 0x411111f0 }, /* N/A */
1322 { 0x16, 0x01011411 }, /* CLFE */
1323 { 0x17, 0x01016412 }, /* surr */
1324 { 0x18, 0x01a19c30 }, /* mic-in */
1325 { 0x19, 0x0121411f }, /* HP */
1326 { 0x1a, 0x01813031 }, /* line-in */
1327 { 0x1b, 0x02a19c40 }, /* front-mic */
1328 { 0x1c, 0x411111f0 }, /* N/A */
1329 { 0x1d, 0x411111f0 }, /* N/A */
1330 /* 0x1e is filled in below */
1331 { 0x1f, 0x411111f0 }, /* N/A */
1335 [ALC880_FIXUP_5ST] = {
1336 .type = HDA_FIXUP_PINS,
1337 .v.pins = (const struct hda_pintbl[]) {
1338 { 0x1e, 0x411111f0 }, /* N/A */
1342 .chain_id = ALC880_FIXUP_5ST_BASE,
1344 [ALC880_FIXUP_5ST_DIG] = {
1345 .type = HDA_FIXUP_PINS,
1346 .v.pins = (const struct hda_pintbl[]) {
1347 { 0x1e, 0x0144111e }, /* SPDIF */
1351 .chain_id = ALC880_FIXUP_5ST_BASE,
1353 [ALC880_FIXUP_6ST_BASE] = {
1354 .type = HDA_FIXUP_PINS,
1355 .v.pins = (const struct hda_pintbl[]) {
1356 { 0x14, 0x01014010 }, /* front */
1357 { 0x15, 0x01016412 }, /* surr */
1358 { 0x16, 0x01011411 }, /* CLFE */
1359 { 0x17, 0x01012414 }, /* side */
1360 { 0x18, 0x01a19c30 }, /* mic-in */
1361 { 0x19, 0x02a19c40 }, /* front-mic */
1362 { 0x1a, 0x01813031 }, /* line-in */
1363 { 0x1b, 0x0121411f }, /* HP */
1364 { 0x1c, 0x411111f0 }, /* N/A */
1365 { 0x1d, 0x411111f0 }, /* N/A */
1366 /* 0x1e is filled in below */
1367 { 0x1f, 0x411111f0 }, /* N/A */
1371 [ALC880_FIXUP_6ST] = {
1372 .type = HDA_FIXUP_PINS,
1373 .v.pins = (const struct hda_pintbl[]) {
1374 { 0x1e, 0x411111f0 }, /* N/A */
1378 .chain_id = ALC880_FIXUP_6ST_BASE,
1380 [ALC880_FIXUP_6ST_DIG] = {
1381 .type = HDA_FIXUP_PINS,
1382 .v.pins = (const struct hda_pintbl[]) {
1383 { 0x1e, 0x0144111e }, /* SPDIF */
1387 .chain_id = ALC880_FIXUP_6ST_BASE,
1389 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1390 .type = HDA_FIXUP_PINS,
1391 .v.pins = (const struct hda_pintbl[]) {
1392 { 0x1b, 0x0121401f }, /* HP with jack detect */
1395 .chained_before = true,
1396 .chain_id = ALC880_FIXUP_6ST_BASE,
1400 static const struct snd_pci_quirk alc880_fixup_tbl[] = {
1401 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
1402 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
1403 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
1404 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
1405 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
1406 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
1407 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
1408 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
1409 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
1410 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
1411 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
1412 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
1413 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
1414 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
1415 SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
1416 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
1417 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
1418 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
1419 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1420 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1421 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
1422 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
1423 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
1425 /* Below is the copied entries from alc880_quirks.c.
1426 * It's not quite sure whether BIOS sets the correct pin-config table
1427 * on these machines, thus they are kept to be compatible with
1428 * the old static quirks. Once when it's confirmed to work without
1429 * these overrides, it'd be better to remove.
1431 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1432 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1433 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1434 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1435 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1436 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1437 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1438 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1439 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1440 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1441 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1442 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1443 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1444 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1445 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1446 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1447 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1448 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1449 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1450 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1451 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1452 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1453 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1454 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1455 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1456 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1457 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1458 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1459 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1460 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1461 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1462 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1463 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1465 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1466 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1467 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1471 static const struct hda_model_fixup alc880_fixup_models[] = {
1472 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1473 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1474 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1475 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1476 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1477 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
1478 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
1484 * OK, here we have finally the patch for ALC880
1486 static int patch_alc880(struct hda_codec *codec)
1488 struct alc_spec *spec;
1491 err = alc_alloc_spec(codec, 0x0b);
1496 spec->gen.need_dac_fix = 1;
1497 spec->gen.beep_nid = 0x01;
1499 codec->patch_ops.unsol_event = alc880_unsol_event;
1501 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
1503 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1505 /* automatic parse from the BIOS config */
1506 err = alc880_parse_auto_config(codec);
1510 if (!spec->gen.no_analog)
1511 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1513 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1526 static int alc260_parse_auto_config(struct hda_codec *codec)
1528 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
1529 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1530 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
1537 ALC260_FIXUP_HP_DC5750,
1538 ALC260_FIXUP_HP_PIN_0F,
1541 ALC260_FIXUP_GPIO1_TOGGLE,
1542 ALC260_FIXUP_REPLACER,
1543 ALC260_FIXUP_HP_B1900,
1545 ALC260_FIXUP_FSC_S7020,
1546 ALC260_FIXUP_FSC_S7020_JWSE,
1547 ALC260_FIXUP_VAIO_PINS,
1550 static void alc260_gpio1_automute(struct hda_codec *codec)
1552 struct alc_spec *spec = codec->spec;
1553 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
1554 spec->gen.hp_jack_present);
1557 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1558 const struct hda_fixup *fix, int action)
1560 struct alc_spec *spec = codec->spec;
1561 if (action == HDA_FIXUP_ACT_PROBE) {
1562 /* although the machine has only one output pin, we need to
1563 * toggle GPIO1 according to the jack state
1565 spec->gen.automute_hook = alc260_gpio1_automute;
1566 spec->gen.detect_hp = 1;
1567 spec->gen.automute_speaker = 1;
1568 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
1569 snd_hda_jack_detect_enable_callback(codec, 0x0f,
1570 snd_hda_gen_hp_automute);
1571 snd_hda_add_verbs(codec, alc_gpio1_init_verbs);
1575 static void alc260_fixup_kn1(struct hda_codec *codec,
1576 const struct hda_fixup *fix, int action)
1578 struct alc_spec *spec = codec->spec;
1579 static const struct hda_pintbl pincfgs[] = {
1580 { 0x0f, 0x02214000 }, /* HP/speaker */
1581 { 0x12, 0x90a60160 }, /* int mic */
1582 { 0x13, 0x02a19000 }, /* ext mic */
1583 { 0x18, 0x01446000 }, /* SPDIF out */
1584 /* disable bogus I/O pins */
1585 { 0x10, 0x411111f0 },
1586 { 0x11, 0x411111f0 },
1587 { 0x14, 0x411111f0 },
1588 { 0x15, 0x411111f0 },
1589 { 0x16, 0x411111f0 },
1590 { 0x17, 0x411111f0 },
1591 { 0x19, 0x411111f0 },
1596 case HDA_FIXUP_ACT_PRE_PROBE:
1597 snd_hda_apply_pincfgs(codec, pincfgs);
1599 case HDA_FIXUP_ACT_PROBE:
1600 spec->init_amp = ALC_INIT_NONE;
1605 static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1606 const struct hda_fixup *fix, int action)
1608 struct alc_spec *spec = codec->spec;
1609 if (action == HDA_FIXUP_ACT_PROBE)
1610 spec->init_amp = ALC_INIT_NONE;
1613 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1614 const struct hda_fixup *fix, int action)
1616 struct alc_spec *spec = codec->spec;
1617 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1618 spec->gen.add_jack_modes = 1;
1619 spec->gen.hp_mic = 1;
1623 static const struct hda_fixup alc260_fixups[] = {
1624 [ALC260_FIXUP_HP_DC5750] = {
1625 .type = HDA_FIXUP_PINS,
1626 .v.pins = (const struct hda_pintbl[]) {
1627 { 0x11, 0x90130110 }, /* speaker */
1631 [ALC260_FIXUP_HP_PIN_0F] = {
1632 .type = HDA_FIXUP_PINS,
1633 .v.pins = (const struct hda_pintbl[]) {
1634 { 0x0f, 0x01214000 }, /* HP */
1638 [ALC260_FIXUP_COEF] = {
1639 .type = HDA_FIXUP_VERBS,
1640 .v.verbs = (const struct hda_verb[]) {
1641 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1642 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
1646 [ALC260_FIXUP_GPIO1] = {
1647 .type = HDA_FIXUP_VERBS,
1648 .v.verbs = alc_gpio1_init_verbs,
1650 [ALC260_FIXUP_GPIO1_TOGGLE] = {
1651 .type = HDA_FIXUP_FUNC,
1652 .v.func = alc260_fixup_gpio1_toggle,
1654 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1656 [ALC260_FIXUP_REPLACER] = {
1657 .type = HDA_FIXUP_VERBS,
1658 .v.verbs = (const struct hda_verb[]) {
1659 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1660 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
1664 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1666 [ALC260_FIXUP_HP_B1900] = {
1667 .type = HDA_FIXUP_FUNC,
1668 .v.func = alc260_fixup_gpio1_toggle,
1670 .chain_id = ALC260_FIXUP_COEF,
1672 [ALC260_FIXUP_KN1] = {
1673 .type = HDA_FIXUP_FUNC,
1674 .v.func = alc260_fixup_kn1,
1676 [ALC260_FIXUP_FSC_S7020] = {
1677 .type = HDA_FIXUP_FUNC,
1678 .v.func = alc260_fixup_fsc_s7020,
1680 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1681 .type = HDA_FIXUP_FUNC,
1682 .v.func = alc260_fixup_fsc_s7020_jwse,
1684 .chain_id = ALC260_FIXUP_FSC_S7020,
1686 [ALC260_FIXUP_VAIO_PINS] = {
1687 .type = HDA_FIXUP_PINS,
1688 .v.pins = (const struct hda_pintbl[]) {
1689 /* Pin configs are missing completely on some VAIOs */
1690 { 0x0f, 0x01211020 },
1691 { 0x10, 0x0001003f },
1692 { 0x11, 0x411111f0 },
1693 { 0x12, 0x01a15930 },
1694 { 0x13, 0x411111f0 },
1695 { 0x14, 0x411111f0 },
1696 { 0x15, 0x411111f0 },
1697 { 0x16, 0x411111f0 },
1698 { 0x17, 0x411111f0 },
1699 { 0x18, 0x411111f0 },
1700 { 0x19, 0x411111f0 },
1706 static const struct snd_pci_quirk alc260_fixup_tbl[] = {
1707 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
1708 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
1709 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
1710 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
1711 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
1712 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
1713 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
1714 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
1715 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
1716 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
1717 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
1718 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
1722 static const struct hda_model_fixup alc260_fixup_models[] = {
1723 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1724 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1725 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1726 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1732 static int patch_alc260(struct hda_codec *codec)
1734 struct alc_spec *spec;
1737 err = alc_alloc_spec(codec, 0x07);
1742 /* as quite a few machines require HP amp for speaker outputs,
1743 * it's easier to enable it unconditionally; even if it's unneeded,
1744 * it's almost harmless.
1746 spec->gen.prefer_hp_amp = 1;
1747 spec->gen.beep_nid = 0x01;
1749 spec->shutup = alc_eapd_shutup;
1751 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1753 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1755 /* automatic parse from the BIOS config */
1756 err = alc260_parse_auto_config(codec);
1760 if (!spec->gen.no_analog)
1761 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1763 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1774 * ALC882/883/885/888/889 support
1776 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1777 * configuration. Each pin widget can choose any input DACs and a mixer.
1778 * Each ADC is connected from a mixer of all inputs. This makes possible
1779 * 6-channel independent captures.
1781 * In addition, an independent DAC for the multi-playback (not used in this
1789 ALC882_FIXUP_ABIT_AW9D_MAX,
1790 ALC882_FIXUP_LENOVO_Y530,
1791 ALC882_FIXUP_PB_M5210,
1792 ALC882_FIXUP_ACER_ASPIRE_7736,
1793 ALC882_FIXUP_ASUS_W90V,
1795 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
1796 ALC889_FIXUP_VAIO_TT,
1797 ALC888_FIXUP_EEE1601,
1801 ALC883_FIXUP_ACER_EAPD,
1806 ALC882_FIXUP_ASUS_W2JC,
1807 ALC882_FIXUP_ACER_ASPIRE_4930G,
1808 ALC882_FIXUP_ACER_ASPIRE_8930G,
1809 ALC882_FIXUP_ASPIRE_8930G_VERBS,
1810 ALC885_FIXUP_MACPRO_GPIO,
1811 ALC889_FIXUP_DAC_ROUTE,
1812 ALC889_FIXUP_MBP_VREF,
1813 ALC889_FIXUP_IMAC91_VREF,
1814 ALC889_FIXUP_MBA11_VREF,
1815 ALC889_FIXUP_MBA21_VREF,
1816 ALC889_FIXUP_MP11_VREF,
1817 ALC889_FIXUP_MP41_VREF,
1818 ALC882_FIXUP_INV_DMIC,
1819 ALC882_FIXUP_NO_PRIMARY_HP,
1820 ALC887_FIXUP_ASUS_BASS,
1821 ALC887_FIXUP_BASS_CHMAP,
1822 ALC1220_FIXUP_GB_DUAL_CODECS,
1825 static void alc889_fixup_coef(struct hda_codec *codec,
1826 const struct hda_fixup *fix, int action)
1828 if (action != HDA_FIXUP_ACT_INIT)
1830 alc_update_coef_idx(codec, 7, 0, 0x2030);
1833 /* toggle speaker-output according to the hp-jack state */
1834 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
1836 unsigned int gpiostate, gpiomask, gpiodir;
1838 gpiostate = snd_hda_codec_read(codec, codec->core.afg, 0,
1839 AC_VERB_GET_GPIO_DATA, 0);
1842 gpiostate |= (1 << pin);
1844 gpiostate &= ~(1 << pin);
1846 gpiomask = snd_hda_codec_read(codec, codec->core.afg, 0,
1847 AC_VERB_GET_GPIO_MASK, 0);
1848 gpiomask |= (1 << pin);
1850 gpiodir = snd_hda_codec_read(codec, codec->core.afg, 0,
1851 AC_VERB_GET_GPIO_DIRECTION, 0);
1852 gpiodir |= (1 << pin);
1855 snd_hda_codec_write(codec, codec->core.afg, 0,
1856 AC_VERB_SET_GPIO_MASK, gpiomask);
1857 snd_hda_codec_write(codec, codec->core.afg, 0,
1858 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
1862 snd_hda_codec_write(codec, codec->core.afg, 0,
1863 AC_VERB_SET_GPIO_DATA, gpiostate);
1866 /* set up GPIO at initialization */
1867 static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
1868 const struct hda_fixup *fix, int action)
1870 if (action != HDA_FIXUP_ACT_INIT)
1872 alc882_gpio_mute(codec, 0, 0);
1873 alc882_gpio_mute(codec, 1, 0);
1876 /* Fix the connection of some pins for ALC889:
1877 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
1878 * work correctly (bko#42740)
1880 static void alc889_fixup_dac_route(struct hda_codec *codec,
1881 const struct hda_fixup *fix, int action)
1883 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1884 /* fake the connections during parsing the tree */
1885 hda_nid_t conn1[2] = { 0x0c, 0x0d };
1886 hda_nid_t conn2[2] = { 0x0e, 0x0f };
1887 snd_hda_override_conn_list(codec, 0x14, 2, conn1);
1888 snd_hda_override_conn_list(codec, 0x15, 2, conn1);
1889 snd_hda_override_conn_list(codec, 0x18, 2, conn2);
1890 snd_hda_override_conn_list(codec, 0x1a, 2, conn2);
1891 } else if (action == HDA_FIXUP_ACT_PROBE) {
1892 /* restore the connections */
1893 hda_nid_t conn[5] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
1894 snd_hda_override_conn_list(codec, 0x14, 5, conn);
1895 snd_hda_override_conn_list(codec, 0x15, 5, conn);
1896 snd_hda_override_conn_list(codec, 0x18, 5, conn);
1897 snd_hda_override_conn_list(codec, 0x1a, 5, conn);
1901 /* Set VREF on HP pin */
1902 static void alc889_fixup_mbp_vref(struct hda_codec *codec,
1903 const struct hda_fixup *fix, int action)
1905 struct alc_spec *spec = codec->spec;
1906 static hda_nid_t nids[3] = { 0x14, 0x15, 0x19 };
1909 if (action != HDA_FIXUP_ACT_INIT)
1911 for (i = 0; i < ARRAY_SIZE(nids); i++) {
1912 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
1913 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
1915 val = snd_hda_codec_get_pin_target(codec, nids[i]);
1916 val |= AC_PINCTL_VREF_80;
1917 snd_hda_set_pin_ctl(codec, nids[i], val);
1918 spec->gen.keep_vref_in_automute = 1;
1923 static void alc889_fixup_mac_pins(struct hda_codec *codec,
1924 const hda_nid_t *nids, int num_nids)
1926 struct alc_spec *spec = codec->spec;
1929 for (i = 0; i < num_nids; i++) {
1931 val = snd_hda_codec_get_pin_target(codec, nids[i]);
1932 val |= AC_PINCTL_VREF_50;
1933 snd_hda_set_pin_ctl(codec, nids[i], val);
1935 spec->gen.keep_vref_in_automute = 1;
1938 /* Set VREF on speaker pins on imac91 */
1939 static void alc889_fixup_imac91_vref(struct hda_codec *codec,
1940 const struct hda_fixup *fix, int action)
1942 static hda_nid_t nids[2] = { 0x18, 0x1a };
1944 if (action == HDA_FIXUP_ACT_INIT)
1945 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1948 /* Set VREF on speaker pins on mba11 */
1949 static void alc889_fixup_mba11_vref(struct hda_codec *codec,
1950 const struct hda_fixup *fix, int action)
1952 static hda_nid_t nids[1] = { 0x18 };
1954 if (action == HDA_FIXUP_ACT_INIT)
1955 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1958 /* Set VREF on speaker pins on mba21 */
1959 static void alc889_fixup_mba21_vref(struct hda_codec *codec,
1960 const struct hda_fixup *fix, int action)
1962 static hda_nid_t nids[2] = { 0x18, 0x19 };
1964 if (action == HDA_FIXUP_ACT_INIT)
1965 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1968 /* Don't take HP output as primary
1969 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
1970 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
1972 static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
1973 const struct hda_fixup *fix, int action)
1975 struct alc_spec *spec = codec->spec;
1976 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1977 spec->gen.no_primary_hp = 1;
1978 spec->gen.no_multi_io = 1;
1982 static void alc_fixup_bass_chmap(struct hda_codec *codec,
1983 const struct hda_fixup *fix, int action);
1985 /* For dual-codec configuration, we need to disable some features to avoid
1986 * conflicts of kctls and PCM streams
1988 static void alc_fixup_dual_codecs(struct hda_codec *codec,
1989 const struct hda_fixup *fix, int action)
1991 struct alc_spec *spec = codec->spec;
1993 if (action != HDA_FIXUP_ACT_PRE_PROBE)
1995 /* disable vmaster */
1996 spec->gen.suppress_vmaster = 1;
1997 /* auto-mute and auto-mic switch don't work with multiple codecs */
1998 spec->gen.suppress_auto_mute = 1;
1999 spec->gen.suppress_auto_mic = 1;
2000 /* disable aamix as well */
2001 spec->gen.mixer_nid = 0;
2002 /* add location prefix to avoid conflicts */
2003 codec->force_pin_prefix = 1;
2006 static void rename_ctl(struct hda_codec *codec, const char *oldname,
2007 const char *newname)
2009 struct snd_kcontrol *kctl;
2011 kctl = snd_hda_find_mixer_ctl(codec, oldname);
2013 strcpy(kctl->id.name, newname);
2016 static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2017 const struct hda_fixup *fix,
2020 alc_fixup_dual_codecs(codec, fix, action);
2022 case HDA_FIXUP_ACT_PRE_PROBE:
2023 /* override card longname to provide a unique UCM profile */
2024 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2026 case HDA_FIXUP_ACT_BUILD:
2027 /* rename Capture controls depending on the codec */
2028 rename_ctl(codec, "Capture Volume",
2030 "Rear-Panel Capture Volume" :
2031 "Front-Panel Capture Volume");
2032 rename_ctl(codec, "Capture Switch",
2034 "Rear-Panel Capture Switch" :
2035 "Front-Panel Capture Switch");
2040 static const struct hda_fixup alc882_fixups[] = {
2041 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
2042 .type = HDA_FIXUP_PINS,
2043 .v.pins = (const struct hda_pintbl[]) {
2044 { 0x15, 0x01080104 }, /* side */
2045 { 0x16, 0x01011012 }, /* rear */
2046 { 0x17, 0x01016011 }, /* clfe */
2050 [ALC882_FIXUP_LENOVO_Y530] = {
2051 .type = HDA_FIXUP_PINS,
2052 .v.pins = (const struct hda_pintbl[]) {
2053 { 0x15, 0x99130112 }, /* rear int speakers */
2054 { 0x16, 0x99130111 }, /* subwoofer */
2058 [ALC882_FIXUP_PB_M5210] = {
2059 .type = HDA_FIXUP_PINCTLS,
2060 .v.pins = (const struct hda_pintbl[]) {
2061 { 0x19, PIN_VREF50 },
2065 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
2066 .type = HDA_FIXUP_FUNC,
2067 .v.func = alc_fixup_sku_ignore,
2069 [ALC882_FIXUP_ASUS_W90V] = {
2070 .type = HDA_FIXUP_PINS,
2071 .v.pins = (const struct hda_pintbl[]) {
2072 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
2076 [ALC889_FIXUP_CD] = {
2077 .type = HDA_FIXUP_PINS,
2078 .v.pins = (const struct hda_pintbl[]) {
2079 { 0x1c, 0x993301f0 }, /* CD */
2083 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2084 .type = HDA_FIXUP_PINS,
2085 .v.pins = (const struct hda_pintbl[]) {
2086 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2090 .chain_id = ALC889_FIXUP_CD,
2092 [ALC889_FIXUP_VAIO_TT] = {
2093 .type = HDA_FIXUP_PINS,
2094 .v.pins = (const struct hda_pintbl[]) {
2095 { 0x17, 0x90170111 }, /* hidden surround speaker */
2099 [ALC888_FIXUP_EEE1601] = {
2100 .type = HDA_FIXUP_VERBS,
2101 .v.verbs = (const struct hda_verb[]) {
2102 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2103 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
2107 [ALC886_FIXUP_EAPD] = {
2108 .type = HDA_FIXUP_VERBS,
2109 .v.verbs = (const struct hda_verb[]) {
2110 /* change to EAPD mode */
2111 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2112 { 0x20, AC_VERB_SET_PROC_COEF, 0x0068 },
2116 [ALC882_FIXUP_EAPD] = {
2117 .type = HDA_FIXUP_VERBS,
2118 .v.verbs = (const struct hda_verb[]) {
2119 /* change to EAPD mode */
2120 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2121 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2125 [ALC883_FIXUP_EAPD] = {
2126 .type = HDA_FIXUP_VERBS,
2127 .v.verbs = (const struct hda_verb[]) {
2128 /* change to EAPD mode */
2129 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2130 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2134 [ALC883_FIXUP_ACER_EAPD] = {
2135 .type = HDA_FIXUP_VERBS,
2136 .v.verbs = (const struct hda_verb[]) {
2137 /* eanable EAPD on Acer laptops */
2138 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2139 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2143 [ALC882_FIXUP_GPIO1] = {
2144 .type = HDA_FIXUP_VERBS,
2145 .v.verbs = alc_gpio1_init_verbs,
2147 [ALC882_FIXUP_GPIO2] = {
2148 .type = HDA_FIXUP_VERBS,
2149 .v.verbs = alc_gpio2_init_verbs,
2151 [ALC882_FIXUP_GPIO3] = {
2152 .type = HDA_FIXUP_VERBS,
2153 .v.verbs = alc_gpio3_init_verbs,
2155 [ALC882_FIXUP_ASUS_W2JC] = {
2156 .type = HDA_FIXUP_VERBS,
2157 .v.verbs = alc_gpio1_init_verbs,
2159 .chain_id = ALC882_FIXUP_EAPD,
2161 [ALC889_FIXUP_COEF] = {
2162 .type = HDA_FIXUP_FUNC,
2163 .v.func = alc889_fixup_coef,
2165 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
2166 .type = HDA_FIXUP_PINS,
2167 .v.pins = (const struct hda_pintbl[]) {
2168 { 0x16, 0x99130111 }, /* CLFE speaker */
2169 { 0x17, 0x99130112 }, /* surround speaker */
2173 .chain_id = ALC882_FIXUP_GPIO1,
2175 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
2176 .type = HDA_FIXUP_PINS,
2177 .v.pins = (const struct hda_pintbl[]) {
2178 { 0x16, 0x99130111 }, /* CLFE speaker */
2179 { 0x1b, 0x99130112 }, /* surround speaker */
2183 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2185 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2186 /* additional init verbs for Acer Aspire 8930G */
2187 .type = HDA_FIXUP_VERBS,
2188 .v.verbs = (const struct hda_verb[]) {
2189 /* Enable all DACs */
2190 /* DAC DISABLE/MUTE 1? */
2191 /* setting bits 1-5 disables DAC nids 0x02-0x06
2192 * apparently. Init=0x38 */
2193 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2194 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2195 /* DAC DISABLE/MUTE 2? */
2196 /* some bit here disables the other DACs.
2198 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2199 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2201 * This laptop has a stereo digital microphone.
2202 * The mics are only 1cm apart which makes the stereo
2203 * useless. However, either the mic or the ALC889
2204 * makes the signal become a difference/sum signal
2205 * instead of standard stereo, which is annoying.
2206 * So instead we flip this bit which makes the
2207 * codec replicate the sum signal to both channels,
2208 * turning it into a normal mono mic.
2210 /* DMIC_CONTROL? Init value = 0x0001 */
2211 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2212 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2213 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2214 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2218 .chain_id = ALC882_FIXUP_GPIO1,
2220 [ALC885_FIXUP_MACPRO_GPIO] = {
2221 .type = HDA_FIXUP_FUNC,
2222 .v.func = alc885_fixup_macpro_gpio,
2224 [ALC889_FIXUP_DAC_ROUTE] = {
2225 .type = HDA_FIXUP_FUNC,
2226 .v.func = alc889_fixup_dac_route,
2228 [ALC889_FIXUP_MBP_VREF] = {
2229 .type = HDA_FIXUP_FUNC,
2230 .v.func = alc889_fixup_mbp_vref,
2232 .chain_id = ALC882_FIXUP_GPIO1,
2234 [ALC889_FIXUP_IMAC91_VREF] = {
2235 .type = HDA_FIXUP_FUNC,
2236 .v.func = alc889_fixup_imac91_vref,
2238 .chain_id = ALC882_FIXUP_GPIO1,
2240 [ALC889_FIXUP_MBA11_VREF] = {
2241 .type = HDA_FIXUP_FUNC,
2242 .v.func = alc889_fixup_mba11_vref,
2244 .chain_id = ALC889_FIXUP_MBP_VREF,
2246 [ALC889_FIXUP_MBA21_VREF] = {
2247 .type = HDA_FIXUP_FUNC,
2248 .v.func = alc889_fixup_mba21_vref,
2250 .chain_id = ALC889_FIXUP_MBP_VREF,
2252 [ALC889_FIXUP_MP11_VREF] = {
2253 .type = HDA_FIXUP_FUNC,
2254 .v.func = alc889_fixup_mba11_vref,
2256 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2258 [ALC889_FIXUP_MP41_VREF] = {
2259 .type = HDA_FIXUP_FUNC,
2260 .v.func = alc889_fixup_mbp_vref,
2262 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2264 [ALC882_FIXUP_INV_DMIC] = {
2265 .type = HDA_FIXUP_FUNC,
2266 .v.func = alc_fixup_inv_dmic,
2268 [ALC882_FIXUP_NO_PRIMARY_HP] = {
2269 .type = HDA_FIXUP_FUNC,
2270 .v.func = alc882_fixup_no_primary_hp,
2272 [ALC887_FIXUP_ASUS_BASS] = {
2273 .type = HDA_FIXUP_PINS,
2274 .v.pins = (const struct hda_pintbl[]) {
2275 {0x16, 0x99130130}, /* bass speaker */
2279 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2281 [ALC887_FIXUP_BASS_CHMAP] = {
2282 .type = HDA_FIXUP_FUNC,
2283 .v.func = alc_fixup_bass_chmap,
2285 [ALC1220_FIXUP_GB_DUAL_CODECS] = {
2286 .type = HDA_FIXUP_FUNC,
2287 .v.func = alc1220_fixup_gb_dual_codecs,
2291 static const struct snd_pci_quirk alc882_fixup_tbl[] = {
2292 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2293 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2294 SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2295 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2296 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2297 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2298 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
2299 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2300 ALC882_FIXUP_ACER_ASPIRE_4930G),
2301 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2302 ALC882_FIXUP_ACER_ASPIRE_4930G),
2303 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2304 ALC882_FIXUP_ACER_ASPIRE_8930G),
2305 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2306 ALC882_FIXUP_ACER_ASPIRE_8930G),
2307 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2308 ALC882_FIXUP_ACER_ASPIRE_4930G),
2309 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
2310 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2311 ALC882_FIXUP_ACER_ASPIRE_4930G),
2312 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2313 ALC882_FIXUP_ACER_ASPIRE_4930G),
2314 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2315 ALC882_FIXUP_ACER_ASPIRE_4930G),
2316 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
2317 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
2318 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
2319 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
2320 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
2321 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
2322 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
2323 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
2324 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
2325 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2326 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
2327 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
2328 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
2329 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
2331 /* All Apple entries are in codec SSIDs */
2332 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2333 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2334 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2335 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
2336 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2337 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
2338 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2339 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
2340 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
2341 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
2342 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
2343 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2344 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2345 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
2346 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2347 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2348 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
2349 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
2350 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
2351 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2352 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
2353 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
2355 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
2356 SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
2357 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
2358 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2359 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
2360 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2361 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
2362 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
2363 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2364 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
2365 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
2366 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
2370 static const struct hda_model_fixup alc882_fixup_models[] = {
2371 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2372 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2373 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
2374 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
2375 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
2376 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
2381 * BIOS auto configuration
2383 /* almost identical with ALC880 parser... */
2384 static int alc882_parse_auto_config(struct hda_codec *codec)
2386 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
2387 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2388 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
2393 static int patch_alc882(struct hda_codec *codec)
2395 struct alc_spec *spec;
2398 err = alc_alloc_spec(codec, 0x0b);
2404 switch (codec->core.vendor_id) {
2412 /* ALC883 and variants */
2413 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2417 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
2419 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2421 alc_auto_parse_customize_define(codec);
2423 if (has_cdefine_beep(codec))
2424 spec->gen.beep_nid = 0x01;
2426 /* automatic parse from the BIOS config */
2427 err = alc882_parse_auto_config(codec);
2431 if (!spec->gen.no_analog && spec->gen.beep_nid)
2432 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2434 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2447 static int alc262_parse_auto_config(struct hda_codec *codec)
2449 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
2450 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2451 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
2458 ALC262_FIXUP_FSC_H270,
2459 ALC262_FIXUP_FSC_S7110,
2460 ALC262_FIXUP_HP_Z200,
2462 ALC262_FIXUP_LENOVO_3000,
2464 ALC262_FIXUP_BENQ_T31,
2465 ALC262_FIXUP_INV_DMIC,
2466 ALC262_FIXUP_INTEL_BAYLEYBAY,
2469 static const struct hda_fixup alc262_fixups[] = {
2470 [ALC262_FIXUP_FSC_H270] = {
2471 .type = HDA_FIXUP_PINS,
2472 .v.pins = (const struct hda_pintbl[]) {
2473 { 0x14, 0x99130110 }, /* speaker */
2474 { 0x15, 0x0221142f }, /* front HP */
2475 { 0x1b, 0x0121141f }, /* rear HP */
2479 [ALC262_FIXUP_FSC_S7110] = {
2480 .type = HDA_FIXUP_PINS,
2481 .v.pins = (const struct hda_pintbl[]) {
2482 { 0x15, 0x90170110 }, /* speaker */
2486 .chain_id = ALC262_FIXUP_BENQ,
2488 [ALC262_FIXUP_HP_Z200] = {
2489 .type = HDA_FIXUP_PINS,
2490 .v.pins = (const struct hda_pintbl[]) {
2491 { 0x16, 0x99130120 }, /* internal speaker */
2495 [ALC262_FIXUP_TYAN] = {
2496 .type = HDA_FIXUP_PINS,
2497 .v.pins = (const struct hda_pintbl[]) {
2498 { 0x14, 0x1993e1f0 }, /* int AUX */
2502 [ALC262_FIXUP_LENOVO_3000] = {
2503 .type = HDA_FIXUP_PINCTLS,
2504 .v.pins = (const struct hda_pintbl[]) {
2505 { 0x19, PIN_VREF50 },
2509 .chain_id = ALC262_FIXUP_BENQ,
2511 [ALC262_FIXUP_BENQ] = {
2512 .type = HDA_FIXUP_VERBS,
2513 .v.verbs = (const struct hda_verb[]) {
2514 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2515 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2519 [ALC262_FIXUP_BENQ_T31] = {
2520 .type = HDA_FIXUP_VERBS,
2521 .v.verbs = (const struct hda_verb[]) {
2522 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2523 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2527 [ALC262_FIXUP_INV_DMIC] = {
2528 .type = HDA_FIXUP_FUNC,
2529 .v.func = alc_fixup_inv_dmic,
2531 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2532 .type = HDA_FIXUP_FUNC,
2533 .v.func = alc_fixup_no_depop_delay,
2537 static const struct snd_pci_quirk alc262_fixup_tbl[] = {
2538 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
2539 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
2540 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
2541 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
2542 SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
2543 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
2544 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
2545 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2546 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
2547 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
2551 static const struct hda_model_fixup alc262_fixup_models[] = {
2552 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
2558 static int patch_alc262(struct hda_codec *codec)
2560 struct alc_spec *spec;
2563 err = alc_alloc_spec(codec, 0x0b);
2568 spec->gen.shared_mic_vref_pin = 0x18;
2570 spec->shutup = alc_eapd_shutup;
2573 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2576 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
2578 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2580 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
2582 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2584 alc_auto_parse_customize_define(codec);
2586 if (has_cdefine_beep(codec))
2587 spec->gen.beep_nid = 0x01;
2589 /* automatic parse from the BIOS config */
2590 err = alc262_parse_auto_config(codec);
2594 if (!spec->gen.no_analog && spec->gen.beep_nid)
2595 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2597 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2609 /* bind Beep switches of both NID 0x0f and 0x10 */
2610 static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2611 struct snd_ctl_elem_value *ucontrol)
2613 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2617 mutex_lock(&codec->control_mutex);
2618 pval = kcontrol->private_value;
2619 kcontrol->private_value = (pval & ~0xff) | 0x0f;
2620 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2622 kcontrol->private_value = (pval & ~0xff) | 0x10;
2623 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2625 kcontrol->private_value = pval;
2626 mutex_unlock(&codec->control_mutex);
2630 static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2631 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
2633 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2634 .name = "Beep Playback Switch",
2635 .subdevice = HDA_SUBDEV_AMP_FLAG,
2636 .info = snd_hda_mixer_amp_switch_info,
2637 .get = snd_hda_mixer_amp_switch_get,
2638 .put = alc268_beep_switch_put,
2639 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
2644 /* set PCBEEP vol = 0, mute connections */
2645 static const struct hda_verb alc268_beep_init_verbs[] = {
2646 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2647 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2648 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2653 ALC268_FIXUP_INV_DMIC,
2654 ALC268_FIXUP_HP_EAPD,
2658 static const struct hda_fixup alc268_fixups[] = {
2659 [ALC268_FIXUP_INV_DMIC] = {
2660 .type = HDA_FIXUP_FUNC,
2661 .v.func = alc_fixup_inv_dmic,
2663 [ALC268_FIXUP_HP_EAPD] = {
2664 .type = HDA_FIXUP_VERBS,
2665 .v.verbs = (const struct hda_verb[]) {
2666 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
2670 [ALC268_FIXUP_SPDIF] = {
2671 .type = HDA_FIXUP_PINS,
2672 .v.pins = (const struct hda_pintbl[]) {
2673 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
2679 static const struct hda_model_fixup alc268_fixup_models[] = {
2680 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
2681 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
2685 static const struct snd_pci_quirk alc268_fixup_tbl[] = {
2686 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
2687 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
2688 /* below is codec SSID since multiple Toshiba laptops have the
2689 * same PCI SSID 1179:ff00
2691 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
2696 * BIOS auto configuration
2698 static int alc268_parse_auto_config(struct hda_codec *codec)
2700 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2701 return alc_parse_auto_config(codec, NULL, alc268_ssids);
2706 static int patch_alc268(struct hda_codec *codec)
2708 struct alc_spec *spec;
2711 /* ALC268 has no aa-loopback mixer */
2712 err = alc_alloc_spec(codec, 0);
2717 spec->gen.beep_nid = 0x01;
2719 spec->shutup = alc_eapd_shutup;
2721 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
2722 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2724 /* automatic parse from the BIOS config */
2725 err = alc268_parse_auto_config(codec);
2729 if (err > 0 && !spec->gen.no_analog &&
2730 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
2731 add_mixer(spec, alc268_beep_mixer);
2732 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
2733 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
2734 /* override the amp caps for beep generator */
2735 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
2736 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
2737 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
2738 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
2739 (0 << AC_AMPCAP_MUTE_SHIFT));
2742 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2755 static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
2756 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
2759 static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
2760 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
2763 /* different alc269-variants */
2765 ALC269_TYPE_ALC269VA,
2766 ALC269_TYPE_ALC269VB,
2767 ALC269_TYPE_ALC269VC,
2768 ALC269_TYPE_ALC269VD,
2788 * BIOS auto configuration
2790 static int alc269_parse_auto_config(struct hda_codec *codec)
2792 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
2793 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
2794 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2795 struct alc_spec *spec = codec->spec;
2796 const hda_nid_t *ssids;
2798 switch (spec->codec_variant) {
2799 case ALC269_TYPE_ALC269VA:
2800 case ALC269_TYPE_ALC269VC:
2801 case ALC269_TYPE_ALC280:
2802 case ALC269_TYPE_ALC284:
2803 case ALC269_TYPE_ALC293:
2804 ssids = alc269va_ssids;
2806 case ALC269_TYPE_ALC269VB:
2807 case ALC269_TYPE_ALC269VD:
2808 case ALC269_TYPE_ALC282:
2809 case ALC269_TYPE_ALC283:
2810 case ALC269_TYPE_ALC286:
2811 case ALC269_TYPE_ALC298:
2812 case ALC269_TYPE_ALC255:
2813 case ALC269_TYPE_ALC256:
2814 case ALC269_TYPE_ALC257:
2815 case ALC269_TYPE_ALC215:
2816 case ALC269_TYPE_ALC225:
2817 case ALC269_TYPE_ALC294:
2818 case ALC269_TYPE_ALC300:
2819 case ALC269_TYPE_ALC623:
2820 case ALC269_TYPE_ALC700:
2821 ssids = alc269_ssids;
2824 ssids = alc269_ssids;
2828 return alc_parse_auto_config(codec, alc269_ignore, ssids);
2831 static int find_ext_mic_pin(struct hda_codec *codec);
2833 static void alc286_shutup(struct hda_codec *codec)
2836 int mic_pin = find_ext_mic_pin(codec);
2837 /* don't shut up pins when unloading the driver; otherwise it breaks
2838 * the default pin setup at the next load of the driver
2840 if (codec->bus->shutdown)
2842 for (i = 0; i < codec->init_pins.used; i++) {
2843 struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i);
2844 /* use read here for syncing after issuing each verb */
2845 if (pin->nid != mic_pin)
2846 snd_hda_codec_read(codec, pin->nid, 0,
2847 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
2849 codec->pins_shutup = 1;
2852 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
2854 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
2857 static void alc269_shutup(struct hda_codec *codec)
2859 struct alc_spec *spec = codec->spec;
2861 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
2862 alc269vb_toggle_power_output(codec, 0);
2863 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
2864 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
2867 snd_hda_shutup_pins(codec);
2870 static struct coef_fw alc282_coefs[] = {
2871 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
2872 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
2873 WRITE_COEF(0x07, 0x0200), /* DMIC control */
2874 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
2875 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
2876 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
2877 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
2878 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
2879 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
2880 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
2881 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
2882 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
2883 WRITE_COEF(0x34, 0xa0c0), /* ANC */
2884 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
2885 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
2886 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
2887 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
2888 WRITE_COEF(0x63, 0x2902), /* PLL */
2889 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
2890 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
2891 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
2892 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
2893 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
2894 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
2895 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
2896 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
2897 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
2898 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
2899 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
2903 static void alc282_restore_default_value(struct hda_codec *codec)
2905 alc_process_coef_fw(codec, alc282_coefs);
2908 static void alc282_init(struct hda_codec *codec)
2910 struct alc_spec *spec = codec->spec;
2911 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
2915 alc282_restore_default_value(codec);
2919 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
2920 coef78 = alc_read_coef_idx(codec, 0x78);
2922 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
2923 /* Headphone capless set to high power mode */
2924 alc_write_coef_idx(codec, 0x78, 0x9004);
2929 snd_hda_codec_write(codec, hp_pin, 0,
2930 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
2935 snd_hda_codec_write(codec, hp_pin, 0,
2936 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
2941 /* Headphone capless set to normal mode */
2942 alc_write_coef_idx(codec, 0x78, coef78);
2945 static void alc282_shutup(struct hda_codec *codec)
2947 struct alc_spec *spec = codec->spec;
2948 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
2953 alc269_shutup(codec);
2957 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
2958 coef78 = alc_read_coef_idx(codec, 0x78);
2959 alc_write_coef_idx(codec, 0x78, 0x9004);
2964 snd_hda_codec_write(codec, hp_pin, 0,
2965 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
2970 snd_hda_codec_write(codec, hp_pin, 0,
2971 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
2976 alc_auto_setup_eapd(codec, false);
2977 snd_hda_shutup_pins(codec);
2978 alc_write_coef_idx(codec, 0x78, coef78);
2981 static struct coef_fw alc283_coefs[] = {
2982 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
2983 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
2984 WRITE_COEF(0x07, 0x0200), /* DMIC control */
2985 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
2986 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
2987 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
2988 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
2989 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
2990 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
2991 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
2992 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
2993 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
2994 WRITE_COEF(0x22, 0xa0c0), /* ANC */
2995 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
2996 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
2997 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
2998 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
2999 WRITE_COEF(0x2e, 0x2902), /* PLL */
3000 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3001 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3002 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3003 WRITE_COEF(0x36, 0x0), /* capless control 5 */
3004 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3005 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3006 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3007 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3008 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3009 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3010 WRITE_COEF(0x49, 0x0), /* test mode */
3011 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3012 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3013 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
3014 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
3018 static void alc283_restore_default_value(struct hda_codec *codec)
3020 alc_process_coef_fw(codec, alc283_coefs);
3023 static void alc283_init(struct hda_codec *codec)
3025 struct alc_spec *spec = codec->spec;
3026 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3029 if (!spec->gen.autocfg.hp_outs) {
3030 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
3031 hp_pin = spec->gen.autocfg.line_out_pins[0];
3034 alc283_restore_default_value(codec);
3040 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3042 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3043 /* Headphone capless set to high power mode */
3044 alc_write_coef_idx(codec, 0x43, 0x9004);
3046 snd_hda_codec_write(codec, hp_pin, 0,
3047 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3052 snd_hda_codec_write(codec, hp_pin, 0,
3053 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3057 /* Index 0x46 Combo jack auto switch control 2 */
3058 /* 3k pull low control for Headset jack. */
3059 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3060 /* Headphone capless set to normal mode */
3061 alc_write_coef_idx(codec, 0x43, 0x9614);
3064 static void alc283_shutup(struct hda_codec *codec)
3066 struct alc_spec *spec = codec->spec;
3067 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3070 if (!spec->gen.autocfg.hp_outs) {
3071 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
3072 hp_pin = spec->gen.autocfg.line_out_pins[0];
3076 alc269_shutup(codec);
3080 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3082 alc_write_coef_idx(codec, 0x43, 0x9004);
3084 /*depop hp during suspend*/
3085 alc_write_coef_idx(codec, 0x06, 0x2100);
3087 snd_hda_codec_write(codec, hp_pin, 0,
3088 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3093 snd_hda_codec_write(codec, hp_pin, 0,
3094 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3096 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3100 alc_auto_setup_eapd(codec, false);
3101 snd_hda_shutup_pins(codec);
3102 alc_write_coef_idx(codec, 0x43, 0x9614);
3105 static void alc256_init(struct hda_codec *codec)
3107 struct alc_spec *spec = codec->spec;
3108 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3116 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3121 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3123 snd_hda_codec_write(codec, hp_pin, 0,
3124 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3129 snd_hda_codec_write(codec, hp_pin, 0,
3130 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3135 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3136 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3137 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3138 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
3140 * Expose headphone mic (or possibly Line In on some machines) instead
3141 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3142 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3145 alc_write_coef_idx(codec, 0x36, 0x5757);
3148 static void alc256_shutup(struct hda_codec *codec)
3150 struct alc_spec *spec = codec->spec;
3151 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3155 alc269_shutup(codec);
3159 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3164 snd_hda_codec_write(codec, hp_pin, 0,
3165 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3170 /* 3k pull low control for Headset jack. */
3171 /* NOTE: call this before clearing the pin, otherwise codec stalls */
3172 /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
3173 * when booting with headset plugged. So skip setting it for the codec alc257
3175 if (codec->core.vendor_id != 0x10ec0257)
3176 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3178 snd_hda_codec_write(codec, hp_pin, 0,
3179 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3184 alc_auto_setup_eapd(codec, false);
3185 snd_hda_shutup_pins(codec);
3188 static void alc_default_init(struct hda_codec *codec)
3190 struct alc_spec *spec = codec->spec;
3191 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3199 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3204 snd_hda_codec_write(codec, hp_pin, 0,
3205 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3210 snd_hda_codec_write(codec, hp_pin, 0,
3211 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3217 static void alc_default_shutup(struct hda_codec *codec)
3219 struct alc_spec *spec = codec->spec;
3220 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3224 alc269_shutup(codec);
3228 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3233 snd_hda_codec_write(codec, hp_pin, 0,
3234 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3239 snd_hda_codec_write(codec, hp_pin, 0,
3240 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3245 alc_auto_setup_eapd(codec, false);
3246 snd_hda_shutup_pins(codec);
3249 static void alc294_hp_init(struct hda_codec *codec)
3251 struct alc_spec *spec = codec->spec;
3252 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3258 snd_hda_codec_write(codec, hp_pin, 0,
3259 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3263 snd_hda_codec_write(codec, hp_pin, 0,
3264 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3266 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3267 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3269 /* Wait for depop procedure finish */
3270 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3271 for (i = 0; i < 20 && val & 0x0080; i++) {
3273 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3275 /* Set HP depop to auto mode */
3276 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3280 static void alc294_init(struct hda_codec *codec)
3282 struct alc_spec *spec = codec->spec;
3284 /* required only at boot or S4 resume time */
3285 if (!spec->done_hp_init ||
3286 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
3287 alc294_hp_init(codec);
3288 spec->done_hp_init = true;
3290 alc_default_init(codec);
3293 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3296 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3297 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3298 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3301 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3305 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3306 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3308 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3313 static void alc5505_dsp_halt(struct hda_codec *codec)
3317 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3318 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3319 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3320 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3321 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3322 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3323 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3324 val = alc5505_coef_get(codec, 0x6220);
3325 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3328 static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3330 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3331 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3332 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3333 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3334 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3335 alc5505_coef_set(codec, 0x880c, 0x00000004);
3338 static void alc5505_dsp_init(struct hda_codec *codec)
3342 alc5505_dsp_halt(codec);
3343 alc5505_dsp_back_from_halt(codec);
3344 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3345 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3346 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3347 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3348 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3349 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3350 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3351 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3352 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3353 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3354 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3355 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3356 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3358 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3360 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3362 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3364 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3365 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3366 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3367 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3368 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3369 alc5505_coef_set(codec, 0x880c, 0x00000003);
3370 alc5505_coef_set(codec, 0x880c, 0x00000010);
3372 #ifdef HALT_REALTEK_ALC5505
3373 alc5505_dsp_halt(codec);
3377 #ifdef HALT_REALTEK_ALC5505
3378 #define alc5505_dsp_suspend(codec) /* NOP */
3379 #define alc5505_dsp_resume(codec) /* NOP */
3381 #define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
3382 #define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
3386 static int alc269_suspend(struct hda_codec *codec)
3388 struct alc_spec *spec = codec->spec;
3390 if (spec->has_alc5505_dsp)
3391 alc5505_dsp_suspend(codec);
3392 return alc_suspend(codec);
3395 static int alc269_resume(struct hda_codec *codec)
3397 struct alc_spec *spec = codec->spec;
3399 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3400 alc269vb_toggle_power_output(codec, 0);
3401 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3402 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
3406 codec->patch_ops.init(codec);
3408 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3409 alc269vb_toggle_power_output(codec, 1);
3410 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3411 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
3415 regcache_sync(codec->core.regmap);
3416 hda_call_check_power_status(codec, 0x01);
3418 /* on some machine, the BIOS will clear the codec gpio data when enter
3419 * suspend, and won't restore the data after resume, so we restore it
3423 snd_hda_codec_write(codec, codec->core.afg, 0, AC_VERB_SET_GPIO_DATA,
3426 if (spec->has_alc5505_dsp)
3427 alc5505_dsp_resume(codec);
3431 #endif /* CONFIG_PM */
3433 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
3434 const struct hda_fixup *fix, int action)
3436 struct alc_spec *spec = codec->spec;
3438 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3439 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
3442 static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
3443 const struct hda_fixup *fix,
3446 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
3447 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
3449 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
3450 snd_hda_codec_set_pincfg(codec, 0x19,
3451 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
3452 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
3455 static void alc269_fixup_hweq(struct hda_codec *codec,
3456 const struct hda_fixup *fix, int action)
3458 if (action == HDA_FIXUP_ACT_INIT)
3459 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
3462 static void alc269_fixup_headset_mic(struct hda_codec *codec,
3463 const struct hda_fixup *fix, int action)
3465 struct alc_spec *spec = codec->spec;
3467 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3468 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3471 static void alc271_fixup_dmic(struct hda_codec *codec,
3472 const struct hda_fixup *fix, int action)
3474 static const struct hda_verb verbs[] = {
3475 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
3476 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
3481 if (strcmp(codec->core.chip_name, "ALC271X") &&
3482 strcmp(codec->core.chip_name, "ALC269VB"))
3484 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
3485 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
3486 snd_hda_sequence_write(codec, verbs);
3489 static void alc269_fixup_pcm_44k(struct hda_codec *codec,
3490 const struct hda_fixup *fix, int action)
3492 struct alc_spec *spec = codec->spec;
3494 if (action != HDA_FIXUP_ACT_PROBE)
3497 /* Due to a hardware problem on Lenovo Ideadpad, we need to
3498 * fix the sample rate of analog I/O to 44.1kHz
3500 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
3501 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
3504 static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
3505 const struct hda_fixup *fix, int action)
3507 /* The digital-mic unit sends PDM (differential signal) instead of
3508 * the standard PCM, thus you can't record a valid mono stream as is.
3509 * Below is a workaround specific to ALC269 to control the dmic
3510 * signal source as mono.
3512 if (action == HDA_FIXUP_ACT_INIT)
3513 alc_update_coef_idx(codec, 0x07, 0, 0x80);
3516 static void alc269_quanta_automute(struct hda_codec *codec)
3518 snd_hda_gen_update_outputs(codec);
3520 alc_write_coef_idx(codec, 0x0c, 0x680);
3521 alc_write_coef_idx(codec, 0x0c, 0x480);
3524 static void alc269_fixup_quanta_mute(struct hda_codec *codec,
3525 const struct hda_fixup *fix, int action)
3527 struct alc_spec *spec = codec->spec;
3528 if (action != HDA_FIXUP_ACT_PROBE)
3530 spec->gen.automute_hook = alc269_quanta_automute;
3533 static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
3534 struct hda_jack_callback *jack)
3536 struct alc_spec *spec = codec->spec;
3539 snd_hda_gen_hp_automute(codec, jack);
3541 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
3543 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3546 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3550 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
3551 const struct hda_fixup *fix, int action)
3553 struct alc_spec *spec = codec->spec;
3554 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3555 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3556 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
3561 /* update mute-LED according to the speaker mute state via mic VREF pin */
3562 static void alc269_fixup_mic_mute_hook(void *private_data, int enabled)
3564 struct hda_codec *codec = private_data;
3565 struct alc_spec *spec = codec->spec;
3566 unsigned int pinval;
3568 if (spec->mute_led_polarity)
3570 pinval = snd_hda_codec_get_pin_target(codec, spec->mute_led_nid);
3571 pinval &= ~AC_PINCTL_VREFEN;
3572 pinval |= enabled ? AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80;
3573 if (spec->mute_led_nid) {
3574 /* temporarily power up/down for setting VREF */
3575 snd_hda_power_up_pm(codec);
3576 snd_hda_set_pin_ctl_cache(codec, spec->mute_led_nid, pinval);
3577 snd_hda_power_down_pm(codec);
3581 /* Make sure the led works even in runtime suspend */
3582 static unsigned int led_power_filter(struct hda_codec *codec,
3584 unsigned int power_state)
3586 struct alc_spec *spec = codec->spec;
3588 if (power_state != AC_PWRST_D3 || nid == 0 ||
3589 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
3592 /* Set pin ctl again, it might have just been set to 0 */
3593 snd_hda_set_pin_ctl(codec, nid,
3594 snd_hda_codec_get_pin_target(codec, nid));
3596 return snd_hda_gen_path_power_filter(codec, nid, power_state);
3599 static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
3600 const struct hda_fixup *fix, int action)
3602 struct alc_spec *spec = codec->spec;
3603 const struct dmi_device *dev = NULL;
3605 if (action != HDA_FIXUP_ACT_PRE_PROBE)
3608 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
3610 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
3612 if (pin < 0x0a || pin >= 0x10)
3614 spec->mute_led_polarity = pol;
3615 spec->mute_led_nid = pin - 0x0a + 0x18;
3616 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3617 spec->gen.vmaster_mute_enum = 1;
3618 codec->power_filter = led_power_filter;
3620 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
3621 spec->mute_led_polarity);
3626 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
3627 const struct hda_fixup *fix, int action)
3629 struct alc_spec *spec = codec->spec;
3630 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3631 spec->mute_led_polarity = 0;
3632 spec->mute_led_nid = 0x18;
3633 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3634 spec->gen.vmaster_mute_enum = 1;
3635 codec->power_filter = led_power_filter;
3639 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
3640 const struct hda_fixup *fix, int action)
3642 struct alc_spec *spec = codec->spec;
3643 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3644 spec->mute_led_polarity = 0;
3645 spec->mute_led_nid = 0x19;
3646 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3647 spec->gen.vmaster_mute_enum = 1;
3648 codec->power_filter = led_power_filter;
3652 static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
3653 const struct hda_fixup *fix, int action)
3655 struct alc_spec *spec = codec->spec;
3656 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3657 spec->mute_led_polarity = 0;
3658 spec->mute_led_nid = 0x1b;
3659 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3660 spec->gen.vmaster_mute_enum = 1;
3661 codec->power_filter = led_power_filter;
3665 /* update LED status via GPIO */
3666 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
3669 struct alc_spec *spec = codec->spec;
3670 unsigned int oldval = spec->gpio_led;
3672 if (spec->mute_led_polarity)
3676 spec->gpio_led &= ~mask;
3678 spec->gpio_led |= mask;
3679 if (spec->gpio_led != oldval)
3680 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
3684 /* turn on/off mute LED via GPIO per vmaster hook */
3685 static void alc_fixup_gpio_mute_hook(void *private_data, int enabled)
3687 struct hda_codec *codec = private_data;
3688 struct alc_spec *spec = codec->spec;
3690 alc_update_gpio_led(codec, spec->gpio_mute_led_mask, enabled);
3693 /* turn on/off mic-mute LED via GPIO per capture hook */
3694 static void alc_fixup_gpio_mic_mute_hook(struct hda_codec *codec,
3695 struct snd_kcontrol *kcontrol,
3696 struct snd_ctl_elem_value *ucontrol)
3698 struct alc_spec *spec = codec->spec;
3701 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
3702 ucontrol->value.integer.value[0] ||
3703 ucontrol->value.integer.value[1]);
3706 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
3707 const struct hda_fixup *fix, int action)
3709 struct alc_spec *spec = codec->spec;
3710 static const struct hda_verb gpio_init[] = {
3711 { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 },
3712 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 },
3716 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3717 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
3718 spec->gen.cap_sync_hook = alc_fixup_gpio_mic_mute_hook;
3720 spec->mute_led_polarity = 0;
3721 spec->gpio_mute_led_mask = 0x08;
3722 spec->gpio_mic_led_mask = 0x10;
3723 snd_hda_add_verbs(codec, gpio_init);
3727 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
3728 const struct hda_fixup *fix, int action)
3730 struct alc_spec *spec = codec->spec;
3731 static const struct hda_verb gpio_init[] = {
3732 { 0x01, AC_VERB_SET_GPIO_MASK, 0x22 },
3733 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x22 },
3737 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3738 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
3739 spec->gen.cap_sync_hook = alc_fixup_gpio_mic_mute_hook;
3741 spec->mute_led_polarity = 0;
3742 spec->gpio_mute_led_mask = 0x02;
3743 spec->gpio_mic_led_mask = 0x20;
3744 snd_hda_add_verbs(codec, gpio_init);
3748 /* turn on/off mic-mute LED per capture hook */
3749 static void alc269_fixup_hp_cap_mic_mute_hook(struct hda_codec *codec,
3750 struct snd_kcontrol *kcontrol,
3751 struct snd_ctl_elem_value *ucontrol)
3753 struct alc_spec *spec = codec->spec;
3754 unsigned int pinval, enable, disable;
3756 pinval = snd_hda_codec_get_pin_target(codec, spec->cap_mute_led_nid);
3757 pinval &= ~AC_PINCTL_VREFEN;
3758 enable = pinval | AC_PINCTL_VREF_80;
3759 disable = pinval | AC_PINCTL_VREF_HIZ;
3764 if (ucontrol->value.integer.value[0] ||
3765 ucontrol->value.integer.value[1])
3770 if (spec->cap_mute_led_nid)
3771 snd_hda_set_pin_ctl_cache(codec, spec->cap_mute_led_nid, pinval);
3774 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
3775 const struct hda_fixup *fix, int action)
3777 struct alc_spec *spec = codec->spec;
3778 static const struct hda_verb gpio_init[] = {
3779 { 0x01, AC_VERB_SET_GPIO_MASK, 0x08 },
3780 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x08 },
3784 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3785 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
3786 spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook;
3788 spec->mute_led_polarity = 0;
3789 spec->gpio_mute_led_mask = 0x08;
3790 spec->cap_mute_led_nid = 0x18;
3791 snd_hda_add_verbs(codec, gpio_init);
3792 codec->power_filter = led_power_filter;
3796 static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
3797 const struct hda_fixup *fix, int action)
3799 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to enable headphone amp */
3800 struct alc_spec *spec = codec->spec;
3801 static const struct hda_verb gpio_init[] = {
3802 { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 },
3803 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 },
3807 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3808 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
3809 spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook;
3811 spec->mute_led_polarity = 0;
3812 spec->gpio_mute_led_mask = 0x08;
3813 spec->cap_mute_led_nid = 0x18;
3814 snd_hda_add_verbs(codec, gpio_init);
3815 codec->power_filter = led_power_filter;
3819 #if IS_REACHABLE(CONFIG_INPUT)
3820 static void gpio2_mic_hotkey_event(struct hda_codec *codec,
3821 struct hda_jack_callback *event)
3823 struct alc_spec *spec = codec->spec;
3825 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
3826 send both key on and key off event for every interrupt. */
3827 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
3828 input_sync(spec->kb_dev);
3829 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
3830 input_sync(spec->kb_dev);
3833 static int alc_register_micmute_input_device(struct hda_codec *codec)
3835 struct alc_spec *spec = codec->spec;
3838 spec->kb_dev = input_allocate_device();
3839 if (!spec->kb_dev) {
3840 codec_err(codec, "Out of memory (input_allocate_device)\n");
3844 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
3846 spec->kb_dev->name = "Microphone Mute Button";
3847 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
3848 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
3849 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
3850 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
3851 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
3852 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
3854 if (input_register_device(spec->kb_dev)) {
3855 codec_err(codec, "input_register_device failed\n");
3856 input_free_device(spec->kb_dev);
3857 spec->kb_dev = NULL;
3864 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
3865 const struct hda_fixup *fix, int action)
3867 /* GPIO1 = set according to SKU external amp
3868 GPIO2 = mic mute hotkey
3870 GPIO4 = mic mute LED */
3871 static const struct hda_verb gpio_init[] = {
3872 { 0x01, AC_VERB_SET_GPIO_MASK, 0x1e },
3873 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x1a },
3874 { 0x01, AC_VERB_SET_GPIO_DATA, 0x02 },
3878 struct alc_spec *spec = codec->spec;
3880 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3881 if (alc_register_micmute_input_device(codec) != 0)
3884 snd_hda_add_verbs(codec, gpio_init);
3885 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
3886 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
3887 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
3888 gpio2_mic_hotkey_event);
3890 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
3891 spec->gen.cap_sync_hook = alc_fixup_gpio_mic_mute_hook;
3893 spec->mute_led_polarity = 0;
3894 spec->gpio_mute_led_mask = 0x08;
3895 spec->gpio_mic_led_mask = 0x10;
3903 case HDA_FIXUP_ACT_PROBE:
3904 spec->init_amp = ALC_INIT_DEFAULT;
3906 case HDA_FIXUP_ACT_FREE:
3907 input_unregister_device(spec->kb_dev);
3908 spec->kb_dev = NULL;
3912 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
3913 const struct hda_fixup *fix, int action)
3915 /* Line2 = mic mute hotkey
3916 GPIO2 = mic mute LED */
3917 static const struct hda_verb gpio_init[] = {
3918 { 0x01, AC_VERB_SET_GPIO_MASK, 0x04 },
3919 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04 },
3923 struct alc_spec *spec = codec->spec;
3925 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3926 if (alc_register_micmute_input_device(codec) != 0)
3929 snd_hda_add_verbs(codec, gpio_init);
3930 snd_hda_jack_detect_enable_callback(codec, 0x1b,
3931 gpio2_mic_hotkey_event);
3933 spec->gen.cap_sync_hook = alc_fixup_gpio_mic_mute_hook;
3935 spec->mute_led_polarity = 0;
3936 spec->gpio_mic_led_mask = 0x04;
3944 case HDA_FIXUP_ACT_PROBE:
3945 spec->init_amp = ALC_INIT_DEFAULT;
3947 case HDA_FIXUP_ACT_FREE:
3948 input_unregister_device(spec->kb_dev);
3949 spec->kb_dev = NULL;
3953 #define alc280_fixup_hp_gpio2_mic_hotkey NULL
3954 #define alc233_fixup_lenovo_line2_mic_hotkey NULL
3957 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
3958 const struct hda_fixup *fix, int action)
3960 struct alc_spec *spec = codec->spec;
3962 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3963 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3964 spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook;
3965 spec->mute_led_polarity = 0;
3966 spec->mute_led_nid = 0x1a;
3967 spec->cap_mute_led_nid = 0x18;
3968 spec->gen.vmaster_mute_enum = 1;
3969 codec->power_filter = led_power_filter;
3973 static struct coef_fw alc225_pre_hsmode[] = {
3974 UPDATE_COEF(0x4a, 1<<8, 0),
3975 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
3976 UPDATE_COEF(0x63, 3<<14, 3<<14),
3977 UPDATE_COEF(0x4a, 3<<4, 2<<4),
3978 UPDATE_COEF(0x4a, 3<<10, 3<<10),
3979 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
3980 UPDATE_COEF(0x4a, 3<<10, 0),
3984 static void alc_headset_mode_unplugged(struct hda_codec *codec)
3986 static struct coef_fw coef0255[] = {
3987 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
3988 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
3989 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
3990 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
3991 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
3994 static struct coef_fw coef0256[] = {
3995 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
3996 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
3997 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
3998 WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
3999 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4002 static struct coef_fw coef0233[] = {
4003 WRITE_COEF(0x1b, 0x0c0b),
4004 WRITE_COEF(0x45, 0xc429),
4005 UPDATE_COEF(0x35, 0x4000, 0),
4006 WRITE_COEF(0x06, 0x2104),
4007 WRITE_COEF(0x1a, 0x0001),
4008 WRITE_COEF(0x26, 0x0004),
4009 WRITE_COEF(0x32, 0x42a3),
4012 static struct coef_fw coef0288[] = {
4013 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4014 UPDATE_COEF(0x50, 0x2000, 0x2000),
4015 UPDATE_COEF(0x56, 0x0006, 0x0006),
4016 UPDATE_COEF(0x66, 0x0008, 0),
4017 UPDATE_COEF(0x67, 0x2000, 0),
4020 static struct coef_fw coef0298[] = {
4021 UPDATE_COEF(0x19, 0x1300, 0x0300),
4024 static struct coef_fw coef0292[] = {
4025 WRITE_COEF(0x76, 0x000e),
4026 WRITE_COEF(0x6c, 0x2400),
4027 WRITE_COEF(0x18, 0x7308),
4028 WRITE_COEF(0x6b, 0xc429),
4031 static struct coef_fw coef0293[] = {
4032 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
4033 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
4034 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
4035 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
4036 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
4037 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4040 static struct coef_fw coef0668[] = {
4041 WRITE_COEF(0x15, 0x0d40),
4042 WRITE_COEF(0xb7, 0x802b),
4045 static struct coef_fw coef0225[] = {
4046 UPDATE_COEF(0x63, 3<<14, 0),
4049 static struct coef_fw coef0274[] = {
4050 UPDATE_COEF(0x4a, 0x0100, 0),
4051 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
4052 UPDATE_COEF(0x6b, 0xf000, 0x5000),
4053 UPDATE_COEF(0x4a, 0x0010, 0),
4054 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
4055 WRITE_COEF(0x45, 0x5289),
4056 UPDATE_COEF(0x4a, 0x0c00, 0),
4060 switch (codec->core.vendor_id) {
4062 alc_process_coef_fw(codec, coef0255);
4066 alc_process_coef_fw(codec, coef0256);
4071 alc_process_coef_fw(codec, coef0274);
4075 alc_process_coef_fw(codec, coef0233);
4079 alc_process_coef_fw(codec, coef0288);
4082 alc_process_coef_fw(codec, coef0298);
4083 alc_process_coef_fw(codec, coef0288);
4086 alc_process_coef_fw(codec, coef0292);
4089 alc_process_coef_fw(codec, coef0293);
4092 alc_process_coef_fw(codec, coef0668);
4097 alc_process_coef_fw(codec, alc225_pre_hsmode);
4098 alc_process_coef_fw(codec, coef0225);
4101 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4104 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
4108 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
4111 static struct coef_fw coef0255[] = {
4112 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
4113 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4116 static struct coef_fw coef0256[] = {
4117 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
4118 WRITE_COEFEX(0x57, 0x03, 0x09a3),
4119 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4122 static struct coef_fw coef0233[] = {
4123 UPDATE_COEF(0x35, 0, 1<<14),
4124 WRITE_COEF(0x06, 0x2100),
4125 WRITE_COEF(0x1a, 0x0021),
4126 WRITE_COEF(0x26, 0x008c),
4129 static struct coef_fw coef0288[] = {
4130 UPDATE_COEF(0x4f, 0x00c0, 0),
4131 UPDATE_COEF(0x50, 0x2000, 0),
4132 UPDATE_COEF(0x56, 0x0006, 0),
4133 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4134 UPDATE_COEF(0x66, 0x0008, 0x0008),
4135 UPDATE_COEF(0x67, 0x2000, 0x2000),
4138 static struct coef_fw coef0292[] = {
4139 WRITE_COEF(0x19, 0xa208),
4140 WRITE_COEF(0x2e, 0xacf0),
4143 static struct coef_fw coef0293[] = {
4144 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
4145 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
4146 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4149 static struct coef_fw coef0688[] = {
4150 WRITE_COEF(0xb7, 0x802b),
4151 WRITE_COEF(0xb5, 0x1040),
4152 UPDATE_COEF(0xc3, 0, 1<<12),
4155 static struct coef_fw coef0225[] = {
4156 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
4157 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4158 UPDATE_COEF(0x63, 3<<14, 0),
4161 static struct coef_fw coef0274[] = {
4162 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
4163 UPDATE_COEF(0x4a, 0x0010, 0),
4164 UPDATE_COEF(0x6b, 0xf000, 0),
4168 switch (codec->core.vendor_id) {
4170 alc_write_coef_idx(codec, 0x45, 0xc489);
4171 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4172 alc_process_coef_fw(codec, coef0255);
4173 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4177 alc_write_coef_idx(codec, 0x45, 0xc489);
4178 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4179 alc_process_coef_fw(codec, coef0256);
4180 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4185 alc_write_coef_idx(codec, 0x45, 0x4689);
4186 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4187 alc_process_coef_fw(codec, coef0274);
4188 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4192 alc_write_coef_idx(codec, 0x45, 0xc429);
4193 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4194 alc_process_coef_fw(codec, coef0233);
4195 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4200 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4201 alc_process_coef_fw(codec, coef0288);
4202 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4205 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4206 alc_process_coef_fw(codec, coef0292);
4209 /* Set to TRS mode */
4210 alc_write_coef_idx(codec, 0x45, 0xc429);
4211 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4212 alc_process_coef_fw(codec, coef0293);
4213 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4216 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
4220 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4221 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4224 alc_write_coef_idx(codec, 0x11, 0x0001);
4225 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4226 alc_process_coef_fw(codec, coef0688);
4227 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4232 alc_process_coef_fw(codec, alc225_pre_hsmode);
4233 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
4234 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4235 alc_process_coef_fw(codec, coef0225);
4236 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4239 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
4242 static void alc_headset_mode_default(struct hda_codec *codec)
4244 static struct coef_fw coef0225[] = {
4245 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
4246 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
4247 UPDATE_COEF(0x49, 3<<8, 0<<8),
4248 UPDATE_COEF(0x4a, 3<<4, 3<<4),
4249 UPDATE_COEF(0x63, 3<<14, 0),
4250 UPDATE_COEF(0x67, 0xf000, 0x3000),
4253 static struct coef_fw coef0255[] = {
4254 WRITE_COEF(0x45, 0xc089),
4255 WRITE_COEF(0x45, 0xc489),
4256 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4257 WRITE_COEF(0x49, 0x0049),
4260 static struct coef_fw coef0256[] = {
4261 WRITE_COEF(0x45, 0xc489),
4262 WRITE_COEFEX(0x57, 0x03, 0x0da3),
4263 WRITE_COEF(0x49, 0x0049),
4264 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4265 WRITE_COEF(0x06, 0x6100),
4268 static struct coef_fw coef0233[] = {
4269 WRITE_COEF(0x06, 0x2100),
4270 WRITE_COEF(0x32, 0x4ea3),
4273 static struct coef_fw coef0288[] = {
4274 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
4275 UPDATE_COEF(0x50, 0x2000, 0x2000),
4276 UPDATE_COEF(0x56, 0x0006, 0x0006),
4277 UPDATE_COEF(0x66, 0x0008, 0),
4278 UPDATE_COEF(0x67, 0x2000, 0),
4281 static struct coef_fw coef0292[] = {
4282 WRITE_COEF(0x76, 0x000e),
4283 WRITE_COEF(0x6c, 0x2400),
4284 WRITE_COEF(0x6b, 0xc429),
4285 WRITE_COEF(0x18, 0x7308),
4288 static struct coef_fw coef0293[] = {
4289 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4290 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
4291 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4294 static struct coef_fw coef0688[] = {
4295 WRITE_COEF(0x11, 0x0041),
4296 WRITE_COEF(0x15, 0x0d40),
4297 WRITE_COEF(0xb7, 0x802b),
4300 static struct coef_fw coef0274[] = {
4301 WRITE_COEF(0x45, 0x4289),
4302 UPDATE_COEF(0x4a, 0x0010, 0x0010),
4303 UPDATE_COEF(0x6b, 0x0f00, 0),
4304 UPDATE_COEF(0x49, 0x0300, 0x0300),
4308 switch (codec->core.vendor_id) {
4312 alc_process_coef_fw(codec, alc225_pre_hsmode);
4313 alc_process_coef_fw(codec, coef0225);
4316 alc_process_coef_fw(codec, coef0255);
4320 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
4321 alc_write_coef_idx(codec, 0x45, 0xc089);
4323 alc_process_coef_fw(codec, coef0256);
4328 alc_process_coef_fw(codec, coef0274);
4332 alc_process_coef_fw(codec, coef0233);
4337 alc_process_coef_fw(codec, coef0288);
4340 alc_process_coef_fw(codec, coef0292);
4343 alc_process_coef_fw(codec, coef0293);
4346 alc_process_coef_fw(codec, coef0688);
4349 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4352 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
4356 static void alc_headset_mode_ctia(struct hda_codec *codec)
4360 static struct coef_fw coef0255[] = {
4361 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
4362 WRITE_COEF(0x1b, 0x0c2b),
4363 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4366 static struct coef_fw coef0256[] = {
4367 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
4368 WRITE_COEF(0x1b, 0x0e6b),
4371 static struct coef_fw coef0233[] = {
4372 WRITE_COEF(0x45, 0xd429),
4373 WRITE_COEF(0x1b, 0x0c2b),
4374 WRITE_COEF(0x32, 0x4ea3),
4377 static struct coef_fw coef0288[] = {
4378 UPDATE_COEF(0x50, 0x2000, 0x2000),
4379 UPDATE_COEF(0x56, 0x0006, 0x0006),
4380 UPDATE_COEF(0x66, 0x0008, 0),
4381 UPDATE_COEF(0x67, 0x2000, 0),
4384 static struct coef_fw coef0292[] = {
4385 WRITE_COEF(0x6b, 0xd429),
4386 WRITE_COEF(0x76, 0x0008),
4387 WRITE_COEF(0x18, 0x7388),
4390 static struct coef_fw coef0293[] = {
4391 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
4392 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
4395 static struct coef_fw coef0688[] = {
4396 WRITE_COEF(0x11, 0x0001),
4397 WRITE_COEF(0x15, 0x0d60),
4398 WRITE_COEF(0xc3, 0x0000),
4401 static struct coef_fw coef0225_1[] = {
4402 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
4403 UPDATE_COEF(0x63, 3<<14, 2<<14),
4406 static struct coef_fw coef0225_2[] = {
4407 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
4408 UPDATE_COEF(0x63, 3<<14, 1<<14),
4412 switch (codec->core.vendor_id) {
4414 alc_process_coef_fw(codec, coef0255);
4418 alc_process_coef_fw(codec, coef0256);
4423 alc_write_coef_idx(codec, 0x45, 0xd689);
4427 alc_process_coef_fw(codec, coef0233);
4430 val = alc_read_coef_idx(codec, 0x50);
4431 if (val & (1 << 12)) {
4432 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
4433 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4436 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
4437 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4443 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4445 alc_process_coef_fw(codec, coef0288);
4448 alc_process_coef_fw(codec, coef0292);
4451 alc_process_coef_fw(codec, coef0293);
4454 alc_process_coef_fw(codec, coef0688);
4459 val = alc_read_coef_idx(codec, 0x45);
4461 alc_process_coef_fw(codec, coef0225_2);
4463 alc_process_coef_fw(codec, coef0225_1);
4466 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4469 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
4473 static void alc_headset_mode_omtp(struct hda_codec *codec)
4475 static struct coef_fw coef0255[] = {
4476 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
4477 WRITE_COEF(0x1b, 0x0c2b),
4478 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4481 static struct coef_fw coef0256[] = {
4482 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
4483 WRITE_COEF(0x1b, 0x0e6b),
4486 static struct coef_fw coef0233[] = {
4487 WRITE_COEF(0x45, 0xe429),
4488 WRITE_COEF(0x1b, 0x0c2b),
4489 WRITE_COEF(0x32, 0x4ea3),
4492 static struct coef_fw coef0288[] = {
4493 UPDATE_COEF(0x50, 0x2000, 0x2000),
4494 UPDATE_COEF(0x56, 0x0006, 0x0006),
4495 UPDATE_COEF(0x66, 0x0008, 0),
4496 UPDATE_COEF(0x67, 0x2000, 0),
4499 static struct coef_fw coef0292[] = {
4500 WRITE_COEF(0x6b, 0xe429),
4501 WRITE_COEF(0x76, 0x0008),
4502 WRITE_COEF(0x18, 0x7388),
4505 static struct coef_fw coef0293[] = {
4506 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
4507 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
4510 static struct coef_fw coef0688[] = {
4511 WRITE_COEF(0x11, 0x0001),
4512 WRITE_COEF(0x15, 0x0d50),
4513 WRITE_COEF(0xc3, 0x0000),
4516 static struct coef_fw coef0225[] = {
4517 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
4518 UPDATE_COEF(0x63, 3<<14, 2<<14),
4522 switch (codec->core.vendor_id) {
4524 alc_process_coef_fw(codec, coef0255);
4528 alc_process_coef_fw(codec, coef0256);
4533 alc_write_coef_idx(codec, 0x45, 0xe689);
4537 alc_process_coef_fw(codec, coef0233);
4540 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
4541 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
4546 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
4548 alc_process_coef_fw(codec, coef0288);
4551 alc_process_coef_fw(codec, coef0292);
4554 alc_process_coef_fw(codec, coef0293);
4557 alc_process_coef_fw(codec, coef0688);
4562 alc_process_coef_fw(codec, coef0225);
4565 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
4568 static void alc_determine_headset_type(struct hda_codec *codec)
4571 bool is_ctia = false;
4572 struct alc_spec *spec = codec->spec;
4573 static struct coef_fw coef0255[] = {
4574 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
4575 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
4579 static struct coef_fw coef0288[] = {
4580 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
4583 static struct coef_fw coef0298[] = {
4584 UPDATE_COEF(0x50, 0x2000, 0x2000),
4585 UPDATE_COEF(0x56, 0x0006, 0x0006),
4586 UPDATE_COEF(0x66, 0x0008, 0),
4587 UPDATE_COEF(0x67, 0x2000, 0),
4588 UPDATE_COEF(0x19, 0x1300, 0x1300),
4591 static struct coef_fw coef0293[] = {
4592 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
4593 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
4596 static struct coef_fw coef0688[] = {
4597 WRITE_COEF(0x11, 0x0001),
4598 WRITE_COEF(0xb7, 0x802b),
4599 WRITE_COEF(0x15, 0x0d60),
4600 WRITE_COEF(0xc3, 0x0c00),
4603 static struct coef_fw coef0274[] = {
4604 UPDATE_COEF(0x4a, 0x0010, 0),
4605 UPDATE_COEF(0x4a, 0x8000, 0),
4606 WRITE_COEF(0x45, 0xd289),
4607 UPDATE_COEF(0x49, 0x0300, 0x0300),
4611 switch (codec->core.vendor_id) {
4613 alc_process_coef_fw(codec, coef0255);
4615 val = alc_read_coef_idx(codec, 0x46);
4616 is_ctia = (val & 0x0070) == 0x0070;
4620 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
4621 alc_write_coef_idx(codec, 0x06, 0x6104);
4622 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
4624 snd_hda_codec_write(codec, 0x21, 0,
4625 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
4627 snd_hda_codec_write(codec, 0x21, 0,
4628 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4630 alc_process_coef_fw(codec, coef0255);
4632 val = alc_read_coef_idx(codec, 0x46);
4633 is_ctia = (val & 0x0070) == 0x0070;
4635 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
4636 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4638 snd_hda_codec_write(codec, 0x21, 0,
4639 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
4641 snd_hda_codec_write(codec, 0x21, 0,
4642 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
4647 alc_process_coef_fw(codec, coef0274);
4649 val = alc_read_coef_idx(codec, 0x46);
4650 is_ctia = (val & 0x00f0) == 0x00f0;
4654 alc_write_coef_idx(codec, 0x45, 0xd029);
4656 val = alc_read_coef_idx(codec, 0x46);
4657 is_ctia = (val & 0x0070) == 0x0070;
4660 snd_hda_codec_write(codec, 0x21, 0,
4661 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
4663 snd_hda_codec_write(codec, 0x21, 0,
4664 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4667 val = alc_read_coef_idx(codec, 0x50);
4668 if (val & (1 << 12)) {
4669 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
4670 alc_process_coef_fw(codec, coef0288);
4672 val = alc_read_coef_idx(codec, 0x50);
4673 is_ctia = (val & 0x0070) == 0x0070;
4675 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
4676 alc_process_coef_fw(codec, coef0288);
4678 val = alc_read_coef_idx(codec, 0x50);
4679 is_ctia = (val & 0x0070) == 0x0070;
4681 alc_process_coef_fw(codec, coef0298);
4682 snd_hda_codec_write(codec, 0x21, 0,
4683 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
4685 snd_hda_codec_write(codec, 0x21, 0,
4686 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
4690 alc_process_coef_fw(codec, coef0288);
4692 val = alc_read_coef_idx(codec, 0x50);
4693 is_ctia = (val & 0x0070) == 0x0070;
4696 alc_write_coef_idx(codec, 0x6b, 0xd429);
4698 val = alc_read_coef_idx(codec, 0x6c);
4699 is_ctia = (val & 0x001c) == 0x001c;
4702 alc_process_coef_fw(codec, coef0293);
4704 val = alc_read_coef_idx(codec, 0x46);
4705 is_ctia = (val & 0x0070) == 0x0070;
4708 alc_process_coef_fw(codec, coef0688);
4710 val = alc_read_coef_idx(codec, 0xbe);
4711 is_ctia = (val & 0x1c02) == 0x1c02;
4716 alc_process_coef_fw(codec, alc225_pre_hsmode);
4717 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
4718 val = alc_read_coef_idx(codec, 0x45);
4719 if (val & (1 << 9)) {
4720 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
4721 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
4723 val = alc_read_coef_idx(codec, 0x46);
4724 is_ctia = (val & 0x00f0) == 0x00f0;
4726 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
4727 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
4729 val = alc_read_coef_idx(codec, 0x46);
4730 is_ctia = (val & 0x00f0) == 0x00f0;
4732 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
4733 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
4734 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
4741 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
4742 is_ctia ? "yes" : "no");
4743 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
4746 static void alc_update_headset_mode(struct hda_codec *codec)
4748 struct alc_spec *spec = codec->spec;
4750 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
4751 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
4753 int new_headset_mode;
4755 if (!snd_hda_jack_detect(codec, hp_pin))
4756 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
4757 else if (mux_pin == spec->headset_mic_pin)
4758 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
4759 else if (mux_pin == spec->headphone_mic_pin)
4760 new_headset_mode = ALC_HEADSET_MODE_MIC;
4762 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
4764 if (new_headset_mode == spec->current_headset_mode) {
4765 snd_hda_gen_update_outputs(codec);
4769 switch (new_headset_mode) {
4770 case ALC_HEADSET_MODE_UNPLUGGED:
4771 alc_headset_mode_unplugged(codec);
4772 spec->gen.hp_jack_present = false;
4774 case ALC_HEADSET_MODE_HEADSET:
4775 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
4776 alc_determine_headset_type(codec);
4777 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
4778 alc_headset_mode_ctia(codec);
4779 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
4780 alc_headset_mode_omtp(codec);
4781 spec->gen.hp_jack_present = true;
4783 case ALC_HEADSET_MODE_MIC:
4784 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
4785 spec->gen.hp_jack_present = false;
4787 case ALC_HEADSET_MODE_HEADPHONE:
4788 alc_headset_mode_default(codec);
4789 spec->gen.hp_jack_present = true;
4792 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
4793 snd_hda_set_pin_ctl_cache(codec, hp_pin,
4794 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
4795 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
4796 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
4799 spec->current_headset_mode = new_headset_mode;
4801 snd_hda_gen_update_outputs(codec);
4804 static void alc_update_headset_mode_hook(struct hda_codec *codec,
4805 struct snd_kcontrol *kcontrol,
4806 struct snd_ctl_elem_value *ucontrol)
4808 alc_update_headset_mode(codec);
4811 static void alc_update_headset_jack_cb(struct hda_codec *codec,
4812 struct hda_jack_callback *jack)
4814 struct alc_spec *spec = codec->spec;
4815 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
4816 snd_hda_gen_hp_automute(codec, jack);
4817 alc_update_headset_mode(codec);
4820 static void alc_probe_headset_mode(struct hda_codec *codec)
4823 struct alc_spec *spec = codec->spec;
4824 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
4827 for (i = 0; i < cfg->num_inputs; i++) {
4828 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
4829 spec->headset_mic_pin = cfg->inputs[i].pin;
4830 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
4831 spec->headphone_mic_pin = cfg->inputs[i].pin;
4834 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
4835 spec->gen.automute_hook = alc_update_headset_mode;
4836 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
4839 static void alc_fixup_headset_mode(struct hda_codec *codec,
4840 const struct hda_fixup *fix, int action)
4842 struct alc_spec *spec = codec->spec;
4845 case HDA_FIXUP_ACT_PRE_PROBE:
4846 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
4848 case HDA_FIXUP_ACT_PROBE:
4849 alc_probe_headset_mode(codec);
4851 case HDA_FIXUP_ACT_INIT:
4852 spec->current_headset_mode = 0;
4853 alc_update_headset_mode(codec);
4858 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
4859 const struct hda_fixup *fix, int action)
4861 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4862 struct alc_spec *spec = codec->spec;
4863 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4866 alc_fixup_headset_mode(codec, fix, action);
4869 static void alc255_set_default_jack_type(struct hda_codec *codec)
4871 /* Set to iphone type */
4872 static struct coef_fw alc255fw[] = {
4873 WRITE_COEF(0x1b, 0x880b),
4874 WRITE_COEF(0x45, 0xd089),
4875 WRITE_COEF(0x1b, 0x080b),
4876 WRITE_COEF(0x46, 0x0004),
4877 WRITE_COEF(0x1b, 0x0c0b),
4880 static struct coef_fw alc256fw[] = {
4881 WRITE_COEF(0x1b, 0x884b),
4882 WRITE_COEF(0x45, 0xd089),
4883 WRITE_COEF(0x1b, 0x084b),
4884 WRITE_COEF(0x46, 0x0004),
4885 WRITE_COEF(0x1b, 0x0c4b),
4888 switch (codec->core.vendor_id) {
4890 alc_process_coef_fw(codec, alc255fw);
4894 alc_process_coef_fw(codec, alc256fw);
4900 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
4901 const struct hda_fixup *fix, int action)
4903 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4904 alc255_set_default_jack_type(codec);
4906 alc_fixup_headset_mode(codec, fix, action);
4909 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
4910 const struct hda_fixup *fix, int action)
4912 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4913 struct alc_spec *spec = codec->spec;
4914 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4915 alc255_set_default_jack_type(codec);
4918 alc_fixup_headset_mode(codec, fix, action);
4921 static void alc288_update_headset_jack_cb(struct hda_codec *codec,
4922 struct hda_jack_callback *jack)
4924 struct alc_spec *spec = codec->spec;
4927 alc_update_headset_jack_cb(codec, jack);
4928 /* Headset Mic enable or disable, only for Dell Dino */
4929 present = spec->gen.hp_jack_present ? 0x40 : 0;
4930 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
4934 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
4935 const struct hda_fixup *fix, int action)
4937 alc_fixup_headset_mode(codec, fix, action);
4938 if (action == HDA_FIXUP_ACT_PROBE) {
4939 struct alc_spec *spec = codec->spec;
4940 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
4944 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
4945 const struct hda_fixup *fix, int action)
4947 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4948 struct alc_spec *spec = codec->spec;
4949 spec->gen.auto_mute_via_amp = 1;
4953 static void alc_no_shutup(struct hda_codec *codec)
4957 static void alc_fixup_no_shutup(struct hda_codec *codec,
4958 const struct hda_fixup *fix, int action)
4960 if (action == HDA_FIXUP_ACT_PROBE) {
4961 struct alc_spec *spec = codec->spec;
4962 spec->shutup = alc_no_shutup;
4966 static void alc_fixup_disable_aamix(struct hda_codec *codec,
4967 const struct hda_fixup *fix, int action)
4969 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4970 struct alc_spec *spec = codec->spec;
4971 /* Disable AA-loopback as it causes white noise */
4972 spec->gen.mixer_nid = 0;
4976 /* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
4977 static void alc_fixup_tpt440_dock(struct hda_codec *codec,
4978 const struct hda_fixup *fix, int action)
4980 static const struct hda_pintbl pincfgs[] = {
4981 { 0x16, 0x21211010 }, /* dock headphone */
4982 { 0x19, 0x21a11010 }, /* dock mic */
4985 struct alc_spec *spec = codec->spec;
4987 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4988 spec->reboot_notify = snd_hda_gen_reboot_notify; /* reduce noise */
4989 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
4990 codec->power_save_node = 0; /* avoid click noises */
4991 snd_hda_apply_pincfgs(codec, pincfgs);
4995 static void alc_fixup_tpt470_dock(struct hda_codec *codec,
4996 const struct hda_fixup *fix, int action)
4998 static const struct hda_pintbl pincfgs[] = {
4999 { 0x17, 0x21211010 }, /* dock headphone */
5000 { 0x19, 0x21a11010 }, /* dock mic */
5003 /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
5004 * the speaker output becomes too low by some reason on Thinkpads with
5007 static hda_nid_t preferred_pairs[] = {
5008 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
5011 struct alc_spec *spec = codec->spec;
5013 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5014 spec->gen.preferred_dacs = preferred_pairs;
5015 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5016 snd_hda_apply_pincfgs(codec, pincfgs);
5017 } else if (action == HDA_FIXUP_ACT_INIT) {
5018 /* Enable DOCK device */
5019 snd_hda_codec_write(codec, 0x17, 0,
5020 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5021 /* Enable DOCK device */
5022 snd_hda_codec_write(codec, 0x19, 0,
5023 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5027 static void alc_shutup_dell_xps13(struct hda_codec *codec)
5029 struct alc_spec *spec = codec->spec;
5030 int hp_pin = spec->gen.autocfg.hp_pins[0];
5032 /* Prevent pop noises when headphones are plugged in */
5033 snd_hda_codec_write(codec, hp_pin, 0,
5034 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5038 static void alc_fixup_dell_xps13(struct hda_codec *codec,
5039 const struct hda_fixup *fix, int action)
5041 struct alc_spec *spec = codec->spec;
5042 struct hda_input_mux *imux = &spec->gen.input_mux;
5046 case HDA_FIXUP_ACT_PRE_PROBE:
5047 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
5048 * it causes a click noise at start up
5050 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
5052 case HDA_FIXUP_ACT_PROBE:
5053 spec->shutup = alc_shutup_dell_xps13;
5055 /* Make the internal mic the default input source. */
5056 for (i = 0; i < imux->num_items; i++) {
5057 if (spec->gen.imux_pins[i] == 0x12) {
5058 spec->gen.cur_mux[0] = i;
5066 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
5067 const struct hda_fixup *fix, int action)
5069 struct alc_spec *spec = codec->spec;
5071 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5072 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5073 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
5075 /* Disable boost for mic-in permanently. (This code is only called
5076 from quirks that guarantee that the headphone is at NID 0x1b.) */
5077 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
5078 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
5080 alc_fixup_headset_mode(codec, fix, action);
5083 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
5084 const struct hda_fixup *fix, int action)
5086 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5087 alc_write_coef_idx(codec, 0xc4, 0x8000);
5088 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
5089 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
5091 alc_fixup_headset_mode(codec, fix, action);
5094 /* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
5095 static int find_ext_mic_pin(struct hda_codec *codec)
5097 struct alc_spec *spec = codec->spec;
5098 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5100 unsigned int defcfg;
5103 for (i = 0; i < cfg->num_inputs; i++) {
5104 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5106 nid = cfg->inputs[i].pin;
5107 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5108 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
5116 static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
5117 const struct hda_fixup *fix,
5120 struct alc_spec *spec = codec->spec;
5122 if (action == HDA_FIXUP_ACT_PROBE) {
5123 int mic_pin = find_ext_mic_pin(codec);
5124 int hp_pin = spec->gen.autocfg.hp_pins[0];
5126 if (snd_BUG_ON(!mic_pin || !hp_pin))
5128 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
5132 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
5133 const struct hda_fixup *fix,
5136 struct alc_spec *spec = codec->spec;
5137 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5140 /* The mic boosts on level 2 and 3 are too noisy
5141 on the internal mic input.
5142 Therefore limit the boost to 0 or 1. */
5144 if (action != HDA_FIXUP_ACT_PROBE)
5147 for (i = 0; i < cfg->num_inputs; i++) {
5148 hda_nid_t nid = cfg->inputs[i].pin;
5149 unsigned int defcfg;
5150 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5152 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5153 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
5156 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
5157 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
5158 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
5159 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
5160 (0 << AC_AMPCAP_MUTE_SHIFT));
5164 static void alc283_hp_automute_hook(struct hda_codec *codec,
5165 struct hda_jack_callback *jack)
5167 struct alc_spec *spec = codec->spec;
5171 snd_hda_gen_hp_automute(codec, jack);
5173 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
5176 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5180 static void alc283_fixup_chromebook(struct hda_codec *codec,
5181 const struct hda_fixup *fix, int action)
5183 struct alc_spec *spec = codec->spec;
5186 case HDA_FIXUP_ACT_PRE_PROBE:
5187 snd_hda_override_wcaps(codec, 0x03, 0);
5188 /* Disable AA-loopback as it causes white noise */
5189 spec->gen.mixer_nid = 0;
5191 case HDA_FIXUP_ACT_INIT:
5192 /* MIC2-VREF control */
5193 /* Set to manual mode */
5194 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
5195 /* Enable Line1 input control by verb */
5196 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
5201 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
5202 const struct hda_fixup *fix, int action)
5204 struct alc_spec *spec = codec->spec;
5207 case HDA_FIXUP_ACT_PRE_PROBE:
5208 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
5210 case HDA_FIXUP_ACT_INIT:
5211 /* MIC2-VREF control */
5212 /* Set to manual mode */
5213 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
5218 /* mute tablet speaker pin (0x14) via dock plugging in addition */
5219 static void asus_tx300_automute(struct hda_codec *codec)
5221 struct alc_spec *spec = codec->spec;
5222 snd_hda_gen_update_outputs(codec);
5223 if (snd_hda_jack_detect(codec, 0x1b))
5224 spec->gen.mute_bits |= (1ULL << 0x14);
5227 static void alc282_fixup_asus_tx300(struct hda_codec *codec,
5228 const struct hda_fixup *fix, int action)
5230 struct alc_spec *spec = codec->spec;
5231 /* TX300 needs to set up GPIO2 for the speaker amp */
5232 static const struct hda_verb gpio2_verbs[] = {
5233 { 0x01, AC_VERB_SET_GPIO_MASK, 0x04 },
5234 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04 },
5235 { 0x01, AC_VERB_SET_GPIO_DATA, 0x04 },
5238 static const struct hda_pintbl dock_pins[] = {
5239 { 0x1b, 0x21114000 }, /* dock speaker pin */
5244 case HDA_FIXUP_ACT_PRE_PROBE:
5245 snd_hda_add_verbs(codec, gpio2_verbs);
5246 snd_hda_apply_pincfgs(codec, dock_pins);
5247 spec->gen.auto_mute_via_amp = 1;
5248 spec->gen.automute_hook = asus_tx300_automute;
5249 snd_hda_jack_detect_enable_callback(codec, 0x1b,
5250 snd_hda_gen_hp_automute);
5252 case HDA_FIXUP_ACT_BUILD:
5253 /* this is a bit tricky; give more sane names for the main
5254 * (tablet) speaker and the dock speaker, respectively
5256 rename_ctl(codec, "Speaker Playback Switch",
5257 "Dock Speaker Playback Switch");
5258 rename_ctl(codec, "Bass Speaker Playback Switch",
5259 "Speaker Playback Switch");
5264 static void alc290_fixup_mono_speakers(struct hda_codec *codec,
5265 const struct hda_fixup *fix, int action)
5267 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5268 /* DAC node 0x03 is giving mono output. We therefore want to
5269 make sure 0x14 (front speaker) and 0x15 (headphones) use the
5270 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
5271 hda_nid_t conn1[2] = { 0x0c };
5272 snd_hda_override_conn_list(codec, 0x14, 1, conn1);
5273 snd_hda_override_conn_list(codec, 0x15, 1, conn1);
5277 static void alc298_fixup_speaker_volume(struct hda_codec *codec,
5278 const struct hda_fixup *fix, int action)
5280 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5281 /* The speaker is routed to the Node 0x06 by a mistake, as a result
5282 we can't adjust the speaker's volume since this node does not has
5283 Amp-out capability. we change the speaker's route to:
5284 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
5285 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
5286 speaker's volume now. */
5288 hda_nid_t conn1[1] = { 0x0c };
5289 snd_hda_override_conn_list(codec, 0x17, 1, conn1);
5293 /* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
5294 static void alc295_fixup_disable_dac3(struct hda_codec *codec,
5295 const struct hda_fixup *fix, int action)
5297 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5298 hda_nid_t conn[2] = { 0x02, 0x03 };
5299 snd_hda_override_conn_list(codec, 0x17, 2, conn);
5303 /* Hook to update amp GPIO4 for automute */
5304 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
5305 struct hda_jack_callback *jack)
5307 struct alc_spec *spec = codec->spec;
5309 snd_hda_gen_hp_automute(codec, jack);
5310 /* mute_led_polarity is set to 0, so we pass inverted value here */
5311 alc_update_gpio_led(codec, 0x10, !spec->gen.hp_jack_present);
5314 /* Manage GPIOs for HP EliteBook Folio 9480m.
5316 * GPIO4 is the headphone amplifier power control
5317 * GPIO3 is the audio output mute indicator LED
5320 static void alc280_fixup_hp_9480m(struct hda_codec *codec,
5321 const struct hda_fixup *fix,
5324 struct alc_spec *spec = codec->spec;
5325 static const struct hda_verb gpio_init[] = {
5326 { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 },
5327 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 },
5331 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5332 /* Set the hooks to turn the headphone amp on/off
5335 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
5336 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
5338 /* The GPIOs are currently off */
5341 /* GPIO3 is connected to the output mute LED,
5342 * high is on, low is off
5344 spec->mute_led_polarity = 0;
5345 spec->gpio_mute_led_mask = 0x08;
5347 /* Initialize GPIO configuration */
5348 snd_hda_add_verbs(codec, gpio_init);
5352 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
5353 const struct hda_fixup *fix,
5356 alc_fixup_dual_codecs(codec, fix, action);
5358 case HDA_FIXUP_ACT_PRE_PROBE:
5359 /* override card longname to provide a unique UCM profile */
5360 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
5362 case HDA_FIXUP_ACT_BUILD:
5363 /* rename Capture controls depending on the codec */
5364 rename_ctl(codec, "Capture Volume",
5366 "Rear-Panel Capture Volume" :
5367 "Front-Panel Capture Volume");
5368 rename_ctl(codec, "Capture Switch",
5370 "Rear-Panel Capture Switch" :
5371 "Front-Panel Capture Switch");
5376 static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
5377 const struct hda_fixup *fix, int action)
5379 if (action != HDA_FIXUP_ACT_PRE_PROBE)
5382 codec->power_save_node = 1;
5385 /* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
5386 static void alc274_fixup_bind_dacs(struct hda_codec *codec,
5387 const struct hda_fixup *fix, int action)
5389 struct alc_spec *spec = codec->spec;
5390 static hda_nid_t preferred_pairs[] = {
5391 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
5395 if (action != HDA_FIXUP_ACT_PRE_PROBE)
5398 spec->gen.preferred_dacs = preferred_pairs;
5399 spec->gen.auto_mute_via_amp = 1;
5400 codec->power_save_node = 0;
5403 static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
5404 const struct hda_fixup *fix, int action)
5406 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5407 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
5410 /* for hda_fixup_thinkpad_acpi() */
5411 #include "thinkpad_helper.c"
5413 static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
5414 const struct hda_fixup *fix, int action)
5416 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
5417 hda_fixup_thinkpad_acpi(codec, fix, action);
5420 /* for dell wmi mic mute led */
5421 #include "dell_wmi_helper.c"
5424 ALC269_FIXUP_SONY_VAIO,
5425 ALC275_FIXUP_SONY_VAIO_GPIO2,
5426 ALC269_FIXUP_DELL_M101Z,
5427 ALC269_FIXUP_SKU_IGNORE,
5428 ALC269_FIXUP_ASUS_G73JW,
5429 ALC269_FIXUP_LENOVO_EAPD,
5430 ALC275_FIXUP_SONY_HWEQ,
5431 ALC275_FIXUP_SONY_DISABLE_AAMIX,
5433 ALC269_FIXUP_PCM_44K,
5434 ALC269_FIXUP_STEREO_DMIC,
5435 ALC269_FIXUP_HEADSET_MIC,
5436 ALC269_FIXUP_QUANTA_MUTE,
5437 ALC269_FIXUP_LIFEBOOK,
5438 ALC269_FIXUP_LIFEBOOK_EXTMIC,
5439 ALC269_FIXUP_LIFEBOOK_HP_PIN,
5440 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
5441 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
5444 ALC269VB_FIXUP_AMIC,
5445 ALC269VB_FIXUP_DMIC,
5446 ALC269_FIXUP_HP_MUTE_LED,
5447 ALC269_FIXUP_HP_MUTE_LED_MIC1,
5448 ALC269_FIXUP_HP_MUTE_LED_MIC2,
5449 ALC269_FIXUP_HP_MUTE_LED_MIC3,
5450 ALC269_FIXUP_HP_GPIO_LED,
5451 ALC269_FIXUP_HP_GPIO_MIC1_LED,
5452 ALC269_FIXUP_HP_LINE1_MIC1_LED,
5453 ALC269_FIXUP_INV_DMIC,
5454 ALC269_FIXUP_LENOVO_DOCK,
5455 ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
5456 ALC269_FIXUP_NO_SHUTUP,
5457 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
5458 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
5459 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
5460 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
5461 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
5462 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
5463 ALC269_FIXUP_HEADSET_MODE,
5464 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
5465 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
5466 ALC269_FIXUP_ASUS_X101_FUNC,
5467 ALC269_FIXUP_ASUS_X101_VERB,
5468 ALC269_FIXUP_ASUS_X101,
5469 ALC271_FIXUP_AMIC_MIC2,
5470 ALC271_FIXUP_HP_GATE_MIC_JACK,
5471 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
5472 ALC269_FIXUP_ACER_AC700,
5473 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
5474 ALC269VB_FIXUP_ASUS_ZENBOOK,
5475 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
5476 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
5477 ALC269VB_FIXUP_ORDISSIMO_EVE2,
5478 ALC283_FIXUP_CHROME_BOOK,
5479 ALC283_FIXUP_SENSE_COMBO_JACK,
5480 ALC282_FIXUP_ASUS_TX300,
5481 ALC283_FIXUP_INT_MIC,
5482 ALC290_FIXUP_MONO_SPEAKERS,
5483 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
5484 ALC290_FIXUP_SUBWOOFER,
5485 ALC290_FIXUP_SUBWOOFER_HSJACK,
5486 ALC269_FIXUP_THINKPAD_ACPI,
5487 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
5488 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
5489 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
5490 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5491 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
5492 ALC255_FIXUP_HEADSET_MODE,
5493 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
5494 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
5495 ALC292_FIXUP_TPT440_DOCK,
5496 ALC292_FIXUP_TPT440,
5497 ALC283_FIXUP_HEADSET_MIC,
5498 ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED,
5499 ALC282_FIXUP_ASPIRE_V5_PINS,
5500 ALC280_FIXUP_HP_GPIO4,
5501 ALC286_FIXUP_HP_GPIO_LED,
5502 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
5503 ALC280_FIXUP_HP_DOCK_PINS,
5504 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
5505 ALC280_FIXUP_HP_9480M,
5506 ALC288_FIXUP_DELL_HEADSET_MODE,
5507 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
5508 ALC288_FIXUP_DELL_XPS_13_GPIO6,
5509 ALC288_FIXUP_DELL_XPS_13,
5510 ALC288_FIXUP_DISABLE_AAMIX,
5511 ALC292_FIXUP_DELL_E7X,
5512 ALC292_FIXUP_DISABLE_AAMIX,
5513 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
5514 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
5515 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
5516 ALC275_FIXUP_DELL_XPS,
5517 ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE,
5518 ALC293_FIXUP_LENOVO_SPK_NOISE,
5519 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
5520 ALC255_FIXUP_DELL_SPK_NOISE,
5521 ALC225_FIXUP_DISABLE_MIC_VREF,
5522 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
5523 ALC295_FIXUP_DISABLE_DAC3,
5524 ALC280_FIXUP_HP_HEADSET_MIC,
5525 ALC221_FIXUP_HP_FRONT_MIC,
5526 ALC292_FIXUP_TPT460,
5527 ALC298_FIXUP_SPK_VOLUME,
5528 ALC298_FIXUP_LENOVO_SPK_VOLUME,
5529 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
5530 ALC269_FIXUP_ATIV_BOOK_8,
5531 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
5532 ALC256_FIXUP_ASUS_HEADSET_MODE,
5533 ALC256_FIXUP_ASUS_MIC,
5534 ALC256_FIXUP_ASUS_AIO_GPIO2,
5535 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
5536 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
5537 ALC233_FIXUP_LENOVO_MULTI_CODECS,
5538 ALC294_FIXUP_LENOVO_MIC_LOCATION,
5539 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
5540 ALC225_FIXUP_S3_POP_NOISE,
5541 ALC700_FIXUP_INTEL_REFERENCE,
5542 ALC274_FIXUP_DELL_BIND_DACS,
5543 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
5544 ALC298_FIXUP_TPT470_DOCK,
5545 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
5546 ALC255_FIXUP_DELL_HEADSET_MIC,
5547 ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
5548 ALC225_FIXUP_WYSE_AUTO_MUTE,
5549 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
5552 static const struct hda_fixup alc269_fixups[] = {
5553 [ALC269_FIXUP_SONY_VAIO] = {
5554 .type = HDA_FIXUP_PINCTLS,
5555 .v.pins = (const struct hda_pintbl[]) {
5556 {0x19, PIN_VREFGRD},
5560 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
5561 .type = HDA_FIXUP_VERBS,
5562 .v.verbs = (const struct hda_verb[]) {
5563 {0x01, AC_VERB_SET_GPIO_MASK, 0x04},
5564 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04},
5565 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5569 .chain_id = ALC269_FIXUP_SONY_VAIO
5571 [ALC269_FIXUP_DELL_M101Z] = {
5572 .type = HDA_FIXUP_VERBS,
5573 .v.verbs = (const struct hda_verb[]) {
5574 /* Enables internal speaker */
5575 {0x20, AC_VERB_SET_COEF_INDEX, 13},
5576 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
5580 [ALC269_FIXUP_SKU_IGNORE] = {
5581 .type = HDA_FIXUP_FUNC,
5582 .v.func = alc_fixup_sku_ignore,
5584 [ALC269_FIXUP_ASUS_G73JW] = {
5585 .type = HDA_FIXUP_PINS,
5586 .v.pins = (const struct hda_pintbl[]) {
5587 { 0x17, 0x99130111 }, /* subwoofer */
5591 [ALC269_FIXUP_LENOVO_EAPD] = {
5592 .type = HDA_FIXUP_VERBS,
5593 .v.verbs = (const struct hda_verb[]) {
5594 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
5598 [ALC275_FIXUP_SONY_HWEQ] = {
5599 .type = HDA_FIXUP_FUNC,
5600 .v.func = alc269_fixup_hweq,
5602 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
5604 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
5605 .type = HDA_FIXUP_FUNC,
5606 .v.func = alc_fixup_disable_aamix,
5608 .chain_id = ALC269_FIXUP_SONY_VAIO
5610 [ALC271_FIXUP_DMIC] = {
5611 .type = HDA_FIXUP_FUNC,
5612 .v.func = alc271_fixup_dmic,
5614 [ALC269_FIXUP_PCM_44K] = {
5615 .type = HDA_FIXUP_FUNC,
5616 .v.func = alc269_fixup_pcm_44k,
5618 .chain_id = ALC269_FIXUP_QUANTA_MUTE
5620 [ALC269_FIXUP_STEREO_DMIC] = {
5621 .type = HDA_FIXUP_FUNC,
5622 .v.func = alc269_fixup_stereo_dmic,
5624 [ALC269_FIXUP_HEADSET_MIC] = {
5625 .type = HDA_FIXUP_FUNC,
5626 .v.func = alc269_fixup_headset_mic,
5628 [ALC269_FIXUP_QUANTA_MUTE] = {
5629 .type = HDA_FIXUP_FUNC,
5630 .v.func = alc269_fixup_quanta_mute,
5632 [ALC269_FIXUP_LIFEBOOK] = {
5633 .type = HDA_FIXUP_PINS,
5634 .v.pins = (const struct hda_pintbl[]) {
5635 { 0x1a, 0x2101103f }, /* dock line-out */
5636 { 0x1b, 0x23a11040 }, /* dock mic-in */
5640 .chain_id = ALC269_FIXUP_QUANTA_MUTE
5642 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
5643 .type = HDA_FIXUP_PINS,
5644 .v.pins = (const struct hda_pintbl[]) {
5645 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
5649 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
5650 .type = HDA_FIXUP_PINS,
5651 .v.pins = (const struct hda_pintbl[]) {
5652 { 0x21, 0x0221102f }, /* HP out */
5656 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
5657 .type = HDA_FIXUP_FUNC,
5658 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
5660 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
5661 .type = HDA_FIXUP_FUNC,
5662 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
5664 [ALC269_FIXUP_AMIC] = {
5665 .type = HDA_FIXUP_PINS,
5666 .v.pins = (const struct hda_pintbl[]) {
5667 { 0x14, 0x99130110 }, /* speaker */
5668 { 0x15, 0x0121401f }, /* HP out */
5669 { 0x18, 0x01a19c20 }, /* mic */
5670 { 0x19, 0x99a3092f }, /* int-mic */
5674 [ALC269_FIXUP_DMIC] = {
5675 .type = HDA_FIXUP_PINS,
5676 .v.pins = (const struct hda_pintbl[]) {
5677 { 0x12, 0x99a3092f }, /* int-mic */
5678 { 0x14, 0x99130110 }, /* speaker */
5679 { 0x15, 0x0121401f }, /* HP out */
5680 { 0x18, 0x01a19c20 }, /* mic */
5684 [ALC269VB_FIXUP_AMIC] = {
5685 .type = HDA_FIXUP_PINS,
5686 .v.pins = (const struct hda_pintbl[]) {
5687 { 0x14, 0x99130110 }, /* speaker */
5688 { 0x18, 0x01a19c20 }, /* mic */
5689 { 0x19, 0x99a3092f }, /* int-mic */
5690 { 0x21, 0x0121401f }, /* HP out */
5694 [ALC269VB_FIXUP_DMIC] = {
5695 .type = HDA_FIXUP_PINS,
5696 .v.pins = (const struct hda_pintbl[]) {
5697 { 0x12, 0x99a3092f }, /* int-mic */
5698 { 0x14, 0x99130110 }, /* speaker */
5699 { 0x18, 0x01a19c20 }, /* mic */
5700 { 0x21, 0x0121401f }, /* HP out */
5704 [ALC269_FIXUP_HP_MUTE_LED] = {
5705 .type = HDA_FIXUP_FUNC,
5706 .v.func = alc269_fixup_hp_mute_led,
5708 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
5709 .type = HDA_FIXUP_FUNC,
5710 .v.func = alc269_fixup_hp_mute_led_mic1,
5712 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
5713 .type = HDA_FIXUP_FUNC,
5714 .v.func = alc269_fixup_hp_mute_led_mic2,
5716 [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
5717 .type = HDA_FIXUP_FUNC,
5718 .v.func = alc269_fixup_hp_mute_led_mic3,
5720 [ALC269_FIXUP_HP_GPIO_LED] = {
5721 .type = HDA_FIXUP_FUNC,
5722 .v.func = alc269_fixup_hp_gpio_led,
5724 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
5725 .type = HDA_FIXUP_FUNC,
5726 .v.func = alc269_fixup_hp_gpio_mic1_led,
5728 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
5729 .type = HDA_FIXUP_FUNC,
5730 .v.func = alc269_fixup_hp_line1_mic1_led,
5732 [ALC269_FIXUP_INV_DMIC] = {
5733 .type = HDA_FIXUP_FUNC,
5734 .v.func = alc_fixup_inv_dmic,
5736 [ALC269_FIXUP_NO_SHUTUP] = {
5737 .type = HDA_FIXUP_FUNC,
5738 .v.func = alc_fixup_no_shutup,
5740 [ALC269_FIXUP_LENOVO_DOCK] = {
5741 .type = HDA_FIXUP_PINS,
5742 .v.pins = (const struct hda_pintbl[]) {
5743 { 0x19, 0x23a11040 }, /* dock mic */
5744 { 0x1b, 0x2121103f }, /* dock headphone */
5748 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
5750 [ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
5751 .type = HDA_FIXUP_FUNC,
5752 .v.func = alc269_fixup_limit_int_mic_boost,
5754 .chain_id = ALC269_FIXUP_LENOVO_DOCK,
5756 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
5757 .type = HDA_FIXUP_FUNC,
5758 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
5760 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
5762 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
5763 .type = HDA_FIXUP_PINS,
5764 .v.pins = (const struct hda_pintbl[]) {
5765 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5766 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5770 .chain_id = ALC269_FIXUP_HEADSET_MODE
5772 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
5773 .type = HDA_FIXUP_PINS,
5774 .v.pins = (const struct hda_pintbl[]) {
5775 { 0x16, 0x21014020 }, /* dock line out */
5776 { 0x19, 0x21a19030 }, /* dock mic */
5777 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5781 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
5783 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
5784 .type = HDA_FIXUP_PINS,
5785 .v.pins = (const struct hda_pintbl[]) {
5786 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5790 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
5792 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
5793 .type = HDA_FIXUP_PINS,
5794 .v.pins = (const struct hda_pintbl[]) {
5795 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5796 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5800 .chain_id = ALC269_FIXUP_HEADSET_MODE
5802 [ALC269_FIXUP_HEADSET_MODE] = {
5803 .type = HDA_FIXUP_FUNC,
5804 .v.func = alc_fixup_headset_mode,
5806 .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
5808 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
5809 .type = HDA_FIXUP_FUNC,
5810 .v.func = alc_fixup_headset_mode_no_hp_mic,
5812 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
5813 .type = HDA_FIXUP_PINS,
5814 .v.pins = (const struct hda_pintbl[]) {
5815 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
5819 .chain_id = ALC269_FIXUP_HEADSET_MODE,
5821 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
5822 .type = HDA_FIXUP_PINS,
5823 .v.pins = (const struct hda_pintbl[]) {
5824 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5828 .chain_id = ALC269_FIXUP_HEADSET_MIC
5830 [ALC269_FIXUP_ASUS_X101_FUNC] = {
5831 .type = HDA_FIXUP_FUNC,
5832 .v.func = alc269_fixup_x101_headset_mic,
5834 [ALC269_FIXUP_ASUS_X101_VERB] = {
5835 .type = HDA_FIXUP_VERBS,
5836 .v.verbs = (const struct hda_verb[]) {
5837 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5838 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
5839 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
5843 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
5845 [ALC269_FIXUP_ASUS_X101] = {
5846 .type = HDA_FIXUP_PINS,
5847 .v.pins = (const struct hda_pintbl[]) {
5848 { 0x18, 0x04a1182c }, /* Headset mic */
5852 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
5854 [ALC271_FIXUP_AMIC_MIC2] = {
5855 .type = HDA_FIXUP_PINS,
5856 .v.pins = (const struct hda_pintbl[]) {
5857 { 0x14, 0x99130110 }, /* speaker */
5858 { 0x19, 0x01a19c20 }, /* mic */
5859 { 0x1b, 0x99a7012f }, /* int-mic */
5860 { 0x21, 0x0121401f }, /* HP out */
5864 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
5865 .type = HDA_FIXUP_FUNC,
5866 .v.func = alc271_hp_gate_mic_jack,
5868 .chain_id = ALC271_FIXUP_AMIC_MIC2,
5870 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
5871 .type = HDA_FIXUP_FUNC,
5872 .v.func = alc269_fixup_limit_int_mic_boost,
5874 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
5876 [ALC269_FIXUP_ACER_AC700] = {
5877 .type = HDA_FIXUP_PINS,
5878 .v.pins = (const struct hda_pintbl[]) {
5879 { 0x12, 0x99a3092f }, /* int-mic */
5880 { 0x14, 0x99130110 }, /* speaker */
5881 { 0x18, 0x03a11c20 }, /* mic */
5882 { 0x1e, 0x0346101e }, /* SPDIF1 */
5883 { 0x21, 0x0321101f }, /* HP out */
5887 .chain_id = ALC271_FIXUP_DMIC,
5889 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
5890 .type = HDA_FIXUP_FUNC,
5891 .v.func = alc269_fixup_limit_int_mic_boost,
5893 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
5895 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
5896 .type = HDA_FIXUP_FUNC,
5897 .v.func = alc269_fixup_limit_int_mic_boost,
5899 .chain_id = ALC269VB_FIXUP_DMIC,
5901 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
5902 .type = HDA_FIXUP_VERBS,
5903 .v.verbs = (const struct hda_verb[]) {
5904 /* class-D output amp +5dB */
5905 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
5906 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
5910 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
5912 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
5913 .type = HDA_FIXUP_FUNC,
5914 .v.func = alc269_fixup_limit_int_mic_boost,
5916 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
5918 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
5919 .type = HDA_FIXUP_PINS,
5920 .v.pins = (const struct hda_pintbl[]) {
5921 { 0x12, 0x99a3092f }, /* int-mic */
5922 { 0x18, 0x03a11d20 }, /* mic */
5923 { 0x19, 0x411111f0 }, /* Unused bogus pin */
5927 [ALC283_FIXUP_CHROME_BOOK] = {
5928 .type = HDA_FIXUP_FUNC,
5929 .v.func = alc283_fixup_chromebook,
5931 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
5932 .type = HDA_FIXUP_FUNC,
5933 .v.func = alc283_fixup_sense_combo_jack,
5935 .chain_id = ALC283_FIXUP_CHROME_BOOK,
5937 [ALC282_FIXUP_ASUS_TX300] = {
5938 .type = HDA_FIXUP_FUNC,
5939 .v.func = alc282_fixup_asus_tx300,
5941 [ALC283_FIXUP_INT_MIC] = {
5942 .type = HDA_FIXUP_VERBS,
5943 .v.verbs = (const struct hda_verb[]) {
5944 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
5945 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
5949 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
5951 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
5952 .type = HDA_FIXUP_PINS,
5953 .v.pins = (const struct hda_pintbl[]) {
5954 { 0x17, 0x90170112 }, /* subwoofer */
5958 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
5960 [ALC290_FIXUP_SUBWOOFER] = {
5961 .type = HDA_FIXUP_PINS,
5962 .v.pins = (const struct hda_pintbl[]) {
5963 { 0x17, 0x90170112 }, /* subwoofer */
5967 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
5969 [ALC290_FIXUP_MONO_SPEAKERS] = {
5970 .type = HDA_FIXUP_FUNC,
5971 .v.func = alc290_fixup_mono_speakers,
5973 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
5974 .type = HDA_FIXUP_FUNC,
5975 .v.func = alc290_fixup_mono_speakers,
5977 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
5979 [ALC269_FIXUP_THINKPAD_ACPI] = {
5980 .type = HDA_FIXUP_FUNC,
5981 .v.func = alc_fixup_thinkpad_acpi,
5983 .chain_id = ALC269_FIXUP_SKU_IGNORE,
5985 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
5986 .type = HDA_FIXUP_FUNC,
5987 .v.func = alc_fixup_inv_dmic,
5989 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
5991 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
5992 .type = HDA_FIXUP_PINS,
5993 .v.pins = (const struct hda_pintbl[]) {
5994 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5998 .chain_id = ALC255_FIXUP_HEADSET_MODE
6000 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
6001 .type = HDA_FIXUP_PINS,
6002 .v.pins = (const struct hda_pintbl[]) {
6003 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6007 .chain_id = ALC255_FIXUP_HEADSET_MODE
6009 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6010 .type = HDA_FIXUP_PINS,
6011 .v.pins = (const struct hda_pintbl[]) {
6012 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6013 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6017 .chain_id = ALC255_FIXUP_HEADSET_MODE
6019 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
6020 .type = HDA_FIXUP_PINS,
6021 .v.pins = (const struct hda_pintbl[]) {
6022 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6026 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
6028 [ALC255_FIXUP_HEADSET_MODE] = {
6029 .type = HDA_FIXUP_FUNC,
6030 .v.func = alc_fixup_headset_mode_alc255,
6032 .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
6034 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
6035 .type = HDA_FIXUP_FUNC,
6036 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
6038 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6039 .type = HDA_FIXUP_PINS,
6040 .v.pins = (const struct hda_pintbl[]) {
6041 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6042 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6046 .chain_id = ALC269_FIXUP_HEADSET_MODE
6048 [ALC292_FIXUP_TPT440_DOCK] = {
6049 .type = HDA_FIXUP_FUNC,
6050 .v.func = alc_fixup_tpt440_dock,
6052 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
6054 [ALC292_FIXUP_TPT440] = {
6055 .type = HDA_FIXUP_FUNC,
6056 .v.func = alc_fixup_disable_aamix,
6058 .chain_id = ALC292_FIXUP_TPT440_DOCK,
6060 [ALC283_FIXUP_HEADSET_MIC] = {
6061 .type = HDA_FIXUP_PINS,
6062 .v.pins = (const struct hda_pintbl[]) {
6063 { 0x19, 0x04a110f0 },
6067 [ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED] = {
6068 .type = HDA_FIXUP_FUNC,
6069 .v.func = alc_fixup_dell_wmi,
6071 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
6072 .type = HDA_FIXUP_PINS,
6073 .v.pins = (const struct hda_pintbl[]) {
6074 { 0x12, 0x90a60130 },
6075 { 0x14, 0x90170110 },
6076 { 0x17, 0x40000008 },
6077 { 0x18, 0x411111f0 },
6078 { 0x19, 0x01a1913c },
6079 { 0x1a, 0x411111f0 },
6080 { 0x1b, 0x411111f0 },
6081 { 0x1d, 0x40f89b2d },
6082 { 0x1e, 0x411111f0 },
6083 { 0x21, 0x0321101f },
6087 [ALC280_FIXUP_HP_GPIO4] = {
6088 .type = HDA_FIXUP_FUNC,
6089 .v.func = alc280_fixup_hp_gpio4,
6091 [ALC286_FIXUP_HP_GPIO_LED] = {
6092 .type = HDA_FIXUP_FUNC,
6093 .v.func = alc286_fixup_hp_gpio_led,
6095 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
6096 .type = HDA_FIXUP_FUNC,
6097 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
6099 [ALC280_FIXUP_HP_DOCK_PINS] = {
6100 .type = HDA_FIXUP_PINS,
6101 .v.pins = (const struct hda_pintbl[]) {
6102 { 0x1b, 0x21011020 }, /* line-out */
6103 { 0x1a, 0x01a1903c }, /* headset mic */
6104 { 0x18, 0x2181103f }, /* line-in */
6108 .chain_id = ALC280_FIXUP_HP_GPIO4
6110 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
6111 .type = HDA_FIXUP_PINS,
6112 .v.pins = (const struct hda_pintbl[]) {
6113 { 0x1b, 0x21011020 }, /* line-out */
6114 { 0x18, 0x2181103f }, /* line-in */
6118 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
6120 [ALC280_FIXUP_HP_9480M] = {
6121 .type = HDA_FIXUP_FUNC,
6122 .v.func = alc280_fixup_hp_9480m,
6124 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
6125 .type = HDA_FIXUP_FUNC,
6126 .v.func = alc_fixup_headset_mode_dell_alc288,
6128 .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
6130 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6131 .type = HDA_FIXUP_PINS,
6132 .v.pins = (const struct hda_pintbl[]) {
6133 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6134 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6138 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
6140 [ALC288_FIXUP_DELL_XPS_13_GPIO6] = {
6141 .type = HDA_FIXUP_VERBS,
6142 .v.verbs = (const struct hda_verb[]) {
6143 {0x01, AC_VERB_SET_GPIO_MASK, 0x40},
6144 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x40},
6145 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6149 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
6151 [ALC288_FIXUP_DISABLE_AAMIX] = {
6152 .type = HDA_FIXUP_FUNC,
6153 .v.func = alc_fixup_disable_aamix,
6155 .chain_id = ALC288_FIXUP_DELL_XPS_13_GPIO6
6157 [ALC288_FIXUP_DELL_XPS_13] = {
6158 .type = HDA_FIXUP_FUNC,
6159 .v.func = alc_fixup_dell_xps13,
6161 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
6163 [ALC292_FIXUP_DISABLE_AAMIX] = {
6164 .type = HDA_FIXUP_FUNC,
6165 .v.func = alc_fixup_disable_aamix,
6167 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
6169 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
6170 .type = HDA_FIXUP_FUNC,
6171 .v.func = alc_fixup_disable_aamix,
6173 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
6175 [ALC292_FIXUP_DELL_E7X] = {
6176 .type = HDA_FIXUP_FUNC,
6177 .v.func = alc_fixup_dell_xps13,
6179 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
6181 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6182 .type = HDA_FIXUP_PINS,
6183 .v.pins = (const struct hda_pintbl[]) {
6184 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6185 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6189 .chain_id = ALC269_FIXUP_HEADSET_MODE
6191 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
6192 .type = HDA_FIXUP_PINS,
6193 .v.pins = (const struct hda_pintbl[]) {
6194 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6198 .chain_id = ALC269_FIXUP_HEADSET_MODE
6200 [ALC275_FIXUP_DELL_XPS] = {
6201 .type = HDA_FIXUP_VERBS,
6202 .v.verbs = (const struct hda_verb[]) {
6203 /* Enables internal speaker */
6204 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
6205 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
6206 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
6207 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
6211 [ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE] = {
6212 .type = HDA_FIXUP_VERBS,
6213 .v.verbs = (const struct hda_verb[]) {
6214 /* Disable pass-through path for FRONT 14h */
6215 {0x20, AC_VERB_SET_COEF_INDEX, 0x36},
6216 {0x20, AC_VERB_SET_PROC_COEF, 0x1737},
6220 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6222 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
6223 .type = HDA_FIXUP_FUNC,
6224 .v.func = alc_fixup_disable_aamix,
6226 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
6228 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
6229 .type = HDA_FIXUP_FUNC,
6230 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
6232 [ALC255_FIXUP_DELL_SPK_NOISE] = {
6233 .type = HDA_FIXUP_FUNC,
6234 .v.func = alc_fixup_disable_aamix,
6236 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6238 [ALC225_FIXUP_DISABLE_MIC_VREF] = {
6239 .type = HDA_FIXUP_FUNC,
6240 .v.func = alc_fixup_disable_mic_vref,
6242 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
6244 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6245 .type = HDA_FIXUP_VERBS,
6246 .v.verbs = (const struct hda_verb[]) {
6247 /* Disable pass-through path for FRONT 14h */
6248 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
6249 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
6253 .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
6255 [ALC280_FIXUP_HP_HEADSET_MIC] = {
6256 .type = HDA_FIXUP_FUNC,
6257 .v.func = alc_fixup_disable_aamix,
6259 .chain_id = ALC269_FIXUP_HEADSET_MIC,
6261 [ALC221_FIXUP_HP_FRONT_MIC] = {
6262 .type = HDA_FIXUP_PINS,
6263 .v.pins = (const struct hda_pintbl[]) {
6264 { 0x19, 0x02a19020 }, /* Front Mic */
6268 [ALC292_FIXUP_TPT460] = {
6269 .type = HDA_FIXUP_FUNC,
6270 .v.func = alc_fixup_tpt440_dock,
6272 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
6274 [ALC298_FIXUP_SPK_VOLUME] = {
6275 .type = HDA_FIXUP_FUNC,
6276 .v.func = alc298_fixup_speaker_volume,
6278 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
6280 [ALC298_FIXUP_LENOVO_SPK_VOLUME] = {
6281 .type = HDA_FIXUP_FUNC,
6282 .v.func = alc298_fixup_speaker_volume,
6284 [ALC295_FIXUP_DISABLE_DAC3] = {
6285 .type = HDA_FIXUP_FUNC,
6286 .v.func = alc295_fixup_disable_dac3,
6288 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
6289 .type = HDA_FIXUP_PINS,
6290 .v.pins = (const struct hda_pintbl[]) {
6291 { 0x1b, 0x90170151 },
6295 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6297 [ALC269_FIXUP_ATIV_BOOK_8] = {
6298 .type = HDA_FIXUP_FUNC,
6299 .v.func = alc_fixup_auto_mute_via_amp,
6301 .chain_id = ALC269_FIXUP_NO_SHUTUP
6303 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
6304 .type = HDA_FIXUP_PINS,
6305 .v.pins = (const struct hda_pintbl[]) {
6306 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6307 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6311 .chain_id = ALC269_FIXUP_HEADSET_MODE
6313 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
6314 .type = HDA_FIXUP_FUNC,
6315 .v.func = alc_fixup_headset_mode,
6317 [ALC256_FIXUP_ASUS_MIC] = {
6318 .type = HDA_FIXUP_PINS,
6319 .v.pins = (const struct hda_pintbl[]) {
6320 { 0x13, 0x90a60160 }, /* use as internal mic */
6321 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
6325 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
6327 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
6328 .type = HDA_FIXUP_VERBS,
6329 .v.verbs = (const struct hda_verb[]) {
6330 /* Set up GPIO2 for the speaker amp */
6331 { 0x01, AC_VERB_SET_GPIO_MASK, 0x04 },
6332 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04 },
6333 { 0x01, AC_VERB_SET_GPIO_DATA, 0x04 },
6337 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
6338 .type = HDA_FIXUP_PINS,
6339 .v.pins = (const struct hda_pintbl[]) {
6340 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6344 .chain_id = ALC269_FIXUP_HEADSET_MIC
6346 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
6347 .type = HDA_FIXUP_VERBS,
6348 .v.verbs = (const struct hda_verb[]) {
6349 /* Enables internal speaker */
6350 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
6351 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
6355 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
6357 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
6358 .type = HDA_FIXUP_FUNC,
6359 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
6361 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
6362 .type = HDA_FIXUP_PINS,
6363 .v.pins = (const struct hda_pintbl[]) {
6364 /* Change the mic location from front to right, otherwise there are
6365 two front mics with the same name, pulseaudio can't handle them.
6366 This is just a temporary workaround, after applying this fixup,
6367 there will be one "Front Mic" and one "Mic" in this machine.
6369 { 0x1a, 0x04a19040 },
6373 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
6374 .type = HDA_FIXUP_PINS,
6375 .v.pins = (const struct hda_pintbl[]) {
6376 { 0x16, 0x0101102f }, /* Rear Headset HP */
6377 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
6378 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
6379 { 0x1b, 0x02011020 },
6383 .chain_id = ALC225_FIXUP_S3_POP_NOISE
6385 [ALC225_FIXUP_S3_POP_NOISE] = {
6386 .type = HDA_FIXUP_FUNC,
6387 .v.func = alc225_fixup_s3_pop_noise,
6389 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6391 [ALC700_FIXUP_INTEL_REFERENCE] = {
6392 .type = HDA_FIXUP_VERBS,
6393 .v.verbs = (const struct hda_verb[]) {
6394 /* Enables internal speaker */
6395 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
6396 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
6397 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
6398 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
6399 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
6400 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
6401 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
6402 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
6406 [ALC274_FIXUP_DELL_BIND_DACS] = {
6407 .type = HDA_FIXUP_FUNC,
6408 .v.func = alc274_fixup_bind_dacs,
6410 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
6412 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
6413 .type = HDA_FIXUP_PINS,
6414 .v.pins = (const struct hda_pintbl[]) {
6415 { 0x1b, 0x0401102f },
6419 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
6421 [ALC298_FIXUP_TPT470_DOCK] = {
6422 .type = HDA_FIXUP_FUNC,
6423 .v.func = alc_fixup_tpt470_dock,
6425 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
6427 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
6428 .type = HDA_FIXUP_PINS,
6429 .v.pins = (const struct hda_pintbl[]) {
6430 { 0x14, 0x0201101f },
6434 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6436 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
6437 .type = HDA_FIXUP_PINS,
6438 .v.pins = (const struct hda_pintbl[]) {
6439 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6443 .chain_id = ALC269_FIXUP_HEADSET_MIC
6445 [ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
6446 .type = HDA_FIXUP_PINS,
6447 .v.pins = (const struct hda_pintbl[]) {
6448 { 0x16, 0x01011020 }, /* Rear Line out */
6449 { 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
6453 .chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
6455 [ALC225_FIXUP_WYSE_AUTO_MUTE] = {
6456 .type = HDA_FIXUP_FUNC,
6457 .v.func = alc_fixup_auto_mute_via_amp,
6459 .chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
6461 [ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
6462 .type = HDA_FIXUP_FUNC,
6463 .v.func = alc_fixup_disable_mic_vref,
6465 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6469 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
6470 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
6471 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
6472 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
6473 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
6474 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
6475 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
6476 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
6477 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
6478 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
6479 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
6480 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
6481 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
6482 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
6483 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
6484 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
6485 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
6486 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
6487 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
6488 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
6489 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
6490 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
6491 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
6492 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
6493 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
6494 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
6495 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
6496 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
6497 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6498 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6499 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
6500 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
6501 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
6502 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
6503 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6504 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6505 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6506 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6507 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6508 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6509 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6510 SND_PCI_QUIRK(0x1028, 0x0704, "Dell XPS 13 9350", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
6511 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
6512 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
6513 SND_PCI_QUIRK(0x1028, 0x075b, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
6514 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
6515 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
6516 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
6517 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
6518 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
6519 SND_PCI_QUIRK(0x1028, 0x082a, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
6520 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
6521 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
6522 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
6523 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
6524 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
6525 SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
6526 SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
6527 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
6528 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6529 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6530 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
6531 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
6532 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
6533 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
6535 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6536 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6537 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6538 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6539 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6540 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6541 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6542 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6543 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6544 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6545 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6546 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6547 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
6548 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
6549 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
6550 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6551 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6552 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6553 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6554 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6555 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
6556 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6557 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6559 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6560 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6561 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6562 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6563 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6564 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6565 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6566 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6567 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6568 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
6569 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6570 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6571 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6572 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6573 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6574 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6575 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6576 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6577 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6578 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6579 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6580 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6581 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6582 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6583 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6584 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6585 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6586 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6587 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6588 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
6589 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
6590 SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
6591 SND_PCI_QUIRK(0x103c, 0x82bf, "HP", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
6592 SND_PCI_QUIRK(0x103c, 0x82c0, "HP", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
6593 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
6594 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
6595 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
6596 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
6597 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
6598 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
6599 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
6600 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
6601 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
6602 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
6603 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
6604 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
6605 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
6606 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
6607 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
6608 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
6609 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
6610 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
6611 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
6612 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
6613 SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
6614 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
6615 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
6616 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
6617 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
6618 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
6619 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
6620 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
6621 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
6622 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
6623 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
6624 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
6625 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
6626 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
6627 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
6628 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
6629 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
6630 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
6631 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
6632 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
6633 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
6634 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
6635 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
6636 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
6637 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
6638 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
6639 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
6640 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
6641 SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
6642 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
6643 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
6644 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
6645 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
6646 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
6647 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
6648 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
6649 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
6650 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
6651 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
6652 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
6653 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
6654 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
6655 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
6656 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
6657 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
6658 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
6659 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
6660 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
6661 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
6662 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
6663 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6664 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6665 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
6666 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
6667 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
6668 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6669 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6670 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
6671 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6672 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6673 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6674 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
6675 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
6676 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
6677 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
6678 SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
6679 SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
6680 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
6681 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
6682 SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
6683 SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
6684 SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
6685 SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940", ALC298_FIXUP_LENOVO_SPK_VOLUME),
6686 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
6687 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
6688 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
6689 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
6690 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
6691 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
6692 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
6693 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
6694 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
6695 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
6696 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
6697 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
6698 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
6699 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
6700 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
6701 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
6702 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6703 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6704 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6705 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
6706 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6707 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6708 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
6709 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
6712 /* Below is a quirk table taken from the old code.
6713 * Basically the device should work as is without the fixup table.
6714 * If BIOS doesn't give a proper info, enable the corresponding
6717 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
6719 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
6720 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
6721 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
6722 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
6723 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
6724 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
6725 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
6726 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
6727 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
6728 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
6729 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
6730 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
6731 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
6732 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
6733 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
6734 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
6735 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
6736 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
6737 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
6738 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
6739 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
6740 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
6741 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
6742 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
6743 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
6744 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
6745 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
6746 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
6747 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
6748 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
6749 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
6750 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
6751 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
6752 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
6753 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
6754 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
6755 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
6756 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
6757 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
6762 static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
6763 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
6764 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
6765 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
6766 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
6770 static const struct hda_model_fixup alc269_fixup_models[] = {
6771 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
6772 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
6773 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
6774 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
6775 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
6776 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
6777 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
6778 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
6779 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
6780 {.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
6781 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
6782 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
6783 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
6784 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
6785 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
6786 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
6787 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
6788 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
6789 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
6790 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
6793 #define ALC225_STANDARD_PINS \
6796 #define ALC256_STANDARD_PINS \
6797 {0x12, 0x90a60140}, \
6798 {0x14, 0x90170110}, \
6801 #define ALC282_STANDARD_PINS \
6804 #define ALC290_STANDARD_PINS \
6807 #define ALC292_STANDARD_PINS \
6808 {0x14, 0x90170110}, \
6811 #define ALC295_STANDARD_PINS \
6812 {0x12, 0xb7a60130}, \
6813 {0x14, 0x90170110}, \
6816 #define ALC298_STANDARD_PINS \
6817 {0x12, 0x90a60130}, \
6820 static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
6821 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
6824 {0x21, 0x02211030}),
6825 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
6828 {0x21, 0x03211020}),
6829 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
6832 {0x21, 0x03211020}),
6833 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
6834 ALC225_STANDARD_PINS,
6836 {0x14, 0x901701a0}),
6837 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
6838 ALC225_STANDARD_PINS,
6840 {0x14, 0x901701b0}),
6841 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
6842 ALC225_STANDARD_PINS,
6844 {0x14, 0x901701a0}),
6845 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
6846 ALC225_STANDARD_PINS,
6848 {0x14, 0x901701b0}),
6849 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
6850 ALC225_STANDARD_PINS,
6852 {0x1b, 0x90170110}),
6853 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6856 {0x21, 0x02211020}),
6857 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
6861 {0x21, 0x02211020}),
6862 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
6867 {0x21, 0x0221101f}),
6868 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
6873 {0x21, 0x0221101f}),
6874 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
6878 {0x21, 0x0221101f}),
6879 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6882 {0x21, 0x02211020}),
6883 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6884 {0x21, 0x02211020}),
6885 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6888 {0x21, 0x02211020}),
6889 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
6891 {0x21, 0x02211020}),
6892 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6894 {0x21, 0x02211040}),
6895 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6898 {0x21, 0x02211020}),
6899 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6902 {0x21, 0x02211030}),
6903 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6906 {0x21, 0x0221101f}),
6907 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6910 {0x21, 0x0221101f}),
6911 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6914 {0x21, 0x0221103f}),
6915 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6918 {0x21, 0x0221103f}),
6919 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6922 {0x21, 0x0221103f}),
6923 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6926 {0x21, 0x0221105f}),
6927 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6930 {0x21, 0x0221101f}),
6931 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6935 {0x21, 0x0321102f}),
6936 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6939 {0x21, 0x02211040}),
6940 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6943 {0x21, 0x02211050}),
6944 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6947 {0x21, 0x02211030}),
6948 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6951 {0x21, 0x02211040}),
6952 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6955 {0x21, 0x02211040}),
6956 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6959 {0x21, 0x02211050}),
6960 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6963 {0x21, 0x02211040}),
6964 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6967 {0x21, 0x02211030}),
6968 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6970 {0x21, 0x02211010}),
6971 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6975 {0x21, 0x0221101f}),
6976 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6979 {0x21, 0x02211030}),
6980 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6983 {0x21, 0x02211030}),
6984 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell Inspiron 5468", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6987 {0x21, 0x02211030}),
6988 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6991 {0x21, 0x02211020}),
6992 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6996 {0x21, 0x0221101f}),
6997 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6998 ALC256_STANDARD_PINS),
6999 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7002 {0x21, 0x0221101f}),
7003 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
7006 {0x21, 0x04211020}),
7007 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
7010 {0x21, 0x03211020}),
7011 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
7015 {0x21, 0x04211020}),
7016 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
7020 {0x1a, 0x04a11020}),
7021 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
7027 {0x1b, 0x02011020}),
7028 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7029 ALC282_STANDARD_PINS,
7032 {0x21, 0x0321101f}),
7033 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7034 ALC282_STANDARD_PINS,
7037 {0x21, 0x03211040}),
7038 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7039 ALC282_STANDARD_PINS,
7042 {0x21, 0x03211020}),
7043 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7044 ALC282_STANDARD_PINS,
7047 {0x21, 0x0421101f}),
7048 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
7049 ALC282_STANDARD_PINS,
7052 {0x21, 0x04211020}),
7053 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7054 ALC282_STANDARD_PINS,
7056 {0x21, 0x0321101f}),
7057 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7060 {0x21, 0x02211030}),
7061 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7062 ALC282_STANDARD_PINS,
7065 {0x21, 0x0321101f}),
7066 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL_XPS_13_GPIO6,
7069 {0x21, 0x0321101f}),
7070 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
7073 {0x21, 0x04211020}),
7074 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7075 ALC290_STANDARD_PINS,
7078 {0x1a, 0x04a11020}),
7079 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7080 ALC290_STANDARD_PINS,
7083 {0x1a, 0x04a11020}),
7084 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7085 ALC290_STANDARD_PINS,
7087 {0x1a, 0x04a11020}),
7088 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7089 ALC290_STANDARD_PINS,
7091 {0x1a, 0x04a11040}),
7092 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7093 ALC290_STANDARD_PINS,
7096 {0x1a, 0x04a11040}),
7097 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7098 ALC290_STANDARD_PINS,
7101 {0x1a, 0x04a11020}),
7102 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7103 ALC290_STANDARD_PINS,
7106 {0x1a, 0x04a11020}),
7107 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
7108 ALC292_STANDARD_PINS,
7111 {0x19, 0x01a19030}),
7112 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
7113 ALC292_STANDARD_PINS,
7117 {0x19, 0x01a1903e}),
7118 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
7119 ALC292_STANDARD_PINS,
7120 {0x12, 0x90a60140}),
7121 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
7122 ALC292_STANDARD_PINS,
7125 {0x19, 0x21a19030}),
7126 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
7127 ALC292_STANDARD_PINS,
7128 {0x13, 0x90a60140}),
7129 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7131 {0x21, 0x04211020}),
7132 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7133 ALC295_STANDARD_PINS,
7135 {0x18, 0x21a19030}),
7136 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7137 ALC295_STANDARD_PINS,
7139 {0x18, 0x21a19050}),
7140 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7141 ALC295_STANDARD_PINS),
7142 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7143 ALC298_STANDARD_PINS,
7144 {0x17, 0x90170110}),
7145 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7146 ALC298_STANDARD_PINS,
7147 {0x17, 0x90170140}),
7148 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7149 ALC298_STANDARD_PINS,
7150 {0x17, 0x90170150}),
7151 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
7156 {0x21, 0x03211030}),
7157 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
7158 ALC225_STANDARD_PINS,
7160 {0x17, 0x90170110}),
7161 SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
7166 {0x21, 0x0221101f}),
7170 static void alc269_fill_coef(struct hda_codec *codec)
7172 struct alc_spec *spec = codec->spec;
7175 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
7178 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
7179 alc_write_coef_idx(codec, 0xf, 0x960b);
7180 alc_write_coef_idx(codec, 0xe, 0x8817);
7183 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
7184 alc_write_coef_idx(codec, 0xf, 0x960b);
7185 alc_write_coef_idx(codec, 0xe, 0x8814);
7188 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
7189 /* Power up output pin */
7190 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
7193 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
7194 val = alc_read_coef_idx(codec, 0xd);
7195 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
7196 /* Capless ramp up clock control */
7197 alc_write_coef_idx(codec, 0xd, val | (1<<10));
7199 val = alc_read_coef_idx(codec, 0x17);
7200 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
7201 /* Class D power on reset */
7202 alc_write_coef_idx(codec, 0x17, val | (1<<7));
7207 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
7212 static int patch_alc269(struct hda_codec *codec)
7214 struct alc_spec *spec;
7217 err = alc_alloc_spec(codec, 0x0b);
7222 spec->gen.shared_mic_vref_pin = 0x18;
7223 codec->power_save_node = 0;
7226 codec->patch_ops.suspend = alc269_suspend;
7227 codec->patch_ops.resume = alc269_resume;
7229 spec->shutup = alc_default_shutup;
7230 spec->init_hook = alc_default_init;
7232 snd_hda_pick_fixup(codec, alc269_fixup_models,
7233 alc269_fixup_tbl, alc269_fixups);
7234 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups);
7235 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
7237 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
7239 alc_auto_parse_customize_define(codec);
7241 if (has_cdefine_beep(codec))
7242 spec->gen.beep_nid = 0x01;
7244 switch (codec->core.vendor_id) {
7246 spec->codec_variant = ALC269_TYPE_ALC269VA;
7247 switch (alc_get_coef0(codec) & 0x00f0) {
7249 if (codec->bus->pci &&
7250 codec->bus->pci->subsystem_vendor == 0x1025 &&
7251 spec->cdefine.platform_type == 1)
7252 err = alc_codec_rename(codec, "ALC271X");
7253 spec->codec_variant = ALC269_TYPE_ALC269VB;
7256 if (codec->bus->pci &&
7257 codec->bus->pci->subsystem_vendor == 0x17aa &&
7258 codec->bus->pci->subsystem_device == 0x21f3)
7259 err = alc_codec_rename(codec, "ALC3202");
7260 spec->codec_variant = ALC269_TYPE_ALC269VC;
7263 spec->codec_variant = ALC269_TYPE_ALC269VD;
7266 alc_fix_pll_init(codec, 0x20, 0x04, 15);
7270 spec->shutup = alc269_shutup;
7271 spec->init_hook = alc269_fill_coef;
7272 alc269_fill_coef(codec);
7277 spec->codec_variant = ALC269_TYPE_ALC280;
7280 spec->codec_variant = ALC269_TYPE_ALC282;
7281 spec->shutup = alc282_shutup;
7282 spec->init_hook = alc282_init;
7286 spec->codec_variant = ALC269_TYPE_ALC283;
7287 spec->shutup = alc283_shutup;
7288 spec->init_hook = alc283_init;
7292 spec->codec_variant = ALC269_TYPE_ALC284;
7295 spec->codec_variant = ALC269_TYPE_ALC293;
7299 spec->codec_variant = ALC269_TYPE_ALC286;
7300 spec->shutup = alc286_shutup;
7303 spec->codec_variant = ALC269_TYPE_ALC298;
7307 spec->codec_variant = ALC269_TYPE_ALC255;
7308 spec->shutup = alc256_shutup;
7309 spec->init_hook = alc256_init;
7313 spec->codec_variant = ALC269_TYPE_ALC256;
7314 spec->shutup = alc256_shutup;
7315 spec->init_hook = alc256_init;
7316 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
7319 spec->codec_variant = ALC269_TYPE_ALC257;
7320 spec->shutup = alc256_shutup;
7321 spec->init_hook = alc256_init;
7322 spec->gen.mixer_nid = 0;
7329 spec->codec_variant = ALC269_TYPE_ALC215;
7330 spec->gen.mixer_nid = 0;
7334 spec->codec_variant = ALC269_TYPE_ALC225;
7335 spec->gen.mixer_nid = 0; /* no loopback on ALC225 ALC295 */
7338 spec->codec_variant = ALC269_TYPE_ALC225;
7339 spec->gen.mixer_nid = 0; /* no loopback on ALC299 */
7344 spec->codec_variant = ALC269_TYPE_ALC294;
7345 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
7346 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
7347 spec->init_hook = alc294_init;
7350 spec->codec_variant = ALC269_TYPE_ALC300;
7351 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
7354 spec->codec_variant = ALC269_TYPE_ALC623;
7360 spec->codec_variant = ALC269_TYPE_ALC700;
7361 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
7362 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
7363 spec->init_hook = alc294_init;
7368 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
7369 spec->has_alc5505_dsp = 1;
7370 spec->init_hook = alc5505_dsp_init;
7373 /* automatic parse from the BIOS config */
7374 err = alc269_parse_auto_config(codec);
7378 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid)
7379 set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
7381 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
7394 static int alc861_parse_auto_config(struct hda_codec *codec)
7396 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
7397 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
7398 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
7401 /* Pin config fixes */
7403 ALC861_FIXUP_FSC_AMILO_PI1505,
7404 ALC861_FIXUP_AMP_VREF_0F,
7405 ALC861_FIXUP_NO_JACK_DETECT,
7406 ALC861_FIXUP_ASUS_A6RP,
7407 ALC660_FIXUP_ASUS_W7J,
7410 /* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
7411 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
7412 const struct hda_fixup *fix, int action)
7414 struct alc_spec *spec = codec->spec;
7417 if (action != HDA_FIXUP_ACT_INIT)
7419 val = snd_hda_codec_get_pin_target(codec, 0x0f);
7420 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
7421 val |= AC_PINCTL_IN_EN;
7422 val |= AC_PINCTL_VREF_50;
7423 snd_hda_set_pin_ctl(codec, 0x0f, val);
7424 spec->gen.keep_vref_in_automute = 1;
7427 /* suppress the jack-detection */
7428 static void alc_fixup_no_jack_detect(struct hda_codec *codec,
7429 const struct hda_fixup *fix, int action)
7431 if (action == HDA_FIXUP_ACT_PRE_PROBE)
7432 codec->no_jack_detect = 1;
7435 static const struct hda_fixup alc861_fixups[] = {
7436 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
7437 .type = HDA_FIXUP_PINS,
7438 .v.pins = (const struct hda_pintbl[]) {
7439 { 0x0b, 0x0221101f }, /* HP */
7440 { 0x0f, 0x90170310 }, /* speaker */
7444 [ALC861_FIXUP_AMP_VREF_0F] = {
7445 .type = HDA_FIXUP_FUNC,
7446 .v.func = alc861_fixup_asus_amp_vref_0f,
7448 [ALC861_FIXUP_NO_JACK_DETECT] = {
7449 .type = HDA_FIXUP_FUNC,
7450 .v.func = alc_fixup_no_jack_detect,
7452 [ALC861_FIXUP_ASUS_A6RP] = {
7453 .type = HDA_FIXUP_FUNC,
7454 .v.func = alc861_fixup_asus_amp_vref_0f,
7456 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
7458 [ALC660_FIXUP_ASUS_W7J] = {
7459 .type = HDA_FIXUP_VERBS,
7460 .v.verbs = (const struct hda_verb[]) {
7461 /* ASUS W7J needs a magic pin setup on unused NID 0x10
7462 * for enabling outputs
7464 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
7470 static const struct snd_pci_quirk alc861_fixup_tbl[] = {
7471 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
7472 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
7473 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
7474 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
7475 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
7476 SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F),
7477 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
7483 static int patch_alc861(struct hda_codec *codec)
7485 struct alc_spec *spec;
7488 err = alc_alloc_spec(codec, 0x15);
7493 spec->gen.beep_nid = 0x23;
7496 spec->power_hook = alc_power_eapd;
7499 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
7500 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
7502 /* automatic parse from the BIOS config */
7503 err = alc861_parse_auto_config(codec);
7507 if (!spec->gen.no_analog)
7508 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
7510 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
7524 * In addition, an independent DAC
7526 static int alc861vd_parse_auto_config(struct hda_codec *codec)
7528 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
7529 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
7530 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
7534 ALC660VD_FIX_ASUS_GPIO1,
7535 ALC861VD_FIX_DALLAS,
7538 /* exclude VREF80 */
7539 static void alc861vd_fixup_dallas(struct hda_codec *codec,
7540 const struct hda_fixup *fix, int action)
7542 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
7543 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
7544 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
7548 static const struct hda_fixup alc861vd_fixups[] = {
7549 [ALC660VD_FIX_ASUS_GPIO1] = {
7550 .type = HDA_FIXUP_VERBS,
7551 .v.verbs = (const struct hda_verb[]) {
7553 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
7554 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
7555 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
7559 [ALC861VD_FIX_DALLAS] = {
7560 .type = HDA_FIXUP_FUNC,
7561 .v.func = alc861vd_fixup_dallas,
7565 static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
7566 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
7567 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
7568 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
7574 static int patch_alc861vd(struct hda_codec *codec)
7576 struct alc_spec *spec;
7579 err = alc_alloc_spec(codec, 0x0b);
7584 spec->gen.beep_nid = 0x23;
7586 spec->shutup = alc_eapd_shutup;
7588 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
7589 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
7591 /* automatic parse from the BIOS config */
7592 err = alc861vd_parse_auto_config(codec);
7596 if (!spec->gen.no_analog)
7597 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
7599 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
7611 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
7612 * configuration. Each pin widget can choose any input DACs and a mixer.
7613 * Each ADC is connected from a mixer of all inputs. This makes possible
7614 * 6-channel independent captures.
7616 * In addition, an independent DAC for the multi-playback (not used in this
7621 * BIOS auto configuration
7624 static int alc662_parse_auto_config(struct hda_codec *codec)
7626 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
7627 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
7628 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
7629 const hda_nid_t *ssids;
7631 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
7632 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
7633 codec->core.vendor_id == 0x10ec0671)
7634 ssids = alc663_ssids;
7636 ssids = alc662_ssids;
7637 return alc_parse_auto_config(codec, alc662_ignore, ssids);
7640 static void alc272_fixup_mario(struct hda_codec *codec,
7641 const struct hda_fixup *fix, int action)
7643 if (action != HDA_FIXUP_ACT_PRE_PROBE)
7645 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
7646 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
7647 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
7648 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
7649 (0 << AC_AMPCAP_MUTE_SHIFT)))
7650 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
7653 static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
7655 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
7657 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
7658 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
7662 /* override the 2.1 chmap */
7663 static void alc_fixup_bass_chmap(struct hda_codec *codec,
7664 const struct hda_fixup *fix, int action)
7666 if (action == HDA_FIXUP_ACT_BUILD) {
7667 struct alc_spec *spec = codec->spec;
7668 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
7672 /* avoid D3 for keeping GPIO up */
7673 static unsigned int gpio_led_power_filter(struct hda_codec *codec,
7675 unsigned int power_state)
7677 struct alc_spec *spec = codec->spec;
7678 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_led)
7683 static void alc662_fixup_led_gpio1(struct hda_codec *codec,
7684 const struct hda_fixup *fix, int action)
7686 struct alc_spec *spec = codec->spec;
7687 static const struct hda_verb gpio_init[] = {
7688 { 0x01, AC_VERB_SET_GPIO_MASK, 0x01 },
7689 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01 },
7693 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
7694 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
7696 spec->mute_led_polarity = 1;
7697 spec->gpio_mute_led_mask = 0x01;
7698 snd_hda_add_verbs(codec, gpio_init);
7699 codec->power_filter = gpio_led_power_filter;
7703 static void alc662_usi_automute_hook(struct hda_codec *codec,
7704 struct hda_jack_callback *jack)
7706 struct alc_spec *spec = codec->spec;
7709 snd_hda_gen_hp_automute(codec, jack);
7711 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
7713 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
7717 static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
7718 const struct hda_fixup *fix, int action)
7720 struct alc_spec *spec = codec->spec;
7721 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
7722 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
7723 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
7727 static struct coef_fw alc668_coefs[] = {
7728 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
7729 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
7730 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
7731 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
7732 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
7733 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
7734 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
7735 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
7736 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
7737 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
7738 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
7739 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
7740 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
7741 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
7742 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
7743 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
7744 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
7745 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
7746 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
7747 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
7751 static void alc668_restore_default_value(struct hda_codec *codec)
7753 alc_process_coef_fw(codec, alc668_coefs);
7757 ALC662_FIXUP_ASPIRE,
7758 ALC662_FIXUP_LED_GPIO1,
7759 ALC662_FIXUP_IDEAPAD,
7761 ALC662_FIXUP_CZC_P10T,
7762 ALC662_FIXUP_SKU_IGNORE,
7763 ALC662_FIXUP_HP_RP5800,
7764 ALC662_FIXUP_ASUS_MODE1,
7765 ALC662_FIXUP_ASUS_MODE2,
7766 ALC662_FIXUP_ASUS_MODE3,
7767 ALC662_FIXUP_ASUS_MODE4,
7768 ALC662_FIXUP_ASUS_MODE5,
7769 ALC662_FIXUP_ASUS_MODE6,
7770 ALC662_FIXUP_ASUS_MODE7,
7771 ALC662_FIXUP_ASUS_MODE8,
7772 ALC662_FIXUP_NO_JACK_DETECT,
7773 ALC662_FIXUP_ZOTAC_Z68,
7774 ALC662_FIXUP_INV_DMIC,
7775 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
7776 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
7777 ALC662_FIXUP_HEADSET_MODE,
7778 ALC668_FIXUP_HEADSET_MODE,
7779 ALC662_FIXUP_BASS_MODE4_CHMAP,
7780 ALC662_FIXUP_BASS_16,
7781 ALC662_FIXUP_BASS_1A,
7782 ALC662_FIXUP_BASS_CHMAP,
7783 ALC668_FIXUP_AUTO_MUTE,
7784 ALC668_FIXUP_DELL_DISABLE_AAMIX,
7785 ALC668_FIXUP_DELL_XPS13,
7786 ALC662_FIXUP_ASUS_Nx50,
7787 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
7788 ALC668_FIXUP_ASUS_Nx51,
7789 ALC668_FIXUP_MIC_COEF,
7790 ALC668_FIXUP_ASUS_G751,
7791 ALC891_FIXUP_HEADSET_MODE,
7792 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
7793 ALC662_FIXUP_ACER_VERITON,
7794 ALC892_FIXUP_ASROCK_MOBO,
7795 ALC662_FIXUP_USI_FUNC,
7796 ALC662_FIXUP_USI_HEADSET_MODE,
7797 ALC662_FIXUP_LENOVO_MULTI_CODECS,
7800 static const struct hda_fixup alc662_fixups[] = {
7801 [ALC662_FIXUP_ASPIRE] = {
7802 .type = HDA_FIXUP_PINS,
7803 .v.pins = (const struct hda_pintbl[]) {
7804 { 0x15, 0x99130112 }, /* subwoofer */
7808 [ALC662_FIXUP_LED_GPIO1] = {
7809 .type = HDA_FIXUP_FUNC,
7810 .v.func = alc662_fixup_led_gpio1,
7812 [ALC662_FIXUP_IDEAPAD] = {
7813 .type = HDA_FIXUP_PINS,
7814 .v.pins = (const struct hda_pintbl[]) {
7815 { 0x17, 0x99130112 }, /* subwoofer */
7819 .chain_id = ALC662_FIXUP_LED_GPIO1,
7821 [ALC272_FIXUP_MARIO] = {
7822 .type = HDA_FIXUP_FUNC,
7823 .v.func = alc272_fixup_mario,
7825 [ALC662_FIXUP_CZC_P10T] = {
7826 .type = HDA_FIXUP_VERBS,
7827 .v.verbs = (const struct hda_verb[]) {
7828 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
7832 [ALC662_FIXUP_SKU_IGNORE] = {
7833 .type = HDA_FIXUP_FUNC,
7834 .v.func = alc_fixup_sku_ignore,
7836 [ALC662_FIXUP_HP_RP5800] = {
7837 .type = HDA_FIXUP_PINS,
7838 .v.pins = (const struct hda_pintbl[]) {
7839 { 0x14, 0x0221201f }, /* HP out */
7843 .chain_id = ALC662_FIXUP_SKU_IGNORE
7845 [ALC662_FIXUP_ASUS_MODE1] = {
7846 .type = HDA_FIXUP_PINS,
7847 .v.pins = (const struct hda_pintbl[]) {
7848 { 0x14, 0x99130110 }, /* speaker */
7849 { 0x18, 0x01a19c20 }, /* mic */
7850 { 0x19, 0x99a3092f }, /* int-mic */
7851 { 0x21, 0x0121401f }, /* HP out */
7855 .chain_id = ALC662_FIXUP_SKU_IGNORE
7857 [ALC662_FIXUP_ASUS_MODE2] = {
7858 .type = HDA_FIXUP_PINS,
7859 .v.pins = (const struct hda_pintbl[]) {
7860 { 0x14, 0x99130110 }, /* speaker */
7861 { 0x18, 0x01a19820 }, /* mic */
7862 { 0x19, 0x99a3092f }, /* int-mic */
7863 { 0x1b, 0x0121401f }, /* HP out */
7867 .chain_id = ALC662_FIXUP_SKU_IGNORE
7869 [ALC662_FIXUP_ASUS_MODE3] = {
7870 .type = HDA_FIXUP_PINS,
7871 .v.pins = (const struct hda_pintbl[]) {
7872 { 0x14, 0x99130110 }, /* speaker */
7873 { 0x15, 0x0121441f }, /* HP */
7874 { 0x18, 0x01a19840 }, /* mic */
7875 { 0x19, 0x99a3094f }, /* int-mic */
7876 { 0x21, 0x01211420 }, /* HP2 */
7880 .chain_id = ALC662_FIXUP_SKU_IGNORE
7882 [ALC662_FIXUP_ASUS_MODE4] = {
7883 .type = HDA_FIXUP_PINS,
7884 .v.pins = (const struct hda_pintbl[]) {
7885 { 0x14, 0x99130110 }, /* speaker */
7886 { 0x16, 0x99130111 }, /* speaker */
7887 { 0x18, 0x01a19840 }, /* mic */
7888 { 0x19, 0x99a3094f }, /* int-mic */
7889 { 0x21, 0x0121441f }, /* HP */
7893 .chain_id = ALC662_FIXUP_SKU_IGNORE
7895 [ALC662_FIXUP_ASUS_MODE5] = {
7896 .type = HDA_FIXUP_PINS,
7897 .v.pins = (const struct hda_pintbl[]) {
7898 { 0x14, 0x99130110 }, /* speaker */
7899 { 0x15, 0x0121441f }, /* HP */
7900 { 0x16, 0x99130111 }, /* speaker */
7901 { 0x18, 0x01a19840 }, /* mic */
7902 { 0x19, 0x99a3094f }, /* int-mic */
7906 .chain_id = ALC662_FIXUP_SKU_IGNORE
7908 [ALC662_FIXUP_ASUS_MODE6] = {
7909 .type = HDA_FIXUP_PINS,
7910 .v.pins = (const struct hda_pintbl[]) {
7911 { 0x14, 0x99130110 }, /* speaker */
7912 { 0x15, 0x01211420 }, /* HP2 */
7913 { 0x18, 0x01a19840 }, /* mic */
7914 { 0x19, 0x99a3094f }, /* int-mic */
7915 { 0x1b, 0x0121441f }, /* HP */
7919 .chain_id = ALC662_FIXUP_SKU_IGNORE
7921 [ALC662_FIXUP_ASUS_MODE7] = {
7922 .type = HDA_FIXUP_PINS,
7923 .v.pins = (const struct hda_pintbl[]) {
7924 { 0x14, 0x99130110 }, /* speaker */
7925 { 0x17, 0x99130111 }, /* speaker */
7926 { 0x18, 0x01a19840 }, /* mic */
7927 { 0x19, 0x99a3094f }, /* int-mic */
7928 { 0x1b, 0x01214020 }, /* HP */
7929 { 0x21, 0x0121401f }, /* HP */
7933 .chain_id = ALC662_FIXUP_SKU_IGNORE
7935 [ALC662_FIXUP_ASUS_MODE8] = {
7936 .type = HDA_FIXUP_PINS,
7937 .v.pins = (const struct hda_pintbl[]) {
7938 { 0x14, 0x99130110 }, /* speaker */
7939 { 0x12, 0x99a30970 }, /* int-mic */
7940 { 0x15, 0x01214020 }, /* HP */
7941 { 0x17, 0x99130111 }, /* speaker */
7942 { 0x18, 0x01a19840 }, /* mic */
7943 { 0x21, 0x0121401f }, /* HP */
7947 .chain_id = ALC662_FIXUP_SKU_IGNORE
7949 [ALC662_FIXUP_NO_JACK_DETECT] = {
7950 .type = HDA_FIXUP_FUNC,
7951 .v.func = alc_fixup_no_jack_detect,
7953 [ALC662_FIXUP_ZOTAC_Z68] = {
7954 .type = HDA_FIXUP_PINS,
7955 .v.pins = (const struct hda_pintbl[]) {
7956 { 0x1b, 0x02214020 }, /* Front HP */
7960 [ALC662_FIXUP_INV_DMIC] = {
7961 .type = HDA_FIXUP_FUNC,
7962 .v.func = alc_fixup_inv_dmic,
7964 [ALC668_FIXUP_DELL_XPS13] = {
7965 .type = HDA_FIXUP_FUNC,
7966 .v.func = alc_fixup_dell_xps13,
7968 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
7970 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
7971 .type = HDA_FIXUP_FUNC,
7972 .v.func = alc_fixup_disable_aamix,
7974 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
7976 [ALC668_FIXUP_AUTO_MUTE] = {
7977 .type = HDA_FIXUP_FUNC,
7978 .v.func = alc_fixup_auto_mute_via_amp,
7980 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
7982 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
7983 .type = HDA_FIXUP_PINS,
7984 .v.pins = (const struct hda_pintbl[]) {
7985 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
7986 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
7990 .chain_id = ALC662_FIXUP_HEADSET_MODE
7992 [ALC662_FIXUP_HEADSET_MODE] = {
7993 .type = HDA_FIXUP_FUNC,
7994 .v.func = alc_fixup_headset_mode_alc662,
7996 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
7997 .type = HDA_FIXUP_PINS,
7998 .v.pins = (const struct hda_pintbl[]) {
7999 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
8000 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
8004 .chain_id = ALC668_FIXUP_HEADSET_MODE
8006 [ALC668_FIXUP_HEADSET_MODE] = {
8007 .type = HDA_FIXUP_FUNC,
8008 .v.func = alc_fixup_headset_mode_alc668,
8010 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
8011 .type = HDA_FIXUP_FUNC,
8012 .v.func = alc_fixup_bass_chmap,
8014 .chain_id = ALC662_FIXUP_ASUS_MODE4
8016 [ALC662_FIXUP_BASS_16] = {
8017 .type = HDA_FIXUP_PINS,
8018 .v.pins = (const struct hda_pintbl[]) {
8019 {0x16, 0x80106111}, /* bass speaker */
8023 .chain_id = ALC662_FIXUP_BASS_CHMAP,
8025 [ALC662_FIXUP_BASS_1A] = {
8026 .type = HDA_FIXUP_PINS,
8027 .v.pins = (const struct hda_pintbl[]) {
8028 {0x1a, 0x80106111}, /* bass speaker */
8032 .chain_id = ALC662_FIXUP_BASS_CHMAP,
8034 [ALC662_FIXUP_BASS_CHMAP] = {
8035 .type = HDA_FIXUP_FUNC,
8036 .v.func = alc_fixup_bass_chmap,
8038 [ALC662_FIXUP_ASUS_Nx50] = {
8039 .type = HDA_FIXUP_FUNC,
8040 .v.func = alc_fixup_auto_mute_via_amp,
8042 .chain_id = ALC662_FIXUP_BASS_1A
8044 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
8045 .type = HDA_FIXUP_FUNC,
8046 .v.func = alc_fixup_headset_mode_alc668,
8047 .chain_id = ALC662_FIXUP_BASS_CHMAP
8049 [ALC668_FIXUP_ASUS_Nx51] = {
8050 .type = HDA_FIXUP_PINS,
8051 .v.pins = (const struct hda_pintbl[]) {
8052 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
8053 { 0x1a, 0x90170151 }, /* bass speaker */
8054 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
8058 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
8060 [ALC668_FIXUP_MIC_COEF] = {
8061 .type = HDA_FIXUP_VERBS,
8062 .v.verbs = (const struct hda_verb[]) {
8063 { 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
8064 { 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
8068 [ALC668_FIXUP_ASUS_G751] = {
8069 .type = HDA_FIXUP_PINS,
8070 .v.pins = (const struct hda_pintbl[]) {
8071 { 0x16, 0x0421101f }, /* HP */
8075 .chain_id = ALC668_FIXUP_MIC_COEF
8077 [ALC891_FIXUP_HEADSET_MODE] = {
8078 .type = HDA_FIXUP_FUNC,
8079 .v.func = alc_fixup_headset_mode,
8081 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
8082 .type = HDA_FIXUP_PINS,
8083 .v.pins = (const struct hda_pintbl[]) {
8084 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
8085 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
8089 .chain_id = ALC891_FIXUP_HEADSET_MODE
8091 [ALC662_FIXUP_ACER_VERITON] = {
8092 .type = HDA_FIXUP_PINS,
8093 .v.pins = (const struct hda_pintbl[]) {
8094 { 0x15, 0x50170120 }, /* no internal speaker */
8098 [ALC892_FIXUP_ASROCK_MOBO] = {
8099 .type = HDA_FIXUP_PINS,
8100 .v.pins = (const struct hda_pintbl[]) {
8101 { 0x15, 0x40f000f0 }, /* disabled */
8102 { 0x16, 0x40f000f0 }, /* disabled */
8106 [ALC662_FIXUP_USI_FUNC] = {
8107 .type = HDA_FIXUP_FUNC,
8108 .v.func = alc662_fixup_usi_headset_mic,
8110 [ALC662_FIXUP_USI_HEADSET_MODE] = {
8111 .type = HDA_FIXUP_PINS,
8112 .v.pins = (const struct hda_pintbl[]) {
8113 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
8114 { 0x18, 0x01a1903d },
8118 .chain_id = ALC662_FIXUP_USI_FUNC
8120 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
8121 .type = HDA_FIXUP_FUNC,
8122 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
8126 static const struct snd_pci_quirk alc662_fixup_tbl[] = {
8127 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
8128 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
8129 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
8130 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
8131 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
8132 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
8133 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
8134 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
8135 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8136 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8137 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
8138 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
8139 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
8140 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8141 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8142 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8143 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8144 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8145 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
8146 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
8147 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
8148 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
8149 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
8150 SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
8151 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
8152 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
8153 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
8154 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
8155 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
8156 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
8157 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
8158 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
8159 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
8160 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
8161 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
8162 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
8163 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
8164 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
8165 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
8166 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
8167 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
8168 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
8171 /* Below is a quirk table taken from the old code.
8172 * Basically the device should work as is without the fixup table.
8173 * If BIOS doesn't give a proper info, enable the corresponding
8176 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
8177 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
8178 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
8179 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
8180 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8181 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8182 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8183 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
8184 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
8185 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8186 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
8187 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
8188 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
8189 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
8190 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
8191 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8192 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
8193 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
8194 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8195 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
8196 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
8197 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8198 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
8199 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
8200 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
8201 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8202 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
8203 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
8204 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8205 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
8206 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8207 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8208 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
8209 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
8210 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
8211 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
8212 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
8213 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
8214 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
8215 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8216 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
8217 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
8218 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8219 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
8220 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
8221 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
8222 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
8223 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
8224 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8225 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
8230 static const struct hda_model_fixup alc662_fixup_models[] = {
8231 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
8232 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
8233 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
8234 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
8235 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
8236 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
8237 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
8238 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
8239 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
8240 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
8241 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
8242 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
8246 static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
8247 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
8251 {0x21, 0x01014020}),
8252 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
8256 {0x21, 0x01014020}),
8257 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
8261 {0x1b, 0x0221401f}),
8262 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8266 {0x16, 0x03011020}),
8267 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8271 {0x16, 0x03011020}),
8272 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8276 {0x16, 0x03011020}),
8277 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8280 {0x16, 0x03011020}),
8281 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
8284 {0x15, 0x0321101f}),
8290 static int patch_alc662(struct hda_codec *codec)
8292 struct alc_spec *spec;
8295 err = alc_alloc_spec(codec, 0x0b);
8301 spec->shutup = alc_eapd_shutup;
8303 /* handle multiple HPs as is */
8304 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
8306 alc_fix_pll_init(codec, 0x20, 0x04, 15);
8308 switch (codec->core.vendor_id) {
8310 spec->init_hook = alc668_restore_default_value;
8314 snd_hda_pick_fixup(codec, alc662_fixup_models,
8315 alc662_fixup_tbl, alc662_fixups);
8316 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups);
8317 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
8319 alc_auto_parse_customize_define(codec);
8321 if (has_cdefine_beep(codec))
8322 spec->gen.beep_nid = 0x01;
8324 if ((alc_get_coef0(codec) & (1 << 14)) &&
8325 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
8326 spec->cdefine.platform_type == 1) {
8327 err = alc_codec_rename(codec, "ALC272X");
8332 /* automatic parse from the BIOS config */
8333 err = alc662_parse_auto_config(codec);
8337 if (!spec->gen.no_analog && spec->gen.beep_nid) {
8338 switch (codec->core.vendor_id) {
8340 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
8346 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
8349 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
8354 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
8367 static int alc680_parse_auto_config(struct hda_codec *codec)
8369 return alc_parse_auto_config(codec, NULL, NULL);
8374 static int patch_alc680(struct hda_codec *codec)
8378 /* ALC680 has no aa-loopback mixer */
8379 err = alc_alloc_spec(codec, 0);
8383 /* automatic parse from the BIOS config */
8384 err = alc680_parse_auto_config(codec);
8396 static const struct hda_device_id snd_hda_id_realtek[] = {
8397 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
8398 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
8399 HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
8400 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
8401 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
8402 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
8403 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
8404 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
8405 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
8406 HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
8407 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
8408 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
8409 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
8410 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
8411 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
8412 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
8413 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
8414 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
8415 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
8416 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
8417 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
8418 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
8419 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
8420 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
8421 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
8422 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
8423 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
8424 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
8425 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
8426 HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
8427 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
8428 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
8429 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
8430 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
8431 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
8432 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
8433 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
8434 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
8435 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
8436 HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
8437 HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
8438 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
8439 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
8440 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
8441 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
8442 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
8443 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
8444 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
8445 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
8446 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
8447 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
8448 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
8449 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
8450 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
8451 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
8452 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
8453 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
8454 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
8455 HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
8456 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
8457 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
8458 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
8459 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
8460 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
8461 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
8462 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
8463 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
8464 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
8465 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
8466 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
8467 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
8468 HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
8469 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
8470 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
8471 HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
8472 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
8473 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
8476 MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
8478 MODULE_LICENSE("GPL");
8479 MODULE_DESCRIPTION("Realtek HD-audio codec");
8481 static struct hda_codec_driver realtek_driver = {
8482 .id = snd_hda_id_realtek,
8485 module_hda_codec_driver(realtek_driver);