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 <sound/core.h>
33 #include <sound/jack.h>
34 #include "hda_codec.h"
35 #include "hda_local.h"
36 #include "hda_auto_parser.h"
38 #include "hda_generic.h"
40 /* keep halting ALC5505 DSP, for power saving */
41 #define HALT_REALTEK_ALC5505
44 #define GPIO_MASK 0x03
46 /* extra amp-initialization sequence types */
56 ALC_HEADSET_MODE_UNKNOWN,
57 ALC_HEADSET_MODE_UNPLUGGED,
58 ALC_HEADSET_MODE_HEADSET,
60 ALC_HEADSET_MODE_HEADPHONE,
64 ALC_HEADSET_TYPE_UNKNOWN,
65 ALC_HEADSET_TYPE_CTIA,
66 ALC_HEADSET_TYPE_OMTP,
69 struct alc_customize_define {
71 unsigned char port_connectivity;
72 unsigned char check_sum;
73 unsigned char customization;
74 unsigned char external_amp;
75 unsigned int enable_pcbeep:1;
76 unsigned int platform_type:1;
78 unsigned int override:1;
79 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
83 struct hda_gen_spec gen; /* must be at head */
85 /* codec parameterization */
86 const struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
87 unsigned int num_mixers;
88 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
90 struct alc_customize_define cdefine;
91 unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
93 /* mute LED for HP laptops, see alc269_fixup_mic_mute_hook() */
94 int mute_led_polarity;
95 hda_nid_t mute_led_nid;
96 hda_nid_t cap_mute_led_nid;
98 unsigned int gpio_led; /* used for alc269_fixup_hp_gpio_led() */
100 hda_nid_t headset_mic_pin;
101 hda_nid_t headphone_mic_pin;
102 int current_headset_mode;
103 int current_headset_type;
106 void (*init_hook)(struct hda_codec *codec);
108 void (*power_hook)(struct hda_codec *codec);
110 void (*shutup)(struct hda_codec *codec);
113 int codec_variant; /* flag for other variants */
114 unsigned int has_alc5505_dsp:1;
115 unsigned int no_depop_delay:1;
119 unsigned int pll_coef_idx, pll_coef_bit;
124 * COEF access helper functions
127 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
128 unsigned int coef_idx)
132 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
133 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
137 #define alc_read_coef_idx(codec, coef_idx) \
138 alc_read_coefex_idx(codec, 0x20, coef_idx)
140 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
141 unsigned int coef_idx, unsigned int coef_val)
143 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
144 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
147 #define alc_write_coef_idx(codec, coef_idx, coef_val) \
148 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
150 static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
151 unsigned int coef_idx, unsigned int mask,
152 unsigned int bits_set)
154 unsigned int val = alc_read_coefex_idx(codec, nid, coef_idx);
157 alc_write_coefex_idx(codec, nid, coef_idx,
158 (val & ~mask) | bits_set);
161 #define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
162 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
164 /* a special bypass for COEF 0; read the cached value at the second time */
165 static unsigned int alc_get_coef0(struct hda_codec *codec)
167 struct alc_spec *spec = codec->spec;
170 spec->coef0 = alc_read_coef_idx(codec, 0);
174 /* coef writes/updates batch */
182 #define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
183 { .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
184 #define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
185 #define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
186 #define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
188 static void alc_process_coef_fw(struct hda_codec *codec,
189 const struct coef_fw *fw)
191 for (; fw->nid; fw++) {
192 if (fw->mask == (unsigned short)-1)
193 alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
195 alc_update_coefex_idx(codec, fw->nid, fw->idx,
201 * Append the given mixer and verb elements for the later use
202 * The mixer array is referred in build_controls(), and init_verbs are
205 static void add_mixer(struct alc_spec *spec, const struct snd_kcontrol_new *mix)
207 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
209 spec->mixers[spec->num_mixers++] = mix;
213 * GPIO setup tables, used in initialization
215 /* Enable GPIO mask and set output */
216 static const struct hda_verb alc_gpio1_init_verbs[] = {
217 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
218 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
219 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
223 static const struct hda_verb alc_gpio2_init_verbs[] = {
224 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
225 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
226 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
230 static const struct hda_verb alc_gpio3_init_verbs[] = {
231 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
232 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
233 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
238 * Fix hardware PLL issue
239 * On some codecs, the analog PLL gating control must be off while
240 * the default value is 1.
242 static void alc_fix_pll(struct hda_codec *codec)
244 struct alc_spec *spec = codec->spec;
247 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
248 1 << spec->pll_coef_bit, 0);
251 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
252 unsigned int coef_idx, unsigned int coef_bit)
254 struct alc_spec *spec = codec->spec;
256 spec->pll_coef_idx = coef_idx;
257 spec->pll_coef_bit = coef_bit;
261 /* update the master volume per volume-knob's unsol event */
262 static void alc_update_knob_master(struct hda_codec *codec,
263 struct hda_jack_callback *jack)
266 struct snd_kcontrol *kctl;
267 struct snd_ctl_elem_value *uctl;
269 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
272 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
275 val = snd_hda_codec_read(codec, jack->tbl->nid, 0,
276 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
277 val &= HDA_AMP_VOLMASK;
278 uctl->value.integer.value[0] = val;
279 uctl->value.integer.value[1] = val;
280 kctl->put(kctl, uctl);
284 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
286 /* For some reason, the res given from ALC880 is broken.
287 Here we adjust it properly. */
288 snd_hda_jack_unsol_event(codec, res >> 2);
291 /* Change EAPD to verb control */
292 static void alc_fill_eapd_coef(struct hda_codec *codec)
296 coef = alc_get_coef0(codec);
298 switch (codec->vendor_id) {
300 alc_update_coef_idx(codec, 0x7, 0, 1<<5);
304 alc_update_coef_idx(codec, 0x7, 0, 1<<13);
307 if ((coef & 0x00f0) == 0x0010)
308 alc_update_coef_idx(codec, 0xd, 0, 1<<14);
309 if ((coef & 0x00f0) == 0x0020)
310 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
311 if ((coef & 0x00f0) == 0x0030)
312 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
318 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
326 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
330 alc_update_coef_idx(codec, 0xa, 1<<13, 0);
333 if ((coef & 0x00f0) == 0x0030)
334 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
343 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
346 alc_update_coef_idx(codec, 0x7, 3<<13, 0);
349 alc_update_coef_idx(codec, 0x4, 1<<10, 0);
352 if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
353 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
356 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
360 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
365 /* additional initialization for ALC888 variants */
366 static void alc888_coef_init(struct hda_codec *codec)
368 switch (alc_get_coef0(codec) & 0x00f0) {
373 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
378 /* turn on/off EAPD control (only if available) */
379 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
381 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
383 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
384 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
388 /* turn on/off EAPD controls of the codec */
389 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
391 /* We currently only handle front, HP */
392 static hda_nid_t pins[] = {
393 0x0f, 0x10, 0x14, 0x15, 0
396 for (p = pins; *p; p++)
397 set_eapd(codec, *p, on);
400 /* generic shutup callback;
401 * just turning off EPAD and a little pause for avoiding pop-noise
403 static void alc_eapd_shutup(struct hda_codec *codec)
405 struct alc_spec *spec = codec->spec;
407 alc_auto_setup_eapd(codec, false);
408 if (!spec->no_depop_delay)
410 snd_hda_shutup_pins(codec);
413 /* generic EAPD initialization */
414 static void alc_auto_init_amp(struct hda_codec *codec, int type)
416 alc_fill_eapd_coef(codec);
417 alc_auto_setup_eapd(codec, true);
420 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
423 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
426 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
428 case ALC_INIT_DEFAULT:
429 switch (codec->vendor_id) {
431 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
437 alc_update_coef_idx(codec, 7, 0, 0x2030);
440 alc888_coef_init(codec);
449 * Realtek SSID verification
452 /* Could be any non-zero and even value. When used as fixup, tells
453 * the driver to ignore any present sku defines.
455 #define ALC_FIXUP_SKU_IGNORE (2)
457 static void alc_fixup_sku_ignore(struct hda_codec *codec,
458 const struct hda_fixup *fix, int action)
460 struct alc_spec *spec = codec->spec;
461 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
462 spec->cdefine.fixup = 1;
463 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
467 static void alc_fixup_no_depop_delay(struct hda_codec *codec,
468 const struct hda_fixup *fix, int action)
470 struct alc_spec *spec = codec->spec;
472 if (action == HDA_FIXUP_ACT_PROBE) {
473 spec->no_depop_delay = 1;
474 codec->depop_delay = 0;
478 static int alc_auto_parse_customize_define(struct hda_codec *codec)
480 unsigned int ass, tmp, i;
482 struct alc_spec *spec = codec->spec;
484 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
486 if (spec->cdefine.fixup) {
487 ass = spec->cdefine.sku_cfg;
488 if (ass == ALC_FIXUP_SKU_IGNORE)
493 if (!codec->bus->pci)
495 ass = codec->subsystem_id & 0xffff;
496 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
500 if (codec->vendor_id == 0x10ec0260)
502 ass = snd_hda_codec_get_pincfg(codec, nid);
505 codec_info(codec, "%s: SKU not ready 0x%08x\n",
506 codec->chip_name, ass);
512 for (i = 1; i < 16; i++) {
516 if (((ass >> 16) & 0xf) != tmp)
519 spec->cdefine.port_connectivity = ass >> 30;
520 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
521 spec->cdefine.check_sum = (ass >> 16) & 0xf;
522 spec->cdefine.customization = ass >> 8;
524 spec->cdefine.sku_cfg = ass;
525 spec->cdefine.external_amp = (ass & 0x38) >> 3;
526 spec->cdefine.platform_type = (ass & 0x4) >> 2;
527 spec->cdefine.swap = (ass & 0x2) >> 1;
528 spec->cdefine.override = ass & 0x1;
530 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
531 nid, spec->cdefine.sku_cfg);
532 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
533 spec->cdefine.port_connectivity);
534 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
535 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
536 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
537 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
538 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
539 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
540 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
545 /* return the position of NID in the list, or -1 if not found */
546 static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
549 for (i = 0; i < nums; i++)
554 /* return true if the given NID is found in the list */
555 static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
557 return find_idx_in_nid_list(nid, list, nums) >= 0;
560 /* check subsystem ID and set up device-specific initialization;
561 * return 1 if initialized, 0 if invalid SSID
563 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
564 * 31 ~ 16 : Manufacture ID
566 * 7 ~ 0 : Assembly ID
567 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
569 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
571 unsigned int ass, tmp, i;
573 struct alc_spec *spec = codec->spec;
575 if (spec->cdefine.fixup) {
576 ass = spec->cdefine.sku_cfg;
577 if (ass == ALC_FIXUP_SKU_IGNORE)
582 ass = codec->subsystem_id & 0xffff;
583 if (codec->bus->pci &&
584 ass != codec->bus->pci->subsystem_device && (ass & 1))
587 /* invalid SSID, check the special NID pin defcfg instead */
589 * 31~30 : port connectivity
592 * 19~16 : Check sum (15:1)
597 if (codec->vendor_id == 0x10ec0260)
599 ass = snd_hda_codec_get_pincfg(codec, nid);
601 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
605 if ((ass >> 30) != 1) /* no physical connection */
610 for (i = 1; i < 16; i++) {
614 if (((ass >> 16) & 0xf) != tmp)
617 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
618 ass & 0xffff, codec->vendor_id);
622 * 2 : 0 --> Desktop, 1 --> Laptop
623 * 3~5 : External Amplifier control
626 tmp = (ass & 0x38) >> 3; /* external Amp control */
629 spec->init_amp = ALC_INIT_GPIO1;
632 spec->init_amp = ALC_INIT_GPIO2;
635 spec->init_amp = ALC_INIT_GPIO3;
639 spec->init_amp = ALC_INIT_DEFAULT;
643 /* is laptop or Desktop and enable the function "Mute internal speaker
644 * when the external headphone out jack is plugged"
649 * 10~8 : Jack location
650 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
652 * 15 : 1 --> enable the function "Mute internal speaker
653 * when the external headphone out jack is plugged"
655 if (!spec->gen.autocfg.hp_pins[0] &&
656 !(spec->gen.autocfg.line_out_pins[0] &&
657 spec->gen.autocfg.line_out_type == AUTO_PIN_HP_OUT)) {
659 tmp = (ass >> 11) & 0x3; /* HP to chassis */
661 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
662 spec->gen.autocfg.line_outs))
664 spec->gen.autocfg.hp_pins[0] = nid;
669 /* Check the validity of ALC subsystem-id
670 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
671 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
673 if (!alc_subsystem_id(codec, ports)) {
674 struct alc_spec *spec = codec->spec;
676 "realtek: Enable default setup for auto mode as fallback\n");
677 spec->init_amp = ALC_INIT_DEFAULT;
684 static void alc_fixup_inv_dmic(struct hda_codec *codec,
685 const struct hda_fixup *fix, int action)
687 struct alc_spec *spec = codec->spec;
689 spec->gen.inv_dmic_split = 1;
693 #ifdef CONFIG_SND_HDA_INPUT_BEEP
694 /* additional beep mixers; the actual parameters are overwritten at build */
695 static const struct snd_kcontrol_new alc_beep_mixer[] = {
696 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
697 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
702 static int alc_build_controls(struct hda_codec *codec)
704 struct alc_spec *spec = codec->spec;
707 err = snd_hda_gen_build_controls(codec);
711 for (i = 0; i < spec->num_mixers; i++) {
712 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
717 #ifdef CONFIG_SND_HDA_INPUT_BEEP
718 /* create beep controls if needed */
719 if (spec->beep_amp) {
720 const struct snd_kcontrol_new *knew;
721 for (knew = alc_beep_mixer; knew->name; knew++) {
722 struct snd_kcontrol *kctl;
723 kctl = snd_ctl_new1(knew, codec);
726 kctl->private_value = spec->beep_amp;
727 err = snd_hda_ctl_add(codec, 0, kctl);
734 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
743 static int alc_init(struct hda_codec *codec)
745 struct alc_spec *spec = codec->spec;
748 spec->init_hook(codec);
751 alc_auto_init_amp(codec, spec->init_amp);
753 snd_hda_gen_init(codec);
755 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
760 static inline void alc_shutup(struct hda_codec *codec)
762 struct alc_spec *spec = codec->spec;
764 if (spec && spec->shutup)
767 snd_hda_shutup_pins(codec);
770 #define alc_free snd_hda_gen_free
773 static void alc_power_eapd(struct hda_codec *codec)
775 alc_auto_setup_eapd(codec, false);
778 static int alc_suspend(struct hda_codec *codec)
780 struct alc_spec *spec = codec->spec;
782 if (spec && spec->power_hook)
783 spec->power_hook(codec);
789 static int alc_resume(struct hda_codec *codec)
791 struct alc_spec *spec = codec->spec;
793 if (!spec->no_depop_delay)
794 msleep(150); /* to avoid pop noise */
795 codec->patch_ops.init(codec);
796 snd_hda_codec_resume_amp(codec);
797 snd_hda_codec_resume_cache(codec);
798 hda_call_check_power_status(codec, 0x01);
805 static const struct hda_codec_ops alc_patch_ops = {
806 .build_controls = alc_build_controls,
807 .build_pcms = snd_hda_gen_build_pcms,
810 .unsol_event = snd_hda_jack_unsol_event,
812 .resume = alc_resume,
813 .suspend = alc_suspend,
814 .check_power_status = snd_hda_gen_check_power_status,
816 .reboot_notify = alc_shutup,
820 /* replace the codec chip_name with the given string */
821 static int alc_codec_rename(struct hda_codec *codec, const char *name)
823 kfree(codec->chip_name);
824 codec->chip_name = kstrdup(name, GFP_KERNEL);
825 if (!codec->chip_name) {
833 * Rename codecs appropriately from COEF value or subvendor id
835 struct alc_codec_rename_table {
836 unsigned int vendor_id;
837 unsigned short coef_mask;
838 unsigned short coef_bits;
842 struct alc_codec_rename_pci_table {
843 unsigned int codec_vendor_id;
844 unsigned short pci_subvendor;
845 unsigned short pci_subdevice;
849 static struct alc_codec_rename_table rename_tbl[] = {
850 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
851 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
852 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
853 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
854 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
855 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
856 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
857 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
858 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
859 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
860 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
861 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
862 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
863 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
864 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
865 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
866 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
870 static struct alc_codec_rename_pci_table rename_pci_tbl[] = {
871 { 0x10ec0280, 0x1028, 0, "ALC3220" },
872 { 0x10ec0282, 0x1028, 0, "ALC3221" },
873 { 0x10ec0283, 0x1028, 0, "ALC3223" },
874 { 0x10ec0288, 0x1028, 0, "ALC3263" },
875 { 0x10ec0292, 0x1028, 0, "ALC3226" },
876 { 0x10ec0293, 0x1028, 0, "ALC3235" },
877 { 0x10ec0255, 0x1028, 0, "ALC3234" },
878 { 0x10ec0668, 0x1028, 0, "ALC3661" },
879 { 0x10ec0275, 0x1028, 0, "ALC3260" },
880 { 0x10ec0899, 0x1028, 0, "ALC3861" },
881 { 0x10ec0670, 0x1025, 0, "ALC669X" },
882 { 0x10ec0676, 0x1025, 0, "ALC679X" },
883 { 0x10ec0282, 0x1043, 0, "ALC3229" },
884 { 0x10ec0233, 0x1043, 0, "ALC3236" },
885 { 0x10ec0280, 0x103c, 0, "ALC3228" },
886 { 0x10ec0282, 0x103c, 0, "ALC3227" },
887 { 0x10ec0286, 0x103c, 0, "ALC3242" },
888 { 0x10ec0290, 0x103c, 0, "ALC3241" },
889 { 0x10ec0668, 0x103c, 0, "ALC3662" },
890 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
891 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
895 static int alc_codec_rename_from_preset(struct hda_codec *codec)
897 const struct alc_codec_rename_table *p;
898 const struct alc_codec_rename_pci_table *q;
900 for (p = rename_tbl; p->vendor_id; p++) {
901 if (p->vendor_id != codec->vendor_id)
903 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
904 return alc_codec_rename(codec, p->name);
907 if (!codec->bus->pci)
909 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
910 if (q->codec_vendor_id != codec->vendor_id)
912 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
914 if (!q->pci_subdevice ||
915 q->pci_subdevice == codec->bus->pci->subsystem_device)
916 return alc_codec_rename(codec, q->name);
924 * Digital-beep handlers
926 #ifdef CONFIG_SND_HDA_INPUT_BEEP
927 #define set_beep_amp(spec, nid, idx, dir) \
928 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
930 static const struct snd_pci_quirk beep_white_list[] = {
931 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
932 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
933 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
934 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
935 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
936 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
937 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
938 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
939 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
943 static inline int has_cdefine_beep(struct hda_codec *codec)
945 struct alc_spec *spec = codec->spec;
946 const struct snd_pci_quirk *q;
947 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list);
950 return spec->cdefine.enable_pcbeep;
953 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
954 #define has_cdefine_beep(codec) 0
957 /* parse the BIOS configuration and set up the alc_spec */
958 /* return 1 if successful, 0 if the proper config is not found,
959 * or a negative error code
961 static int alc_parse_auto_config(struct hda_codec *codec,
962 const hda_nid_t *ignore_nids,
963 const hda_nid_t *ssid_nids)
965 struct alc_spec *spec = codec->spec;
966 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
969 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
975 alc_ssid_check(codec, ssid_nids);
977 err = snd_hda_gen_parse_auto_config(codec, cfg);
984 /* common preparation job for alc_spec */
985 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
987 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
993 snd_hda_gen_spec_init(&spec->gen);
994 spec->gen.mixer_nid = mixer_nid;
995 spec->gen.own_eapd_ctl = 1;
996 codec->single_adc_amp = 1;
997 /* FIXME: do we need this for all Realtek codec models? */
998 codec->spdif_status_reset = 1;
1000 err = alc_codec_rename_from_preset(codec);
1008 static int alc880_parse_auto_config(struct hda_codec *codec)
1010 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
1011 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
1012 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1021 ALC880_FIXUP_MEDION_RIM,
1023 ALC880_FIXUP_LG_LW25,
1025 ALC880_FIXUP_EAPD_COEF,
1026 ALC880_FIXUP_TCL_S700,
1027 ALC880_FIXUP_VOL_KNOB,
1028 ALC880_FIXUP_FUJITSU,
1030 ALC880_FIXUP_UNIWILL,
1031 ALC880_FIXUP_UNIWILL_DIG,
1033 ALC880_FIXUP_ASUS_W5A,
1034 ALC880_FIXUP_3ST_BASE,
1036 ALC880_FIXUP_3ST_DIG,
1037 ALC880_FIXUP_5ST_BASE,
1039 ALC880_FIXUP_5ST_DIG,
1040 ALC880_FIXUP_6ST_BASE,
1042 ALC880_FIXUP_6ST_DIG,
1043 ALC880_FIXUP_6ST_AUTOMUTE,
1046 /* enable the volume-knob widget support on NID 0x21 */
1047 static void alc880_fixup_vol_knob(struct hda_codec *codec,
1048 const struct hda_fixup *fix, int action)
1050 if (action == HDA_FIXUP_ACT_PROBE)
1051 snd_hda_jack_detect_enable_callback(codec, 0x21,
1052 alc_update_knob_master);
1055 static const struct hda_fixup alc880_fixups[] = {
1056 [ALC880_FIXUP_GPIO1] = {
1057 .type = HDA_FIXUP_VERBS,
1058 .v.verbs = alc_gpio1_init_verbs,
1060 [ALC880_FIXUP_GPIO2] = {
1061 .type = HDA_FIXUP_VERBS,
1062 .v.verbs = alc_gpio2_init_verbs,
1064 [ALC880_FIXUP_MEDION_RIM] = {
1065 .type = HDA_FIXUP_VERBS,
1066 .v.verbs = (const struct hda_verb[]) {
1067 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1068 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1072 .chain_id = ALC880_FIXUP_GPIO2,
1074 [ALC880_FIXUP_LG] = {
1075 .type = HDA_FIXUP_PINS,
1076 .v.pins = (const struct hda_pintbl[]) {
1077 /* disable bogus unused pins */
1078 { 0x16, 0x411111f0 },
1079 { 0x18, 0x411111f0 },
1080 { 0x1a, 0x411111f0 },
1084 [ALC880_FIXUP_LG_LW25] = {
1085 .type = HDA_FIXUP_PINS,
1086 .v.pins = (const struct hda_pintbl[]) {
1087 { 0x1a, 0x0181344f }, /* line-in */
1088 { 0x1b, 0x0321403f }, /* headphone */
1092 [ALC880_FIXUP_W810] = {
1093 .type = HDA_FIXUP_PINS,
1094 .v.pins = (const struct hda_pintbl[]) {
1095 /* disable bogus unused pins */
1096 { 0x17, 0x411111f0 },
1100 .chain_id = ALC880_FIXUP_GPIO2,
1102 [ALC880_FIXUP_EAPD_COEF] = {
1103 .type = HDA_FIXUP_VERBS,
1104 .v.verbs = (const struct hda_verb[]) {
1105 /* change to EAPD mode */
1106 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1107 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1111 [ALC880_FIXUP_TCL_S700] = {
1112 .type = HDA_FIXUP_VERBS,
1113 .v.verbs = (const struct hda_verb[]) {
1114 /* change to EAPD mode */
1115 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1116 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1120 .chain_id = ALC880_FIXUP_GPIO2,
1122 [ALC880_FIXUP_VOL_KNOB] = {
1123 .type = HDA_FIXUP_FUNC,
1124 .v.func = alc880_fixup_vol_knob,
1126 [ALC880_FIXUP_FUJITSU] = {
1127 /* override all pins as BIOS on old Amilo is broken */
1128 .type = HDA_FIXUP_PINS,
1129 .v.pins = (const struct hda_pintbl[]) {
1130 { 0x14, 0x0121411f }, /* HP */
1131 { 0x15, 0x99030120 }, /* speaker */
1132 { 0x16, 0x99030130 }, /* bass speaker */
1133 { 0x17, 0x411111f0 }, /* N/A */
1134 { 0x18, 0x411111f0 }, /* N/A */
1135 { 0x19, 0x01a19950 }, /* mic-in */
1136 { 0x1a, 0x411111f0 }, /* N/A */
1137 { 0x1b, 0x411111f0 }, /* N/A */
1138 { 0x1c, 0x411111f0 }, /* N/A */
1139 { 0x1d, 0x411111f0 }, /* N/A */
1140 { 0x1e, 0x01454140 }, /* SPDIF out */
1144 .chain_id = ALC880_FIXUP_VOL_KNOB,
1146 [ALC880_FIXUP_F1734] = {
1147 /* almost compatible with FUJITSU, but no bass and SPDIF */
1148 .type = HDA_FIXUP_PINS,
1149 .v.pins = (const struct hda_pintbl[]) {
1150 { 0x14, 0x0121411f }, /* HP */
1151 { 0x15, 0x99030120 }, /* speaker */
1152 { 0x16, 0x411111f0 }, /* N/A */
1153 { 0x17, 0x411111f0 }, /* N/A */
1154 { 0x18, 0x411111f0 }, /* N/A */
1155 { 0x19, 0x01a19950 }, /* mic-in */
1156 { 0x1a, 0x411111f0 }, /* N/A */
1157 { 0x1b, 0x411111f0 }, /* N/A */
1158 { 0x1c, 0x411111f0 }, /* N/A */
1159 { 0x1d, 0x411111f0 }, /* N/A */
1160 { 0x1e, 0x411111f0 }, /* N/A */
1164 .chain_id = ALC880_FIXUP_VOL_KNOB,
1166 [ALC880_FIXUP_UNIWILL] = {
1167 /* need to fix HP and speaker pins to be parsed correctly */
1168 .type = HDA_FIXUP_PINS,
1169 .v.pins = (const struct hda_pintbl[]) {
1170 { 0x14, 0x0121411f }, /* HP */
1171 { 0x15, 0x99030120 }, /* speaker */
1172 { 0x16, 0x99030130 }, /* bass speaker */
1176 [ALC880_FIXUP_UNIWILL_DIG] = {
1177 .type = HDA_FIXUP_PINS,
1178 .v.pins = (const struct hda_pintbl[]) {
1179 /* disable bogus unused pins */
1180 { 0x17, 0x411111f0 },
1181 { 0x19, 0x411111f0 },
1182 { 0x1b, 0x411111f0 },
1183 { 0x1f, 0x411111f0 },
1187 [ALC880_FIXUP_Z71V] = {
1188 .type = HDA_FIXUP_PINS,
1189 .v.pins = (const struct hda_pintbl[]) {
1190 /* set up the whole pins as BIOS is utterly broken */
1191 { 0x14, 0x99030120 }, /* speaker */
1192 { 0x15, 0x0121411f }, /* HP */
1193 { 0x16, 0x411111f0 }, /* N/A */
1194 { 0x17, 0x411111f0 }, /* N/A */
1195 { 0x18, 0x01a19950 }, /* mic-in */
1196 { 0x19, 0x411111f0 }, /* N/A */
1197 { 0x1a, 0x01813031 }, /* line-in */
1198 { 0x1b, 0x411111f0 }, /* N/A */
1199 { 0x1c, 0x411111f0 }, /* N/A */
1200 { 0x1d, 0x411111f0 }, /* N/A */
1201 { 0x1e, 0x0144111e }, /* SPDIF */
1205 [ALC880_FIXUP_ASUS_W5A] = {
1206 .type = HDA_FIXUP_PINS,
1207 .v.pins = (const struct hda_pintbl[]) {
1208 /* set up the whole pins as BIOS is utterly broken */
1209 { 0x14, 0x0121411f }, /* HP */
1210 { 0x15, 0x411111f0 }, /* N/A */
1211 { 0x16, 0x411111f0 }, /* N/A */
1212 { 0x17, 0x411111f0 }, /* N/A */
1213 { 0x18, 0x90a60160 }, /* mic */
1214 { 0x19, 0x411111f0 }, /* N/A */
1215 { 0x1a, 0x411111f0 }, /* N/A */
1216 { 0x1b, 0x411111f0 }, /* N/A */
1217 { 0x1c, 0x411111f0 }, /* N/A */
1218 { 0x1d, 0x411111f0 }, /* N/A */
1219 { 0x1e, 0xb743111e }, /* SPDIF out */
1223 .chain_id = ALC880_FIXUP_GPIO1,
1225 [ALC880_FIXUP_3ST_BASE] = {
1226 .type = HDA_FIXUP_PINS,
1227 .v.pins = (const struct hda_pintbl[]) {
1228 { 0x14, 0x01014010 }, /* line-out */
1229 { 0x15, 0x411111f0 }, /* N/A */
1230 { 0x16, 0x411111f0 }, /* N/A */
1231 { 0x17, 0x411111f0 }, /* N/A */
1232 { 0x18, 0x01a19c30 }, /* mic-in */
1233 { 0x19, 0x0121411f }, /* HP */
1234 { 0x1a, 0x01813031 }, /* line-in */
1235 { 0x1b, 0x02a19c40 }, /* front-mic */
1236 { 0x1c, 0x411111f0 }, /* N/A */
1237 { 0x1d, 0x411111f0 }, /* N/A */
1238 /* 0x1e is filled in below */
1239 { 0x1f, 0x411111f0 }, /* N/A */
1243 [ALC880_FIXUP_3ST] = {
1244 .type = HDA_FIXUP_PINS,
1245 .v.pins = (const struct hda_pintbl[]) {
1246 { 0x1e, 0x411111f0 }, /* N/A */
1250 .chain_id = ALC880_FIXUP_3ST_BASE,
1252 [ALC880_FIXUP_3ST_DIG] = {
1253 .type = HDA_FIXUP_PINS,
1254 .v.pins = (const struct hda_pintbl[]) {
1255 { 0x1e, 0x0144111e }, /* SPDIF */
1259 .chain_id = ALC880_FIXUP_3ST_BASE,
1261 [ALC880_FIXUP_5ST_BASE] = {
1262 .type = HDA_FIXUP_PINS,
1263 .v.pins = (const struct hda_pintbl[]) {
1264 { 0x14, 0x01014010 }, /* front */
1265 { 0x15, 0x411111f0 }, /* N/A */
1266 { 0x16, 0x01011411 }, /* CLFE */
1267 { 0x17, 0x01016412 }, /* surr */
1268 { 0x18, 0x01a19c30 }, /* mic-in */
1269 { 0x19, 0x0121411f }, /* HP */
1270 { 0x1a, 0x01813031 }, /* line-in */
1271 { 0x1b, 0x02a19c40 }, /* front-mic */
1272 { 0x1c, 0x411111f0 }, /* N/A */
1273 { 0x1d, 0x411111f0 }, /* N/A */
1274 /* 0x1e is filled in below */
1275 { 0x1f, 0x411111f0 }, /* N/A */
1279 [ALC880_FIXUP_5ST] = {
1280 .type = HDA_FIXUP_PINS,
1281 .v.pins = (const struct hda_pintbl[]) {
1282 { 0x1e, 0x411111f0 }, /* N/A */
1286 .chain_id = ALC880_FIXUP_5ST_BASE,
1288 [ALC880_FIXUP_5ST_DIG] = {
1289 .type = HDA_FIXUP_PINS,
1290 .v.pins = (const struct hda_pintbl[]) {
1291 { 0x1e, 0x0144111e }, /* SPDIF */
1295 .chain_id = ALC880_FIXUP_5ST_BASE,
1297 [ALC880_FIXUP_6ST_BASE] = {
1298 .type = HDA_FIXUP_PINS,
1299 .v.pins = (const struct hda_pintbl[]) {
1300 { 0x14, 0x01014010 }, /* front */
1301 { 0x15, 0x01016412 }, /* surr */
1302 { 0x16, 0x01011411 }, /* CLFE */
1303 { 0x17, 0x01012414 }, /* side */
1304 { 0x18, 0x01a19c30 }, /* mic-in */
1305 { 0x19, 0x02a19c40 }, /* front-mic */
1306 { 0x1a, 0x01813031 }, /* line-in */
1307 { 0x1b, 0x0121411f }, /* HP */
1308 { 0x1c, 0x411111f0 }, /* N/A */
1309 { 0x1d, 0x411111f0 }, /* N/A */
1310 /* 0x1e is filled in below */
1311 { 0x1f, 0x411111f0 }, /* N/A */
1315 [ALC880_FIXUP_6ST] = {
1316 .type = HDA_FIXUP_PINS,
1317 .v.pins = (const struct hda_pintbl[]) {
1318 { 0x1e, 0x411111f0 }, /* N/A */
1322 .chain_id = ALC880_FIXUP_6ST_BASE,
1324 [ALC880_FIXUP_6ST_DIG] = {
1325 .type = HDA_FIXUP_PINS,
1326 .v.pins = (const struct hda_pintbl[]) {
1327 { 0x1e, 0x0144111e }, /* SPDIF */
1331 .chain_id = ALC880_FIXUP_6ST_BASE,
1333 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1334 .type = HDA_FIXUP_PINS,
1335 .v.pins = (const struct hda_pintbl[]) {
1336 { 0x1b, 0x0121401f }, /* HP with jack detect */
1339 .chained_before = true,
1340 .chain_id = ALC880_FIXUP_6ST_BASE,
1344 static const struct snd_pci_quirk alc880_fixup_tbl[] = {
1345 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
1346 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
1347 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
1348 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
1349 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
1350 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
1351 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
1352 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
1353 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
1354 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
1355 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
1356 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
1357 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
1358 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
1359 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_FIXUP_F1734),
1360 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
1361 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
1362 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
1363 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1364 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1365 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
1366 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
1367 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
1369 /* Below is the copied entries from alc880_quirks.c.
1370 * It's not quite sure whether BIOS sets the correct pin-config table
1371 * on these machines, thus they are kept to be compatible with
1372 * the old static quirks. Once when it's confirmed to work without
1373 * these overrides, it'd be better to remove.
1375 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1376 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1377 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1378 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1379 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1380 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1381 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1382 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1383 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1384 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1385 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1386 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1387 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1388 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1389 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1390 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1391 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1392 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1393 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1394 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1395 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1396 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1397 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1398 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1399 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1400 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1401 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1402 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1403 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1404 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1405 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1406 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1407 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1409 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1410 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1411 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1415 static const struct hda_model_fixup alc880_fixup_models[] = {
1416 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1417 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1418 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1419 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1420 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1421 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
1422 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
1428 * OK, here we have finally the patch for ALC880
1430 static int patch_alc880(struct hda_codec *codec)
1432 struct alc_spec *spec;
1435 err = alc_alloc_spec(codec, 0x0b);
1440 spec->gen.need_dac_fix = 1;
1441 spec->gen.beep_nid = 0x01;
1443 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
1445 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1447 /* automatic parse from the BIOS config */
1448 err = alc880_parse_auto_config(codec);
1452 if (!spec->gen.no_analog)
1453 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1455 codec->patch_ops = alc_patch_ops;
1456 codec->patch_ops.unsol_event = alc880_unsol_event;
1459 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1472 static int alc260_parse_auto_config(struct hda_codec *codec)
1474 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
1475 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1476 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
1483 ALC260_FIXUP_HP_DC5750,
1484 ALC260_FIXUP_HP_PIN_0F,
1487 ALC260_FIXUP_GPIO1_TOGGLE,
1488 ALC260_FIXUP_REPLACER,
1489 ALC260_FIXUP_HP_B1900,
1491 ALC260_FIXUP_FSC_S7020,
1492 ALC260_FIXUP_FSC_S7020_JWSE,
1493 ALC260_FIXUP_VAIO_PINS,
1496 static void alc260_gpio1_automute(struct hda_codec *codec)
1498 struct alc_spec *spec = codec->spec;
1499 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
1500 spec->gen.hp_jack_present);
1503 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1504 const struct hda_fixup *fix, int action)
1506 struct alc_spec *spec = codec->spec;
1507 if (action == HDA_FIXUP_ACT_PROBE) {
1508 /* although the machine has only one output pin, we need to
1509 * toggle GPIO1 according to the jack state
1511 spec->gen.automute_hook = alc260_gpio1_automute;
1512 spec->gen.detect_hp = 1;
1513 spec->gen.automute_speaker = 1;
1514 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
1515 snd_hda_jack_detect_enable_callback(codec, 0x0f,
1516 snd_hda_gen_hp_automute);
1517 snd_hda_add_verbs(codec, alc_gpio1_init_verbs);
1521 static void alc260_fixup_kn1(struct hda_codec *codec,
1522 const struct hda_fixup *fix, int action)
1524 struct alc_spec *spec = codec->spec;
1525 static const struct hda_pintbl pincfgs[] = {
1526 { 0x0f, 0x02214000 }, /* HP/speaker */
1527 { 0x12, 0x90a60160 }, /* int mic */
1528 { 0x13, 0x02a19000 }, /* ext mic */
1529 { 0x18, 0x01446000 }, /* SPDIF out */
1530 /* disable bogus I/O pins */
1531 { 0x10, 0x411111f0 },
1532 { 0x11, 0x411111f0 },
1533 { 0x14, 0x411111f0 },
1534 { 0x15, 0x411111f0 },
1535 { 0x16, 0x411111f0 },
1536 { 0x17, 0x411111f0 },
1537 { 0x19, 0x411111f0 },
1542 case HDA_FIXUP_ACT_PRE_PROBE:
1543 snd_hda_apply_pincfgs(codec, pincfgs);
1545 case HDA_FIXUP_ACT_PROBE:
1546 spec->init_amp = ALC_INIT_NONE;
1551 static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1552 const struct hda_fixup *fix, int action)
1554 struct alc_spec *spec = codec->spec;
1555 if (action == HDA_FIXUP_ACT_PROBE)
1556 spec->init_amp = ALC_INIT_NONE;
1559 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1560 const struct hda_fixup *fix, int action)
1562 struct alc_spec *spec = codec->spec;
1563 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1564 spec->gen.add_jack_modes = 1;
1565 spec->gen.hp_mic = 1;
1569 static const struct hda_fixup alc260_fixups[] = {
1570 [ALC260_FIXUP_HP_DC5750] = {
1571 .type = HDA_FIXUP_PINS,
1572 .v.pins = (const struct hda_pintbl[]) {
1573 { 0x11, 0x90130110 }, /* speaker */
1577 [ALC260_FIXUP_HP_PIN_0F] = {
1578 .type = HDA_FIXUP_PINS,
1579 .v.pins = (const struct hda_pintbl[]) {
1580 { 0x0f, 0x01214000 }, /* HP */
1584 [ALC260_FIXUP_COEF] = {
1585 .type = HDA_FIXUP_VERBS,
1586 .v.verbs = (const struct hda_verb[]) {
1587 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1588 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
1592 [ALC260_FIXUP_GPIO1] = {
1593 .type = HDA_FIXUP_VERBS,
1594 .v.verbs = alc_gpio1_init_verbs,
1596 [ALC260_FIXUP_GPIO1_TOGGLE] = {
1597 .type = HDA_FIXUP_FUNC,
1598 .v.func = alc260_fixup_gpio1_toggle,
1600 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1602 [ALC260_FIXUP_REPLACER] = {
1603 .type = HDA_FIXUP_VERBS,
1604 .v.verbs = (const struct hda_verb[]) {
1605 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1606 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
1610 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1612 [ALC260_FIXUP_HP_B1900] = {
1613 .type = HDA_FIXUP_FUNC,
1614 .v.func = alc260_fixup_gpio1_toggle,
1616 .chain_id = ALC260_FIXUP_COEF,
1618 [ALC260_FIXUP_KN1] = {
1619 .type = HDA_FIXUP_FUNC,
1620 .v.func = alc260_fixup_kn1,
1622 [ALC260_FIXUP_FSC_S7020] = {
1623 .type = HDA_FIXUP_FUNC,
1624 .v.func = alc260_fixup_fsc_s7020,
1626 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1627 .type = HDA_FIXUP_FUNC,
1628 .v.func = alc260_fixup_fsc_s7020_jwse,
1630 .chain_id = ALC260_FIXUP_FSC_S7020,
1632 [ALC260_FIXUP_VAIO_PINS] = {
1633 .type = HDA_FIXUP_PINS,
1634 .v.pins = (const struct hda_pintbl[]) {
1635 /* Pin configs are missing completely on some VAIOs */
1636 { 0x0f, 0x01211020 },
1637 { 0x10, 0x0001003f },
1638 { 0x11, 0x411111f0 },
1639 { 0x12, 0x01a15930 },
1640 { 0x13, 0x411111f0 },
1641 { 0x14, 0x411111f0 },
1642 { 0x15, 0x411111f0 },
1643 { 0x16, 0x411111f0 },
1644 { 0x17, 0x411111f0 },
1645 { 0x18, 0x411111f0 },
1646 { 0x19, 0x411111f0 },
1652 static const struct snd_pci_quirk alc260_fixup_tbl[] = {
1653 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
1654 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
1655 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
1656 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
1657 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
1658 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
1659 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
1660 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
1661 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
1662 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
1663 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
1664 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
1668 static const struct hda_model_fixup alc260_fixup_models[] = {
1669 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1670 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1671 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1672 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1678 static int patch_alc260(struct hda_codec *codec)
1680 struct alc_spec *spec;
1683 err = alc_alloc_spec(codec, 0x07);
1688 /* as quite a few machines require HP amp for speaker outputs,
1689 * it's easier to enable it unconditionally; even if it's unneeded,
1690 * it's almost harmless.
1692 spec->gen.prefer_hp_amp = 1;
1693 spec->gen.beep_nid = 0x01;
1695 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1697 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1699 /* automatic parse from the BIOS config */
1700 err = alc260_parse_auto_config(codec);
1704 if (!spec->gen.no_analog)
1705 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1707 codec->patch_ops = alc_patch_ops;
1708 spec->shutup = alc_eapd_shutup;
1710 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1721 * ALC882/883/885/888/889 support
1723 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1724 * configuration. Each pin widget can choose any input DACs and a mixer.
1725 * Each ADC is connected from a mixer of all inputs. This makes possible
1726 * 6-channel independent captures.
1728 * In addition, an independent DAC for the multi-playback (not used in this
1736 ALC882_FIXUP_ABIT_AW9D_MAX,
1737 ALC882_FIXUP_LENOVO_Y530,
1738 ALC882_FIXUP_PB_M5210,
1739 ALC882_FIXUP_ACER_ASPIRE_7736,
1740 ALC882_FIXUP_ASUS_W90V,
1742 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
1743 ALC889_FIXUP_VAIO_TT,
1744 ALC888_FIXUP_EEE1601,
1747 ALC883_FIXUP_ACER_EAPD,
1752 ALC882_FIXUP_ASUS_W2JC,
1753 ALC882_FIXUP_ACER_ASPIRE_4930G,
1754 ALC882_FIXUP_ACER_ASPIRE_8930G,
1755 ALC882_FIXUP_ASPIRE_8930G_VERBS,
1756 ALC885_FIXUP_MACPRO_GPIO,
1757 ALC889_FIXUP_DAC_ROUTE,
1758 ALC889_FIXUP_MBP_VREF,
1759 ALC889_FIXUP_IMAC91_VREF,
1760 ALC889_FIXUP_MBA11_VREF,
1761 ALC889_FIXUP_MBA21_VREF,
1762 ALC889_FIXUP_MP11_VREF,
1763 ALC882_FIXUP_INV_DMIC,
1764 ALC882_FIXUP_NO_PRIMARY_HP,
1765 ALC887_FIXUP_ASUS_BASS,
1766 ALC887_FIXUP_BASS_CHMAP,
1769 static void alc889_fixup_coef(struct hda_codec *codec,
1770 const struct hda_fixup *fix, int action)
1772 if (action != HDA_FIXUP_ACT_INIT)
1774 alc_update_coef_idx(codec, 7, 0, 0x2030);
1777 /* toggle speaker-output according to the hp-jack state */
1778 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
1780 unsigned int gpiostate, gpiomask, gpiodir;
1782 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
1783 AC_VERB_GET_GPIO_DATA, 0);
1786 gpiostate |= (1 << pin);
1788 gpiostate &= ~(1 << pin);
1790 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
1791 AC_VERB_GET_GPIO_MASK, 0);
1792 gpiomask |= (1 << pin);
1794 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
1795 AC_VERB_GET_GPIO_DIRECTION, 0);
1796 gpiodir |= (1 << pin);
1799 snd_hda_codec_write(codec, codec->afg, 0,
1800 AC_VERB_SET_GPIO_MASK, gpiomask);
1801 snd_hda_codec_write(codec, codec->afg, 0,
1802 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
1806 snd_hda_codec_write(codec, codec->afg, 0,
1807 AC_VERB_SET_GPIO_DATA, gpiostate);
1810 /* set up GPIO at initialization */
1811 static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
1812 const struct hda_fixup *fix, int action)
1814 if (action != HDA_FIXUP_ACT_INIT)
1816 alc882_gpio_mute(codec, 0, 0);
1817 alc882_gpio_mute(codec, 1, 0);
1820 /* Fix the connection of some pins for ALC889:
1821 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
1822 * work correctly (bko#42740)
1824 static void alc889_fixup_dac_route(struct hda_codec *codec,
1825 const struct hda_fixup *fix, int action)
1827 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1828 /* fake the connections during parsing the tree */
1829 hda_nid_t conn1[2] = { 0x0c, 0x0d };
1830 hda_nid_t conn2[2] = { 0x0e, 0x0f };
1831 snd_hda_override_conn_list(codec, 0x14, 2, conn1);
1832 snd_hda_override_conn_list(codec, 0x15, 2, conn1);
1833 snd_hda_override_conn_list(codec, 0x18, 2, conn2);
1834 snd_hda_override_conn_list(codec, 0x1a, 2, conn2);
1835 } else if (action == HDA_FIXUP_ACT_PROBE) {
1836 /* restore the connections */
1837 hda_nid_t conn[5] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
1838 snd_hda_override_conn_list(codec, 0x14, 5, conn);
1839 snd_hda_override_conn_list(codec, 0x15, 5, conn);
1840 snd_hda_override_conn_list(codec, 0x18, 5, conn);
1841 snd_hda_override_conn_list(codec, 0x1a, 5, conn);
1845 /* Set VREF on HP pin */
1846 static void alc889_fixup_mbp_vref(struct hda_codec *codec,
1847 const struct hda_fixup *fix, int action)
1849 struct alc_spec *spec = codec->spec;
1850 static hda_nid_t nids[2] = { 0x14, 0x15 };
1853 if (action != HDA_FIXUP_ACT_INIT)
1855 for (i = 0; i < ARRAY_SIZE(nids); i++) {
1856 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
1857 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
1859 val = snd_hda_codec_get_pin_target(codec, nids[i]);
1860 val |= AC_PINCTL_VREF_80;
1861 snd_hda_set_pin_ctl(codec, nids[i], val);
1862 spec->gen.keep_vref_in_automute = 1;
1867 static void alc889_fixup_mac_pins(struct hda_codec *codec,
1868 const hda_nid_t *nids, int num_nids)
1870 struct alc_spec *spec = codec->spec;
1873 for (i = 0; i < num_nids; i++) {
1875 val = snd_hda_codec_get_pin_target(codec, nids[i]);
1876 val |= AC_PINCTL_VREF_50;
1877 snd_hda_set_pin_ctl(codec, nids[i], val);
1879 spec->gen.keep_vref_in_automute = 1;
1882 /* Set VREF on speaker pins on imac91 */
1883 static void alc889_fixup_imac91_vref(struct hda_codec *codec,
1884 const struct hda_fixup *fix, int action)
1886 static hda_nid_t nids[2] = { 0x18, 0x1a };
1888 if (action == HDA_FIXUP_ACT_INIT)
1889 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1892 /* Set VREF on speaker pins on mba11 */
1893 static void alc889_fixup_mba11_vref(struct hda_codec *codec,
1894 const struct hda_fixup *fix, int action)
1896 static hda_nid_t nids[1] = { 0x18 };
1898 if (action == HDA_FIXUP_ACT_INIT)
1899 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1902 /* Set VREF on speaker pins on mba21 */
1903 static void alc889_fixup_mba21_vref(struct hda_codec *codec,
1904 const struct hda_fixup *fix, int action)
1906 static hda_nid_t nids[2] = { 0x18, 0x19 };
1908 if (action == HDA_FIXUP_ACT_INIT)
1909 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1912 /* Don't take HP output as primary
1913 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
1914 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
1916 static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
1917 const struct hda_fixup *fix, int action)
1919 struct alc_spec *spec = codec->spec;
1920 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1921 spec->gen.no_primary_hp = 1;
1922 spec->gen.no_multi_io = 1;
1926 static void alc_fixup_bass_chmap(struct hda_codec *codec,
1927 const struct hda_fixup *fix, int action);
1929 static const struct hda_fixup alc882_fixups[] = {
1930 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
1931 .type = HDA_FIXUP_PINS,
1932 .v.pins = (const struct hda_pintbl[]) {
1933 { 0x15, 0x01080104 }, /* side */
1934 { 0x16, 0x01011012 }, /* rear */
1935 { 0x17, 0x01016011 }, /* clfe */
1939 [ALC882_FIXUP_LENOVO_Y530] = {
1940 .type = HDA_FIXUP_PINS,
1941 .v.pins = (const struct hda_pintbl[]) {
1942 { 0x15, 0x99130112 }, /* rear int speakers */
1943 { 0x16, 0x99130111 }, /* subwoofer */
1947 [ALC882_FIXUP_PB_M5210] = {
1948 .type = HDA_FIXUP_PINCTLS,
1949 .v.pins = (const struct hda_pintbl[]) {
1950 { 0x19, PIN_VREF50 },
1954 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
1955 .type = HDA_FIXUP_FUNC,
1956 .v.func = alc_fixup_sku_ignore,
1958 [ALC882_FIXUP_ASUS_W90V] = {
1959 .type = HDA_FIXUP_PINS,
1960 .v.pins = (const struct hda_pintbl[]) {
1961 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
1965 [ALC889_FIXUP_CD] = {
1966 .type = HDA_FIXUP_PINS,
1967 .v.pins = (const struct hda_pintbl[]) {
1968 { 0x1c, 0x993301f0 }, /* CD */
1972 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
1973 .type = HDA_FIXUP_PINS,
1974 .v.pins = (const struct hda_pintbl[]) {
1975 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
1979 .chain_id = ALC889_FIXUP_CD,
1981 [ALC889_FIXUP_VAIO_TT] = {
1982 .type = HDA_FIXUP_PINS,
1983 .v.pins = (const struct hda_pintbl[]) {
1984 { 0x17, 0x90170111 }, /* hidden surround speaker */
1988 [ALC888_FIXUP_EEE1601] = {
1989 .type = HDA_FIXUP_VERBS,
1990 .v.verbs = (const struct hda_verb[]) {
1991 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
1992 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
1996 [ALC882_FIXUP_EAPD] = {
1997 .type = HDA_FIXUP_VERBS,
1998 .v.verbs = (const struct hda_verb[]) {
1999 /* change to EAPD mode */
2000 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2001 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2005 [ALC883_FIXUP_EAPD] = {
2006 .type = HDA_FIXUP_VERBS,
2007 .v.verbs = (const struct hda_verb[]) {
2008 /* change to EAPD mode */
2009 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2010 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2014 [ALC883_FIXUP_ACER_EAPD] = {
2015 .type = HDA_FIXUP_VERBS,
2016 .v.verbs = (const struct hda_verb[]) {
2017 /* eanable EAPD on Acer laptops */
2018 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2019 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2023 [ALC882_FIXUP_GPIO1] = {
2024 .type = HDA_FIXUP_VERBS,
2025 .v.verbs = alc_gpio1_init_verbs,
2027 [ALC882_FIXUP_GPIO2] = {
2028 .type = HDA_FIXUP_VERBS,
2029 .v.verbs = alc_gpio2_init_verbs,
2031 [ALC882_FIXUP_GPIO3] = {
2032 .type = HDA_FIXUP_VERBS,
2033 .v.verbs = alc_gpio3_init_verbs,
2035 [ALC882_FIXUP_ASUS_W2JC] = {
2036 .type = HDA_FIXUP_VERBS,
2037 .v.verbs = alc_gpio1_init_verbs,
2039 .chain_id = ALC882_FIXUP_EAPD,
2041 [ALC889_FIXUP_COEF] = {
2042 .type = HDA_FIXUP_FUNC,
2043 .v.func = alc889_fixup_coef,
2045 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
2046 .type = HDA_FIXUP_PINS,
2047 .v.pins = (const struct hda_pintbl[]) {
2048 { 0x16, 0x99130111 }, /* CLFE speaker */
2049 { 0x17, 0x99130112 }, /* surround speaker */
2053 .chain_id = ALC882_FIXUP_GPIO1,
2055 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
2056 .type = HDA_FIXUP_PINS,
2057 .v.pins = (const struct hda_pintbl[]) {
2058 { 0x16, 0x99130111 }, /* CLFE speaker */
2059 { 0x1b, 0x99130112 }, /* surround speaker */
2063 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2065 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2066 /* additional init verbs for Acer Aspire 8930G */
2067 .type = HDA_FIXUP_VERBS,
2068 .v.verbs = (const struct hda_verb[]) {
2069 /* Enable all DACs */
2070 /* DAC DISABLE/MUTE 1? */
2071 /* setting bits 1-5 disables DAC nids 0x02-0x06
2072 * apparently. Init=0x38 */
2073 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2074 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2075 /* DAC DISABLE/MUTE 2? */
2076 /* some bit here disables the other DACs.
2078 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2079 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2081 * This laptop has a stereo digital microphone.
2082 * The mics are only 1cm apart which makes the stereo
2083 * useless. However, either the mic or the ALC889
2084 * makes the signal become a difference/sum signal
2085 * instead of standard stereo, which is annoying.
2086 * So instead we flip this bit which makes the
2087 * codec replicate the sum signal to both channels,
2088 * turning it into a normal mono mic.
2090 /* DMIC_CONTROL? Init value = 0x0001 */
2091 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2092 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2093 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2094 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2098 .chain_id = ALC882_FIXUP_GPIO1,
2100 [ALC885_FIXUP_MACPRO_GPIO] = {
2101 .type = HDA_FIXUP_FUNC,
2102 .v.func = alc885_fixup_macpro_gpio,
2104 [ALC889_FIXUP_DAC_ROUTE] = {
2105 .type = HDA_FIXUP_FUNC,
2106 .v.func = alc889_fixup_dac_route,
2108 [ALC889_FIXUP_MBP_VREF] = {
2109 .type = HDA_FIXUP_FUNC,
2110 .v.func = alc889_fixup_mbp_vref,
2112 .chain_id = ALC882_FIXUP_GPIO1,
2114 [ALC889_FIXUP_IMAC91_VREF] = {
2115 .type = HDA_FIXUP_FUNC,
2116 .v.func = alc889_fixup_imac91_vref,
2118 .chain_id = ALC882_FIXUP_GPIO1,
2120 [ALC889_FIXUP_MBA11_VREF] = {
2121 .type = HDA_FIXUP_FUNC,
2122 .v.func = alc889_fixup_mba11_vref,
2124 .chain_id = ALC889_FIXUP_MBP_VREF,
2126 [ALC889_FIXUP_MBA21_VREF] = {
2127 .type = HDA_FIXUP_FUNC,
2128 .v.func = alc889_fixup_mba21_vref,
2130 .chain_id = ALC889_FIXUP_MBP_VREF,
2132 [ALC889_FIXUP_MP11_VREF] = {
2133 .type = HDA_FIXUP_FUNC,
2134 .v.func = alc889_fixup_mba11_vref,
2136 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2138 [ALC882_FIXUP_INV_DMIC] = {
2139 .type = HDA_FIXUP_FUNC,
2140 .v.func = alc_fixup_inv_dmic,
2142 [ALC882_FIXUP_NO_PRIMARY_HP] = {
2143 .type = HDA_FIXUP_FUNC,
2144 .v.func = alc882_fixup_no_primary_hp,
2146 [ALC887_FIXUP_ASUS_BASS] = {
2147 .type = HDA_FIXUP_PINS,
2148 .v.pins = (const struct hda_pintbl[]) {
2149 {0x16, 0x99130130}, /* bass speaker */
2153 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2155 [ALC887_FIXUP_BASS_CHMAP] = {
2156 .type = HDA_FIXUP_FUNC,
2157 .v.func = alc_fixup_bass_chmap,
2161 static const struct snd_pci_quirk alc882_fixup_tbl[] = {
2162 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2163 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2164 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2165 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2166 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2167 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
2168 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2169 ALC882_FIXUP_ACER_ASPIRE_4930G),
2170 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2171 ALC882_FIXUP_ACER_ASPIRE_4930G),
2172 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2173 ALC882_FIXUP_ACER_ASPIRE_8930G),
2174 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2175 ALC882_FIXUP_ACER_ASPIRE_8930G),
2176 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2177 ALC882_FIXUP_ACER_ASPIRE_4930G),
2178 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2179 ALC882_FIXUP_ACER_ASPIRE_4930G),
2180 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2181 ALC882_FIXUP_ACER_ASPIRE_4930G),
2182 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
2183 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2184 ALC882_FIXUP_ACER_ASPIRE_4930G),
2185 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
2186 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
2187 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
2188 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
2189 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
2190 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
2191 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
2192 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
2193 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
2194 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
2195 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2197 /* All Apple entries are in codec SSIDs */
2198 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2199 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2200 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2201 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
2202 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2203 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
2204 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2205 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
2206 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
2207 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
2208 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
2209 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2210 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2211 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
2212 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2213 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2214 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
2215 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 5,1", ALC885_FIXUP_MACPRO_GPIO),
2216 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
2217 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2218 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
2219 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_IMAC91_VREF),
2221 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
2222 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
2223 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
2224 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
2225 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
2226 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2227 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
2228 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
2229 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
2233 static const struct hda_model_fixup alc882_fixup_models[] = {
2234 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2235 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2236 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
2237 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
2238 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
2243 * BIOS auto configuration
2245 /* almost identical with ALC880 parser... */
2246 static int alc882_parse_auto_config(struct hda_codec *codec)
2248 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
2249 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2250 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
2255 static int patch_alc882(struct hda_codec *codec)
2257 struct alc_spec *spec;
2260 err = alc_alloc_spec(codec, 0x0b);
2266 switch (codec->vendor_id) {
2272 /* ALC883 and variants */
2273 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2277 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
2279 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2281 alc_auto_parse_customize_define(codec);
2283 if (has_cdefine_beep(codec))
2284 spec->gen.beep_nid = 0x01;
2286 /* automatic parse from the BIOS config */
2287 err = alc882_parse_auto_config(codec);
2291 if (!spec->gen.no_analog && spec->gen.beep_nid)
2292 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2294 codec->patch_ops = alc_patch_ops;
2296 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2309 static int alc262_parse_auto_config(struct hda_codec *codec)
2311 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
2312 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2313 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
2320 ALC262_FIXUP_FSC_H270,
2321 ALC262_FIXUP_FSC_S7110,
2322 ALC262_FIXUP_HP_Z200,
2324 ALC262_FIXUP_LENOVO_3000,
2326 ALC262_FIXUP_BENQ_T31,
2327 ALC262_FIXUP_INV_DMIC,
2328 ALC262_FIXUP_INTEL_BAYLEYBAY,
2331 static const struct hda_fixup alc262_fixups[] = {
2332 [ALC262_FIXUP_FSC_H270] = {
2333 .type = HDA_FIXUP_PINS,
2334 .v.pins = (const struct hda_pintbl[]) {
2335 { 0x14, 0x99130110 }, /* speaker */
2336 { 0x15, 0x0221142f }, /* front HP */
2337 { 0x1b, 0x0121141f }, /* rear HP */
2341 [ALC262_FIXUP_FSC_S7110] = {
2342 .type = HDA_FIXUP_PINS,
2343 .v.pins = (const struct hda_pintbl[]) {
2344 { 0x15, 0x90170110 }, /* speaker */
2348 .chain_id = ALC262_FIXUP_BENQ,
2350 [ALC262_FIXUP_HP_Z200] = {
2351 .type = HDA_FIXUP_PINS,
2352 .v.pins = (const struct hda_pintbl[]) {
2353 { 0x16, 0x99130120 }, /* internal speaker */
2357 [ALC262_FIXUP_TYAN] = {
2358 .type = HDA_FIXUP_PINS,
2359 .v.pins = (const struct hda_pintbl[]) {
2360 { 0x14, 0x1993e1f0 }, /* int AUX */
2364 [ALC262_FIXUP_LENOVO_3000] = {
2365 .type = HDA_FIXUP_PINCTLS,
2366 .v.pins = (const struct hda_pintbl[]) {
2367 { 0x19, PIN_VREF50 },
2371 .chain_id = ALC262_FIXUP_BENQ,
2373 [ALC262_FIXUP_BENQ] = {
2374 .type = HDA_FIXUP_VERBS,
2375 .v.verbs = (const struct hda_verb[]) {
2376 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2377 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2381 [ALC262_FIXUP_BENQ_T31] = {
2382 .type = HDA_FIXUP_VERBS,
2383 .v.verbs = (const struct hda_verb[]) {
2384 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2385 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2389 [ALC262_FIXUP_INV_DMIC] = {
2390 .type = HDA_FIXUP_FUNC,
2391 .v.func = alc_fixup_inv_dmic,
2393 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2394 .type = HDA_FIXUP_FUNC,
2395 .v.func = alc_fixup_no_depop_delay,
2399 static const struct snd_pci_quirk alc262_fixup_tbl[] = {
2400 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
2401 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
2402 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
2403 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
2404 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
2405 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
2406 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2407 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
2408 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
2412 static const struct hda_model_fixup alc262_fixup_models[] = {
2413 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
2419 static int patch_alc262(struct hda_codec *codec)
2421 struct alc_spec *spec;
2424 err = alc_alloc_spec(codec, 0x0b);
2429 spec->gen.shared_mic_vref_pin = 0x18;
2432 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2435 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
2437 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2439 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
2441 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2443 alc_auto_parse_customize_define(codec);
2445 if (has_cdefine_beep(codec))
2446 spec->gen.beep_nid = 0x01;
2448 /* automatic parse from the BIOS config */
2449 err = alc262_parse_auto_config(codec);
2453 if (!spec->gen.no_analog && spec->gen.beep_nid)
2454 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2456 codec->patch_ops = alc_patch_ops;
2457 spec->shutup = alc_eapd_shutup;
2459 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2471 /* bind Beep switches of both NID 0x0f and 0x10 */
2472 static const struct hda_bind_ctls alc268_bind_beep_sw = {
2473 .ops = &snd_hda_bind_sw,
2475 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
2476 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
2481 static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2482 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
2483 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
2487 /* set PCBEEP vol = 0, mute connections */
2488 static const struct hda_verb alc268_beep_init_verbs[] = {
2489 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2490 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2491 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2496 ALC268_FIXUP_INV_DMIC,
2497 ALC268_FIXUP_HP_EAPD,
2501 static const struct hda_fixup alc268_fixups[] = {
2502 [ALC268_FIXUP_INV_DMIC] = {
2503 .type = HDA_FIXUP_FUNC,
2504 .v.func = alc_fixup_inv_dmic,
2506 [ALC268_FIXUP_HP_EAPD] = {
2507 .type = HDA_FIXUP_VERBS,
2508 .v.verbs = (const struct hda_verb[]) {
2509 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
2513 [ALC268_FIXUP_SPDIF] = {
2514 .type = HDA_FIXUP_PINS,
2515 .v.pins = (const struct hda_pintbl[]) {
2516 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
2522 static const struct hda_model_fixup alc268_fixup_models[] = {
2523 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
2524 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
2528 static const struct snd_pci_quirk alc268_fixup_tbl[] = {
2529 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
2530 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
2531 /* below is codec SSID since multiple Toshiba laptops have the
2532 * same PCI SSID 1179:ff00
2534 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
2539 * BIOS auto configuration
2541 static int alc268_parse_auto_config(struct hda_codec *codec)
2543 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2544 return alc_parse_auto_config(codec, NULL, alc268_ssids);
2549 static int patch_alc268(struct hda_codec *codec)
2551 struct alc_spec *spec;
2554 /* ALC268 has no aa-loopback mixer */
2555 err = alc_alloc_spec(codec, 0);
2560 spec->gen.beep_nid = 0x01;
2562 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
2563 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2565 /* automatic parse from the BIOS config */
2566 err = alc268_parse_auto_config(codec);
2570 if (err > 0 && !spec->gen.no_analog &&
2571 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
2572 add_mixer(spec, alc268_beep_mixer);
2573 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
2574 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
2575 /* override the amp caps for beep generator */
2576 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
2577 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
2578 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
2579 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
2580 (0 << AC_AMPCAP_MUTE_SHIFT));
2583 codec->patch_ops = alc_patch_ops;
2584 spec->shutup = alc_eapd_shutup;
2586 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2599 static int playback_pcm_open(struct hda_pcm_stream *hinfo,
2600 struct hda_codec *codec,
2601 struct snd_pcm_substream *substream)
2603 struct hda_gen_spec *spec = codec->spec;
2604 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2608 static int playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2609 struct hda_codec *codec,
2610 unsigned int stream_tag,
2611 unsigned int format,
2612 struct snd_pcm_substream *substream)
2614 struct hda_gen_spec *spec = codec->spec;
2615 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2616 stream_tag, format, substream);
2619 static int playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2620 struct hda_codec *codec,
2621 struct snd_pcm_substream *substream)
2623 struct hda_gen_spec *spec = codec->spec;
2624 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2627 static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
2631 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
2632 /* NID is set in alc_build_pcms */
2634 .open = playback_pcm_open,
2635 .prepare = playback_pcm_prepare,
2636 .cleanup = playback_pcm_cleanup
2640 static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
2644 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
2645 /* NID is set in alc_build_pcms */
2648 /* different alc269-variants */
2650 ALC269_TYPE_ALC269VA,
2651 ALC269_TYPE_ALC269VB,
2652 ALC269_TYPE_ALC269VC,
2653 ALC269_TYPE_ALC269VD,
2664 * BIOS auto configuration
2666 static int alc269_parse_auto_config(struct hda_codec *codec)
2668 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
2669 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
2670 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2671 struct alc_spec *spec = codec->spec;
2672 const hda_nid_t *ssids;
2674 switch (spec->codec_variant) {
2675 case ALC269_TYPE_ALC269VA:
2676 case ALC269_TYPE_ALC269VC:
2677 case ALC269_TYPE_ALC280:
2678 case ALC269_TYPE_ALC284:
2679 case ALC269_TYPE_ALC285:
2680 ssids = alc269va_ssids;
2682 case ALC269_TYPE_ALC269VB:
2683 case ALC269_TYPE_ALC269VD:
2684 case ALC269_TYPE_ALC282:
2685 case ALC269_TYPE_ALC283:
2686 case ALC269_TYPE_ALC286:
2687 case ALC269_TYPE_ALC255:
2688 ssids = alc269_ssids;
2691 ssids = alc269_ssids;
2695 return alc_parse_auto_config(codec, alc269_ignore, ssids);
2698 static int find_ext_mic_pin(struct hda_codec *codec);
2700 static void alc286_shutup(struct hda_codec *codec)
2703 int mic_pin = find_ext_mic_pin(codec);
2704 /* don't shut up pins when unloading the driver; otherwise it breaks
2705 * the default pin setup at the next load of the driver
2707 if (codec->bus->shutdown)
2709 for (i = 0; i < codec->init_pins.used; i++) {
2710 struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i);
2711 /* use read here for syncing after issuing each verb */
2712 if (pin->nid != mic_pin)
2713 snd_hda_codec_read(codec, pin->nid, 0,
2714 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
2716 codec->pins_shutup = 1;
2719 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
2721 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
2724 static void alc269_shutup(struct hda_codec *codec)
2726 struct alc_spec *spec = codec->spec;
2728 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
2729 alc269vb_toggle_power_output(codec, 0);
2730 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
2731 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
2734 snd_hda_shutup_pins(codec);
2737 static struct coef_fw alc282_coefs[] = {
2738 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
2739 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
2740 WRITE_COEF(0x07, 0x0200), /* DMIC control */
2741 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
2742 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
2743 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
2744 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
2745 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
2746 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
2747 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
2748 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
2749 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
2750 WRITE_COEF(0x34, 0xa0c0), /* ANC */
2751 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
2752 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
2753 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
2754 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
2755 WRITE_COEF(0x63, 0x2902), /* PLL */
2756 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
2757 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
2758 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
2759 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
2760 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
2761 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
2762 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
2763 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
2764 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
2765 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
2766 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
2770 static void alc282_restore_default_value(struct hda_codec *codec)
2772 alc_process_coef_fw(codec, alc282_coefs);
2775 static void alc282_init(struct hda_codec *codec)
2777 struct alc_spec *spec = codec->spec;
2778 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
2782 alc282_restore_default_value(codec);
2786 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
2787 coef78 = alc_read_coef_idx(codec, 0x78);
2789 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
2790 /* Headphone capless set to high power mode */
2791 alc_write_coef_idx(codec, 0x78, 0x9004);
2796 snd_hda_codec_write(codec, hp_pin, 0,
2797 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
2802 snd_hda_codec_write(codec, hp_pin, 0,
2803 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
2808 /* Headphone capless set to normal mode */
2809 alc_write_coef_idx(codec, 0x78, coef78);
2812 static void alc282_shutup(struct hda_codec *codec)
2814 struct alc_spec *spec = codec->spec;
2815 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
2820 alc269_shutup(codec);
2824 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
2825 coef78 = alc_read_coef_idx(codec, 0x78);
2826 alc_write_coef_idx(codec, 0x78, 0x9004);
2831 snd_hda_codec_write(codec, hp_pin, 0,
2832 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
2837 snd_hda_codec_write(codec, hp_pin, 0,
2838 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
2843 alc_auto_setup_eapd(codec, false);
2844 snd_hda_shutup_pins(codec);
2845 alc_write_coef_idx(codec, 0x78, coef78);
2848 static struct coef_fw alc283_coefs[] = {
2849 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
2850 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
2851 WRITE_COEF(0x07, 0x0200), /* DMIC control */
2852 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
2853 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
2854 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
2855 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
2856 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
2857 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
2858 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
2859 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
2860 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
2861 WRITE_COEF(0x22, 0xa0c0), /* ANC */
2862 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
2863 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
2864 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
2865 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
2866 WRITE_COEF(0x2e, 0x2902), /* PLL */
2867 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
2868 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
2869 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
2870 WRITE_COEF(0x36, 0x0), /* capless control 5 */
2871 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
2872 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
2873 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
2874 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
2875 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
2876 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
2877 WRITE_COEF(0x49, 0x0), /* test mode */
2878 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
2879 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
2880 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
2881 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
2885 static void alc283_restore_default_value(struct hda_codec *codec)
2887 alc_process_coef_fw(codec, alc283_coefs);
2890 static void alc283_init(struct hda_codec *codec)
2892 struct alc_spec *spec = codec->spec;
2893 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
2896 if (!spec->gen.autocfg.hp_outs) {
2897 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
2898 hp_pin = spec->gen.autocfg.line_out_pins[0];
2901 alc283_restore_default_value(codec);
2905 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
2907 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
2908 /* Headphone capless set to high power mode */
2909 alc_write_coef_idx(codec, 0x43, 0x9004);
2911 snd_hda_codec_write(codec, hp_pin, 0,
2912 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
2917 snd_hda_codec_write(codec, hp_pin, 0,
2918 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
2922 /* Index 0x46 Combo jack auto switch control 2 */
2923 /* 3k pull low control for Headset jack. */
2924 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
2925 /* Headphone capless set to normal mode */
2926 alc_write_coef_idx(codec, 0x43, 0x9614);
2929 static void alc283_shutup(struct hda_codec *codec)
2931 struct alc_spec *spec = codec->spec;
2932 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
2935 if (!spec->gen.autocfg.hp_outs) {
2936 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
2937 hp_pin = spec->gen.autocfg.line_out_pins[0];
2941 alc269_shutup(codec);
2945 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
2947 alc_write_coef_idx(codec, 0x43, 0x9004);
2949 /*depop hp during suspend*/
2950 alc_write_coef_idx(codec, 0x06, 0x2100);
2952 snd_hda_codec_write(codec, hp_pin, 0,
2953 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
2958 snd_hda_codec_write(codec, hp_pin, 0,
2959 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
2961 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
2965 alc_auto_setup_eapd(codec, false);
2966 snd_hda_shutup_pins(codec);
2967 alc_write_coef_idx(codec, 0x43, 0x9614);
2970 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
2973 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
2974 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
2975 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
2978 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
2982 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
2983 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
2985 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
2990 static void alc5505_dsp_halt(struct hda_codec *codec)
2994 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
2995 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
2996 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
2997 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
2998 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
2999 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3000 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3001 val = alc5505_coef_get(codec, 0x6220);
3002 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3005 static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3007 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3008 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3009 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3010 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3011 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3012 alc5505_coef_set(codec, 0x880c, 0x00000004);
3015 static void alc5505_dsp_init(struct hda_codec *codec)
3019 alc5505_dsp_halt(codec);
3020 alc5505_dsp_back_from_halt(codec);
3021 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3022 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3023 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3024 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3025 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3026 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3027 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3028 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3029 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3030 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3031 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3032 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3033 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3035 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3037 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3039 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3041 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3042 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3043 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3044 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3045 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3046 alc5505_coef_set(codec, 0x880c, 0x00000003);
3047 alc5505_coef_set(codec, 0x880c, 0x00000010);
3049 #ifdef HALT_REALTEK_ALC5505
3050 alc5505_dsp_halt(codec);
3054 #ifdef HALT_REALTEK_ALC5505
3055 #define alc5505_dsp_suspend(codec) /* NOP */
3056 #define alc5505_dsp_resume(codec) /* NOP */
3058 #define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
3059 #define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
3063 static int alc269_suspend(struct hda_codec *codec)
3065 struct alc_spec *spec = codec->spec;
3067 if (spec->has_alc5505_dsp)
3068 alc5505_dsp_suspend(codec);
3069 return alc_suspend(codec);
3072 static int alc269_resume(struct hda_codec *codec)
3074 struct alc_spec *spec = codec->spec;
3076 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3077 alc269vb_toggle_power_output(codec, 0);
3078 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3079 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
3083 codec->patch_ops.init(codec);
3085 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3086 alc269vb_toggle_power_output(codec, 1);
3087 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3088 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
3092 snd_hda_codec_resume_amp(codec);
3093 snd_hda_codec_resume_cache(codec);
3094 hda_call_check_power_status(codec, 0x01);
3096 /* on some machine, the BIOS will clear the codec gpio data when enter
3097 * suspend, and won't restore the data after resume, so we restore it
3101 snd_hda_codec_write(codec, codec->afg, 0, AC_VERB_SET_GPIO_DATA,
3104 if (spec->has_alc5505_dsp)
3105 alc5505_dsp_resume(codec);
3109 #endif /* CONFIG_PM */
3111 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
3112 const struct hda_fixup *fix, int action)
3114 struct alc_spec *spec = codec->spec;
3116 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3117 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
3120 static void alc269_fixup_hweq(struct hda_codec *codec,
3121 const struct hda_fixup *fix, int action)
3123 if (action == HDA_FIXUP_ACT_INIT)
3124 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
3127 static void alc269_fixup_headset_mic(struct hda_codec *codec,
3128 const struct hda_fixup *fix, int action)
3130 struct alc_spec *spec = codec->spec;
3132 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3133 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3136 static void alc271_fixup_dmic(struct hda_codec *codec,
3137 const struct hda_fixup *fix, int action)
3139 static const struct hda_verb verbs[] = {
3140 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
3141 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
3146 if (strcmp(codec->chip_name, "ALC271X") &&
3147 strcmp(codec->chip_name, "ALC269VB"))
3149 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
3150 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
3151 snd_hda_sequence_write(codec, verbs);
3154 static void alc269_fixup_pcm_44k(struct hda_codec *codec,
3155 const struct hda_fixup *fix, int action)
3157 struct alc_spec *spec = codec->spec;
3159 if (action != HDA_FIXUP_ACT_PROBE)
3162 /* Due to a hardware problem on Lenovo Ideadpad, we need to
3163 * fix the sample rate of analog I/O to 44.1kHz
3165 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
3166 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
3169 static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
3170 const struct hda_fixup *fix, int action)
3172 /* The digital-mic unit sends PDM (differential signal) instead of
3173 * the standard PCM, thus you can't record a valid mono stream as is.
3174 * Below is a workaround specific to ALC269 to control the dmic
3175 * signal source as mono.
3177 if (action == HDA_FIXUP_ACT_INIT)
3178 alc_update_coef_idx(codec, 0x07, 0, 0x80);
3181 static void alc269_quanta_automute(struct hda_codec *codec)
3183 snd_hda_gen_update_outputs(codec);
3185 alc_write_coef_idx(codec, 0x0c, 0x680);
3186 alc_write_coef_idx(codec, 0x0c, 0x480);
3189 static void alc269_fixup_quanta_mute(struct hda_codec *codec,
3190 const struct hda_fixup *fix, int action)
3192 struct alc_spec *spec = codec->spec;
3193 if (action != HDA_FIXUP_ACT_PROBE)
3195 spec->gen.automute_hook = alc269_quanta_automute;
3198 static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
3199 struct hda_jack_callback *jack)
3201 struct alc_spec *spec = codec->spec;
3204 snd_hda_gen_hp_automute(codec, jack);
3206 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
3208 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3211 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3215 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
3216 const struct hda_fixup *fix, int action)
3218 struct alc_spec *spec = codec->spec;
3219 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3220 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3221 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
3226 /* update mute-LED according to the speaker mute state via mic VREF pin */
3227 static void alc269_fixup_mic_mute_hook(void *private_data, int enabled)
3229 struct hda_codec *codec = private_data;
3230 struct alc_spec *spec = codec->spec;
3231 unsigned int pinval;
3233 if (spec->mute_led_polarity)
3235 pinval = snd_hda_codec_get_pin_target(codec, spec->mute_led_nid);
3236 pinval &= ~AC_PINCTL_VREFEN;
3237 pinval |= enabled ? AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80;
3238 if (spec->mute_led_nid)
3239 snd_hda_set_pin_ctl_cache(codec, spec->mute_led_nid, pinval);
3242 /* Make sure the led works even in runtime suspend */
3243 static unsigned int led_power_filter(struct hda_codec *codec,
3245 unsigned int power_state)
3247 struct alc_spec *spec = codec->spec;
3249 if (power_state != AC_PWRST_D3 || nid == 0 ||
3250 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
3253 /* Set pin ctl again, it might have just been set to 0 */
3254 snd_hda_set_pin_ctl(codec, nid,
3255 snd_hda_codec_get_pin_target(codec, nid));
3260 static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
3261 const struct hda_fixup *fix, int action)
3263 struct alc_spec *spec = codec->spec;
3264 const struct dmi_device *dev = NULL;
3266 if (action != HDA_FIXUP_ACT_PRE_PROBE)
3269 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
3271 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
3273 if (pin < 0x0a || pin >= 0x10)
3275 spec->mute_led_polarity = pol;
3276 spec->mute_led_nid = pin - 0x0a + 0x18;
3277 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3278 spec->gen.vmaster_mute_enum = 1;
3279 codec->power_filter = led_power_filter;
3281 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
3282 spec->mute_led_polarity);
3287 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
3288 const struct hda_fixup *fix, int action)
3290 struct alc_spec *spec = codec->spec;
3291 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3292 spec->mute_led_polarity = 0;
3293 spec->mute_led_nid = 0x18;
3294 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3295 spec->gen.vmaster_mute_enum = 1;
3296 codec->power_filter = led_power_filter;
3300 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
3301 const struct hda_fixup *fix, int action)
3303 struct alc_spec *spec = codec->spec;
3304 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3305 spec->mute_led_polarity = 0;
3306 spec->mute_led_nid = 0x19;
3307 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3308 spec->gen.vmaster_mute_enum = 1;
3309 codec->power_filter = led_power_filter;
3313 /* turn on/off mute LED per vmaster hook */
3314 static void alc269_fixup_hp_gpio_mute_hook(void *private_data, int enabled)
3316 struct hda_codec *codec = private_data;
3317 struct alc_spec *spec = codec->spec;
3318 unsigned int oldval = spec->gpio_led;
3321 spec->gpio_led &= ~0x08;
3323 spec->gpio_led |= 0x08;
3324 if (spec->gpio_led != oldval)
3325 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
3329 /* turn on/off mic-mute LED per capture hook */
3330 static void alc269_fixup_hp_gpio_mic_mute_hook(struct hda_codec *codec,
3331 struct snd_kcontrol *kcontrol,
3332 struct snd_ctl_elem_value *ucontrol)
3334 struct alc_spec *spec = codec->spec;
3335 unsigned int oldval = spec->gpio_led;
3340 if (ucontrol->value.integer.value[0] ||
3341 ucontrol->value.integer.value[1])
3342 spec->gpio_led &= ~0x10;
3344 spec->gpio_led |= 0x10;
3345 if (spec->gpio_led != oldval)
3346 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
3350 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
3351 const struct hda_fixup *fix, int action)
3353 struct alc_spec *spec = codec->spec;
3354 static const struct hda_verb gpio_init[] = {
3355 { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 },
3356 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 },
3360 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3361 spec->gen.vmaster_mute.hook = alc269_fixup_hp_gpio_mute_hook;
3362 spec->gen.cap_sync_hook = alc269_fixup_hp_gpio_mic_mute_hook;
3364 snd_hda_add_verbs(codec, gpio_init);
3368 /* turn on/off mic-mute LED per capture hook */
3369 static void alc269_fixup_hp_cap_mic_mute_hook(struct hda_codec *codec,
3370 struct snd_kcontrol *kcontrol,
3371 struct snd_ctl_elem_value *ucontrol)
3373 struct alc_spec *spec = codec->spec;
3374 unsigned int pinval, enable, disable;
3376 pinval = snd_hda_codec_get_pin_target(codec, spec->cap_mute_led_nid);
3377 pinval &= ~AC_PINCTL_VREFEN;
3378 enable = pinval | AC_PINCTL_VREF_80;
3379 disable = pinval | AC_PINCTL_VREF_HIZ;
3384 if (ucontrol->value.integer.value[0] ||
3385 ucontrol->value.integer.value[1])
3390 if (spec->cap_mute_led_nid)
3391 snd_hda_set_pin_ctl_cache(codec, spec->cap_mute_led_nid, pinval);
3394 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
3395 const struct hda_fixup *fix, int action)
3397 struct alc_spec *spec = codec->spec;
3398 static const struct hda_verb gpio_init[] = {
3399 { 0x01, AC_VERB_SET_GPIO_MASK, 0x08 },
3400 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x08 },
3404 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3405 spec->gen.vmaster_mute.hook = alc269_fixup_hp_gpio_mute_hook;
3406 spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook;
3408 spec->cap_mute_led_nid = 0x18;
3409 snd_hda_add_verbs(codec, gpio_init);
3410 codec->power_filter = led_power_filter;
3414 static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
3415 const struct hda_fixup *fix, int action)
3417 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to enable headphone amp */
3418 struct alc_spec *spec = codec->spec;
3419 static const struct hda_verb gpio_init[] = {
3420 { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 },
3421 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 },
3425 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3426 spec->gen.vmaster_mute.hook = alc269_fixup_hp_gpio_mute_hook;
3427 spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook;
3429 spec->cap_mute_led_nid = 0x18;
3430 snd_hda_add_verbs(codec, gpio_init);
3431 codec->power_filter = led_power_filter;
3435 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
3436 const struct hda_fixup *fix, int action)
3438 struct alc_spec *spec = codec->spec;
3440 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3441 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3442 spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook;
3443 spec->mute_led_polarity = 0;
3444 spec->mute_led_nid = 0x1a;
3445 spec->cap_mute_led_nid = 0x18;
3446 spec->gen.vmaster_mute_enum = 1;
3447 codec->power_filter = led_power_filter;
3451 static void alc_headset_mode_unplugged(struct hda_codec *codec)
3453 static struct coef_fw coef0255[] = {
3454 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
3455 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
3456 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
3457 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
3458 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
3461 static struct coef_fw coef0233[] = {
3462 WRITE_COEF(0x1b, 0x0c0b),
3463 WRITE_COEF(0x45, 0xc429),
3464 UPDATE_COEF(0x35, 0x4000, 0),
3465 WRITE_COEF(0x06, 0x2104),
3466 WRITE_COEF(0x1a, 0x0001),
3467 WRITE_COEF(0x26, 0x0004),
3468 WRITE_COEF(0x32, 0x42a3),
3471 static struct coef_fw coef0292[] = {
3472 WRITE_COEF(0x76, 0x000e),
3473 WRITE_COEF(0x6c, 0x2400),
3474 WRITE_COEF(0x18, 0x7308),
3475 WRITE_COEF(0x6b, 0xc429),
3478 static struct coef_fw coef0293[] = {
3479 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
3480 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
3481 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
3482 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
3483 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
3484 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
3487 static struct coef_fw coef0668[] = {
3488 WRITE_COEF(0x15, 0x0d40),
3489 WRITE_COEF(0xb7, 0x802b),
3493 switch (codec->vendor_id) {
3495 alc_process_coef_fw(codec, coef0255);
3499 alc_process_coef_fw(codec, coef0233);
3502 alc_process_coef_fw(codec, coef0292);
3505 alc_process_coef_fw(codec, coef0293);
3508 alc_process_coef_fw(codec, coef0668);
3511 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
3515 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
3518 static struct coef_fw coef0255[] = {
3519 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
3520 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
3523 static struct coef_fw coef0233[] = {
3524 UPDATE_COEF(0x35, 0, 1<<14),
3525 WRITE_COEF(0x06, 0x2100),
3526 WRITE_COEF(0x1a, 0x0021),
3527 WRITE_COEF(0x26, 0x008c),
3530 static struct coef_fw coef0292[] = {
3531 WRITE_COEF(0x19, 0xa208),
3532 WRITE_COEF(0x2e, 0xacf0),
3535 static struct coef_fw coef0293[] = {
3536 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
3537 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
3538 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
3541 static struct coef_fw coef0688[] = {
3542 WRITE_COEF(0xb7, 0x802b),
3543 WRITE_COEF(0xb5, 0x1040),
3544 UPDATE_COEF(0xc3, 0, 1<<12),
3548 switch (codec->vendor_id) {
3550 alc_write_coef_idx(codec, 0x45, 0xc489);
3551 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
3552 alc_process_coef_fw(codec, coef0255);
3553 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
3557 alc_write_coef_idx(codec, 0x45, 0xc429);
3558 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
3559 alc_process_coef_fw(codec, coef0233);
3560 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
3563 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
3564 alc_process_coef_fw(codec, coef0292);
3567 /* Set to TRS mode */
3568 alc_write_coef_idx(codec, 0x45, 0xc429);
3569 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
3570 alc_process_coef_fw(codec, coef0293);
3571 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
3574 alc_write_coef_idx(codec, 0x11, 0x0001);
3575 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
3576 alc_process_coef_fw(codec, coef0688);
3577 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
3580 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
3583 static void alc_headset_mode_default(struct hda_codec *codec)
3585 static struct coef_fw coef0255[] = {
3586 WRITE_COEF(0x45, 0xc089),
3587 WRITE_COEF(0x45, 0xc489),
3588 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
3589 WRITE_COEF(0x49, 0x0049),
3592 static struct coef_fw coef0233[] = {
3593 WRITE_COEF(0x06, 0x2100),
3594 WRITE_COEF(0x32, 0x4ea3),
3597 static struct coef_fw coef0292[] = {
3598 WRITE_COEF(0x76, 0x000e),
3599 WRITE_COEF(0x6c, 0x2400),
3600 WRITE_COEF(0x6b, 0xc429),
3601 WRITE_COEF(0x18, 0x7308),
3604 static struct coef_fw coef0293[] = {
3605 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
3606 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
3607 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
3610 static struct coef_fw coef0688[] = {
3611 WRITE_COEF(0x11, 0x0041),
3612 WRITE_COEF(0x15, 0x0d40),
3613 WRITE_COEF(0xb7, 0x802b),
3617 switch (codec->vendor_id) {
3619 alc_process_coef_fw(codec, coef0255);
3623 alc_process_coef_fw(codec, coef0233);
3626 alc_process_coef_fw(codec, coef0292);
3629 alc_process_coef_fw(codec, coef0293);
3632 alc_process_coef_fw(codec, coef0688);
3635 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
3639 static void alc_headset_mode_ctia(struct hda_codec *codec)
3641 static struct coef_fw coef0255[] = {
3642 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
3643 WRITE_COEF(0x1b, 0x0c2b),
3644 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
3647 static struct coef_fw coef0233[] = {
3648 WRITE_COEF(0x45, 0xd429),
3649 WRITE_COEF(0x1b, 0x0c2b),
3650 WRITE_COEF(0x32, 0x4ea3),
3653 static struct coef_fw coef0292[] = {
3654 WRITE_COEF(0x6b, 0xd429),
3655 WRITE_COEF(0x76, 0x0008),
3656 WRITE_COEF(0x18, 0x7388),
3659 static struct coef_fw coef0293[] = {
3660 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
3661 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
3664 static struct coef_fw coef0688[] = {
3665 WRITE_COEF(0x11, 0x0001),
3666 WRITE_COEF(0x15, 0x0d60),
3667 WRITE_COEF(0xc3, 0x0000),
3671 switch (codec->vendor_id) {
3673 alc_process_coef_fw(codec, coef0255);
3677 alc_process_coef_fw(codec, coef0233);
3680 alc_process_coef_fw(codec, coef0292);
3683 alc_process_coef_fw(codec, coef0293);
3686 alc_process_coef_fw(codec, coef0688);
3689 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
3693 static void alc_headset_mode_omtp(struct hda_codec *codec)
3695 static struct coef_fw coef0255[] = {
3696 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
3697 WRITE_COEF(0x1b, 0x0c2b),
3698 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
3701 static struct coef_fw coef0233[] = {
3702 WRITE_COEF(0x45, 0xe429),
3703 WRITE_COEF(0x1b, 0x0c2b),
3704 WRITE_COEF(0x32, 0x4ea3),
3707 static struct coef_fw coef0292[] = {
3708 WRITE_COEF(0x6b, 0xe429),
3709 WRITE_COEF(0x76, 0x0008),
3710 WRITE_COEF(0x18, 0x7388),
3713 static struct coef_fw coef0293[] = {
3714 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
3715 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
3718 static struct coef_fw coef0688[] = {
3719 WRITE_COEF(0x11, 0x0001),
3720 WRITE_COEF(0x15, 0x0d50),
3721 WRITE_COEF(0xc3, 0x0000),
3725 switch (codec->vendor_id) {
3727 alc_process_coef_fw(codec, coef0255);
3731 alc_process_coef_fw(codec, coef0233);
3734 alc_process_coef_fw(codec, coef0292);
3737 alc_process_coef_fw(codec, coef0293);
3740 alc_process_coef_fw(codec, coef0688);
3743 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
3746 static void alc_determine_headset_type(struct hda_codec *codec)
3749 bool is_ctia = false;
3750 struct alc_spec *spec = codec->spec;
3751 static struct coef_fw coef0255[] = {
3752 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
3753 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
3757 static struct coef_fw coef0293[] = {
3758 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
3759 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
3762 static struct coef_fw coef0688[] = {
3763 WRITE_COEF(0x11, 0x0001),
3764 WRITE_COEF(0xb7, 0x802b),
3765 WRITE_COEF(0x15, 0x0d60),
3766 WRITE_COEF(0xc3, 0x0c00),
3770 switch (codec->vendor_id) {
3772 alc_process_coef_fw(codec, coef0255);
3774 val = alc_read_coef_idx(codec, 0x46);
3775 is_ctia = (val & 0x0070) == 0x0070;
3779 alc_write_coef_idx(codec, 0x45, 0xd029);
3781 val = alc_read_coef_idx(codec, 0x46);
3782 is_ctia = (val & 0x0070) == 0x0070;
3785 alc_write_coef_idx(codec, 0x6b, 0xd429);
3787 val = alc_read_coef_idx(codec, 0x6c);
3788 is_ctia = (val & 0x001c) == 0x001c;
3791 alc_process_coef_fw(codec, coef0293);
3793 val = alc_read_coef_idx(codec, 0x46);
3794 is_ctia = (val & 0x0070) == 0x0070;
3797 alc_process_coef_fw(codec, coef0688);
3799 val = alc_read_coef_idx(codec, 0xbe);
3800 is_ctia = (val & 0x1c02) == 0x1c02;
3804 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
3805 is_ctia ? "yes" : "no");
3806 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
3809 static void alc_update_headset_mode(struct hda_codec *codec)
3811 struct alc_spec *spec = codec->spec;
3813 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
3814 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3816 int new_headset_mode;
3818 if (!snd_hda_jack_detect(codec, hp_pin))
3819 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
3820 else if (mux_pin == spec->headset_mic_pin)
3821 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
3822 else if (mux_pin == spec->headphone_mic_pin)
3823 new_headset_mode = ALC_HEADSET_MODE_MIC;
3825 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
3827 if (new_headset_mode == spec->current_headset_mode) {
3828 snd_hda_gen_update_outputs(codec);
3832 switch (new_headset_mode) {
3833 case ALC_HEADSET_MODE_UNPLUGGED:
3834 alc_headset_mode_unplugged(codec);
3835 spec->gen.hp_jack_present = false;
3837 case ALC_HEADSET_MODE_HEADSET:
3838 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
3839 alc_determine_headset_type(codec);
3840 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
3841 alc_headset_mode_ctia(codec);
3842 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
3843 alc_headset_mode_omtp(codec);
3844 spec->gen.hp_jack_present = true;
3846 case ALC_HEADSET_MODE_MIC:
3847 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
3848 spec->gen.hp_jack_present = false;
3850 case ALC_HEADSET_MODE_HEADPHONE:
3851 alc_headset_mode_default(codec);
3852 spec->gen.hp_jack_present = true;
3855 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
3856 snd_hda_set_pin_ctl_cache(codec, hp_pin,
3857 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
3858 if (spec->headphone_mic_pin)
3859 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
3862 spec->current_headset_mode = new_headset_mode;
3864 snd_hda_gen_update_outputs(codec);
3867 static void alc_update_headset_mode_hook(struct hda_codec *codec,
3868 struct snd_kcontrol *kcontrol,
3869 struct snd_ctl_elem_value *ucontrol)
3871 alc_update_headset_mode(codec);
3874 static void alc_update_headset_jack_cb(struct hda_codec *codec,
3875 struct hda_jack_callback *jack)
3877 struct alc_spec *spec = codec->spec;
3878 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
3879 snd_hda_gen_hp_automute(codec, jack);
3882 static void alc_probe_headset_mode(struct hda_codec *codec)
3885 struct alc_spec *spec = codec->spec;
3886 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
3889 for (i = 0; i < cfg->num_inputs; i++) {
3890 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
3891 spec->headset_mic_pin = cfg->inputs[i].pin;
3892 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
3893 spec->headphone_mic_pin = cfg->inputs[i].pin;
3896 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
3897 spec->gen.automute_hook = alc_update_headset_mode;
3898 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
3901 static void alc_fixup_headset_mode(struct hda_codec *codec,
3902 const struct hda_fixup *fix, int action)
3904 struct alc_spec *spec = codec->spec;
3907 case HDA_FIXUP_ACT_PRE_PROBE:
3908 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
3910 case HDA_FIXUP_ACT_PROBE:
3911 alc_probe_headset_mode(codec);
3913 case HDA_FIXUP_ACT_INIT:
3914 spec->current_headset_mode = 0;
3915 alc_update_headset_mode(codec);
3920 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
3921 const struct hda_fixup *fix, int action)
3923 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3924 struct alc_spec *spec = codec->spec;
3925 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3928 alc_fixup_headset_mode(codec, fix, action);
3931 static void alc255_set_default_jack_type(struct hda_codec *codec)
3933 /* Set to iphone type */
3934 static struct coef_fw fw[] = {
3935 WRITE_COEF(0x1b, 0x880b),
3936 WRITE_COEF(0x45, 0xd089),
3937 WRITE_COEF(0x1b, 0x080b),
3938 WRITE_COEF(0x46, 0x0004),
3939 WRITE_COEF(0x1b, 0x0c0b),
3942 alc_process_coef_fw(codec, fw);
3946 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
3947 const struct hda_fixup *fix, int action)
3949 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3950 alc255_set_default_jack_type(codec);
3952 alc_fixup_headset_mode(codec, fix, action);
3955 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
3956 const struct hda_fixup *fix, int action)
3958 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3959 struct alc_spec *spec = codec->spec;
3960 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3961 alc255_set_default_jack_type(codec);
3964 alc_fixup_headset_mode(codec, fix, action);
3967 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
3968 const struct hda_fixup *fix, int action)
3970 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3971 struct alc_spec *spec = codec->spec;
3972 spec->gen.auto_mute_via_amp = 1;
3976 static void alc_no_shutup(struct hda_codec *codec)
3980 static void alc_fixup_no_shutup(struct hda_codec *codec,
3981 const struct hda_fixup *fix, int action)
3983 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3984 struct alc_spec *spec = codec->spec;
3985 spec->shutup = alc_no_shutup;
3989 static void alc_fixup_disable_aamix(struct hda_codec *codec,
3990 const struct hda_fixup *fix, int action)
3992 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3993 struct alc_spec *spec = codec->spec;
3994 /* Disable AA-loopback as it causes white noise */
3995 spec->gen.mixer_nid = 0;
3999 static unsigned int alc_power_filter_xps13(struct hda_codec *codec,
4001 unsigned int power_state)
4003 struct alc_spec *spec = codec->spec;
4005 /* Avoid pop noises when headphones are plugged in */
4006 if (spec->gen.hp_jack_present)
4007 if (nid == codec->afg || nid == 0x02 || nid == 0x15)
4012 static void alc_fixup_dell_xps13(struct hda_codec *codec,
4013 const struct hda_fixup *fix, int action)
4015 if (action == HDA_FIXUP_ACT_PROBE) {
4016 struct alc_spec *spec = codec->spec;
4017 struct hda_input_mux *imux = &spec->gen.input_mux;
4020 spec->shutup = alc_no_shutup;
4021 codec->power_filter = alc_power_filter_xps13;
4023 /* Make the internal mic the default input source. */
4024 for (i = 0; i < imux->num_items; i++) {
4025 if (spec->gen.imux_pins[i] == 0x12) {
4026 spec->gen.cur_mux[0] = i;
4033 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
4034 const struct hda_fixup *fix, int action)
4036 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4037 alc_write_coef_idx(codec, 0xc4, 0x8000);
4038 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
4039 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
4041 alc_fixup_headset_mode(codec, fix, action);
4044 /* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
4045 static int find_ext_mic_pin(struct hda_codec *codec)
4047 struct alc_spec *spec = codec->spec;
4048 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
4050 unsigned int defcfg;
4053 for (i = 0; i < cfg->num_inputs; i++) {
4054 if (cfg->inputs[i].type != AUTO_PIN_MIC)
4056 nid = cfg->inputs[i].pin;
4057 defcfg = snd_hda_codec_get_pincfg(codec, nid);
4058 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
4066 static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
4067 const struct hda_fixup *fix,
4070 struct alc_spec *spec = codec->spec;
4072 if (action == HDA_FIXUP_ACT_PROBE) {
4073 int mic_pin = find_ext_mic_pin(codec);
4074 int hp_pin = spec->gen.autocfg.hp_pins[0];
4076 if (snd_BUG_ON(!mic_pin || !hp_pin))
4078 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
4082 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
4083 const struct hda_fixup *fix,
4086 struct alc_spec *spec = codec->spec;
4087 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
4090 /* The mic boosts on level 2 and 3 are too noisy
4091 on the internal mic input.
4092 Therefore limit the boost to 0 or 1. */
4094 if (action != HDA_FIXUP_ACT_PROBE)
4097 for (i = 0; i < cfg->num_inputs; i++) {
4098 hda_nid_t nid = cfg->inputs[i].pin;
4099 unsigned int defcfg;
4100 if (cfg->inputs[i].type != AUTO_PIN_MIC)
4102 defcfg = snd_hda_codec_get_pincfg(codec, nid);
4103 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
4106 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
4107 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
4108 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
4109 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
4110 (0 << AC_AMPCAP_MUTE_SHIFT));
4114 static void alc283_hp_automute_hook(struct hda_codec *codec,
4115 struct hda_jack_callback *jack)
4117 struct alc_spec *spec = codec->spec;
4121 snd_hda_gen_hp_automute(codec, jack);
4123 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4126 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4130 static void alc283_fixup_chromebook(struct hda_codec *codec,
4131 const struct hda_fixup *fix, int action)
4133 struct alc_spec *spec = codec->spec;
4136 case HDA_FIXUP_ACT_PRE_PROBE:
4137 snd_hda_override_wcaps(codec, 0x03, 0);
4138 /* Disable AA-loopback as it causes white noise */
4139 spec->gen.mixer_nid = 0;
4141 case HDA_FIXUP_ACT_INIT:
4142 /* MIC2-VREF control */
4143 /* Set to manual mode */
4144 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
4145 /* Enable Line1 input control by verb */
4146 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
4151 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
4152 const struct hda_fixup *fix, int action)
4154 struct alc_spec *spec = codec->spec;
4157 case HDA_FIXUP_ACT_PRE_PROBE:
4158 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
4160 case HDA_FIXUP_ACT_INIT:
4161 /* MIC2-VREF control */
4162 /* Set to manual mode */
4163 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
4168 /* mute tablet speaker pin (0x14) via dock plugging in addition */
4169 static void asus_tx300_automute(struct hda_codec *codec)
4171 struct alc_spec *spec = codec->spec;
4172 snd_hda_gen_update_outputs(codec);
4173 if (snd_hda_jack_detect(codec, 0x1b))
4174 spec->gen.mute_bits |= (1ULL << 0x14);
4177 static void alc282_fixup_asus_tx300(struct hda_codec *codec,
4178 const struct hda_fixup *fix, int action)
4180 struct alc_spec *spec = codec->spec;
4181 /* TX300 needs to set up GPIO2 for the speaker amp */
4182 static const struct hda_verb gpio2_verbs[] = {
4183 { 0x01, AC_VERB_SET_GPIO_MASK, 0x04 },
4184 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04 },
4185 { 0x01, AC_VERB_SET_GPIO_DATA, 0x04 },
4188 static const struct hda_pintbl dock_pins[] = {
4189 { 0x1b, 0x21114000 }, /* dock speaker pin */
4192 struct snd_kcontrol *kctl;
4195 case HDA_FIXUP_ACT_PRE_PROBE:
4196 snd_hda_add_verbs(codec, gpio2_verbs);
4197 snd_hda_apply_pincfgs(codec, dock_pins);
4198 spec->gen.auto_mute_via_amp = 1;
4199 spec->gen.automute_hook = asus_tx300_automute;
4200 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4201 snd_hda_gen_hp_automute);
4203 case HDA_FIXUP_ACT_BUILD:
4204 /* this is a bit tricky; give more sane names for the main
4205 * (tablet) speaker and the dock speaker, respectively
4207 kctl = snd_hda_find_mixer_ctl(codec, "Speaker Playback Switch");
4209 strcpy(kctl->id.name, "Dock Speaker Playback Switch");
4210 kctl = snd_hda_find_mixer_ctl(codec, "Bass Speaker Playback Switch");
4212 strcpy(kctl->id.name, "Speaker Playback Switch");
4217 static void alc290_fixup_mono_speakers(struct hda_codec *codec,
4218 const struct hda_fixup *fix, int action)
4220 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4221 /* DAC node 0x03 is giving mono output. We therefore want to
4222 make sure 0x14 (front speaker) and 0x15 (headphones) use the
4223 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
4224 hda_nid_t conn1[2] = { 0x0c };
4225 snd_hda_override_conn_list(codec, 0x14, 1, conn1);
4226 snd_hda_override_conn_list(codec, 0x15, 1, conn1);
4230 /* for hda_fixup_thinkpad_acpi() */
4231 #include "thinkpad_helper.c"
4233 /* for dell wmi mic mute led */
4234 #include "dell_wmi_helper.c"
4237 ALC269_FIXUP_SONY_VAIO,
4238 ALC275_FIXUP_SONY_VAIO_GPIO2,
4239 ALC269_FIXUP_DELL_M101Z,
4240 ALC269_FIXUP_SKU_IGNORE,
4241 ALC269_FIXUP_ASUS_G73JW,
4242 ALC269_FIXUP_LENOVO_EAPD,
4243 ALC275_FIXUP_SONY_HWEQ,
4244 ALC275_FIXUP_SONY_DISABLE_AAMIX,
4246 ALC269_FIXUP_PCM_44K,
4247 ALC269_FIXUP_STEREO_DMIC,
4248 ALC269_FIXUP_HEADSET_MIC,
4249 ALC269_FIXUP_QUANTA_MUTE,
4250 ALC269_FIXUP_LIFEBOOK,
4251 ALC269_FIXUP_LIFEBOOK_EXTMIC,
4254 ALC269VB_FIXUP_AMIC,
4255 ALC269VB_FIXUP_DMIC,
4256 ALC269_FIXUP_HP_MUTE_LED,
4257 ALC269_FIXUP_HP_MUTE_LED_MIC1,
4258 ALC269_FIXUP_HP_MUTE_LED_MIC2,
4259 ALC269_FIXUP_HP_GPIO_LED,
4260 ALC269_FIXUP_HP_GPIO_MIC1_LED,
4261 ALC269_FIXUP_HP_LINE1_MIC1_LED,
4262 ALC269_FIXUP_INV_DMIC,
4263 ALC269_FIXUP_LENOVO_DOCK,
4264 ALC269_FIXUP_NO_SHUTUP,
4265 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
4266 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
4267 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
4268 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
4269 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
4270 ALC269_FIXUP_HEADSET_MODE,
4271 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
4272 ALC269_FIXUP_ASUS_X101_FUNC,
4273 ALC269_FIXUP_ASUS_X101_VERB,
4274 ALC269_FIXUP_ASUS_X101,
4275 ALC271_FIXUP_AMIC_MIC2,
4276 ALC271_FIXUP_HP_GATE_MIC_JACK,
4277 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
4278 ALC269_FIXUP_ACER_AC700,
4279 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
4280 ALC269VB_FIXUP_ASUS_ZENBOOK,
4281 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
4282 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
4283 ALC269VB_FIXUP_ORDISSIMO_EVE2,
4284 ALC283_FIXUP_CHROME_BOOK,
4285 ALC283_FIXUP_SENSE_COMBO_JACK,
4286 ALC282_FIXUP_ASUS_TX300,
4287 ALC283_FIXUP_INT_MIC,
4288 ALC290_FIXUP_MONO_SPEAKERS,
4289 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
4290 ALC290_FIXUP_SUBWOOFER,
4291 ALC290_FIXUP_SUBWOOFER_HSJACK,
4292 ALC269_FIXUP_THINKPAD_ACPI,
4293 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
4294 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
4295 ALC255_FIXUP_HEADSET_MODE,
4296 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
4297 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
4298 ALC292_FIXUP_TPT440_DOCK,
4299 ALC283_FIXUP_BXBT2807_MIC,
4300 ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED,
4301 ALC282_FIXUP_ASPIRE_V5_PINS,
4302 ALC280_FIXUP_HP_GPIO4,
4305 static const struct hda_fixup alc269_fixups[] = {
4306 [ALC269_FIXUP_SONY_VAIO] = {
4307 .type = HDA_FIXUP_PINCTLS,
4308 .v.pins = (const struct hda_pintbl[]) {
4309 {0x19, PIN_VREFGRD},
4313 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
4314 .type = HDA_FIXUP_VERBS,
4315 .v.verbs = (const struct hda_verb[]) {
4316 {0x01, AC_VERB_SET_GPIO_MASK, 0x04},
4317 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04},
4318 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4322 .chain_id = ALC269_FIXUP_SONY_VAIO
4324 [ALC269_FIXUP_DELL_M101Z] = {
4325 .type = HDA_FIXUP_VERBS,
4326 .v.verbs = (const struct hda_verb[]) {
4327 /* Enables internal speaker */
4328 {0x20, AC_VERB_SET_COEF_INDEX, 13},
4329 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
4333 [ALC269_FIXUP_SKU_IGNORE] = {
4334 .type = HDA_FIXUP_FUNC,
4335 .v.func = alc_fixup_sku_ignore,
4337 [ALC269_FIXUP_ASUS_G73JW] = {
4338 .type = HDA_FIXUP_PINS,
4339 .v.pins = (const struct hda_pintbl[]) {
4340 { 0x17, 0x99130111 }, /* subwoofer */
4344 [ALC269_FIXUP_LENOVO_EAPD] = {
4345 .type = HDA_FIXUP_VERBS,
4346 .v.verbs = (const struct hda_verb[]) {
4347 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
4351 [ALC275_FIXUP_SONY_HWEQ] = {
4352 .type = HDA_FIXUP_FUNC,
4353 .v.func = alc269_fixup_hweq,
4355 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
4357 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
4358 .type = HDA_FIXUP_FUNC,
4359 .v.func = alc_fixup_disable_aamix,
4361 .chain_id = ALC269_FIXUP_SONY_VAIO
4363 [ALC271_FIXUP_DMIC] = {
4364 .type = HDA_FIXUP_FUNC,
4365 .v.func = alc271_fixup_dmic,
4367 [ALC269_FIXUP_PCM_44K] = {
4368 .type = HDA_FIXUP_FUNC,
4369 .v.func = alc269_fixup_pcm_44k,
4371 .chain_id = ALC269_FIXUP_QUANTA_MUTE
4373 [ALC269_FIXUP_STEREO_DMIC] = {
4374 .type = HDA_FIXUP_FUNC,
4375 .v.func = alc269_fixup_stereo_dmic,
4377 [ALC269_FIXUP_HEADSET_MIC] = {
4378 .type = HDA_FIXUP_FUNC,
4379 .v.func = alc269_fixup_headset_mic,
4381 [ALC269_FIXUP_QUANTA_MUTE] = {
4382 .type = HDA_FIXUP_FUNC,
4383 .v.func = alc269_fixup_quanta_mute,
4385 [ALC269_FIXUP_LIFEBOOK] = {
4386 .type = HDA_FIXUP_PINS,
4387 .v.pins = (const struct hda_pintbl[]) {
4388 { 0x1a, 0x2101103f }, /* dock line-out */
4389 { 0x1b, 0x23a11040 }, /* dock mic-in */
4393 .chain_id = ALC269_FIXUP_QUANTA_MUTE
4395 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
4396 .type = HDA_FIXUP_PINS,
4397 .v.pins = (const struct hda_pintbl[]) {
4398 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
4402 [ALC269_FIXUP_AMIC] = {
4403 .type = HDA_FIXUP_PINS,
4404 .v.pins = (const struct hda_pintbl[]) {
4405 { 0x14, 0x99130110 }, /* speaker */
4406 { 0x15, 0x0121401f }, /* HP out */
4407 { 0x18, 0x01a19c20 }, /* mic */
4408 { 0x19, 0x99a3092f }, /* int-mic */
4412 [ALC269_FIXUP_DMIC] = {
4413 .type = HDA_FIXUP_PINS,
4414 .v.pins = (const struct hda_pintbl[]) {
4415 { 0x12, 0x99a3092f }, /* int-mic */
4416 { 0x14, 0x99130110 }, /* speaker */
4417 { 0x15, 0x0121401f }, /* HP out */
4418 { 0x18, 0x01a19c20 }, /* mic */
4422 [ALC269VB_FIXUP_AMIC] = {
4423 .type = HDA_FIXUP_PINS,
4424 .v.pins = (const struct hda_pintbl[]) {
4425 { 0x14, 0x99130110 }, /* speaker */
4426 { 0x18, 0x01a19c20 }, /* mic */
4427 { 0x19, 0x99a3092f }, /* int-mic */
4428 { 0x21, 0x0121401f }, /* HP out */
4432 [ALC269VB_FIXUP_DMIC] = {
4433 .type = HDA_FIXUP_PINS,
4434 .v.pins = (const struct hda_pintbl[]) {
4435 { 0x12, 0x99a3092f }, /* int-mic */
4436 { 0x14, 0x99130110 }, /* speaker */
4437 { 0x18, 0x01a19c20 }, /* mic */
4438 { 0x21, 0x0121401f }, /* HP out */
4442 [ALC269_FIXUP_HP_MUTE_LED] = {
4443 .type = HDA_FIXUP_FUNC,
4444 .v.func = alc269_fixup_hp_mute_led,
4446 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
4447 .type = HDA_FIXUP_FUNC,
4448 .v.func = alc269_fixup_hp_mute_led_mic1,
4450 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
4451 .type = HDA_FIXUP_FUNC,
4452 .v.func = alc269_fixup_hp_mute_led_mic2,
4454 [ALC269_FIXUP_HP_GPIO_LED] = {
4455 .type = HDA_FIXUP_FUNC,
4456 .v.func = alc269_fixup_hp_gpio_led,
4458 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
4459 .type = HDA_FIXUP_FUNC,
4460 .v.func = alc269_fixup_hp_gpio_mic1_led,
4462 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
4463 .type = HDA_FIXUP_FUNC,
4464 .v.func = alc269_fixup_hp_line1_mic1_led,
4466 [ALC269_FIXUP_INV_DMIC] = {
4467 .type = HDA_FIXUP_FUNC,
4468 .v.func = alc_fixup_inv_dmic,
4470 [ALC269_FIXUP_NO_SHUTUP] = {
4471 .type = HDA_FIXUP_FUNC,
4472 .v.func = alc_fixup_no_shutup,
4474 [ALC269_FIXUP_LENOVO_DOCK] = {
4475 .type = HDA_FIXUP_PINS,
4476 .v.pins = (const struct hda_pintbl[]) {
4477 { 0x19, 0x23a11040 }, /* dock mic */
4478 { 0x1b, 0x2121103f }, /* dock headphone */
4482 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
4484 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
4485 .type = HDA_FIXUP_FUNC,
4486 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
4488 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
4490 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
4491 .type = HDA_FIXUP_PINS,
4492 .v.pins = (const struct hda_pintbl[]) {
4493 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4494 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
4498 .chain_id = ALC269_FIXUP_HEADSET_MODE
4500 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
4501 .type = HDA_FIXUP_PINS,
4502 .v.pins = (const struct hda_pintbl[]) {
4503 { 0x16, 0x21014020 }, /* dock line out */
4504 { 0x19, 0x21a19030 }, /* dock mic */
4505 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4509 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
4511 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
4512 .type = HDA_FIXUP_PINS,
4513 .v.pins = (const struct hda_pintbl[]) {
4514 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4518 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
4520 [ALC269_FIXUP_HEADSET_MODE] = {
4521 .type = HDA_FIXUP_FUNC,
4522 .v.func = alc_fixup_headset_mode,
4524 .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
4526 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
4527 .type = HDA_FIXUP_FUNC,
4528 .v.func = alc_fixup_headset_mode_no_hp_mic,
4530 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
4531 .type = HDA_FIXUP_PINS,
4532 .v.pins = (const struct hda_pintbl[]) {
4533 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4537 .chain_id = ALC269_FIXUP_HEADSET_MIC
4539 [ALC269_FIXUP_ASUS_X101_FUNC] = {
4540 .type = HDA_FIXUP_FUNC,
4541 .v.func = alc269_fixup_x101_headset_mic,
4543 [ALC269_FIXUP_ASUS_X101_VERB] = {
4544 .type = HDA_FIXUP_VERBS,
4545 .v.verbs = (const struct hda_verb[]) {
4546 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4547 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
4548 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
4552 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
4554 [ALC269_FIXUP_ASUS_X101] = {
4555 .type = HDA_FIXUP_PINS,
4556 .v.pins = (const struct hda_pintbl[]) {
4557 { 0x18, 0x04a1182c }, /* Headset mic */
4561 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
4563 [ALC271_FIXUP_AMIC_MIC2] = {
4564 .type = HDA_FIXUP_PINS,
4565 .v.pins = (const struct hda_pintbl[]) {
4566 { 0x14, 0x99130110 }, /* speaker */
4567 { 0x19, 0x01a19c20 }, /* mic */
4568 { 0x1b, 0x99a7012f }, /* int-mic */
4569 { 0x21, 0x0121401f }, /* HP out */
4573 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
4574 .type = HDA_FIXUP_FUNC,
4575 .v.func = alc271_hp_gate_mic_jack,
4577 .chain_id = ALC271_FIXUP_AMIC_MIC2,
4579 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
4580 .type = HDA_FIXUP_FUNC,
4581 .v.func = alc269_fixup_limit_int_mic_boost,
4583 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
4585 [ALC269_FIXUP_ACER_AC700] = {
4586 .type = HDA_FIXUP_PINS,
4587 .v.pins = (const struct hda_pintbl[]) {
4588 { 0x12, 0x99a3092f }, /* int-mic */
4589 { 0x14, 0x99130110 }, /* speaker */
4590 { 0x18, 0x03a11c20 }, /* mic */
4591 { 0x1e, 0x0346101e }, /* SPDIF1 */
4592 { 0x21, 0x0321101f }, /* HP out */
4596 .chain_id = ALC271_FIXUP_DMIC,
4598 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
4599 .type = HDA_FIXUP_FUNC,
4600 .v.func = alc269_fixup_limit_int_mic_boost,
4602 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
4604 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
4605 .type = HDA_FIXUP_FUNC,
4606 .v.func = alc269_fixup_limit_int_mic_boost,
4608 .chain_id = ALC269VB_FIXUP_DMIC,
4610 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
4611 .type = HDA_FIXUP_VERBS,
4612 .v.verbs = (const struct hda_verb[]) {
4613 /* class-D output amp +5dB */
4614 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
4615 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
4619 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
4621 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
4622 .type = HDA_FIXUP_FUNC,
4623 .v.func = alc269_fixup_limit_int_mic_boost,
4625 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
4627 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
4628 .type = HDA_FIXUP_PINS,
4629 .v.pins = (const struct hda_pintbl[]) {
4630 { 0x12, 0x99a3092f }, /* int-mic */
4631 { 0x18, 0x03a11d20 }, /* mic */
4632 { 0x19, 0x411111f0 }, /* Unused bogus pin */
4636 [ALC283_FIXUP_CHROME_BOOK] = {
4637 .type = HDA_FIXUP_FUNC,
4638 .v.func = alc283_fixup_chromebook,
4640 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
4641 .type = HDA_FIXUP_FUNC,
4642 .v.func = alc283_fixup_sense_combo_jack,
4644 .chain_id = ALC283_FIXUP_CHROME_BOOK,
4646 [ALC282_FIXUP_ASUS_TX300] = {
4647 .type = HDA_FIXUP_FUNC,
4648 .v.func = alc282_fixup_asus_tx300,
4650 [ALC283_FIXUP_INT_MIC] = {
4651 .type = HDA_FIXUP_VERBS,
4652 .v.verbs = (const struct hda_verb[]) {
4653 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
4654 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
4658 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
4660 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
4661 .type = HDA_FIXUP_PINS,
4662 .v.pins = (const struct hda_pintbl[]) {
4663 { 0x17, 0x90170112 }, /* subwoofer */
4667 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
4669 [ALC290_FIXUP_SUBWOOFER] = {
4670 .type = HDA_FIXUP_PINS,
4671 .v.pins = (const struct hda_pintbl[]) {
4672 { 0x17, 0x90170112 }, /* subwoofer */
4676 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
4678 [ALC290_FIXUP_MONO_SPEAKERS] = {
4679 .type = HDA_FIXUP_FUNC,
4680 .v.func = alc290_fixup_mono_speakers,
4682 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
4683 .type = HDA_FIXUP_FUNC,
4684 .v.func = alc290_fixup_mono_speakers,
4686 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
4688 [ALC269_FIXUP_THINKPAD_ACPI] = {
4689 .type = HDA_FIXUP_FUNC,
4690 .v.func = hda_fixup_thinkpad_acpi,
4692 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
4693 .type = HDA_FIXUP_PINS,
4694 .v.pins = (const struct hda_pintbl[]) {
4695 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4696 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
4700 .chain_id = ALC255_FIXUP_HEADSET_MODE
4702 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
4703 .type = HDA_FIXUP_PINS,
4704 .v.pins = (const struct hda_pintbl[]) {
4705 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4709 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
4711 [ALC255_FIXUP_HEADSET_MODE] = {
4712 .type = HDA_FIXUP_FUNC,
4713 .v.func = alc_fixup_headset_mode_alc255,
4715 .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
4717 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
4718 .type = HDA_FIXUP_FUNC,
4719 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
4721 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
4722 .type = HDA_FIXUP_PINS,
4723 .v.pins = (const struct hda_pintbl[]) {
4724 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
4725 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4729 .chain_id = ALC269_FIXUP_HEADSET_MODE
4731 [ALC292_FIXUP_TPT440_DOCK] = {
4732 .type = HDA_FIXUP_PINS,
4733 .v.pins = (const struct hda_pintbl[]) {
4734 { 0x16, 0x21211010 }, /* dock headphone */
4735 { 0x19, 0x21a11010 }, /* dock mic */
4739 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
4741 [ALC283_FIXUP_BXBT2807_MIC] = {
4742 .type = HDA_FIXUP_PINS,
4743 .v.pins = (const struct hda_pintbl[]) {
4744 { 0x19, 0x04a110f0 },
4748 [ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED] = {
4749 .type = HDA_FIXUP_FUNC,
4750 .v.func = alc_fixup_dell_wmi,
4752 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
4753 .type = HDA_FIXUP_PINS,
4754 .v.pins = (const struct hda_pintbl[]) {
4755 { 0x12, 0x90a60130 },
4756 { 0x14, 0x90170110 },
4757 { 0x17, 0x40000008 },
4758 { 0x18, 0x411111f0 },
4759 { 0x19, 0x411111f0 },
4760 { 0x1a, 0x411111f0 },
4761 { 0x1b, 0x411111f0 },
4762 { 0x1d, 0x40f89b2d },
4763 { 0x1e, 0x411111f0 },
4764 { 0x21, 0x0321101f },
4768 [ALC280_FIXUP_HP_GPIO4] = {
4769 .type = HDA_FIXUP_FUNC,
4770 .v.func = alc280_fixup_hp_gpio4,
4774 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
4775 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
4776 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
4777 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
4778 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
4779 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
4780 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
4781 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
4782 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
4783 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
4784 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
4785 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4786 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4787 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4788 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
4789 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
4790 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
4791 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
4792 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
4793 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
4794 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
4795 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
4796 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
4797 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
4799 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4800 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4801 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4802 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4803 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4804 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4805 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4806 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4807 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4808 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4809 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4810 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4811 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4812 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4813 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4814 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4815 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4816 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4818 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4819 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4820 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4821 SND_PCI_QUIRK(0x103c, 0x2246, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4822 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4823 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4824 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4825 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4826 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4827 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4828 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4829 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4830 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4831 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4832 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4833 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4834 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4835 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4836 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4837 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4838 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4839 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4840 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4841 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4842 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4843 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4844 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4845 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4846 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4847 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4848 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
4849 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4850 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4851 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
4852 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
4853 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
4854 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
4855 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
4856 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4857 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
4858 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
4859 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
4860 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
4861 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
4862 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
4863 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
4864 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
4865 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
4866 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
4867 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
4868 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
4869 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
4870 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
4871 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_BXBT2807_MIC),
4872 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
4873 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
4874 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
4875 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
4876 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
4877 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK),
4878 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
4879 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
4880 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
4881 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
4882 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
4883 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440_DOCK),
4884 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
4885 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
4886 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
4887 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
4888 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4889 SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP),
4890 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4891 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
4892 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
4893 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4894 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4895 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
4896 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
4897 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
4900 /* Below is a quirk table taken from the old code.
4901 * Basically the device should work as is without the fixup table.
4902 * If BIOS doesn't give a proper info, enable the corresponding
4905 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
4907 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
4908 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
4909 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
4910 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
4911 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
4912 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
4913 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
4914 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
4915 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
4916 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
4917 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
4918 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
4919 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
4920 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
4921 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
4922 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
4923 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
4924 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
4925 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
4926 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
4927 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
4928 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
4929 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
4930 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
4931 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
4932 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
4933 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
4934 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
4935 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
4936 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
4937 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
4938 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
4939 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
4940 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
4941 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
4942 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
4943 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
4944 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
4945 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
4950 static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
4951 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
4952 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
4953 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
4954 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
4958 static const struct hda_model_fixup alc269_fixup_models[] = {
4959 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
4960 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
4961 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
4962 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
4963 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
4964 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
4965 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
4966 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
4967 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
4968 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
4969 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
4970 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
4971 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
4975 #define ALC255_STANDARD_PINS \
4976 {0x18, 0x411111f0}, \
4977 {0x19, 0x411111f0}, \
4978 {0x1a, 0x411111f0}, \
4979 {0x1b, 0x411111f0}, \
4982 #define ALC282_STANDARD_PINS \
4983 {0x14, 0x90170110}, \
4984 {0x18, 0x411111f0}, \
4985 {0x1a, 0x411111f0}, \
4986 {0x1b, 0x411111f0}, \
4989 #define ALC290_STANDARD_PINS \
4990 {0x12, 0x99a30130}, \
4991 {0x13, 0x40000000}, \
4992 {0x16, 0x411111f0}, \
4993 {0x17, 0x411111f0}, \
4994 {0x19, 0x411111f0}, \
4995 {0x1b, 0x411111f0}, \
4998 #define ALC292_STANDARD_PINS \
4999 {0x14, 0x90170110}, \
5000 {0x15, 0x0221401f}, \
5001 {0x1a, 0x411111f0}, \
5002 {0x1b, 0x411111f0}, \
5003 {0x1d, 0x40700001}, \
5006 static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
5007 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
5008 ALC255_STANDARD_PINS,
5013 {0x21, 0x02211020}),
5014 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5015 ALC255_STANDARD_PINS,
5020 {0x21, 0x02211020}),
5021 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5022 ALC255_STANDARD_PINS,
5027 {0x21, 0x02211030}),
5028 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5038 {0x21, 0x0321102f}),
5039 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5040 ALC255_STANDARD_PINS,
5045 {0x21, 0x02211040}),
5046 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5047 ALC255_STANDARD_PINS,
5052 {0x21, 0x02211050}),
5053 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5054 ALC255_STANDARD_PINS,
5059 {0x21, 0x02211030}),
5060 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5061 ALC255_STANDARD_PINS,
5066 {0x21, 0x02211040}),
5067 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
5079 {0x1e, 0x411111f0}),
5080 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
5092 {0x1e, 0x411111f0}),
5093 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
5094 ALC282_STANDARD_PINS,
5099 {0x21, 0x0321101f}),
5100 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
5101 ALC282_STANDARD_PINS,
5106 {0x21, 0x03211040}),
5107 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
5108 ALC282_STANDARD_PINS,
5113 {0x21, 0x03211020}),
5114 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
5115 ALC282_STANDARD_PINS,
5120 {0x21, 0x03211020}),
5121 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
5122 ALC282_STANDARD_PINS,
5127 {0x21, 0x0421101f}),
5128 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
5129 ALC282_STANDARD_PINS,
5134 {0x21, 0x04211020}),
5135 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
5136 ALC282_STANDARD_PINS,
5141 {0x21, 0x04211020}),
5142 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
5143 ALC282_STANDARD_PINS,
5148 {0x21, 0x0321101f}),
5149 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
5159 {0x21, 0x02211030}),
5160 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
5161 ALC282_STANDARD_PINS,
5166 {0x21, 0x0321101f}),
5167 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
5168 ALC290_STANDARD_PINS,
5173 {0x1d, 0x4075812d}),
5174 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
5175 ALC290_STANDARD_PINS,
5180 {0x1d, 0x4075812d}),
5181 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
5182 ALC290_STANDARD_PINS,
5187 {0x1d, 0x4075812d}),
5188 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
5189 ALC290_STANDARD_PINS,
5194 {0x1d, 0x4076a12d}),
5195 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
5196 ALC290_STANDARD_PINS,
5201 {0x1d, 0x4076a12d}),
5202 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
5203 ALC290_STANDARD_PINS,
5208 {0x1d, 0x4076a12d}),
5209 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
5210 ALC290_STANDARD_PINS,
5215 {0x1d, 0x4075812d}),
5216 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
5217 ALC292_STANDARD_PINS,
5222 {0x19, 0x01a19030}),
5223 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
5224 ALC292_STANDARD_PINS,
5229 {0x19, 0x01a1903e}),
5230 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
5231 ALC292_STANDARD_PINS,
5236 {0x19, 0x411111f0}),
5237 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
5238 ALC292_STANDARD_PINS,
5243 {0x19, 0x21a19030}),
5244 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
5245 ALC292_STANDARD_PINS,
5250 {0x19, 0x411111f0}),
5254 static void alc269_fill_coef(struct hda_codec *codec)
5256 struct alc_spec *spec = codec->spec;
5259 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
5262 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
5263 alc_write_coef_idx(codec, 0xf, 0x960b);
5264 alc_write_coef_idx(codec, 0xe, 0x8817);
5267 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
5268 alc_write_coef_idx(codec, 0xf, 0x960b);
5269 alc_write_coef_idx(codec, 0xe, 0x8814);
5272 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
5273 /* Power up output pin */
5274 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
5277 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
5278 val = alc_read_coef_idx(codec, 0xd);
5279 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
5280 /* Capless ramp up clock control */
5281 alc_write_coef_idx(codec, 0xd, val | (1<<10));
5283 val = alc_read_coef_idx(codec, 0x17);
5284 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
5285 /* Class D power on reset */
5286 alc_write_coef_idx(codec, 0x17, val | (1<<7));
5291 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
5296 static int patch_alc269(struct hda_codec *codec)
5298 struct alc_spec *spec;
5301 err = alc_alloc_spec(codec, 0x0b);
5306 spec->gen.shared_mic_vref_pin = 0x18;
5308 snd_hda_pick_fixup(codec, alc269_fixup_models,
5309 alc269_fixup_tbl, alc269_fixups);
5310 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups);
5311 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
5313 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
5315 alc_auto_parse_customize_define(codec);
5317 if (has_cdefine_beep(codec))
5318 spec->gen.beep_nid = 0x01;
5320 switch (codec->vendor_id) {
5322 spec->codec_variant = ALC269_TYPE_ALC269VA;
5323 switch (alc_get_coef0(codec) & 0x00f0) {
5325 if (codec->bus->pci &&
5326 codec->bus->pci->subsystem_vendor == 0x1025 &&
5327 spec->cdefine.platform_type == 1)
5328 err = alc_codec_rename(codec, "ALC271X");
5329 spec->codec_variant = ALC269_TYPE_ALC269VB;
5332 if (codec->bus->pci &&
5333 codec->bus->pci->subsystem_vendor == 0x17aa &&
5334 codec->bus->pci->subsystem_device == 0x21f3)
5335 err = alc_codec_rename(codec, "ALC3202");
5336 spec->codec_variant = ALC269_TYPE_ALC269VC;
5339 spec->codec_variant = ALC269_TYPE_ALC269VD;
5342 alc_fix_pll_init(codec, 0x20, 0x04, 15);
5346 spec->init_hook = alc269_fill_coef;
5347 alc269_fill_coef(codec);
5352 spec->codec_variant = ALC269_TYPE_ALC280;
5355 spec->codec_variant = ALC269_TYPE_ALC282;
5356 spec->shutup = alc282_shutup;
5357 spec->init_hook = alc282_init;
5361 spec->codec_variant = ALC269_TYPE_ALC283;
5362 spec->shutup = alc283_shutup;
5363 spec->init_hook = alc283_init;
5367 spec->codec_variant = ALC269_TYPE_ALC284;
5371 spec->codec_variant = ALC269_TYPE_ALC285;
5375 spec->codec_variant = ALC269_TYPE_ALC286;
5376 spec->shutup = alc286_shutup;
5379 spec->codec_variant = ALC269_TYPE_ALC255;
5383 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
5384 spec->has_alc5505_dsp = 1;
5385 spec->init_hook = alc5505_dsp_init;
5388 /* automatic parse from the BIOS config */
5389 err = alc269_parse_auto_config(codec);
5393 if (!spec->gen.no_analog && spec->gen.beep_nid)
5394 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
5396 codec->patch_ops = alc_patch_ops;
5398 codec->patch_ops.suspend = alc269_suspend;
5399 codec->patch_ops.resume = alc269_resume;
5402 spec->shutup = alc269_shutup;
5404 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
5417 static int alc861_parse_auto_config(struct hda_codec *codec)
5419 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
5420 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
5421 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
5424 /* Pin config fixes */
5426 ALC861_FIXUP_FSC_AMILO_PI1505,
5427 ALC861_FIXUP_AMP_VREF_0F,
5428 ALC861_FIXUP_NO_JACK_DETECT,
5429 ALC861_FIXUP_ASUS_A6RP,
5430 ALC660_FIXUP_ASUS_W7J,
5433 /* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
5434 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
5435 const struct hda_fixup *fix, int action)
5437 struct alc_spec *spec = codec->spec;
5440 if (action != HDA_FIXUP_ACT_INIT)
5442 val = snd_hda_codec_get_pin_target(codec, 0x0f);
5443 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
5444 val |= AC_PINCTL_IN_EN;
5445 val |= AC_PINCTL_VREF_50;
5446 snd_hda_set_pin_ctl(codec, 0x0f, val);
5447 spec->gen.keep_vref_in_automute = 1;
5450 /* suppress the jack-detection */
5451 static void alc_fixup_no_jack_detect(struct hda_codec *codec,
5452 const struct hda_fixup *fix, int action)
5454 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5455 codec->no_jack_detect = 1;
5458 static const struct hda_fixup alc861_fixups[] = {
5459 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
5460 .type = HDA_FIXUP_PINS,
5461 .v.pins = (const struct hda_pintbl[]) {
5462 { 0x0b, 0x0221101f }, /* HP */
5463 { 0x0f, 0x90170310 }, /* speaker */
5467 [ALC861_FIXUP_AMP_VREF_0F] = {
5468 .type = HDA_FIXUP_FUNC,
5469 .v.func = alc861_fixup_asus_amp_vref_0f,
5471 [ALC861_FIXUP_NO_JACK_DETECT] = {
5472 .type = HDA_FIXUP_FUNC,
5473 .v.func = alc_fixup_no_jack_detect,
5475 [ALC861_FIXUP_ASUS_A6RP] = {
5476 .type = HDA_FIXUP_FUNC,
5477 .v.func = alc861_fixup_asus_amp_vref_0f,
5479 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
5481 [ALC660_FIXUP_ASUS_W7J] = {
5482 .type = HDA_FIXUP_VERBS,
5483 .v.verbs = (const struct hda_verb[]) {
5484 /* ASUS W7J needs a magic pin setup on unused NID 0x10
5485 * for enabling outputs
5487 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5493 static const struct snd_pci_quirk alc861_fixup_tbl[] = {
5494 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
5495 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
5496 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
5497 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
5498 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
5499 SND_PCI_QUIRK(0x1584, 0x2b01, "Haier W18", ALC861_FIXUP_AMP_VREF_0F),
5500 SND_PCI_QUIRK(0x1584, 0x0000, "Uniwill ECS M31EI", ALC861_FIXUP_AMP_VREF_0F),
5501 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
5507 static int patch_alc861(struct hda_codec *codec)
5509 struct alc_spec *spec;
5512 err = alc_alloc_spec(codec, 0x15);
5517 spec->gen.beep_nid = 0x23;
5519 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
5520 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
5522 /* automatic parse from the BIOS config */
5523 err = alc861_parse_auto_config(codec);
5527 if (!spec->gen.no_analog)
5528 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
5530 codec->patch_ops = alc_patch_ops;
5532 spec->power_hook = alc_power_eapd;
5535 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
5549 * In addition, an independent DAC
5551 static int alc861vd_parse_auto_config(struct hda_codec *codec)
5553 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
5554 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
5555 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
5559 ALC660VD_FIX_ASUS_GPIO1,
5560 ALC861VD_FIX_DALLAS,
5563 /* exclude VREF80 */
5564 static void alc861vd_fixup_dallas(struct hda_codec *codec,
5565 const struct hda_fixup *fix, int action)
5567 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5568 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
5569 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
5573 static const struct hda_fixup alc861vd_fixups[] = {
5574 [ALC660VD_FIX_ASUS_GPIO1] = {
5575 .type = HDA_FIXUP_VERBS,
5576 .v.verbs = (const struct hda_verb[]) {
5578 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
5579 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5580 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5584 [ALC861VD_FIX_DALLAS] = {
5585 .type = HDA_FIXUP_FUNC,
5586 .v.func = alc861vd_fixup_dallas,
5590 static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
5591 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
5592 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
5593 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
5599 static int patch_alc861vd(struct hda_codec *codec)
5601 struct alc_spec *spec;
5604 err = alc_alloc_spec(codec, 0x0b);
5609 spec->gen.beep_nid = 0x23;
5611 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
5612 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
5614 /* automatic parse from the BIOS config */
5615 err = alc861vd_parse_auto_config(codec);
5619 if (!spec->gen.no_analog)
5620 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5622 codec->patch_ops = alc_patch_ops;
5624 spec->shutup = alc_eapd_shutup;
5626 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
5638 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
5639 * configuration. Each pin widget can choose any input DACs and a mixer.
5640 * Each ADC is connected from a mixer of all inputs. This makes possible
5641 * 6-channel independent captures.
5643 * In addition, an independent DAC for the multi-playback (not used in this
5648 * BIOS auto configuration
5651 static int alc662_parse_auto_config(struct hda_codec *codec)
5653 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
5654 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
5655 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
5656 const hda_nid_t *ssids;
5658 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
5659 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670 ||
5660 codec->vendor_id == 0x10ec0671)
5661 ssids = alc663_ssids;
5663 ssids = alc662_ssids;
5664 return alc_parse_auto_config(codec, alc662_ignore, ssids);
5667 static void alc272_fixup_mario(struct hda_codec *codec,
5668 const struct hda_fixup *fix, int action)
5670 if (action != HDA_FIXUP_ACT_PRE_PROBE)
5672 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
5673 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
5674 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
5675 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
5676 (0 << AC_AMPCAP_MUTE_SHIFT)))
5677 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
5680 static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
5682 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
5684 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
5685 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
5689 /* override the 2.1 chmap */
5690 static void alc_fixup_bass_chmap(struct hda_codec *codec,
5691 const struct hda_fixup *fix, int action)
5693 if (action == HDA_FIXUP_ACT_BUILD) {
5694 struct alc_spec *spec = codec->spec;
5695 spec->gen.pcm_rec[0].stream[0].chmap = asus_pcm_2_1_chmaps;
5699 /* turn on/off mute LED per vmaster hook */
5700 static void alc662_led_gpio1_mute_hook(void *private_data, int enabled)
5702 struct hda_codec *codec = private_data;
5703 struct alc_spec *spec = codec->spec;
5704 unsigned int oldval = spec->gpio_led;
5707 spec->gpio_led |= 0x01;
5709 spec->gpio_led &= ~0x01;
5710 if (spec->gpio_led != oldval)
5711 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
5715 /* avoid D3 for keeping GPIO up */
5716 static unsigned int gpio_led_power_filter(struct hda_codec *codec,
5718 unsigned int power_state)
5720 struct alc_spec *spec = codec->spec;
5721 if (nid == codec->afg && power_state == AC_PWRST_D3 && spec->gpio_led)
5726 static void alc662_fixup_led_gpio1(struct hda_codec *codec,
5727 const struct hda_fixup *fix, int action)
5729 struct alc_spec *spec = codec->spec;
5730 static const struct hda_verb gpio_init[] = {
5731 { 0x01, AC_VERB_SET_GPIO_MASK, 0x01 },
5732 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01 },
5736 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5737 spec->gen.vmaster_mute.hook = alc662_led_gpio1_mute_hook;
5739 snd_hda_add_verbs(codec, gpio_init);
5740 codec->power_filter = gpio_led_power_filter;
5744 static struct coef_fw alc668_coefs[] = {
5745 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
5746 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
5747 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
5748 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
5749 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
5750 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
5751 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
5752 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
5753 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
5754 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
5755 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
5756 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
5757 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
5758 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
5759 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
5760 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
5761 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
5762 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
5763 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
5764 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
5768 static void alc668_restore_default_value(struct hda_codec *codec)
5770 alc_process_coef_fw(codec, alc668_coefs);
5774 ALC662_FIXUP_ASPIRE,
5775 ALC662_FIXUP_LED_GPIO1,
5776 ALC662_FIXUP_IDEAPAD,
5778 ALC662_FIXUP_CZC_P10T,
5779 ALC662_FIXUP_SKU_IGNORE,
5780 ALC662_FIXUP_HP_RP5800,
5781 ALC662_FIXUP_ASUS_MODE1,
5782 ALC662_FIXUP_ASUS_MODE2,
5783 ALC662_FIXUP_ASUS_MODE3,
5784 ALC662_FIXUP_ASUS_MODE4,
5785 ALC662_FIXUP_ASUS_MODE5,
5786 ALC662_FIXUP_ASUS_MODE6,
5787 ALC662_FIXUP_ASUS_MODE7,
5788 ALC662_FIXUP_ASUS_MODE8,
5789 ALC662_FIXUP_NO_JACK_DETECT,
5790 ALC662_FIXUP_ZOTAC_Z68,
5791 ALC662_FIXUP_INV_DMIC,
5792 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
5793 ALC668_FIXUP_HEADSET_MODE,
5794 ALC662_FIXUP_BASS_MODE4_CHMAP,
5795 ALC662_FIXUP_BASS_16,
5796 ALC662_FIXUP_BASS_1A,
5797 ALC662_FIXUP_BASS_CHMAP,
5798 ALC668_FIXUP_AUTO_MUTE,
5799 ALC668_FIXUP_DELL_DISABLE_AAMIX,
5800 ALC668_FIXUP_DELL_XPS13,
5803 static const struct hda_fixup alc662_fixups[] = {
5804 [ALC662_FIXUP_ASPIRE] = {
5805 .type = HDA_FIXUP_PINS,
5806 .v.pins = (const struct hda_pintbl[]) {
5807 { 0x15, 0x99130112 }, /* subwoofer */
5811 [ALC662_FIXUP_LED_GPIO1] = {
5812 .type = HDA_FIXUP_FUNC,
5813 .v.func = alc662_fixup_led_gpio1,
5815 [ALC662_FIXUP_IDEAPAD] = {
5816 .type = HDA_FIXUP_PINS,
5817 .v.pins = (const struct hda_pintbl[]) {
5818 { 0x17, 0x99130112 }, /* subwoofer */
5822 .chain_id = ALC662_FIXUP_LED_GPIO1,
5824 [ALC272_FIXUP_MARIO] = {
5825 .type = HDA_FIXUP_FUNC,
5826 .v.func = alc272_fixup_mario,
5828 [ALC662_FIXUP_CZC_P10T] = {
5829 .type = HDA_FIXUP_VERBS,
5830 .v.verbs = (const struct hda_verb[]) {
5831 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
5835 [ALC662_FIXUP_SKU_IGNORE] = {
5836 .type = HDA_FIXUP_FUNC,
5837 .v.func = alc_fixup_sku_ignore,
5839 [ALC662_FIXUP_HP_RP5800] = {
5840 .type = HDA_FIXUP_PINS,
5841 .v.pins = (const struct hda_pintbl[]) {
5842 { 0x14, 0x0221201f }, /* HP out */
5846 .chain_id = ALC662_FIXUP_SKU_IGNORE
5848 [ALC662_FIXUP_ASUS_MODE1] = {
5849 .type = HDA_FIXUP_PINS,
5850 .v.pins = (const struct hda_pintbl[]) {
5851 { 0x14, 0x99130110 }, /* speaker */
5852 { 0x18, 0x01a19c20 }, /* mic */
5853 { 0x19, 0x99a3092f }, /* int-mic */
5854 { 0x21, 0x0121401f }, /* HP out */
5858 .chain_id = ALC662_FIXUP_SKU_IGNORE
5860 [ALC662_FIXUP_ASUS_MODE2] = {
5861 .type = HDA_FIXUP_PINS,
5862 .v.pins = (const struct hda_pintbl[]) {
5863 { 0x14, 0x99130110 }, /* speaker */
5864 { 0x18, 0x01a19820 }, /* mic */
5865 { 0x19, 0x99a3092f }, /* int-mic */
5866 { 0x1b, 0x0121401f }, /* HP out */
5870 .chain_id = ALC662_FIXUP_SKU_IGNORE
5872 [ALC662_FIXUP_ASUS_MODE3] = {
5873 .type = HDA_FIXUP_PINS,
5874 .v.pins = (const struct hda_pintbl[]) {
5875 { 0x14, 0x99130110 }, /* speaker */
5876 { 0x15, 0x0121441f }, /* HP */
5877 { 0x18, 0x01a19840 }, /* mic */
5878 { 0x19, 0x99a3094f }, /* int-mic */
5879 { 0x21, 0x01211420 }, /* HP2 */
5883 .chain_id = ALC662_FIXUP_SKU_IGNORE
5885 [ALC662_FIXUP_ASUS_MODE4] = {
5886 .type = HDA_FIXUP_PINS,
5887 .v.pins = (const struct hda_pintbl[]) {
5888 { 0x14, 0x99130110 }, /* speaker */
5889 { 0x16, 0x99130111 }, /* speaker */
5890 { 0x18, 0x01a19840 }, /* mic */
5891 { 0x19, 0x99a3094f }, /* int-mic */
5892 { 0x21, 0x0121441f }, /* HP */
5896 .chain_id = ALC662_FIXUP_SKU_IGNORE
5898 [ALC662_FIXUP_ASUS_MODE5] = {
5899 .type = HDA_FIXUP_PINS,
5900 .v.pins = (const struct hda_pintbl[]) {
5901 { 0x14, 0x99130110 }, /* speaker */
5902 { 0x15, 0x0121441f }, /* HP */
5903 { 0x16, 0x99130111 }, /* speaker */
5904 { 0x18, 0x01a19840 }, /* mic */
5905 { 0x19, 0x99a3094f }, /* int-mic */
5909 .chain_id = ALC662_FIXUP_SKU_IGNORE
5911 [ALC662_FIXUP_ASUS_MODE6] = {
5912 .type = HDA_FIXUP_PINS,
5913 .v.pins = (const struct hda_pintbl[]) {
5914 { 0x14, 0x99130110 }, /* speaker */
5915 { 0x15, 0x01211420 }, /* HP2 */
5916 { 0x18, 0x01a19840 }, /* mic */
5917 { 0x19, 0x99a3094f }, /* int-mic */
5918 { 0x1b, 0x0121441f }, /* HP */
5922 .chain_id = ALC662_FIXUP_SKU_IGNORE
5924 [ALC662_FIXUP_ASUS_MODE7] = {
5925 .type = HDA_FIXUP_PINS,
5926 .v.pins = (const struct hda_pintbl[]) {
5927 { 0x14, 0x99130110 }, /* speaker */
5928 { 0x17, 0x99130111 }, /* speaker */
5929 { 0x18, 0x01a19840 }, /* mic */
5930 { 0x19, 0x99a3094f }, /* int-mic */
5931 { 0x1b, 0x01214020 }, /* HP */
5932 { 0x21, 0x0121401f }, /* HP */
5936 .chain_id = ALC662_FIXUP_SKU_IGNORE
5938 [ALC662_FIXUP_ASUS_MODE8] = {
5939 .type = HDA_FIXUP_PINS,
5940 .v.pins = (const struct hda_pintbl[]) {
5941 { 0x14, 0x99130110 }, /* speaker */
5942 { 0x12, 0x99a30970 }, /* int-mic */
5943 { 0x15, 0x01214020 }, /* HP */
5944 { 0x17, 0x99130111 }, /* speaker */
5945 { 0x18, 0x01a19840 }, /* mic */
5946 { 0x21, 0x0121401f }, /* HP */
5950 .chain_id = ALC662_FIXUP_SKU_IGNORE
5952 [ALC662_FIXUP_NO_JACK_DETECT] = {
5953 .type = HDA_FIXUP_FUNC,
5954 .v.func = alc_fixup_no_jack_detect,
5956 [ALC662_FIXUP_ZOTAC_Z68] = {
5957 .type = HDA_FIXUP_PINS,
5958 .v.pins = (const struct hda_pintbl[]) {
5959 { 0x1b, 0x02214020 }, /* Front HP */
5963 [ALC662_FIXUP_INV_DMIC] = {
5964 .type = HDA_FIXUP_FUNC,
5965 .v.func = alc_fixup_inv_dmic,
5967 [ALC668_FIXUP_DELL_XPS13] = {
5968 .type = HDA_FIXUP_FUNC,
5969 .v.func = alc_fixup_dell_xps13,
5971 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
5973 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
5974 .type = HDA_FIXUP_FUNC,
5975 .v.func = alc_fixup_disable_aamix,
5977 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
5979 [ALC668_FIXUP_AUTO_MUTE] = {
5980 .type = HDA_FIXUP_FUNC,
5981 .v.func = alc_fixup_auto_mute_via_amp,
5983 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
5985 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
5986 .type = HDA_FIXUP_PINS,
5987 .v.pins = (const struct hda_pintbl[]) {
5988 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
5989 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
5993 .chain_id = ALC668_FIXUP_HEADSET_MODE
5995 [ALC668_FIXUP_HEADSET_MODE] = {
5996 .type = HDA_FIXUP_FUNC,
5997 .v.func = alc_fixup_headset_mode_alc668,
5999 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
6000 .type = HDA_FIXUP_FUNC,
6001 .v.func = alc_fixup_bass_chmap,
6003 .chain_id = ALC662_FIXUP_ASUS_MODE4
6005 [ALC662_FIXUP_BASS_16] = {
6006 .type = HDA_FIXUP_PINS,
6007 .v.pins = (const struct hda_pintbl[]) {
6008 {0x16, 0x80106111}, /* bass speaker */
6012 .chain_id = ALC662_FIXUP_BASS_CHMAP,
6014 [ALC662_FIXUP_BASS_1A] = {
6015 .type = HDA_FIXUP_PINS,
6016 .v.pins = (const struct hda_pintbl[]) {
6017 {0x1a, 0x80106111}, /* bass speaker */
6021 .chain_id = ALC662_FIXUP_BASS_CHMAP,
6023 [ALC662_FIXUP_BASS_CHMAP] = {
6024 .type = HDA_FIXUP_FUNC,
6025 .v.func = alc_fixup_bass_chmap,
6029 static const struct snd_pci_quirk alc662_fixup_tbl[] = {
6030 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
6031 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
6032 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
6033 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
6034 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
6035 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
6036 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
6037 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
6038 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
6039 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
6040 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
6041 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
6042 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
6043 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
6044 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
6045 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
6046 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
6047 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_BASS_1A),
6048 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
6049 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
6050 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
6051 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
6052 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
6053 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
6054 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
6055 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
6056 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
6057 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
6058 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
6061 /* Below is a quirk table taken from the old code.
6062 * Basically the device should work as is without the fixup table.
6063 * If BIOS doesn't give a proper info, enable the corresponding
6066 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
6067 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
6068 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
6069 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
6070 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
6071 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6072 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
6073 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
6074 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
6075 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6076 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
6077 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
6078 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
6079 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
6080 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
6081 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6082 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
6083 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
6084 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6085 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
6086 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
6087 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6088 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
6089 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
6090 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
6091 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6092 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
6093 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
6094 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6095 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
6096 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6097 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6098 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
6099 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
6100 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
6101 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
6102 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
6103 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
6104 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
6105 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6106 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
6107 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
6108 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
6109 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
6110 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
6111 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
6112 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
6113 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
6114 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
6115 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
6120 static const struct hda_model_fixup alc662_fixup_models[] = {
6121 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
6122 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
6123 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
6124 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
6125 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
6126 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
6127 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
6128 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
6129 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
6130 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
6131 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
6135 static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
6136 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
6147 {0x1f, 0x411111f0}),
6148 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
6159 {0x1f, 0x411111f0}),
6160 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
6171 {0x1f, 0x411111f0}),
6172 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
6183 {0x1f, 0x411111f0}),
6184 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
6195 {0x1f, 0x411111f0}),
6201 static int patch_alc662(struct hda_codec *codec)
6203 struct alc_spec *spec;
6206 err = alc_alloc_spec(codec, 0x0b);
6212 /* handle multiple HPs as is */
6213 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
6215 alc_fix_pll_init(codec, 0x20, 0x04, 15);
6217 switch (codec->vendor_id) {
6219 spec->init_hook = alc668_restore_default_value;
6223 snd_hda_pick_fixup(codec, alc662_fixup_models,
6224 alc662_fixup_tbl, alc662_fixups);
6225 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups);
6226 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
6228 alc_auto_parse_customize_define(codec);
6230 if (has_cdefine_beep(codec))
6231 spec->gen.beep_nid = 0x01;
6233 if ((alc_get_coef0(codec) & (1 << 14)) &&
6234 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
6235 spec->cdefine.platform_type == 1) {
6236 err = alc_codec_rename(codec, "ALC272X");
6241 /* automatic parse from the BIOS config */
6242 err = alc662_parse_auto_config(codec);
6246 if (!spec->gen.no_analog && spec->gen.beep_nid) {
6247 switch (codec->vendor_id) {
6249 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
6255 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
6258 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
6263 codec->patch_ops = alc_patch_ops;
6264 spec->shutup = alc_eapd_shutup;
6266 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
6279 static int alc680_parse_auto_config(struct hda_codec *codec)
6281 return alc_parse_auto_config(codec, NULL, NULL);
6286 static int patch_alc680(struct hda_codec *codec)
6290 /* ALC680 has no aa-loopback mixer */
6291 err = alc_alloc_spec(codec, 0);
6295 /* automatic parse from the BIOS config */
6296 err = alc680_parse_auto_config(codec);
6302 codec->patch_ops = alc_patch_ops;
6310 static const struct hda_codec_preset snd_hda_preset_realtek[] = {
6311 { .id = 0x10ec0221, .name = "ALC221", .patch = patch_alc269 },
6312 { .id = 0x10ec0231, .name = "ALC231", .patch = patch_alc269 },
6313 { .id = 0x10ec0233, .name = "ALC233", .patch = patch_alc269 },
6314 { .id = 0x10ec0235, .name = "ALC233", .patch = patch_alc269 },
6315 { .id = 0x10ec0255, .name = "ALC255", .patch = patch_alc269 },
6316 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
6317 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
6318 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
6319 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
6320 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
6321 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
6322 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
6323 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
6324 { .id = 0x10ec0276, .name = "ALC276", .patch = patch_alc269 },
6325 { .id = 0x10ec0280, .name = "ALC280", .patch = patch_alc269 },
6326 { .id = 0x10ec0282, .name = "ALC282", .patch = patch_alc269 },
6327 { .id = 0x10ec0283, .name = "ALC283", .patch = patch_alc269 },
6328 { .id = 0x10ec0284, .name = "ALC284", .patch = patch_alc269 },
6329 { .id = 0x10ec0285, .name = "ALC285", .patch = patch_alc269 },
6330 { .id = 0x10ec0286, .name = "ALC286", .patch = patch_alc269 },
6331 { .id = 0x10ec0288, .name = "ALC288", .patch = patch_alc269 },
6332 { .id = 0x10ec0290, .name = "ALC290", .patch = patch_alc269 },
6333 { .id = 0x10ec0292, .name = "ALC292", .patch = patch_alc269 },
6334 { .id = 0x10ec0293, .name = "ALC293", .patch = patch_alc269 },
6335 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
6336 .patch = patch_alc861 },
6337 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
6338 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
6339 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
6340 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
6341 .patch = patch_alc882 },
6342 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
6343 .patch = patch_alc662 },
6344 { .id = 0x10ec0662, .rev = 0x100300, .name = "ALC662 rev3",
6345 .patch = patch_alc662 },
6346 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
6347 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
6348 { .id = 0x10ec0667, .name = "ALC667", .patch = patch_alc662 },
6349 { .id = 0x10ec0668, .name = "ALC668", .patch = patch_alc662 },
6350 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
6351 { .id = 0x10ec0671, .name = "ALC671", .patch = patch_alc662 },
6352 { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
6353 { .id = 0x10ec0867, .name = "ALC891", .patch = patch_alc882 },
6354 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
6355 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
6356 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
6357 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
6358 .patch = patch_alc882 },
6359 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
6360 .patch = patch_alc882 },
6361 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
6362 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
6363 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
6364 .patch = patch_alc882 },
6365 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc882 },
6366 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
6367 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
6368 { .id = 0x10ec0899, .name = "ALC898", .patch = patch_alc882 },
6369 { .id = 0x10ec0900, .name = "ALC1150", .patch = patch_alc882 },
6373 MODULE_ALIAS("snd-hda-codec-id:10ec*");
6375 MODULE_LICENSE("GPL");
6376 MODULE_DESCRIPTION("Realtek HD-audio codec");
6378 static struct hda_codec_preset_list realtek_list = {
6379 .preset = snd_hda_preset_realtek,
6380 .owner = THIS_MODULE,
6383 static int __init patch_realtek_init(void)
6385 return snd_hda_add_codec_preset(&realtek_list);
6388 static void __exit patch_realtek_exit(void)
6390 snd_hda_delete_codec_preset(&realtek_list);
6393 module_init(patch_realtek_init)
6394 module_exit(patch_realtek_exit)