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() */
99 unsigned int gpio_mute_led_mask;
100 unsigned int gpio_mic_led_mask;
102 hda_nid_t headset_mic_pin;
103 hda_nid_t headphone_mic_pin;
104 int current_headset_mode;
105 int current_headset_type;
108 void (*init_hook)(struct hda_codec *codec);
110 void (*power_hook)(struct hda_codec *codec);
112 void (*shutup)(struct hda_codec *codec);
115 int codec_variant; /* flag for other variants */
116 unsigned int has_alc5505_dsp:1;
117 unsigned int no_depop_delay:1;
121 unsigned int pll_coef_idx, pll_coef_bit;
126 * COEF access helper functions
129 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
130 unsigned int coef_idx)
134 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
135 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
139 #define alc_read_coef_idx(codec, coef_idx) \
140 alc_read_coefex_idx(codec, 0x20, coef_idx)
142 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
143 unsigned int coef_idx, unsigned int coef_val)
145 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
146 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
149 #define alc_write_coef_idx(codec, coef_idx, coef_val) \
150 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
152 static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
153 unsigned int coef_idx, unsigned int mask,
154 unsigned int bits_set)
156 unsigned int val = alc_read_coefex_idx(codec, nid, coef_idx);
159 alc_write_coefex_idx(codec, nid, coef_idx,
160 (val & ~mask) | bits_set);
163 #define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
164 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
166 /* a special bypass for COEF 0; read the cached value at the second time */
167 static unsigned int alc_get_coef0(struct hda_codec *codec)
169 struct alc_spec *spec = codec->spec;
172 spec->coef0 = alc_read_coef_idx(codec, 0);
176 /* coef writes/updates batch */
184 #define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
185 { .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
186 #define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
187 #define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
188 #define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
190 static void alc_process_coef_fw(struct hda_codec *codec,
191 const struct coef_fw *fw)
193 for (; fw->nid; fw++) {
194 if (fw->mask == (unsigned short)-1)
195 alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
197 alc_update_coefex_idx(codec, fw->nid, fw->idx,
203 * Append the given mixer and verb elements for the later use
204 * The mixer array is referred in build_controls(), and init_verbs are
207 static void add_mixer(struct alc_spec *spec, const struct snd_kcontrol_new *mix)
209 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
211 spec->mixers[spec->num_mixers++] = mix;
215 * GPIO setup tables, used in initialization
217 /* Enable GPIO mask and set output */
218 static const struct hda_verb alc_gpio1_init_verbs[] = {
219 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
220 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
221 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
225 static const struct hda_verb alc_gpio2_init_verbs[] = {
226 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
227 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
228 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
232 static const struct hda_verb alc_gpio3_init_verbs[] = {
233 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
234 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
235 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
240 * Fix hardware PLL issue
241 * On some codecs, the analog PLL gating control must be off while
242 * the default value is 1.
244 static void alc_fix_pll(struct hda_codec *codec)
246 struct alc_spec *spec = codec->spec;
249 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
250 1 << spec->pll_coef_bit, 0);
253 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
254 unsigned int coef_idx, unsigned int coef_bit)
256 struct alc_spec *spec = codec->spec;
258 spec->pll_coef_idx = coef_idx;
259 spec->pll_coef_bit = coef_bit;
263 /* update the master volume per volume-knob's unsol event */
264 static void alc_update_knob_master(struct hda_codec *codec,
265 struct hda_jack_callback *jack)
268 struct snd_kcontrol *kctl;
269 struct snd_ctl_elem_value *uctl;
271 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
274 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
277 val = snd_hda_codec_read(codec, jack->tbl->nid, 0,
278 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
279 val &= HDA_AMP_VOLMASK;
280 uctl->value.integer.value[0] = val;
281 uctl->value.integer.value[1] = val;
282 kctl->put(kctl, uctl);
286 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
288 /* For some reason, the res given from ALC880 is broken.
289 Here we adjust it properly. */
290 snd_hda_jack_unsol_event(codec, res >> 2);
293 /* additional initialization for ALC888 variants */
294 static void alc888_coef_init(struct hda_codec *codec)
296 switch (alc_get_coef0(codec) & 0x00f0) {
301 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
306 /* turn on/off EAPD control (only if available) */
307 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
309 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
311 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
312 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
316 /* turn on/off EAPD controls of the codec */
317 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
319 /* We currently only handle front, HP */
320 static hda_nid_t pins[] = {
321 0x0f, 0x10, 0x14, 0x15, 0
324 for (p = pins; *p; p++)
325 set_eapd(codec, *p, on);
328 /* generic shutup callback;
329 * just turning off EPAD and a little pause for avoiding pop-noise
331 static void alc_eapd_shutup(struct hda_codec *codec)
333 struct alc_spec *spec = codec->spec;
335 alc_auto_setup_eapd(codec, false);
336 if (!spec->no_depop_delay)
338 snd_hda_shutup_pins(codec);
341 /* generic EAPD initialization */
342 static void alc_auto_init_amp(struct hda_codec *codec, int type)
344 alc_auto_setup_eapd(codec, true);
347 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
350 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
353 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
355 case ALC_INIT_DEFAULT:
356 switch (codec->vendor_id) {
358 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
364 alc_update_coef_idx(codec, 7, 0, 0x2030);
367 alc888_coef_init(codec);
376 * Realtek SSID verification
379 /* Could be any non-zero and even value. When used as fixup, tells
380 * the driver to ignore any present sku defines.
382 #define ALC_FIXUP_SKU_IGNORE (2)
384 static void alc_fixup_sku_ignore(struct hda_codec *codec,
385 const struct hda_fixup *fix, int action)
387 struct alc_spec *spec = codec->spec;
388 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
389 spec->cdefine.fixup = 1;
390 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
394 static void alc_fixup_no_depop_delay(struct hda_codec *codec,
395 const struct hda_fixup *fix, int action)
397 struct alc_spec *spec = codec->spec;
399 if (action == HDA_FIXUP_ACT_PROBE) {
400 spec->no_depop_delay = 1;
401 codec->depop_delay = 0;
405 static int alc_auto_parse_customize_define(struct hda_codec *codec)
407 unsigned int ass, tmp, i;
409 struct alc_spec *spec = codec->spec;
411 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
413 if (spec->cdefine.fixup) {
414 ass = spec->cdefine.sku_cfg;
415 if (ass == ALC_FIXUP_SKU_IGNORE)
420 if (!codec->bus->pci)
422 ass = codec->subsystem_id & 0xffff;
423 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
427 if (codec->vendor_id == 0x10ec0260)
429 ass = snd_hda_codec_get_pincfg(codec, nid);
432 codec_info(codec, "%s: SKU not ready 0x%08x\n",
433 codec->chip_name, ass);
439 for (i = 1; i < 16; i++) {
443 if (((ass >> 16) & 0xf) != tmp)
446 spec->cdefine.port_connectivity = ass >> 30;
447 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
448 spec->cdefine.check_sum = (ass >> 16) & 0xf;
449 spec->cdefine.customization = ass >> 8;
451 spec->cdefine.sku_cfg = ass;
452 spec->cdefine.external_amp = (ass & 0x38) >> 3;
453 spec->cdefine.platform_type = (ass & 0x4) >> 2;
454 spec->cdefine.swap = (ass & 0x2) >> 1;
455 spec->cdefine.override = ass & 0x1;
457 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
458 nid, spec->cdefine.sku_cfg);
459 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
460 spec->cdefine.port_connectivity);
461 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
462 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
463 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
464 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
465 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
466 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
467 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
472 /* return the position of NID in the list, or -1 if not found */
473 static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
476 for (i = 0; i < nums; i++)
481 /* return true if the given NID is found in the list */
482 static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
484 return find_idx_in_nid_list(nid, list, nums) >= 0;
487 /* check subsystem ID and set up device-specific initialization;
488 * return 1 if initialized, 0 if invalid SSID
490 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
491 * 31 ~ 16 : Manufacture ID
493 * 7 ~ 0 : Assembly ID
494 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
496 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
498 unsigned int ass, tmp, i;
500 struct alc_spec *spec = codec->spec;
502 if (spec->cdefine.fixup) {
503 ass = spec->cdefine.sku_cfg;
504 if (ass == ALC_FIXUP_SKU_IGNORE)
509 ass = codec->subsystem_id & 0xffff;
510 if (codec->bus->pci &&
511 ass != codec->bus->pci->subsystem_device && (ass & 1))
514 /* invalid SSID, check the special NID pin defcfg instead */
516 * 31~30 : port connectivity
519 * 19~16 : Check sum (15:1)
524 if (codec->vendor_id == 0x10ec0260)
526 ass = snd_hda_codec_get_pincfg(codec, nid);
528 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
532 if ((ass >> 30) != 1) /* no physical connection */
537 for (i = 1; i < 16; i++) {
541 if (((ass >> 16) & 0xf) != tmp)
544 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
545 ass & 0xffff, codec->vendor_id);
549 * 2 : 0 --> Desktop, 1 --> Laptop
550 * 3~5 : External Amplifier control
553 tmp = (ass & 0x38) >> 3; /* external Amp control */
556 spec->init_amp = ALC_INIT_GPIO1;
559 spec->init_amp = ALC_INIT_GPIO2;
562 spec->init_amp = ALC_INIT_GPIO3;
566 spec->init_amp = ALC_INIT_DEFAULT;
570 /* is laptop or Desktop and enable the function "Mute internal speaker
571 * when the external headphone out jack is plugged"
576 * 10~8 : Jack location
577 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
579 * 15 : 1 --> enable the function "Mute internal speaker
580 * when the external headphone out jack is plugged"
582 if (!spec->gen.autocfg.hp_pins[0] &&
583 !(spec->gen.autocfg.line_out_pins[0] &&
584 spec->gen.autocfg.line_out_type == AUTO_PIN_HP_OUT)) {
586 tmp = (ass >> 11) & 0x3; /* HP to chassis */
588 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
589 spec->gen.autocfg.line_outs))
591 spec->gen.autocfg.hp_pins[0] = nid;
596 /* Check the validity of ALC subsystem-id
597 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
598 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
600 if (!alc_subsystem_id(codec, ports)) {
601 struct alc_spec *spec = codec->spec;
603 "realtek: Enable default setup for auto mode as fallback\n");
604 spec->init_amp = ALC_INIT_DEFAULT;
611 static void alc_fixup_inv_dmic(struct hda_codec *codec,
612 const struct hda_fixup *fix, int action)
614 struct alc_spec *spec = codec->spec;
616 spec->gen.inv_dmic_split = 1;
620 #ifdef CONFIG_SND_HDA_INPUT_BEEP
621 /* additional beep mixers; the actual parameters are overwritten at build */
622 static const struct snd_kcontrol_new alc_beep_mixer[] = {
623 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
624 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
629 static int alc_build_controls(struct hda_codec *codec)
631 struct alc_spec *spec = codec->spec;
634 err = snd_hda_gen_build_controls(codec);
638 for (i = 0; i < spec->num_mixers; i++) {
639 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
644 #ifdef CONFIG_SND_HDA_INPUT_BEEP
645 /* create beep controls if needed */
646 if (spec->beep_amp) {
647 const struct snd_kcontrol_new *knew;
648 for (knew = alc_beep_mixer; knew->name; knew++) {
649 struct snd_kcontrol *kctl;
650 kctl = snd_ctl_new1(knew, codec);
653 kctl->private_value = spec->beep_amp;
654 err = snd_hda_ctl_add(codec, 0, kctl);
661 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
670 static int alc_init(struct hda_codec *codec)
672 struct alc_spec *spec = codec->spec;
675 spec->init_hook(codec);
678 alc_auto_init_amp(codec, spec->init_amp);
680 snd_hda_gen_init(codec);
682 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
687 static inline void alc_shutup(struct hda_codec *codec)
689 struct alc_spec *spec = codec->spec;
691 if (spec && spec->shutup)
694 snd_hda_shutup_pins(codec);
697 #define alc_free snd_hda_gen_free
700 static void alc_power_eapd(struct hda_codec *codec)
702 alc_auto_setup_eapd(codec, false);
705 static int alc_suspend(struct hda_codec *codec)
707 struct alc_spec *spec = codec->spec;
709 if (spec && spec->power_hook)
710 spec->power_hook(codec);
716 static int alc_resume(struct hda_codec *codec)
718 struct alc_spec *spec = codec->spec;
720 if (!spec->no_depop_delay)
721 msleep(150); /* to avoid pop noise */
722 codec->patch_ops.init(codec);
723 snd_hda_codec_resume_amp(codec);
724 snd_hda_codec_resume_cache(codec);
725 hda_call_check_power_status(codec, 0x01);
732 static const struct hda_codec_ops alc_patch_ops = {
733 .build_controls = alc_build_controls,
734 .build_pcms = snd_hda_gen_build_pcms,
737 .unsol_event = snd_hda_jack_unsol_event,
739 .resume = alc_resume,
740 .suspend = alc_suspend,
741 .check_power_status = snd_hda_gen_check_power_status,
743 .reboot_notify = alc_shutup,
747 /* replace the codec chip_name with the given string */
748 static int alc_codec_rename(struct hda_codec *codec, const char *name)
750 kfree(codec->chip_name);
751 codec->chip_name = kstrdup(name, GFP_KERNEL);
752 if (!codec->chip_name) {
760 * Rename codecs appropriately from COEF value or subvendor id
762 struct alc_codec_rename_table {
763 unsigned int vendor_id;
764 unsigned short coef_mask;
765 unsigned short coef_bits;
769 struct alc_codec_rename_pci_table {
770 unsigned int codec_vendor_id;
771 unsigned short pci_subvendor;
772 unsigned short pci_subdevice;
776 static struct alc_codec_rename_table rename_tbl[] = {
777 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
778 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
779 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
780 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
781 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
782 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
783 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
784 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
785 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
786 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
787 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
788 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
789 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
790 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
791 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
792 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
793 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
797 static struct alc_codec_rename_pci_table rename_pci_tbl[] = {
798 { 0x10ec0280, 0x1028, 0, "ALC3220" },
799 { 0x10ec0282, 0x1028, 0, "ALC3221" },
800 { 0x10ec0283, 0x1028, 0, "ALC3223" },
801 { 0x10ec0288, 0x1028, 0, "ALC3263" },
802 { 0x10ec0292, 0x1028, 0, "ALC3226" },
803 { 0x10ec0293, 0x1028, 0, "ALC3235" },
804 { 0x10ec0255, 0x1028, 0, "ALC3234" },
805 { 0x10ec0668, 0x1028, 0, "ALC3661" },
806 { 0x10ec0275, 0x1028, 0, "ALC3260" },
807 { 0x10ec0899, 0x1028, 0, "ALC3861" },
808 { 0x10ec0670, 0x1025, 0, "ALC669X" },
809 { 0x10ec0676, 0x1025, 0, "ALC679X" },
810 { 0x10ec0282, 0x1043, 0, "ALC3229" },
811 { 0x10ec0233, 0x1043, 0, "ALC3236" },
812 { 0x10ec0280, 0x103c, 0, "ALC3228" },
813 { 0x10ec0282, 0x103c, 0, "ALC3227" },
814 { 0x10ec0286, 0x103c, 0, "ALC3242" },
815 { 0x10ec0290, 0x103c, 0, "ALC3241" },
816 { 0x10ec0668, 0x103c, 0, "ALC3662" },
817 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
818 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
822 static int alc_codec_rename_from_preset(struct hda_codec *codec)
824 const struct alc_codec_rename_table *p;
825 const struct alc_codec_rename_pci_table *q;
827 for (p = rename_tbl; p->vendor_id; p++) {
828 if (p->vendor_id != codec->vendor_id)
830 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
831 return alc_codec_rename(codec, p->name);
834 if (!codec->bus->pci)
836 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
837 if (q->codec_vendor_id != codec->vendor_id)
839 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
841 if (!q->pci_subdevice ||
842 q->pci_subdevice == codec->bus->pci->subsystem_device)
843 return alc_codec_rename(codec, q->name);
851 * Digital-beep handlers
853 #ifdef CONFIG_SND_HDA_INPUT_BEEP
854 #define set_beep_amp(spec, nid, idx, dir) \
855 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
857 static const struct snd_pci_quirk beep_white_list[] = {
858 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
859 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
860 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
861 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
862 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
863 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
864 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
865 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
866 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
870 static inline int has_cdefine_beep(struct hda_codec *codec)
872 struct alc_spec *spec = codec->spec;
873 const struct snd_pci_quirk *q;
874 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list);
877 return spec->cdefine.enable_pcbeep;
880 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
881 #define has_cdefine_beep(codec) 0
884 /* parse the BIOS configuration and set up the alc_spec */
885 /* return 1 if successful, 0 if the proper config is not found,
886 * or a negative error code
888 static int alc_parse_auto_config(struct hda_codec *codec,
889 const hda_nid_t *ignore_nids,
890 const hda_nid_t *ssid_nids)
892 struct alc_spec *spec = codec->spec;
893 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
896 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
902 alc_ssid_check(codec, ssid_nids);
904 err = snd_hda_gen_parse_auto_config(codec, cfg);
911 /* common preparation job for alc_spec */
912 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
914 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
920 snd_hda_gen_spec_init(&spec->gen);
921 spec->gen.mixer_nid = mixer_nid;
922 spec->gen.own_eapd_ctl = 1;
923 codec->single_adc_amp = 1;
924 /* FIXME: do we need this for all Realtek codec models? */
925 codec->spdif_status_reset = 1;
927 err = alc_codec_rename_from_preset(codec);
935 static int alc880_parse_auto_config(struct hda_codec *codec)
937 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
938 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
939 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
948 ALC880_FIXUP_MEDION_RIM,
950 ALC880_FIXUP_LG_LW25,
952 ALC880_FIXUP_EAPD_COEF,
953 ALC880_FIXUP_TCL_S700,
954 ALC880_FIXUP_VOL_KNOB,
955 ALC880_FIXUP_FUJITSU,
957 ALC880_FIXUP_UNIWILL,
958 ALC880_FIXUP_UNIWILL_DIG,
960 ALC880_FIXUP_ASUS_W5A,
961 ALC880_FIXUP_3ST_BASE,
963 ALC880_FIXUP_3ST_DIG,
964 ALC880_FIXUP_5ST_BASE,
966 ALC880_FIXUP_5ST_DIG,
967 ALC880_FIXUP_6ST_BASE,
969 ALC880_FIXUP_6ST_DIG,
970 ALC880_FIXUP_6ST_AUTOMUTE,
973 /* enable the volume-knob widget support on NID 0x21 */
974 static void alc880_fixup_vol_knob(struct hda_codec *codec,
975 const struct hda_fixup *fix, int action)
977 if (action == HDA_FIXUP_ACT_PROBE)
978 snd_hda_jack_detect_enable_callback(codec, 0x21,
979 alc_update_knob_master);
982 static const struct hda_fixup alc880_fixups[] = {
983 [ALC880_FIXUP_GPIO1] = {
984 .type = HDA_FIXUP_VERBS,
985 .v.verbs = alc_gpio1_init_verbs,
987 [ALC880_FIXUP_GPIO2] = {
988 .type = HDA_FIXUP_VERBS,
989 .v.verbs = alc_gpio2_init_verbs,
991 [ALC880_FIXUP_MEDION_RIM] = {
992 .type = HDA_FIXUP_VERBS,
993 .v.verbs = (const struct hda_verb[]) {
994 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
995 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
999 .chain_id = ALC880_FIXUP_GPIO2,
1001 [ALC880_FIXUP_LG] = {
1002 .type = HDA_FIXUP_PINS,
1003 .v.pins = (const struct hda_pintbl[]) {
1004 /* disable bogus unused pins */
1005 { 0x16, 0x411111f0 },
1006 { 0x18, 0x411111f0 },
1007 { 0x1a, 0x411111f0 },
1011 [ALC880_FIXUP_LG_LW25] = {
1012 .type = HDA_FIXUP_PINS,
1013 .v.pins = (const struct hda_pintbl[]) {
1014 { 0x1a, 0x0181344f }, /* line-in */
1015 { 0x1b, 0x0321403f }, /* headphone */
1019 [ALC880_FIXUP_W810] = {
1020 .type = HDA_FIXUP_PINS,
1021 .v.pins = (const struct hda_pintbl[]) {
1022 /* disable bogus unused pins */
1023 { 0x17, 0x411111f0 },
1027 .chain_id = ALC880_FIXUP_GPIO2,
1029 [ALC880_FIXUP_EAPD_COEF] = {
1030 .type = HDA_FIXUP_VERBS,
1031 .v.verbs = (const struct hda_verb[]) {
1032 /* change to EAPD mode */
1033 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1034 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1038 [ALC880_FIXUP_TCL_S700] = {
1039 .type = HDA_FIXUP_VERBS,
1040 .v.verbs = (const struct hda_verb[]) {
1041 /* change to EAPD mode */
1042 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1043 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1047 .chain_id = ALC880_FIXUP_GPIO2,
1049 [ALC880_FIXUP_VOL_KNOB] = {
1050 .type = HDA_FIXUP_FUNC,
1051 .v.func = alc880_fixup_vol_knob,
1053 [ALC880_FIXUP_FUJITSU] = {
1054 /* override all pins as BIOS on old Amilo is broken */
1055 .type = HDA_FIXUP_PINS,
1056 .v.pins = (const struct hda_pintbl[]) {
1057 { 0x14, 0x0121411f }, /* HP */
1058 { 0x15, 0x99030120 }, /* speaker */
1059 { 0x16, 0x99030130 }, /* bass speaker */
1060 { 0x17, 0x411111f0 }, /* N/A */
1061 { 0x18, 0x411111f0 }, /* N/A */
1062 { 0x19, 0x01a19950 }, /* mic-in */
1063 { 0x1a, 0x411111f0 }, /* N/A */
1064 { 0x1b, 0x411111f0 }, /* N/A */
1065 { 0x1c, 0x411111f0 }, /* N/A */
1066 { 0x1d, 0x411111f0 }, /* N/A */
1067 { 0x1e, 0x01454140 }, /* SPDIF out */
1071 .chain_id = ALC880_FIXUP_VOL_KNOB,
1073 [ALC880_FIXUP_F1734] = {
1074 /* almost compatible with FUJITSU, but no bass and SPDIF */
1075 .type = HDA_FIXUP_PINS,
1076 .v.pins = (const struct hda_pintbl[]) {
1077 { 0x14, 0x0121411f }, /* HP */
1078 { 0x15, 0x99030120 }, /* speaker */
1079 { 0x16, 0x411111f0 }, /* N/A */
1080 { 0x17, 0x411111f0 }, /* N/A */
1081 { 0x18, 0x411111f0 }, /* N/A */
1082 { 0x19, 0x01a19950 }, /* mic-in */
1083 { 0x1a, 0x411111f0 }, /* N/A */
1084 { 0x1b, 0x411111f0 }, /* N/A */
1085 { 0x1c, 0x411111f0 }, /* N/A */
1086 { 0x1d, 0x411111f0 }, /* N/A */
1087 { 0x1e, 0x411111f0 }, /* N/A */
1091 .chain_id = ALC880_FIXUP_VOL_KNOB,
1093 [ALC880_FIXUP_UNIWILL] = {
1094 /* need to fix HP and speaker pins to be parsed correctly */
1095 .type = HDA_FIXUP_PINS,
1096 .v.pins = (const struct hda_pintbl[]) {
1097 { 0x14, 0x0121411f }, /* HP */
1098 { 0x15, 0x99030120 }, /* speaker */
1099 { 0x16, 0x99030130 }, /* bass speaker */
1103 [ALC880_FIXUP_UNIWILL_DIG] = {
1104 .type = HDA_FIXUP_PINS,
1105 .v.pins = (const struct hda_pintbl[]) {
1106 /* disable bogus unused pins */
1107 { 0x17, 0x411111f0 },
1108 { 0x19, 0x411111f0 },
1109 { 0x1b, 0x411111f0 },
1110 { 0x1f, 0x411111f0 },
1114 [ALC880_FIXUP_Z71V] = {
1115 .type = HDA_FIXUP_PINS,
1116 .v.pins = (const struct hda_pintbl[]) {
1117 /* set up the whole pins as BIOS is utterly broken */
1118 { 0x14, 0x99030120 }, /* speaker */
1119 { 0x15, 0x0121411f }, /* HP */
1120 { 0x16, 0x411111f0 }, /* N/A */
1121 { 0x17, 0x411111f0 }, /* N/A */
1122 { 0x18, 0x01a19950 }, /* mic-in */
1123 { 0x19, 0x411111f0 }, /* N/A */
1124 { 0x1a, 0x01813031 }, /* line-in */
1125 { 0x1b, 0x411111f0 }, /* N/A */
1126 { 0x1c, 0x411111f0 }, /* N/A */
1127 { 0x1d, 0x411111f0 }, /* N/A */
1128 { 0x1e, 0x0144111e }, /* SPDIF */
1132 [ALC880_FIXUP_ASUS_W5A] = {
1133 .type = HDA_FIXUP_PINS,
1134 .v.pins = (const struct hda_pintbl[]) {
1135 /* set up the whole pins as BIOS is utterly broken */
1136 { 0x14, 0x0121411f }, /* HP */
1137 { 0x15, 0x411111f0 }, /* N/A */
1138 { 0x16, 0x411111f0 }, /* N/A */
1139 { 0x17, 0x411111f0 }, /* N/A */
1140 { 0x18, 0x90a60160 }, /* mic */
1141 { 0x19, 0x411111f0 }, /* N/A */
1142 { 0x1a, 0x411111f0 }, /* N/A */
1143 { 0x1b, 0x411111f0 }, /* N/A */
1144 { 0x1c, 0x411111f0 }, /* N/A */
1145 { 0x1d, 0x411111f0 }, /* N/A */
1146 { 0x1e, 0xb743111e }, /* SPDIF out */
1150 .chain_id = ALC880_FIXUP_GPIO1,
1152 [ALC880_FIXUP_3ST_BASE] = {
1153 .type = HDA_FIXUP_PINS,
1154 .v.pins = (const struct hda_pintbl[]) {
1155 { 0x14, 0x01014010 }, /* line-out */
1156 { 0x15, 0x411111f0 }, /* N/A */
1157 { 0x16, 0x411111f0 }, /* N/A */
1158 { 0x17, 0x411111f0 }, /* N/A */
1159 { 0x18, 0x01a19c30 }, /* mic-in */
1160 { 0x19, 0x0121411f }, /* HP */
1161 { 0x1a, 0x01813031 }, /* line-in */
1162 { 0x1b, 0x02a19c40 }, /* front-mic */
1163 { 0x1c, 0x411111f0 }, /* N/A */
1164 { 0x1d, 0x411111f0 }, /* N/A */
1165 /* 0x1e is filled in below */
1166 { 0x1f, 0x411111f0 }, /* N/A */
1170 [ALC880_FIXUP_3ST] = {
1171 .type = HDA_FIXUP_PINS,
1172 .v.pins = (const struct hda_pintbl[]) {
1173 { 0x1e, 0x411111f0 }, /* N/A */
1177 .chain_id = ALC880_FIXUP_3ST_BASE,
1179 [ALC880_FIXUP_3ST_DIG] = {
1180 .type = HDA_FIXUP_PINS,
1181 .v.pins = (const struct hda_pintbl[]) {
1182 { 0x1e, 0x0144111e }, /* SPDIF */
1186 .chain_id = ALC880_FIXUP_3ST_BASE,
1188 [ALC880_FIXUP_5ST_BASE] = {
1189 .type = HDA_FIXUP_PINS,
1190 .v.pins = (const struct hda_pintbl[]) {
1191 { 0x14, 0x01014010 }, /* front */
1192 { 0x15, 0x411111f0 }, /* N/A */
1193 { 0x16, 0x01011411 }, /* CLFE */
1194 { 0x17, 0x01016412 }, /* surr */
1195 { 0x18, 0x01a19c30 }, /* mic-in */
1196 { 0x19, 0x0121411f }, /* HP */
1197 { 0x1a, 0x01813031 }, /* line-in */
1198 { 0x1b, 0x02a19c40 }, /* front-mic */
1199 { 0x1c, 0x411111f0 }, /* N/A */
1200 { 0x1d, 0x411111f0 }, /* N/A */
1201 /* 0x1e is filled in below */
1202 { 0x1f, 0x411111f0 }, /* N/A */
1206 [ALC880_FIXUP_5ST] = {
1207 .type = HDA_FIXUP_PINS,
1208 .v.pins = (const struct hda_pintbl[]) {
1209 { 0x1e, 0x411111f0 }, /* N/A */
1213 .chain_id = ALC880_FIXUP_5ST_BASE,
1215 [ALC880_FIXUP_5ST_DIG] = {
1216 .type = HDA_FIXUP_PINS,
1217 .v.pins = (const struct hda_pintbl[]) {
1218 { 0x1e, 0x0144111e }, /* SPDIF */
1222 .chain_id = ALC880_FIXUP_5ST_BASE,
1224 [ALC880_FIXUP_6ST_BASE] = {
1225 .type = HDA_FIXUP_PINS,
1226 .v.pins = (const struct hda_pintbl[]) {
1227 { 0x14, 0x01014010 }, /* front */
1228 { 0x15, 0x01016412 }, /* surr */
1229 { 0x16, 0x01011411 }, /* CLFE */
1230 { 0x17, 0x01012414 }, /* side */
1231 { 0x18, 0x01a19c30 }, /* mic-in */
1232 { 0x19, 0x02a19c40 }, /* front-mic */
1233 { 0x1a, 0x01813031 }, /* line-in */
1234 { 0x1b, 0x0121411f }, /* HP */
1235 { 0x1c, 0x411111f0 }, /* N/A */
1236 { 0x1d, 0x411111f0 }, /* N/A */
1237 /* 0x1e is filled in below */
1238 { 0x1f, 0x411111f0 }, /* N/A */
1242 [ALC880_FIXUP_6ST] = {
1243 .type = HDA_FIXUP_PINS,
1244 .v.pins = (const struct hda_pintbl[]) {
1245 { 0x1e, 0x411111f0 }, /* N/A */
1249 .chain_id = ALC880_FIXUP_6ST_BASE,
1251 [ALC880_FIXUP_6ST_DIG] = {
1252 .type = HDA_FIXUP_PINS,
1253 .v.pins = (const struct hda_pintbl[]) {
1254 { 0x1e, 0x0144111e }, /* SPDIF */
1258 .chain_id = ALC880_FIXUP_6ST_BASE,
1260 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1261 .type = HDA_FIXUP_PINS,
1262 .v.pins = (const struct hda_pintbl[]) {
1263 { 0x1b, 0x0121401f }, /* HP with jack detect */
1266 .chained_before = true,
1267 .chain_id = ALC880_FIXUP_6ST_BASE,
1271 static const struct snd_pci_quirk alc880_fixup_tbl[] = {
1272 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
1273 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
1274 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
1275 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
1276 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
1277 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
1278 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
1279 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
1280 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
1281 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
1282 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
1283 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
1284 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
1285 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
1286 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_FIXUP_F1734),
1287 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
1288 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
1289 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
1290 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1291 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1292 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
1293 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
1294 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
1296 /* Below is the copied entries from alc880_quirks.c.
1297 * It's not quite sure whether BIOS sets the correct pin-config table
1298 * on these machines, thus they are kept to be compatible with
1299 * the old static quirks. Once when it's confirmed to work without
1300 * these overrides, it'd be better to remove.
1302 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1303 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1304 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1305 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1306 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1307 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1308 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1309 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1310 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1311 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1312 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1313 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1314 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1315 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1316 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1317 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1318 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1319 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1320 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1321 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1322 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1323 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1324 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1325 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1326 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1327 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1328 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1329 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1330 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1331 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1332 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1333 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1334 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1336 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1337 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1338 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1342 static const struct hda_model_fixup alc880_fixup_models[] = {
1343 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1344 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1345 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1346 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1347 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1348 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
1349 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
1355 * OK, here we have finally the patch for ALC880
1357 static int patch_alc880(struct hda_codec *codec)
1359 struct alc_spec *spec;
1362 err = alc_alloc_spec(codec, 0x0b);
1367 spec->gen.need_dac_fix = 1;
1368 spec->gen.beep_nid = 0x01;
1370 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
1372 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1374 /* automatic parse from the BIOS config */
1375 err = alc880_parse_auto_config(codec);
1379 if (!spec->gen.no_analog)
1380 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1382 codec->patch_ops = alc_patch_ops;
1383 codec->patch_ops.unsol_event = alc880_unsol_event;
1386 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1399 static int alc260_parse_auto_config(struct hda_codec *codec)
1401 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
1402 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1403 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
1410 ALC260_FIXUP_HP_DC5750,
1411 ALC260_FIXUP_HP_PIN_0F,
1414 ALC260_FIXUP_GPIO1_TOGGLE,
1415 ALC260_FIXUP_REPLACER,
1416 ALC260_FIXUP_HP_B1900,
1418 ALC260_FIXUP_FSC_S7020,
1419 ALC260_FIXUP_FSC_S7020_JWSE,
1420 ALC260_FIXUP_VAIO_PINS,
1423 static void alc260_gpio1_automute(struct hda_codec *codec)
1425 struct alc_spec *spec = codec->spec;
1426 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
1427 spec->gen.hp_jack_present);
1430 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1431 const struct hda_fixup *fix, int action)
1433 struct alc_spec *spec = codec->spec;
1434 if (action == HDA_FIXUP_ACT_PROBE) {
1435 /* although the machine has only one output pin, we need to
1436 * toggle GPIO1 according to the jack state
1438 spec->gen.automute_hook = alc260_gpio1_automute;
1439 spec->gen.detect_hp = 1;
1440 spec->gen.automute_speaker = 1;
1441 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
1442 snd_hda_jack_detect_enable_callback(codec, 0x0f,
1443 snd_hda_gen_hp_automute);
1444 snd_hda_add_verbs(codec, alc_gpio1_init_verbs);
1448 static void alc260_fixup_kn1(struct hda_codec *codec,
1449 const struct hda_fixup *fix, int action)
1451 struct alc_spec *spec = codec->spec;
1452 static const struct hda_pintbl pincfgs[] = {
1453 { 0x0f, 0x02214000 }, /* HP/speaker */
1454 { 0x12, 0x90a60160 }, /* int mic */
1455 { 0x13, 0x02a19000 }, /* ext mic */
1456 { 0x18, 0x01446000 }, /* SPDIF out */
1457 /* disable bogus I/O pins */
1458 { 0x10, 0x411111f0 },
1459 { 0x11, 0x411111f0 },
1460 { 0x14, 0x411111f0 },
1461 { 0x15, 0x411111f0 },
1462 { 0x16, 0x411111f0 },
1463 { 0x17, 0x411111f0 },
1464 { 0x19, 0x411111f0 },
1469 case HDA_FIXUP_ACT_PRE_PROBE:
1470 snd_hda_apply_pincfgs(codec, pincfgs);
1472 case HDA_FIXUP_ACT_PROBE:
1473 spec->init_amp = ALC_INIT_NONE;
1478 static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1479 const struct hda_fixup *fix, int action)
1481 struct alc_spec *spec = codec->spec;
1482 if (action == HDA_FIXUP_ACT_PROBE)
1483 spec->init_amp = ALC_INIT_NONE;
1486 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1487 const struct hda_fixup *fix, int action)
1489 struct alc_spec *spec = codec->spec;
1490 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1491 spec->gen.add_jack_modes = 1;
1492 spec->gen.hp_mic = 1;
1496 static const struct hda_fixup alc260_fixups[] = {
1497 [ALC260_FIXUP_HP_DC5750] = {
1498 .type = HDA_FIXUP_PINS,
1499 .v.pins = (const struct hda_pintbl[]) {
1500 { 0x11, 0x90130110 }, /* speaker */
1504 [ALC260_FIXUP_HP_PIN_0F] = {
1505 .type = HDA_FIXUP_PINS,
1506 .v.pins = (const struct hda_pintbl[]) {
1507 { 0x0f, 0x01214000 }, /* HP */
1511 [ALC260_FIXUP_COEF] = {
1512 .type = HDA_FIXUP_VERBS,
1513 .v.verbs = (const struct hda_verb[]) {
1514 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1515 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
1519 [ALC260_FIXUP_GPIO1] = {
1520 .type = HDA_FIXUP_VERBS,
1521 .v.verbs = alc_gpio1_init_verbs,
1523 [ALC260_FIXUP_GPIO1_TOGGLE] = {
1524 .type = HDA_FIXUP_FUNC,
1525 .v.func = alc260_fixup_gpio1_toggle,
1527 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1529 [ALC260_FIXUP_REPLACER] = {
1530 .type = HDA_FIXUP_VERBS,
1531 .v.verbs = (const struct hda_verb[]) {
1532 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1533 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
1537 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1539 [ALC260_FIXUP_HP_B1900] = {
1540 .type = HDA_FIXUP_FUNC,
1541 .v.func = alc260_fixup_gpio1_toggle,
1543 .chain_id = ALC260_FIXUP_COEF,
1545 [ALC260_FIXUP_KN1] = {
1546 .type = HDA_FIXUP_FUNC,
1547 .v.func = alc260_fixup_kn1,
1549 [ALC260_FIXUP_FSC_S7020] = {
1550 .type = HDA_FIXUP_FUNC,
1551 .v.func = alc260_fixup_fsc_s7020,
1553 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1554 .type = HDA_FIXUP_FUNC,
1555 .v.func = alc260_fixup_fsc_s7020_jwse,
1557 .chain_id = ALC260_FIXUP_FSC_S7020,
1559 [ALC260_FIXUP_VAIO_PINS] = {
1560 .type = HDA_FIXUP_PINS,
1561 .v.pins = (const struct hda_pintbl[]) {
1562 /* Pin configs are missing completely on some VAIOs */
1563 { 0x0f, 0x01211020 },
1564 { 0x10, 0x0001003f },
1565 { 0x11, 0x411111f0 },
1566 { 0x12, 0x01a15930 },
1567 { 0x13, 0x411111f0 },
1568 { 0x14, 0x411111f0 },
1569 { 0x15, 0x411111f0 },
1570 { 0x16, 0x411111f0 },
1571 { 0x17, 0x411111f0 },
1572 { 0x18, 0x411111f0 },
1573 { 0x19, 0x411111f0 },
1579 static const struct snd_pci_quirk alc260_fixup_tbl[] = {
1580 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
1581 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
1582 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
1583 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
1584 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
1585 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
1586 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
1587 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
1588 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
1589 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
1590 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
1591 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
1595 static const struct hda_model_fixup alc260_fixup_models[] = {
1596 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1597 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1598 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1599 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1605 static int patch_alc260(struct hda_codec *codec)
1607 struct alc_spec *spec;
1610 err = alc_alloc_spec(codec, 0x07);
1615 /* as quite a few machines require HP amp for speaker outputs,
1616 * it's easier to enable it unconditionally; even if it's unneeded,
1617 * it's almost harmless.
1619 spec->gen.prefer_hp_amp = 1;
1620 spec->gen.beep_nid = 0x01;
1622 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1624 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1626 /* automatic parse from the BIOS config */
1627 err = alc260_parse_auto_config(codec);
1631 if (!spec->gen.no_analog)
1632 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1634 codec->patch_ops = alc_patch_ops;
1635 spec->shutup = alc_eapd_shutup;
1637 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1648 * ALC882/883/885/888/889 support
1650 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1651 * configuration. Each pin widget can choose any input DACs and a mixer.
1652 * Each ADC is connected from a mixer of all inputs. This makes possible
1653 * 6-channel independent captures.
1655 * In addition, an independent DAC for the multi-playback (not used in this
1663 ALC882_FIXUP_ABIT_AW9D_MAX,
1664 ALC882_FIXUP_LENOVO_Y530,
1665 ALC882_FIXUP_PB_M5210,
1666 ALC882_FIXUP_ACER_ASPIRE_7736,
1667 ALC882_FIXUP_ASUS_W90V,
1669 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
1670 ALC889_FIXUP_VAIO_TT,
1671 ALC888_FIXUP_EEE1601,
1674 ALC883_FIXUP_ACER_EAPD,
1679 ALC882_FIXUP_ASUS_W2JC,
1680 ALC882_FIXUP_ACER_ASPIRE_4930G,
1681 ALC882_FIXUP_ACER_ASPIRE_8930G,
1682 ALC882_FIXUP_ASPIRE_8930G_VERBS,
1683 ALC885_FIXUP_MACPRO_GPIO,
1684 ALC889_FIXUP_DAC_ROUTE,
1685 ALC889_FIXUP_MBP_VREF,
1686 ALC889_FIXUP_IMAC91_VREF,
1687 ALC889_FIXUP_MBA11_VREF,
1688 ALC889_FIXUP_MBA21_VREF,
1689 ALC889_FIXUP_MP11_VREF,
1690 ALC882_FIXUP_INV_DMIC,
1691 ALC882_FIXUP_NO_PRIMARY_HP,
1692 ALC887_FIXUP_ASUS_BASS,
1693 ALC887_FIXUP_BASS_CHMAP,
1696 static void alc889_fixup_coef(struct hda_codec *codec,
1697 const struct hda_fixup *fix, int action)
1699 if (action != HDA_FIXUP_ACT_INIT)
1701 alc_update_coef_idx(codec, 7, 0, 0x2030);
1704 /* toggle speaker-output according to the hp-jack state */
1705 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
1707 unsigned int gpiostate, gpiomask, gpiodir;
1709 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
1710 AC_VERB_GET_GPIO_DATA, 0);
1713 gpiostate |= (1 << pin);
1715 gpiostate &= ~(1 << pin);
1717 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
1718 AC_VERB_GET_GPIO_MASK, 0);
1719 gpiomask |= (1 << pin);
1721 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
1722 AC_VERB_GET_GPIO_DIRECTION, 0);
1723 gpiodir |= (1 << pin);
1726 snd_hda_codec_write(codec, codec->afg, 0,
1727 AC_VERB_SET_GPIO_MASK, gpiomask);
1728 snd_hda_codec_write(codec, codec->afg, 0,
1729 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
1733 snd_hda_codec_write(codec, codec->afg, 0,
1734 AC_VERB_SET_GPIO_DATA, gpiostate);
1737 /* set up GPIO at initialization */
1738 static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
1739 const struct hda_fixup *fix, int action)
1741 if (action != HDA_FIXUP_ACT_INIT)
1743 alc882_gpio_mute(codec, 0, 0);
1744 alc882_gpio_mute(codec, 1, 0);
1747 /* Fix the connection of some pins for ALC889:
1748 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
1749 * work correctly (bko#42740)
1751 static void alc889_fixup_dac_route(struct hda_codec *codec,
1752 const struct hda_fixup *fix, int action)
1754 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1755 /* fake the connections during parsing the tree */
1756 hda_nid_t conn1[2] = { 0x0c, 0x0d };
1757 hda_nid_t conn2[2] = { 0x0e, 0x0f };
1758 snd_hda_override_conn_list(codec, 0x14, 2, conn1);
1759 snd_hda_override_conn_list(codec, 0x15, 2, conn1);
1760 snd_hda_override_conn_list(codec, 0x18, 2, conn2);
1761 snd_hda_override_conn_list(codec, 0x1a, 2, conn2);
1762 } else if (action == HDA_FIXUP_ACT_PROBE) {
1763 /* restore the connections */
1764 hda_nid_t conn[5] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
1765 snd_hda_override_conn_list(codec, 0x14, 5, conn);
1766 snd_hda_override_conn_list(codec, 0x15, 5, conn);
1767 snd_hda_override_conn_list(codec, 0x18, 5, conn);
1768 snd_hda_override_conn_list(codec, 0x1a, 5, conn);
1772 /* Set VREF on HP pin */
1773 static void alc889_fixup_mbp_vref(struct hda_codec *codec,
1774 const struct hda_fixup *fix, int action)
1776 struct alc_spec *spec = codec->spec;
1777 static hda_nid_t nids[2] = { 0x14, 0x15 };
1780 if (action != HDA_FIXUP_ACT_INIT)
1782 for (i = 0; i < ARRAY_SIZE(nids); i++) {
1783 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
1784 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
1786 val = snd_hda_codec_get_pin_target(codec, nids[i]);
1787 val |= AC_PINCTL_VREF_80;
1788 snd_hda_set_pin_ctl(codec, nids[i], val);
1789 spec->gen.keep_vref_in_automute = 1;
1794 static void alc889_fixup_mac_pins(struct hda_codec *codec,
1795 const hda_nid_t *nids, int num_nids)
1797 struct alc_spec *spec = codec->spec;
1800 for (i = 0; i < num_nids; i++) {
1802 val = snd_hda_codec_get_pin_target(codec, nids[i]);
1803 val |= AC_PINCTL_VREF_50;
1804 snd_hda_set_pin_ctl(codec, nids[i], val);
1806 spec->gen.keep_vref_in_automute = 1;
1809 /* Set VREF on speaker pins on imac91 */
1810 static void alc889_fixup_imac91_vref(struct hda_codec *codec,
1811 const struct hda_fixup *fix, int action)
1813 static hda_nid_t nids[2] = { 0x18, 0x1a };
1815 if (action == HDA_FIXUP_ACT_INIT)
1816 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1819 /* Set VREF on speaker pins on mba11 */
1820 static void alc889_fixup_mba11_vref(struct hda_codec *codec,
1821 const struct hda_fixup *fix, int action)
1823 static hda_nid_t nids[1] = { 0x18 };
1825 if (action == HDA_FIXUP_ACT_INIT)
1826 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1829 /* Set VREF on speaker pins on mba21 */
1830 static void alc889_fixup_mba21_vref(struct hda_codec *codec,
1831 const struct hda_fixup *fix, int action)
1833 static hda_nid_t nids[2] = { 0x18, 0x19 };
1835 if (action == HDA_FIXUP_ACT_INIT)
1836 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1839 /* Don't take HP output as primary
1840 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
1841 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
1843 static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
1844 const struct hda_fixup *fix, int action)
1846 struct alc_spec *spec = codec->spec;
1847 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1848 spec->gen.no_primary_hp = 1;
1849 spec->gen.no_multi_io = 1;
1853 static void alc_fixup_bass_chmap(struct hda_codec *codec,
1854 const struct hda_fixup *fix, int action);
1856 static const struct hda_fixup alc882_fixups[] = {
1857 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
1858 .type = HDA_FIXUP_PINS,
1859 .v.pins = (const struct hda_pintbl[]) {
1860 { 0x15, 0x01080104 }, /* side */
1861 { 0x16, 0x01011012 }, /* rear */
1862 { 0x17, 0x01016011 }, /* clfe */
1866 [ALC882_FIXUP_LENOVO_Y530] = {
1867 .type = HDA_FIXUP_PINS,
1868 .v.pins = (const struct hda_pintbl[]) {
1869 { 0x15, 0x99130112 }, /* rear int speakers */
1870 { 0x16, 0x99130111 }, /* subwoofer */
1874 [ALC882_FIXUP_PB_M5210] = {
1875 .type = HDA_FIXUP_PINCTLS,
1876 .v.pins = (const struct hda_pintbl[]) {
1877 { 0x19, PIN_VREF50 },
1881 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
1882 .type = HDA_FIXUP_FUNC,
1883 .v.func = alc_fixup_sku_ignore,
1885 [ALC882_FIXUP_ASUS_W90V] = {
1886 .type = HDA_FIXUP_PINS,
1887 .v.pins = (const struct hda_pintbl[]) {
1888 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
1892 [ALC889_FIXUP_CD] = {
1893 .type = HDA_FIXUP_PINS,
1894 .v.pins = (const struct hda_pintbl[]) {
1895 { 0x1c, 0x993301f0 }, /* CD */
1899 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
1900 .type = HDA_FIXUP_PINS,
1901 .v.pins = (const struct hda_pintbl[]) {
1902 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
1906 .chain_id = ALC889_FIXUP_CD,
1908 [ALC889_FIXUP_VAIO_TT] = {
1909 .type = HDA_FIXUP_PINS,
1910 .v.pins = (const struct hda_pintbl[]) {
1911 { 0x17, 0x90170111 }, /* hidden surround speaker */
1915 [ALC888_FIXUP_EEE1601] = {
1916 .type = HDA_FIXUP_VERBS,
1917 .v.verbs = (const struct hda_verb[]) {
1918 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
1919 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
1923 [ALC882_FIXUP_EAPD] = {
1924 .type = HDA_FIXUP_VERBS,
1925 .v.verbs = (const struct hda_verb[]) {
1926 /* change to EAPD mode */
1927 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1928 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1932 [ALC883_FIXUP_EAPD] = {
1933 .type = HDA_FIXUP_VERBS,
1934 .v.verbs = (const struct hda_verb[]) {
1935 /* change to EAPD mode */
1936 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1937 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1941 [ALC883_FIXUP_ACER_EAPD] = {
1942 .type = HDA_FIXUP_VERBS,
1943 .v.verbs = (const struct hda_verb[]) {
1944 /* eanable EAPD on Acer laptops */
1945 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1946 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
1950 [ALC882_FIXUP_GPIO1] = {
1951 .type = HDA_FIXUP_VERBS,
1952 .v.verbs = alc_gpio1_init_verbs,
1954 [ALC882_FIXUP_GPIO2] = {
1955 .type = HDA_FIXUP_VERBS,
1956 .v.verbs = alc_gpio2_init_verbs,
1958 [ALC882_FIXUP_GPIO3] = {
1959 .type = HDA_FIXUP_VERBS,
1960 .v.verbs = alc_gpio3_init_verbs,
1962 [ALC882_FIXUP_ASUS_W2JC] = {
1963 .type = HDA_FIXUP_VERBS,
1964 .v.verbs = alc_gpio1_init_verbs,
1966 .chain_id = ALC882_FIXUP_EAPD,
1968 [ALC889_FIXUP_COEF] = {
1969 .type = HDA_FIXUP_FUNC,
1970 .v.func = alc889_fixup_coef,
1972 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
1973 .type = HDA_FIXUP_PINS,
1974 .v.pins = (const struct hda_pintbl[]) {
1975 { 0x16, 0x99130111 }, /* CLFE speaker */
1976 { 0x17, 0x99130112 }, /* surround speaker */
1980 .chain_id = ALC882_FIXUP_GPIO1,
1982 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
1983 .type = HDA_FIXUP_PINS,
1984 .v.pins = (const struct hda_pintbl[]) {
1985 { 0x16, 0x99130111 }, /* CLFE speaker */
1986 { 0x1b, 0x99130112 }, /* surround speaker */
1990 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
1992 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
1993 /* additional init verbs for Acer Aspire 8930G */
1994 .type = HDA_FIXUP_VERBS,
1995 .v.verbs = (const struct hda_verb[]) {
1996 /* Enable all DACs */
1997 /* DAC DISABLE/MUTE 1? */
1998 /* setting bits 1-5 disables DAC nids 0x02-0x06
1999 * apparently. Init=0x38 */
2000 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2001 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2002 /* DAC DISABLE/MUTE 2? */
2003 /* some bit here disables the other DACs.
2005 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2006 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2008 * This laptop has a stereo digital microphone.
2009 * The mics are only 1cm apart which makes the stereo
2010 * useless. However, either the mic or the ALC889
2011 * makes the signal become a difference/sum signal
2012 * instead of standard stereo, which is annoying.
2013 * So instead we flip this bit which makes the
2014 * codec replicate the sum signal to both channels,
2015 * turning it into a normal mono mic.
2017 /* DMIC_CONTROL? Init value = 0x0001 */
2018 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2019 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2020 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2021 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2025 .chain_id = ALC882_FIXUP_GPIO1,
2027 [ALC885_FIXUP_MACPRO_GPIO] = {
2028 .type = HDA_FIXUP_FUNC,
2029 .v.func = alc885_fixup_macpro_gpio,
2031 [ALC889_FIXUP_DAC_ROUTE] = {
2032 .type = HDA_FIXUP_FUNC,
2033 .v.func = alc889_fixup_dac_route,
2035 [ALC889_FIXUP_MBP_VREF] = {
2036 .type = HDA_FIXUP_FUNC,
2037 .v.func = alc889_fixup_mbp_vref,
2039 .chain_id = ALC882_FIXUP_GPIO1,
2041 [ALC889_FIXUP_IMAC91_VREF] = {
2042 .type = HDA_FIXUP_FUNC,
2043 .v.func = alc889_fixup_imac91_vref,
2045 .chain_id = ALC882_FIXUP_GPIO1,
2047 [ALC889_FIXUP_MBA11_VREF] = {
2048 .type = HDA_FIXUP_FUNC,
2049 .v.func = alc889_fixup_mba11_vref,
2051 .chain_id = ALC889_FIXUP_MBP_VREF,
2053 [ALC889_FIXUP_MBA21_VREF] = {
2054 .type = HDA_FIXUP_FUNC,
2055 .v.func = alc889_fixup_mba21_vref,
2057 .chain_id = ALC889_FIXUP_MBP_VREF,
2059 [ALC889_FIXUP_MP11_VREF] = {
2060 .type = HDA_FIXUP_FUNC,
2061 .v.func = alc889_fixup_mba11_vref,
2063 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2065 [ALC882_FIXUP_INV_DMIC] = {
2066 .type = HDA_FIXUP_FUNC,
2067 .v.func = alc_fixup_inv_dmic,
2069 [ALC882_FIXUP_NO_PRIMARY_HP] = {
2070 .type = HDA_FIXUP_FUNC,
2071 .v.func = alc882_fixup_no_primary_hp,
2073 [ALC887_FIXUP_ASUS_BASS] = {
2074 .type = HDA_FIXUP_PINS,
2075 .v.pins = (const struct hda_pintbl[]) {
2076 {0x16, 0x99130130}, /* bass speaker */
2080 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2082 [ALC887_FIXUP_BASS_CHMAP] = {
2083 .type = HDA_FIXUP_FUNC,
2084 .v.func = alc_fixup_bass_chmap,
2088 static const struct snd_pci_quirk alc882_fixup_tbl[] = {
2089 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2090 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2091 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2092 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2093 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2094 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
2095 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2096 ALC882_FIXUP_ACER_ASPIRE_4930G),
2097 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2098 ALC882_FIXUP_ACER_ASPIRE_4930G),
2099 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2100 ALC882_FIXUP_ACER_ASPIRE_8930G),
2101 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2102 ALC882_FIXUP_ACER_ASPIRE_8930G),
2103 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2104 ALC882_FIXUP_ACER_ASPIRE_4930G),
2105 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2106 ALC882_FIXUP_ACER_ASPIRE_4930G),
2107 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2108 ALC882_FIXUP_ACER_ASPIRE_4930G),
2109 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
2110 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2111 ALC882_FIXUP_ACER_ASPIRE_4930G),
2112 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
2113 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
2114 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
2115 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
2116 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
2117 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
2118 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
2119 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
2120 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
2121 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
2122 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2124 /* All Apple entries are in codec SSIDs */
2125 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2126 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2127 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2128 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
2129 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2130 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
2131 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2132 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
2133 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
2134 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
2135 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
2136 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2137 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2138 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
2139 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2140 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2141 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
2142 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 5,1", ALC885_FIXUP_MACPRO_GPIO),
2143 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
2144 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2145 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
2146 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_IMAC91_VREF),
2148 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
2149 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
2150 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
2151 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
2152 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
2153 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2154 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
2155 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
2156 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
2160 static const struct hda_model_fixup alc882_fixup_models[] = {
2161 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2162 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2163 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
2164 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
2165 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
2170 * BIOS auto configuration
2172 /* almost identical with ALC880 parser... */
2173 static int alc882_parse_auto_config(struct hda_codec *codec)
2175 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
2176 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2177 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
2182 static int patch_alc882(struct hda_codec *codec)
2184 struct alc_spec *spec;
2187 err = alc_alloc_spec(codec, 0x0b);
2193 switch (codec->vendor_id) {
2199 /* ALC883 and variants */
2200 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2204 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
2206 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2208 alc_auto_parse_customize_define(codec);
2210 if (has_cdefine_beep(codec))
2211 spec->gen.beep_nid = 0x01;
2213 /* automatic parse from the BIOS config */
2214 err = alc882_parse_auto_config(codec);
2218 if (!spec->gen.no_analog && spec->gen.beep_nid)
2219 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2221 codec->patch_ops = alc_patch_ops;
2223 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2236 static int alc262_parse_auto_config(struct hda_codec *codec)
2238 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
2239 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2240 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
2247 ALC262_FIXUP_FSC_H270,
2248 ALC262_FIXUP_FSC_S7110,
2249 ALC262_FIXUP_HP_Z200,
2251 ALC262_FIXUP_LENOVO_3000,
2253 ALC262_FIXUP_BENQ_T31,
2254 ALC262_FIXUP_INV_DMIC,
2255 ALC262_FIXUP_INTEL_BAYLEYBAY,
2258 static const struct hda_fixup alc262_fixups[] = {
2259 [ALC262_FIXUP_FSC_H270] = {
2260 .type = HDA_FIXUP_PINS,
2261 .v.pins = (const struct hda_pintbl[]) {
2262 { 0x14, 0x99130110 }, /* speaker */
2263 { 0x15, 0x0221142f }, /* front HP */
2264 { 0x1b, 0x0121141f }, /* rear HP */
2268 [ALC262_FIXUP_FSC_S7110] = {
2269 .type = HDA_FIXUP_PINS,
2270 .v.pins = (const struct hda_pintbl[]) {
2271 { 0x15, 0x90170110 }, /* speaker */
2275 .chain_id = ALC262_FIXUP_BENQ,
2277 [ALC262_FIXUP_HP_Z200] = {
2278 .type = HDA_FIXUP_PINS,
2279 .v.pins = (const struct hda_pintbl[]) {
2280 { 0x16, 0x99130120 }, /* internal speaker */
2284 [ALC262_FIXUP_TYAN] = {
2285 .type = HDA_FIXUP_PINS,
2286 .v.pins = (const struct hda_pintbl[]) {
2287 { 0x14, 0x1993e1f0 }, /* int AUX */
2291 [ALC262_FIXUP_LENOVO_3000] = {
2292 .type = HDA_FIXUP_PINCTLS,
2293 .v.pins = (const struct hda_pintbl[]) {
2294 { 0x19, PIN_VREF50 },
2298 .chain_id = ALC262_FIXUP_BENQ,
2300 [ALC262_FIXUP_BENQ] = {
2301 .type = HDA_FIXUP_VERBS,
2302 .v.verbs = (const struct hda_verb[]) {
2303 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2304 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2308 [ALC262_FIXUP_BENQ_T31] = {
2309 .type = HDA_FIXUP_VERBS,
2310 .v.verbs = (const struct hda_verb[]) {
2311 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2312 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2316 [ALC262_FIXUP_INV_DMIC] = {
2317 .type = HDA_FIXUP_FUNC,
2318 .v.func = alc_fixup_inv_dmic,
2320 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2321 .type = HDA_FIXUP_FUNC,
2322 .v.func = alc_fixup_no_depop_delay,
2326 static const struct snd_pci_quirk alc262_fixup_tbl[] = {
2327 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
2328 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
2329 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
2330 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
2331 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
2332 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
2333 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2334 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
2335 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
2339 static const struct hda_model_fixup alc262_fixup_models[] = {
2340 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
2346 static int patch_alc262(struct hda_codec *codec)
2348 struct alc_spec *spec;
2351 err = alc_alloc_spec(codec, 0x0b);
2356 spec->gen.shared_mic_vref_pin = 0x18;
2359 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2362 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
2364 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2366 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
2368 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2370 alc_auto_parse_customize_define(codec);
2372 if (has_cdefine_beep(codec))
2373 spec->gen.beep_nid = 0x01;
2375 /* automatic parse from the BIOS config */
2376 err = alc262_parse_auto_config(codec);
2380 if (!spec->gen.no_analog && spec->gen.beep_nid)
2381 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2383 codec->patch_ops = alc_patch_ops;
2384 spec->shutup = alc_eapd_shutup;
2386 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2398 /* bind Beep switches of both NID 0x0f and 0x10 */
2399 static const struct hda_bind_ctls alc268_bind_beep_sw = {
2400 .ops = &snd_hda_bind_sw,
2402 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
2403 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
2408 static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2409 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
2410 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
2414 /* set PCBEEP vol = 0, mute connections */
2415 static const struct hda_verb alc268_beep_init_verbs[] = {
2416 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2417 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2418 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2423 ALC268_FIXUP_INV_DMIC,
2424 ALC268_FIXUP_HP_EAPD,
2428 static const struct hda_fixup alc268_fixups[] = {
2429 [ALC268_FIXUP_INV_DMIC] = {
2430 .type = HDA_FIXUP_FUNC,
2431 .v.func = alc_fixup_inv_dmic,
2433 [ALC268_FIXUP_HP_EAPD] = {
2434 .type = HDA_FIXUP_VERBS,
2435 .v.verbs = (const struct hda_verb[]) {
2436 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
2440 [ALC268_FIXUP_SPDIF] = {
2441 .type = HDA_FIXUP_PINS,
2442 .v.pins = (const struct hda_pintbl[]) {
2443 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
2449 static const struct hda_model_fixup alc268_fixup_models[] = {
2450 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
2451 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
2455 static const struct snd_pci_quirk alc268_fixup_tbl[] = {
2456 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
2457 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
2458 /* below is codec SSID since multiple Toshiba laptops have the
2459 * same PCI SSID 1179:ff00
2461 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
2466 * BIOS auto configuration
2468 static int alc268_parse_auto_config(struct hda_codec *codec)
2470 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2471 return alc_parse_auto_config(codec, NULL, alc268_ssids);
2476 static int patch_alc268(struct hda_codec *codec)
2478 struct alc_spec *spec;
2481 /* ALC268 has no aa-loopback mixer */
2482 err = alc_alloc_spec(codec, 0);
2487 spec->gen.beep_nid = 0x01;
2489 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
2490 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2492 /* automatic parse from the BIOS config */
2493 err = alc268_parse_auto_config(codec);
2497 if (err > 0 && !spec->gen.no_analog &&
2498 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
2499 add_mixer(spec, alc268_beep_mixer);
2500 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
2501 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
2502 /* override the amp caps for beep generator */
2503 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
2504 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
2505 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
2506 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
2507 (0 << AC_AMPCAP_MUTE_SHIFT));
2510 codec->patch_ops = alc_patch_ops;
2511 spec->shutup = alc_eapd_shutup;
2513 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2526 static int playback_pcm_open(struct hda_pcm_stream *hinfo,
2527 struct hda_codec *codec,
2528 struct snd_pcm_substream *substream)
2530 struct hda_gen_spec *spec = codec->spec;
2531 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2535 static int playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2536 struct hda_codec *codec,
2537 unsigned int stream_tag,
2538 unsigned int format,
2539 struct snd_pcm_substream *substream)
2541 struct hda_gen_spec *spec = codec->spec;
2542 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2543 stream_tag, format, substream);
2546 static int playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2547 struct hda_codec *codec,
2548 struct snd_pcm_substream *substream)
2550 struct hda_gen_spec *spec = codec->spec;
2551 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2554 static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
2558 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
2559 /* NID is set in alc_build_pcms */
2561 .open = playback_pcm_open,
2562 .prepare = playback_pcm_prepare,
2563 .cleanup = playback_pcm_cleanup
2567 static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
2571 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
2572 /* NID is set in alc_build_pcms */
2575 /* different alc269-variants */
2577 ALC269_TYPE_ALC269VA,
2578 ALC269_TYPE_ALC269VB,
2579 ALC269_TYPE_ALC269VC,
2580 ALC269_TYPE_ALC269VD,
2591 * BIOS auto configuration
2593 static int alc269_parse_auto_config(struct hda_codec *codec)
2595 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
2596 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
2597 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2598 struct alc_spec *spec = codec->spec;
2599 const hda_nid_t *ssids;
2601 switch (spec->codec_variant) {
2602 case ALC269_TYPE_ALC269VA:
2603 case ALC269_TYPE_ALC269VC:
2604 case ALC269_TYPE_ALC280:
2605 case ALC269_TYPE_ALC284:
2606 case ALC269_TYPE_ALC285:
2607 ssids = alc269va_ssids;
2609 case ALC269_TYPE_ALC269VB:
2610 case ALC269_TYPE_ALC269VD:
2611 case ALC269_TYPE_ALC282:
2612 case ALC269_TYPE_ALC283:
2613 case ALC269_TYPE_ALC286:
2614 case ALC269_TYPE_ALC255:
2615 ssids = alc269_ssids;
2618 ssids = alc269_ssids;
2622 return alc_parse_auto_config(codec, alc269_ignore, ssids);
2625 static int find_ext_mic_pin(struct hda_codec *codec);
2627 static void alc286_shutup(struct hda_codec *codec)
2630 int mic_pin = find_ext_mic_pin(codec);
2631 /* don't shut up pins when unloading the driver; otherwise it breaks
2632 * the default pin setup at the next load of the driver
2634 if (codec->bus->shutdown)
2636 for (i = 0; i < codec->init_pins.used; i++) {
2637 struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i);
2638 /* use read here for syncing after issuing each verb */
2639 if (pin->nid != mic_pin)
2640 snd_hda_codec_read(codec, pin->nid, 0,
2641 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
2643 codec->pins_shutup = 1;
2646 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
2648 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
2651 static void alc269_shutup(struct hda_codec *codec)
2653 struct alc_spec *spec = codec->spec;
2655 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
2656 alc269vb_toggle_power_output(codec, 0);
2657 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
2658 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
2661 snd_hda_shutup_pins(codec);
2664 static struct coef_fw alc282_coefs[] = {
2665 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
2666 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
2667 WRITE_COEF(0x07, 0x0200), /* DMIC control */
2668 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
2669 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
2670 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
2671 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
2672 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
2673 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
2674 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
2675 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
2676 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
2677 WRITE_COEF(0x34, 0xa0c0), /* ANC */
2678 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
2679 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
2680 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
2681 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
2682 WRITE_COEF(0x63, 0x2902), /* PLL */
2683 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
2684 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
2685 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
2686 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
2687 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
2688 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
2689 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
2690 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
2691 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
2692 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
2693 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
2697 static void alc282_restore_default_value(struct hda_codec *codec)
2699 alc_process_coef_fw(codec, alc282_coefs);
2702 static void alc282_init(struct hda_codec *codec)
2704 struct alc_spec *spec = codec->spec;
2705 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
2709 alc282_restore_default_value(codec);
2713 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
2714 coef78 = alc_read_coef_idx(codec, 0x78);
2716 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
2717 /* Headphone capless set to high power mode */
2718 alc_write_coef_idx(codec, 0x78, 0x9004);
2723 snd_hda_codec_write(codec, hp_pin, 0,
2724 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
2729 snd_hda_codec_write(codec, hp_pin, 0,
2730 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
2735 /* Headphone capless set to normal mode */
2736 alc_write_coef_idx(codec, 0x78, coef78);
2739 static void alc282_shutup(struct hda_codec *codec)
2741 struct alc_spec *spec = codec->spec;
2742 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
2747 alc269_shutup(codec);
2751 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
2752 coef78 = alc_read_coef_idx(codec, 0x78);
2753 alc_write_coef_idx(codec, 0x78, 0x9004);
2758 snd_hda_codec_write(codec, hp_pin, 0,
2759 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
2764 snd_hda_codec_write(codec, hp_pin, 0,
2765 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
2770 alc_auto_setup_eapd(codec, false);
2771 snd_hda_shutup_pins(codec);
2772 alc_write_coef_idx(codec, 0x78, coef78);
2775 static struct coef_fw alc283_coefs[] = {
2776 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
2777 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
2778 WRITE_COEF(0x07, 0x0200), /* DMIC control */
2779 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
2780 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
2781 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
2782 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
2783 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
2784 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
2785 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
2786 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
2787 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
2788 WRITE_COEF(0x22, 0xa0c0), /* ANC */
2789 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
2790 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
2791 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
2792 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
2793 WRITE_COEF(0x2e, 0x2902), /* PLL */
2794 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
2795 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
2796 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
2797 WRITE_COEF(0x36, 0x0), /* capless control 5 */
2798 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
2799 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
2800 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
2801 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
2802 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
2803 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
2804 WRITE_COEF(0x49, 0x0), /* test mode */
2805 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
2806 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
2807 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
2808 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
2812 static void alc283_restore_default_value(struct hda_codec *codec)
2814 alc_process_coef_fw(codec, alc283_coefs);
2817 static void alc283_init(struct hda_codec *codec)
2819 struct alc_spec *spec = codec->spec;
2820 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
2823 if (!spec->gen.autocfg.hp_outs) {
2824 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
2825 hp_pin = spec->gen.autocfg.line_out_pins[0];
2828 alc283_restore_default_value(codec);
2832 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
2834 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
2835 /* Headphone capless set to high power mode */
2836 alc_write_coef_idx(codec, 0x43, 0x9004);
2838 snd_hda_codec_write(codec, hp_pin, 0,
2839 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
2844 snd_hda_codec_write(codec, hp_pin, 0,
2845 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
2849 /* Index 0x46 Combo jack auto switch control 2 */
2850 /* 3k pull low control for Headset jack. */
2851 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
2852 /* Headphone capless set to normal mode */
2853 alc_write_coef_idx(codec, 0x43, 0x9614);
2856 static void alc283_shutup(struct hda_codec *codec)
2858 struct alc_spec *spec = codec->spec;
2859 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
2862 if (!spec->gen.autocfg.hp_outs) {
2863 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
2864 hp_pin = spec->gen.autocfg.line_out_pins[0];
2868 alc269_shutup(codec);
2872 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
2874 alc_write_coef_idx(codec, 0x43, 0x9004);
2876 /*depop hp during suspend*/
2877 alc_write_coef_idx(codec, 0x06, 0x2100);
2879 snd_hda_codec_write(codec, hp_pin, 0,
2880 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
2885 snd_hda_codec_write(codec, hp_pin, 0,
2886 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
2888 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
2892 alc_auto_setup_eapd(codec, false);
2893 snd_hda_shutup_pins(codec);
2894 alc_write_coef_idx(codec, 0x43, 0x9614);
2897 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
2900 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
2901 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
2902 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
2905 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
2909 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
2910 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
2912 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
2917 static void alc5505_dsp_halt(struct hda_codec *codec)
2921 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
2922 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
2923 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
2924 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
2925 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
2926 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
2927 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
2928 val = alc5505_coef_get(codec, 0x6220);
2929 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
2932 static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
2934 alc5505_coef_set(codec, 0x61b8, 0x04133302);
2935 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
2936 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
2937 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
2938 alc5505_coef_set(codec, 0x6220, 0x2002010f);
2939 alc5505_coef_set(codec, 0x880c, 0x00000004);
2942 static void alc5505_dsp_init(struct hda_codec *codec)
2946 alc5505_dsp_halt(codec);
2947 alc5505_dsp_back_from_halt(codec);
2948 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
2949 alc5505_coef_set(codec, 0x61b0, 0x5b16);
2950 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
2951 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
2952 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
2953 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
2954 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
2955 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
2956 alc5505_coef_set(codec, 0x61b8, 0x04173302);
2957 alc5505_coef_set(codec, 0x61b8, 0x04163302);
2958 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
2959 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
2960 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
2962 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
2964 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
2966 alc5505_coef_set(codec, 0x6220, 0x6002018f);
2968 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
2969 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
2970 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
2971 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
2972 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
2973 alc5505_coef_set(codec, 0x880c, 0x00000003);
2974 alc5505_coef_set(codec, 0x880c, 0x00000010);
2976 #ifdef HALT_REALTEK_ALC5505
2977 alc5505_dsp_halt(codec);
2981 #ifdef HALT_REALTEK_ALC5505
2982 #define alc5505_dsp_suspend(codec) /* NOP */
2983 #define alc5505_dsp_resume(codec) /* NOP */
2985 #define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
2986 #define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
2990 static int alc269_suspend(struct hda_codec *codec)
2992 struct alc_spec *spec = codec->spec;
2994 if (spec->has_alc5505_dsp)
2995 alc5505_dsp_suspend(codec);
2996 return alc_suspend(codec);
2999 static int alc269_resume(struct hda_codec *codec)
3001 struct alc_spec *spec = codec->spec;
3003 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3004 alc269vb_toggle_power_output(codec, 0);
3005 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3006 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
3010 codec->patch_ops.init(codec);
3012 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3013 alc269vb_toggle_power_output(codec, 1);
3014 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3015 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
3019 snd_hda_codec_resume_amp(codec);
3020 snd_hda_codec_resume_cache(codec);
3021 hda_call_check_power_status(codec, 0x01);
3023 /* on some machine, the BIOS will clear the codec gpio data when enter
3024 * suspend, and won't restore the data after resume, so we restore it
3028 snd_hda_codec_write(codec, codec->afg, 0, AC_VERB_SET_GPIO_DATA,
3031 if (spec->has_alc5505_dsp)
3032 alc5505_dsp_resume(codec);
3036 #endif /* CONFIG_PM */
3038 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
3039 const struct hda_fixup *fix, int action)
3041 struct alc_spec *spec = codec->spec;
3043 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3044 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
3047 static void alc269_fixup_hweq(struct hda_codec *codec,
3048 const struct hda_fixup *fix, int action)
3050 if (action == HDA_FIXUP_ACT_INIT)
3051 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
3054 static void alc269_fixup_headset_mic(struct hda_codec *codec,
3055 const struct hda_fixup *fix, int action)
3057 struct alc_spec *spec = codec->spec;
3059 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3060 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3063 static void alc271_fixup_dmic(struct hda_codec *codec,
3064 const struct hda_fixup *fix, int action)
3066 static const struct hda_verb verbs[] = {
3067 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
3068 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
3073 if (strcmp(codec->chip_name, "ALC271X") &&
3074 strcmp(codec->chip_name, "ALC269VB"))
3076 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
3077 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
3078 snd_hda_sequence_write(codec, verbs);
3081 static void alc269_fixup_pcm_44k(struct hda_codec *codec,
3082 const struct hda_fixup *fix, int action)
3084 struct alc_spec *spec = codec->spec;
3086 if (action != HDA_FIXUP_ACT_PROBE)
3089 /* Due to a hardware problem on Lenovo Ideadpad, we need to
3090 * fix the sample rate of analog I/O to 44.1kHz
3092 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
3093 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
3096 static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
3097 const struct hda_fixup *fix, int action)
3099 /* The digital-mic unit sends PDM (differential signal) instead of
3100 * the standard PCM, thus you can't record a valid mono stream as is.
3101 * Below is a workaround specific to ALC269 to control the dmic
3102 * signal source as mono.
3104 if (action == HDA_FIXUP_ACT_INIT)
3105 alc_update_coef_idx(codec, 0x07, 0, 0x80);
3108 static void alc269_quanta_automute(struct hda_codec *codec)
3110 snd_hda_gen_update_outputs(codec);
3112 alc_write_coef_idx(codec, 0x0c, 0x680);
3113 alc_write_coef_idx(codec, 0x0c, 0x480);
3116 static void alc269_fixup_quanta_mute(struct hda_codec *codec,
3117 const struct hda_fixup *fix, int action)
3119 struct alc_spec *spec = codec->spec;
3120 if (action != HDA_FIXUP_ACT_PROBE)
3122 spec->gen.automute_hook = alc269_quanta_automute;
3125 static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
3126 struct hda_jack_callback *jack)
3128 struct alc_spec *spec = codec->spec;
3131 snd_hda_gen_hp_automute(codec, jack);
3133 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
3135 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3138 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3142 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
3143 const struct hda_fixup *fix, int action)
3145 struct alc_spec *spec = codec->spec;
3146 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3147 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3148 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
3153 /* update mute-LED according to the speaker mute state via mic VREF pin */
3154 static void alc269_fixup_mic_mute_hook(void *private_data, int enabled)
3156 struct hda_codec *codec = private_data;
3157 struct alc_spec *spec = codec->spec;
3158 unsigned int pinval;
3160 if (spec->mute_led_polarity)
3162 pinval = snd_hda_codec_get_pin_target(codec, spec->mute_led_nid);
3163 pinval &= ~AC_PINCTL_VREFEN;
3164 pinval |= enabled ? AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80;
3165 if (spec->mute_led_nid)
3166 snd_hda_set_pin_ctl_cache(codec, spec->mute_led_nid, pinval);
3169 /* Make sure the led works even in runtime suspend */
3170 static unsigned int led_power_filter(struct hda_codec *codec,
3172 unsigned int power_state)
3174 struct alc_spec *spec = codec->spec;
3176 if (power_state != AC_PWRST_D3 || nid == 0 ||
3177 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
3180 /* Set pin ctl again, it might have just been set to 0 */
3181 snd_hda_set_pin_ctl(codec, nid,
3182 snd_hda_codec_get_pin_target(codec, nid));
3187 static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
3188 const struct hda_fixup *fix, int action)
3190 struct alc_spec *spec = codec->spec;
3191 const struct dmi_device *dev = NULL;
3193 if (action != HDA_FIXUP_ACT_PRE_PROBE)
3196 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
3198 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
3200 if (pin < 0x0a || pin >= 0x10)
3202 spec->mute_led_polarity = pol;
3203 spec->mute_led_nid = pin - 0x0a + 0x18;
3204 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3205 spec->gen.vmaster_mute_enum = 1;
3206 codec->power_filter = led_power_filter;
3208 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
3209 spec->mute_led_polarity);
3214 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
3215 const struct hda_fixup *fix, int action)
3217 struct alc_spec *spec = codec->spec;
3218 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3219 spec->mute_led_polarity = 0;
3220 spec->mute_led_nid = 0x18;
3221 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3222 spec->gen.vmaster_mute_enum = 1;
3223 codec->power_filter = led_power_filter;
3227 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
3228 const struct hda_fixup *fix, int action)
3230 struct alc_spec *spec = codec->spec;
3231 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3232 spec->mute_led_polarity = 0;
3233 spec->mute_led_nid = 0x19;
3234 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3235 spec->gen.vmaster_mute_enum = 1;
3236 codec->power_filter = led_power_filter;
3240 /* update LED status via GPIO */
3241 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
3244 struct alc_spec *spec = codec->spec;
3245 unsigned int oldval = spec->gpio_led;
3247 if (spec->mute_led_polarity)
3251 spec->gpio_led &= ~mask;
3253 spec->gpio_led |= mask;
3254 if (spec->gpio_led != oldval)
3255 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
3259 /* turn on/off mute LED via GPIO per vmaster hook */
3260 static void alc_fixup_gpio_mute_hook(void *private_data, int enabled)
3262 struct hda_codec *codec = private_data;
3263 struct alc_spec *spec = codec->spec;
3265 alc_update_gpio_led(codec, spec->gpio_mute_led_mask, enabled);
3268 /* turn on/off mic-mute LED via GPIO per capture hook */
3269 static void alc_fixup_gpio_mic_mute_hook(struct hda_codec *codec,
3270 struct snd_kcontrol *kcontrol,
3271 struct snd_ctl_elem_value *ucontrol)
3273 struct alc_spec *spec = codec->spec;
3276 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
3277 ucontrol->value.integer.value[0] ||
3278 ucontrol->value.integer.value[1]);
3281 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
3282 const struct hda_fixup *fix, int action)
3284 struct alc_spec *spec = codec->spec;
3285 static const struct hda_verb gpio_init[] = {
3286 { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 },
3287 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 },
3291 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3292 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
3293 spec->gen.cap_sync_hook = alc_fixup_gpio_mic_mute_hook;
3295 spec->mute_led_polarity = 0;
3296 spec->gpio_mute_led_mask = 0x08;
3297 spec->gpio_mic_led_mask = 0x10;
3298 snd_hda_add_verbs(codec, gpio_init);
3302 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
3303 const struct hda_fixup *fix, int action)
3305 struct alc_spec *spec = codec->spec;
3306 static const struct hda_verb gpio_init[] = {
3307 { 0x01, AC_VERB_SET_GPIO_MASK, 0x22 },
3308 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x22 },
3312 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3313 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
3314 spec->gen.cap_sync_hook = alc_fixup_gpio_mic_mute_hook;
3316 spec->mute_led_polarity = 0;
3317 spec->gpio_mute_led_mask = 0x02;
3318 spec->gpio_mic_led_mask = 0x20;
3319 snd_hda_add_verbs(codec, gpio_init);
3323 /* turn on/off mic-mute LED per capture hook */
3324 static void alc269_fixup_hp_cap_mic_mute_hook(struct hda_codec *codec,
3325 struct snd_kcontrol *kcontrol,
3326 struct snd_ctl_elem_value *ucontrol)
3328 struct alc_spec *spec = codec->spec;
3329 unsigned int pinval, enable, disable;
3331 pinval = snd_hda_codec_get_pin_target(codec, spec->cap_mute_led_nid);
3332 pinval &= ~AC_PINCTL_VREFEN;
3333 enable = pinval | AC_PINCTL_VREF_80;
3334 disable = pinval | AC_PINCTL_VREF_HIZ;
3339 if (ucontrol->value.integer.value[0] ||
3340 ucontrol->value.integer.value[1])
3345 if (spec->cap_mute_led_nid)
3346 snd_hda_set_pin_ctl_cache(codec, spec->cap_mute_led_nid, pinval);
3349 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
3350 const struct hda_fixup *fix, int action)
3352 struct alc_spec *spec = codec->spec;
3353 static const struct hda_verb gpio_init[] = {
3354 { 0x01, AC_VERB_SET_GPIO_MASK, 0x08 },
3355 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x08 },
3359 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3360 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
3361 spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook;
3363 spec->mute_led_polarity = 0;
3364 spec->gpio_mute_led_mask = 0x08;
3365 spec->cap_mute_led_nid = 0x18;
3366 snd_hda_add_verbs(codec, gpio_init);
3367 codec->power_filter = led_power_filter;
3371 static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
3372 const struct hda_fixup *fix, int action)
3374 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to enable headphone amp */
3375 struct alc_spec *spec = codec->spec;
3376 static const struct hda_verb gpio_init[] = {
3377 { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 },
3378 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 },
3382 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3383 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
3384 spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook;
3386 spec->mute_led_polarity = 0;
3387 spec->gpio_mute_led_mask = 0x08;
3388 spec->cap_mute_led_nid = 0x18;
3389 snd_hda_add_verbs(codec, gpio_init);
3390 codec->power_filter = led_power_filter;
3394 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
3395 const struct hda_fixup *fix, int action)
3397 struct alc_spec *spec = codec->spec;
3399 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3400 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3401 spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook;
3402 spec->mute_led_polarity = 0;
3403 spec->mute_led_nid = 0x1a;
3404 spec->cap_mute_led_nid = 0x18;
3405 spec->gen.vmaster_mute_enum = 1;
3406 codec->power_filter = led_power_filter;
3410 static void alc_headset_mode_unplugged(struct hda_codec *codec)
3412 static struct coef_fw coef0255[] = {
3413 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
3414 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
3415 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
3416 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
3417 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
3420 static struct coef_fw coef0233[] = {
3421 WRITE_COEF(0x1b, 0x0c0b),
3422 WRITE_COEF(0x45, 0xc429),
3423 UPDATE_COEF(0x35, 0x4000, 0),
3424 WRITE_COEF(0x06, 0x2104),
3425 WRITE_COEF(0x1a, 0x0001),
3426 WRITE_COEF(0x26, 0x0004),
3427 WRITE_COEF(0x32, 0x42a3),
3430 static struct coef_fw coef0292[] = {
3431 WRITE_COEF(0x76, 0x000e),
3432 WRITE_COEF(0x6c, 0x2400),
3433 WRITE_COEF(0x18, 0x7308),
3434 WRITE_COEF(0x6b, 0xc429),
3437 static struct coef_fw coef0293[] = {
3438 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
3439 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
3440 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
3441 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
3442 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
3443 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
3446 static struct coef_fw coef0668[] = {
3447 WRITE_COEF(0x15, 0x0d40),
3448 WRITE_COEF(0xb7, 0x802b),
3452 switch (codec->vendor_id) {
3454 alc_process_coef_fw(codec, coef0255);
3458 alc_process_coef_fw(codec, coef0233);
3461 alc_process_coef_fw(codec, coef0292);
3464 alc_process_coef_fw(codec, coef0293);
3467 alc_process_coef_fw(codec, coef0668);
3470 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
3474 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
3477 static struct coef_fw coef0255[] = {
3478 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
3479 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
3482 static struct coef_fw coef0233[] = {
3483 UPDATE_COEF(0x35, 0, 1<<14),
3484 WRITE_COEF(0x06, 0x2100),
3485 WRITE_COEF(0x1a, 0x0021),
3486 WRITE_COEF(0x26, 0x008c),
3489 static struct coef_fw coef0292[] = {
3490 WRITE_COEF(0x19, 0xa208),
3491 WRITE_COEF(0x2e, 0xacf0),
3494 static struct coef_fw coef0293[] = {
3495 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
3496 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
3497 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
3500 static struct coef_fw coef0688[] = {
3501 WRITE_COEF(0xb7, 0x802b),
3502 WRITE_COEF(0xb5, 0x1040),
3503 UPDATE_COEF(0xc3, 0, 1<<12),
3507 switch (codec->vendor_id) {
3509 alc_write_coef_idx(codec, 0x45, 0xc489);
3510 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
3511 alc_process_coef_fw(codec, coef0255);
3512 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
3516 alc_write_coef_idx(codec, 0x45, 0xc429);
3517 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
3518 alc_process_coef_fw(codec, coef0233);
3519 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
3522 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
3523 alc_process_coef_fw(codec, coef0292);
3526 /* Set to TRS mode */
3527 alc_write_coef_idx(codec, 0x45, 0xc429);
3528 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
3529 alc_process_coef_fw(codec, coef0293);
3530 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
3533 alc_write_coef_idx(codec, 0x11, 0x0001);
3534 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
3535 alc_process_coef_fw(codec, coef0688);
3536 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
3539 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
3542 static void alc_headset_mode_default(struct hda_codec *codec)
3544 static struct coef_fw coef0255[] = {
3545 WRITE_COEF(0x45, 0xc089),
3546 WRITE_COEF(0x45, 0xc489),
3547 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
3548 WRITE_COEF(0x49, 0x0049),
3551 static struct coef_fw coef0233[] = {
3552 WRITE_COEF(0x06, 0x2100),
3553 WRITE_COEF(0x32, 0x4ea3),
3556 static struct coef_fw coef0292[] = {
3557 WRITE_COEF(0x76, 0x000e),
3558 WRITE_COEF(0x6c, 0x2400),
3559 WRITE_COEF(0x6b, 0xc429),
3560 WRITE_COEF(0x18, 0x7308),
3563 static struct coef_fw coef0293[] = {
3564 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
3565 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
3566 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
3569 static struct coef_fw coef0688[] = {
3570 WRITE_COEF(0x11, 0x0041),
3571 WRITE_COEF(0x15, 0x0d40),
3572 WRITE_COEF(0xb7, 0x802b),
3576 switch (codec->vendor_id) {
3578 alc_process_coef_fw(codec, coef0255);
3582 alc_process_coef_fw(codec, coef0233);
3585 alc_process_coef_fw(codec, coef0292);
3588 alc_process_coef_fw(codec, coef0293);
3591 alc_process_coef_fw(codec, coef0688);
3594 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
3598 static void alc_headset_mode_ctia(struct hda_codec *codec)
3600 static struct coef_fw coef0255[] = {
3601 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
3602 WRITE_COEF(0x1b, 0x0c2b),
3603 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
3606 static struct coef_fw coef0233[] = {
3607 WRITE_COEF(0x45, 0xd429),
3608 WRITE_COEF(0x1b, 0x0c2b),
3609 WRITE_COEF(0x32, 0x4ea3),
3612 static struct coef_fw coef0292[] = {
3613 WRITE_COEF(0x6b, 0xd429),
3614 WRITE_COEF(0x76, 0x0008),
3615 WRITE_COEF(0x18, 0x7388),
3618 static struct coef_fw coef0293[] = {
3619 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
3620 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
3623 static struct coef_fw coef0688[] = {
3624 WRITE_COEF(0x11, 0x0001),
3625 WRITE_COEF(0x15, 0x0d60),
3626 WRITE_COEF(0xc3, 0x0000),
3630 switch (codec->vendor_id) {
3632 alc_process_coef_fw(codec, coef0255);
3636 alc_process_coef_fw(codec, coef0233);
3639 alc_process_coef_fw(codec, coef0292);
3642 alc_process_coef_fw(codec, coef0293);
3645 alc_process_coef_fw(codec, coef0688);
3648 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
3652 static void alc_headset_mode_omtp(struct hda_codec *codec)
3654 static struct coef_fw coef0255[] = {
3655 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
3656 WRITE_COEF(0x1b, 0x0c2b),
3657 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
3660 static struct coef_fw coef0233[] = {
3661 WRITE_COEF(0x45, 0xe429),
3662 WRITE_COEF(0x1b, 0x0c2b),
3663 WRITE_COEF(0x32, 0x4ea3),
3666 static struct coef_fw coef0292[] = {
3667 WRITE_COEF(0x6b, 0xe429),
3668 WRITE_COEF(0x76, 0x0008),
3669 WRITE_COEF(0x18, 0x7388),
3672 static struct coef_fw coef0293[] = {
3673 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
3674 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
3677 static struct coef_fw coef0688[] = {
3678 WRITE_COEF(0x11, 0x0001),
3679 WRITE_COEF(0x15, 0x0d50),
3680 WRITE_COEF(0xc3, 0x0000),
3684 switch (codec->vendor_id) {
3686 alc_process_coef_fw(codec, coef0255);
3690 alc_process_coef_fw(codec, coef0233);
3693 alc_process_coef_fw(codec, coef0292);
3696 alc_process_coef_fw(codec, coef0293);
3699 alc_process_coef_fw(codec, coef0688);
3702 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
3705 static void alc_determine_headset_type(struct hda_codec *codec)
3708 bool is_ctia = false;
3709 struct alc_spec *spec = codec->spec;
3710 static struct coef_fw coef0255[] = {
3711 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
3712 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
3716 static struct coef_fw coef0293[] = {
3717 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
3718 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
3721 static struct coef_fw coef0688[] = {
3722 WRITE_COEF(0x11, 0x0001),
3723 WRITE_COEF(0xb7, 0x802b),
3724 WRITE_COEF(0x15, 0x0d60),
3725 WRITE_COEF(0xc3, 0x0c00),
3729 switch (codec->vendor_id) {
3731 alc_process_coef_fw(codec, coef0255);
3733 val = alc_read_coef_idx(codec, 0x46);
3734 is_ctia = (val & 0x0070) == 0x0070;
3738 alc_write_coef_idx(codec, 0x45, 0xd029);
3740 val = alc_read_coef_idx(codec, 0x46);
3741 is_ctia = (val & 0x0070) == 0x0070;
3744 alc_write_coef_idx(codec, 0x6b, 0xd429);
3746 val = alc_read_coef_idx(codec, 0x6c);
3747 is_ctia = (val & 0x001c) == 0x001c;
3750 alc_process_coef_fw(codec, coef0293);
3752 val = alc_read_coef_idx(codec, 0x46);
3753 is_ctia = (val & 0x0070) == 0x0070;
3756 alc_process_coef_fw(codec, coef0688);
3758 val = alc_read_coef_idx(codec, 0xbe);
3759 is_ctia = (val & 0x1c02) == 0x1c02;
3763 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
3764 is_ctia ? "yes" : "no");
3765 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
3768 static void alc_update_headset_mode(struct hda_codec *codec)
3770 struct alc_spec *spec = codec->spec;
3772 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
3773 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3775 int new_headset_mode;
3777 if (!snd_hda_jack_detect(codec, hp_pin))
3778 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
3779 else if (mux_pin == spec->headset_mic_pin)
3780 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
3781 else if (mux_pin == spec->headphone_mic_pin)
3782 new_headset_mode = ALC_HEADSET_MODE_MIC;
3784 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
3786 if (new_headset_mode == spec->current_headset_mode) {
3787 snd_hda_gen_update_outputs(codec);
3791 switch (new_headset_mode) {
3792 case ALC_HEADSET_MODE_UNPLUGGED:
3793 alc_headset_mode_unplugged(codec);
3794 spec->gen.hp_jack_present = false;
3796 case ALC_HEADSET_MODE_HEADSET:
3797 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
3798 alc_determine_headset_type(codec);
3799 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
3800 alc_headset_mode_ctia(codec);
3801 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
3802 alc_headset_mode_omtp(codec);
3803 spec->gen.hp_jack_present = true;
3805 case ALC_HEADSET_MODE_MIC:
3806 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
3807 spec->gen.hp_jack_present = false;
3809 case ALC_HEADSET_MODE_HEADPHONE:
3810 alc_headset_mode_default(codec);
3811 spec->gen.hp_jack_present = true;
3814 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
3815 snd_hda_set_pin_ctl_cache(codec, hp_pin,
3816 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
3817 if (spec->headphone_mic_pin)
3818 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
3821 spec->current_headset_mode = new_headset_mode;
3823 snd_hda_gen_update_outputs(codec);
3826 static void alc_update_headset_mode_hook(struct hda_codec *codec,
3827 struct snd_kcontrol *kcontrol,
3828 struct snd_ctl_elem_value *ucontrol)
3830 alc_update_headset_mode(codec);
3833 static void alc_update_headset_jack_cb(struct hda_codec *codec,
3834 struct hda_jack_callback *jack)
3836 struct alc_spec *spec = codec->spec;
3837 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
3838 snd_hda_gen_hp_automute(codec, jack);
3841 static void alc_probe_headset_mode(struct hda_codec *codec)
3844 struct alc_spec *spec = codec->spec;
3845 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
3848 for (i = 0; i < cfg->num_inputs; i++) {
3849 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
3850 spec->headset_mic_pin = cfg->inputs[i].pin;
3851 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
3852 spec->headphone_mic_pin = cfg->inputs[i].pin;
3855 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
3856 spec->gen.automute_hook = alc_update_headset_mode;
3857 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
3860 static void alc_fixup_headset_mode(struct hda_codec *codec,
3861 const struct hda_fixup *fix, int action)
3863 struct alc_spec *spec = codec->spec;
3866 case HDA_FIXUP_ACT_PRE_PROBE:
3867 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
3869 case HDA_FIXUP_ACT_PROBE:
3870 alc_probe_headset_mode(codec);
3872 case HDA_FIXUP_ACT_INIT:
3873 spec->current_headset_mode = 0;
3874 alc_update_headset_mode(codec);
3879 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
3880 const struct hda_fixup *fix, int action)
3882 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3883 struct alc_spec *spec = codec->spec;
3884 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3887 alc_fixup_headset_mode(codec, fix, action);
3890 static void alc255_set_default_jack_type(struct hda_codec *codec)
3892 /* Set to iphone type */
3893 static struct coef_fw fw[] = {
3894 WRITE_COEF(0x1b, 0x880b),
3895 WRITE_COEF(0x45, 0xd089),
3896 WRITE_COEF(0x1b, 0x080b),
3897 WRITE_COEF(0x46, 0x0004),
3898 WRITE_COEF(0x1b, 0x0c0b),
3901 alc_process_coef_fw(codec, fw);
3905 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
3906 const struct hda_fixup *fix, int action)
3908 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3909 alc255_set_default_jack_type(codec);
3911 alc_fixup_headset_mode(codec, fix, action);
3914 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
3915 const struct hda_fixup *fix, int action)
3917 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3918 struct alc_spec *spec = codec->spec;
3919 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3920 alc255_set_default_jack_type(codec);
3923 alc_fixup_headset_mode(codec, fix, action);
3926 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
3927 const struct hda_fixup *fix, int action)
3929 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3930 struct alc_spec *spec = codec->spec;
3931 spec->gen.auto_mute_via_amp = 1;
3935 static void alc_no_shutup(struct hda_codec *codec)
3939 static void alc_fixup_no_shutup(struct hda_codec *codec,
3940 const struct hda_fixup *fix, int action)
3942 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3943 struct alc_spec *spec = codec->spec;
3944 spec->shutup = alc_no_shutup;
3948 static void alc_fixup_disable_aamix(struct hda_codec *codec,
3949 const struct hda_fixup *fix, int action)
3951 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3952 struct alc_spec *spec = codec->spec;
3953 /* Disable AA-loopback as it causes white noise */
3954 spec->gen.mixer_nid = 0;
3958 static unsigned int alc_power_filter_xps13(struct hda_codec *codec,
3960 unsigned int power_state)
3962 struct alc_spec *spec = codec->spec;
3964 /* Avoid pop noises when headphones are plugged in */
3965 if (spec->gen.hp_jack_present)
3966 if (nid == codec->afg || nid == 0x02 || nid == 0x15)
3971 static void alc_fixup_dell_xps13(struct hda_codec *codec,
3972 const struct hda_fixup *fix, int action)
3974 if (action == HDA_FIXUP_ACT_PROBE) {
3975 struct alc_spec *spec = codec->spec;
3976 struct hda_input_mux *imux = &spec->gen.input_mux;
3979 spec->shutup = alc_no_shutup;
3980 codec->power_filter = alc_power_filter_xps13;
3982 /* Make the internal mic the default input source. */
3983 for (i = 0; i < imux->num_items; i++) {
3984 if (spec->gen.imux_pins[i] == 0x12) {
3985 spec->gen.cur_mux[0] = i;
3992 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
3993 const struct hda_fixup *fix, int action)
3995 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3996 alc_write_coef_idx(codec, 0xc4, 0x8000);
3997 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
3998 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
4000 alc_fixup_headset_mode(codec, fix, action);
4003 /* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
4004 static int find_ext_mic_pin(struct hda_codec *codec)
4006 struct alc_spec *spec = codec->spec;
4007 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
4009 unsigned int defcfg;
4012 for (i = 0; i < cfg->num_inputs; i++) {
4013 if (cfg->inputs[i].type != AUTO_PIN_MIC)
4015 nid = cfg->inputs[i].pin;
4016 defcfg = snd_hda_codec_get_pincfg(codec, nid);
4017 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
4025 static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
4026 const struct hda_fixup *fix,
4029 struct alc_spec *spec = codec->spec;
4031 if (action == HDA_FIXUP_ACT_PROBE) {
4032 int mic_pin = find_ext_mic_pin(codec);
4033 int hp_pin = spec->gen.autocfg.hp_pins[0];
4035 if (snd_BUG_ON(!mic_pin || !hp_pin))
4037 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
4041 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
4042 const struct hda_fixup *fix,
4045 struct alc_spec *spec = codec->spec;
4046 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
4049 /* The mic boosts on level 2 and 3 are too noisy
4050 on the internal mic input.
4051 Therefore limit the boost to 0 or 1. */
4053 if (action != HDA_FIXUP_ACT_PROBE)
4056 for (i = 0; i < cfg->num_inputs; i++) {
4057 hda_nid_t nid = cfg->inputs[i].pin;
4058 unsigned int defcfg;
4059 if (cfg->inputs[i].type != AUTO_PIN_MIC)
4061 defcfg = snd_hda_codec_get_pincfg(codec, nid);
4062 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
4065 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
4066 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
4067 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
4068 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
4069 (0 << AC_AMPCAP_MUTE_SHIFT));
4073 static void alc283_hp_automute_hook(struct hda_codec *codec,
4074 struct hda_jack_callback *jack)
4076 struct alc_spec *spec = codec->spec;
4080 snd_hda_gen_hp_automute(codec, jack);
4082 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4085 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4089 static void alc283_fixup_chromebook(struct hda_codec *codec,
4090 const struct hda_fixup *fix, int action)
4092 struct alc_spec *spec = codec->spec;
4095 case HDA_FIXUP_ACT_PRE_PROBE:
4096 snd_hda_override_wcaps(codec, 0x03, 0);
4097 /* Disable AA-loopback as it causes white noise */
4098 spec->gen.mixer_nid = 0;
4100 case HDA_FIXUP_ACT_INIT:
4101 /* MIC2-VREF control */
4102 /* Set to manual mode */
4103 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
4104 /* Enable Line1 input control by verb */
4105 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
4110 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
4111 const struct hda_fixup *fix, int action)
4113 struct alc_spec *spec = codec->spec;
4116 case HDA_FIXUP_ACT_PRE_PROBE:
4117 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
4119 case HDA_FIXUP_ACT_INIT:
4120 /* MIC2-VREF control */
4121 /* Set to manual mode */
4122 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
4127 /* mute tablet speaker pin (0x14) via dock plugging in addition */
4128 static void asus_tx300_automute(struct hda_codec *codec)
4130 struct alc_spec *spec = codec->spec;
4131 snd_hda_gen_update_outputs(codec);
4132 if (snd_hda_jack_detect(codec, 0x1b))
4133 spec->gen.mute_bits |= (1ULL << 0x14);
4136 static void alc282_fixup_asus_tx300(struct hda_codec *codec,
4137 const struct hda_fixup *fix, int action)
4139 struct alc_spec *spec = codec->spec;
4140 /* TX300 needs to set up GPIO2 for the speaker amp */
4141 static const struct hda_verb gpio2_verbs[] = {
4142 { 0x01, AC_VERB_SET_GPIO_MASK, 0x04 },
4143 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04 },
4144 { 0x01, AC_VERB_SET_GPIO_DATA, 0x04 },
4147 static const struct hda_pintbl dock_pins[] = {
4148 { 0x1b, 0x21114000 }, /* dock speaker pin */
4151 struct snd_kcontrol *kctl;
4154 case HDA_FIXUP_ACT_PRE_PROBE:
4155 snd_hda_add_verbs(codec, gpio2_verbs);
4156 snd_hda_apply_pincfgs(codec, dock_pins);
4157 spec->gen.auto_mute_via_amp = 1;
4158 spec->gen.automute_hook = asus_tx300_automute;
4159 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4160 snd_hda_gen_hp_automute);
4162 case HDA_FIXUP_ACT_BUILD:
4163 /* this is a bit tricky; give more sane names for the main
4164 * (tablet) speaker and the dock speaker, respectively
4166 kctl = snd_hda_find_mixer_ctl(codec, "Speaker Playback Switch");
4168 strcpy(kctl->id.name, "Dock Speaker Playback Switch");
4169 kctl = snd_hda_find_mixer_ctl(codec, "Bass Speaker Playback Switch");
4171 strcpy(kctl->id.name, "Speaker Playback Switch");
4176 static void alc290_fixup_mono_speakers(struct hda_codec *codec,
4177 const struct hda_fixup *fix, int action)
4179 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4180 /* DAC node 0x03 is giving mono output. We therefore want to
4181 make sure 0x14 (front speaker) and 0x15 (headphones) use the
4182 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
4183 hda_nid_t conn1[2] = { 0x0c };
4184 snd_hda_override_conn_list(codec, 0x14, 1, conn1);
4185 snd_hda_override_conn_list(codec, 0x15, 1, conn1);
4189 /* for hda_fixup_thinkpad_acpi() */
4190 #include "thinkpad_helper.c"
4192 /* for dell wmi mic mute led */
4193 #include "dell_wmi_helper.c"
4196 ALC269_FIXUP_SONY_VAIO,
4197 ALC275_FIXUP_SONY_VAIO_GPIO2,
4198 ALC269_FIXUP_DELL_M101Z,
4199 ALC269_FIXUP_SKU_IGNORE,
4200 ALC269_FIXUP_ASUS_G73JW,
4201 ALC269_FIXUP_LENOVO_EAPD,
4202 ALC275_FIXUP_SONY_HWEQ,
4203 ALC275_FIXUP_SONY_DISABLE_AAMIX,
4205 ALC269_FIXUP_PCM_44K,
4206 ALC269_FIXUP_STEREO_DMIC,
4207 ALC269_FIXUP_HEADSET_MIC,
4208 ALC269_FIXUP_QUANTA_MUTE,
4209 ALC269_FIXUP_LIFEBOOK,
4210 ALC269_FIXUP_LIFEBOOK_EXTMIC,
4213 ALC269VB_FIXUP_AMIC,
4214 ALC269VB_FIXUP_DMIC,
4215 ALC269_FIXUP_HP_MUTE_LED,
4216 ALC269_FIXUP_HP_MUTE_LED_MIC1,
4217 ALC269_FIXUP_HP_MUTE_LED_MIC2,
4218 ALC269_FIXUP_HP_GPIO_LED,
4219 ALC269_FIXUP_HP_GPIO_MIC1_LED,
4220 ALC269_FIXUP_HP_LINE1_MIC1_LED,
4221 ALC269_FIXUP_INV_DMIC,
4222 ALC269_FIXUP_LENOVO_DOCK,
4223 ALC269_FIXUP_NO_SHUTUP,
4224 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
4225 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
4226 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
4227 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
4228 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
4229 ALC269_FIXUP_HEADSET_MODE,
4230 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
4231 ALC269_FIXUP_ASUS_X101_FUNC,
4232 ALC269_FIXUP_ASUS_X101_VERB,
4233 ALC269_FIXUP_ASUS_X101,
4234 ALC271_FIXUP_AMIC_MIC2,
4235 ALC271_FIXUP_HP_GATE_MIC_JACK,
4236 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
4237 ALC269_FIXUP_ACER_AC700,
4238 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
4239 ALC269VB_FIXUP_ASUS_ZENBOOK,
4240 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
4241 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
4242 ALC269VB_FIXUP_ORDISSIMO_EVE2,
4243 ALC283_FIXUP_CHROME_BOOK,
4244 ALC283_FIXUP_SENSE_COMBO_JACK,
4245 ALC282_FIXUP_ASUS_TX300,
4246 ALC283_FIXUP_INT_MIC,
4247 ALC290_FIXUP_MONO_SPEAKERS,
4248 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
4249 ALC290_FIXUP_SUBWOOFER,
4250 ALC290_FIXUP_SUBWOOFER_HSJACK,
4251 ALC269_FIXUP_THINKPAD_ACPI,
4252 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
4253 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
4254 ALC255_FIXUP_HEADSET_MODE,
4255 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
4256 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
4257 ALC292_FIXUP_TPT440_DOCK,
4258 ALC283_FIXUP_BXBT2807_MIC,
4259 ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED,
4260 ALC282_FIXUP_ASPIRE_V5_PINS,
4261 ALC280_FIXUP_HP_GPIO4,
4262 ALC286_FIXUP_HP_GPIO_LED,
4265 static const struct hda_fixup alc269_fixups[] = {
4266 [ALC269_FIXUP_SONY_VAIO] = {
4267 .type = HDA_FIXUP_PINCTLS,
4268 .v.pins = (const struct hda_pintbl[]) {
4269 {0x19, PIN_VREFGRD},
4273 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
4274 .type = HDA_FIXUP_VERBS,
4275 .v.verbs = (const struct hda_verb[]) {
4276 {0x01, AC_VERB_SET_GPIO_MASK, 0x04},
4277 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04},
4278 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4282 .chain_id = ALC269_FIXUP_SONY_VAIO
4284 [ALC269_FIXUP_DELL_M101Z] = {
4285 .type = HDA_FIXUP_VERBS,
4286 .v.verbs = (const struct hda_verb[]) {
4287 /* Enables internal speaker */
4288 {0x20, AC_VERB_SET_COEF_INDEX, 13},
4289 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
4293 [ALC269_FIXUP_SKU_IGNORE] = {
4294 .type = HDA_FIXUP_FUNC,
4295 .v.func = alc_fixup_sku_ignore,
4297 [ALC269_FIXUP_ASUS_G73JW] = {
4298 .type = HDA_FIXUP_PINS,
4299 .v.pins = (const struct hda_pintbl[]) {
4300 { 0x17, 0x99130111 }, /* subwoofer */
4304 [ALC269_FIXUP_LENOVO_EAPD] = {
4305 .type = HDA_FIXUP_VERBS,
4306 .v.verbs = (const struct hda_verb[]) {
4307 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
4311 [ALC275_FIXUP_SONY_HWEQ] = {
4312 .type = HDA_FIXUP_FUNC,
4313 .v.func = alc269_fixup_hweq,
4315 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
4317 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
4318 .type = HDA_FIXUP_FUNC,
4319 .v.func = alc_fixup_disable_aamix,
4321 .chain_id = ALC269_FIXUP_SONY_VAIO
4323 [ALC271_FIXUP_DMIC] = {
4324 .type = HDA_FIXUP_FUNC,
4325 .v.func = alc271_fixup_dmic,
4327 [ALC269_FIXUP_PCM_44K] = {
4328 .type = HDA_FIXUP_FUNC,
4329 .v.func = alc269_fixup_pcm_44k,
4331 .chain_id = ALC269_FIXUP_QUANTA_MUTE
4333 [ALC269_FIXUP_STEREO_DMIC] = {
4334 .type = HDA_FIXUP_FUNC,
4335 .v.func = alc269_fixup_stereo_dmic,
4337 [ALC269_FIXUP_HEADSET_MIC] = {
4338 .type = HDA_FIXUP_FUNC,
4339 .v.func = alc269_fixup_headset_mic,
4341 [ALC269_FIXUP_QUANTA_MUTE] = {
4342 .type = HDA_FIXUP_FUNC,
4343 .v.func = alc269_fixup_quanta_mute,
4345 [ALC269_FIXUP_LIFEBOOK] = {
4346 .type = HDA_FIXUP_PINS,
4347 .v.pins = (const struct hda_pintbl[]) {
4348 { 0x1a, 0x2101103f }, /* dock line-out */
4349 { 0x1b, 0x23a11040 }, /* dock mic-in */
4353 .chain_id = ALC269_FIXUP_QUANTA_MUTE
4355 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
4356 .type = HDA_FIXUP_PINS,
4357 .v.pins = (const struct hda_pintbl[]) {
4358 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
4362 [ALC269_FIXUP_AMIC] = {
4363 .type = HDA_FIXUP_PINS,
4364 .v.pins = (const struct hda_pintbl[]) {
4365 { 0x14, 0x99130110 }, /* speaker */
4366 { 0x15, 0x0121401f }, /* HP out */
4367 { 0x18, 0x01a19c20 }, /* mic */
4368 { 0x19, 0x99a3092f }, /* int-mic */
4372 [ALC269_FIXUP_DMIC] = {
4373 .type = HDA_FIXUP_PINS,
4374 .v.pins = (const struct hda_pintbl[]) {
4375 { 0x12, 0x99a3092f }, /* int-mic */
4376 { 0x14, 0x99130110 }, /* speaker */
4377 { 0x15, 0x0121401f }, /* HP out */
4378 { 0x18, 0x01a19c20 }, /* mic */
4382 [ALC269VB_FIXUP_AMIC] = {
4383 .type = HDA_FIXUP_PINS,
4384 .v.pins = (const struct hda_pintbl[]) {
4385 { 0x14, 0x99130110 }, /* speaker */
4386 { 0x18, 0x01a19c20 }, /* mic */
4387 { 0x19, 0x99a3092f }, /* int-mic */
4388 { 0x21, 0x0121401f }, /* HP out */
4392 [ALC269VB_FIXUP_DMIC] = {
4393 .type = HDA_FIXUP_PINS,
4394 .v.pins = (const struct hda_pintbl[]) {
4395 { 0x12, 0x99a3092f }, /* int-mic */
4396 { 0x14, 0x99130110 }, /* speaker */
4397 { 0x18, 0x01a19c20 }, /* mic */
4398 { 0x21, 0x0121401f }, /* HP out */
4402 [ALC269_FIXUP_HP_MUTE_LED] = {
4403 .type = HDA_FIXUP_FUNC,
4404 .v.func = alc269_fixup_hp_mute_led,
4406 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
4407 .type = HDA_FIXUP_FUNC,
4408 .v.func = alc269_fixup_hp_mute_led_mic1,
4410 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
4411 .type = HDA_FIXUP_FUNC,
4412 .v.func = alc269_fixup_hp_mute_led_mic2,
4414 [ALC269_FIXUP_HP_GPIO_LED] = {
4415 .type = HDA_FIXUP_FUNC,
4416 .v.func = alc269_fixup_hp_gpio_led,
4418 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
4419 .type = HDA_FIXUP_FUNC,
4420 .v.func = alc269_fixup_hp_gpio_mic1_led,
4422 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
4423 .type = HDA_FIXUP_FUNC,
4424 .v.func = alc269_fixup_hp_line1_mic1_led,
4426 [ALC269_FIXUP_INV_DMIC] = {
4427 .type = HDA_FIXUP_FUNC,
4428 .v.func = alc_fixup_inv_dmic,
4430 [ALC269_FIXUP_NO_SHUTUP] = {
4431 .type = HDA_FIXUP_FUNC,
4432 .v.func = alc_fixup_no_shutup,
4434 [ALC269_FIXUP_LENOVO_DOCK] = {
4435 .type = HDA_FIXUP_PINS,
4436 .v.pins = (const struct hda_pintbl[]) {
4437 { 0x19, 0x23a11040 }, /* dock mic */
4438 { 0x1b, 0x2121103f }, /* dock headphone */
4442 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
4444 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
4445 .type = HDA_FIXUP_FUNC,
4446 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
4448 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
4450 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
4451 .type = HDA_FIXUP_PINS,
4452 .v.pins = (const struct hda_pintbl[]) {
4453 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4454 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
4458 .chain_id = ALC269_FIXUP_HEADSET_MODE
4460 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
4461 .type = HDA_FIXUP_PINS,
4462 .v.pins = (const struct hda_pintbl[]) {
4463 { 0x16, 0x21014020 }, /* dock line out */
4464 { 0x19, 0x21a19030 }, /* dock mic */
4465 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4469 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
4471 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
4472 .type = HDA_FIXUP_PINS,
4473 .v.pins = (const struct hda_pintbl[]) {
4474 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4478 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
4480 [ALC269_FIXUP_HEADSET_MODE] = {
4481 .type = HDA_FIXUP_FUNC,
4482 .v.func = alc_fixup_headset_mode,
4484 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
4485 .type = HDA_FIXUP_FUNC,
4486 .v.func = alc_fixup_headset_mode_no_hp_mic,
4488 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
4489 .type = HDA_FIXUP_PINS,
4490 .v.pins = (const struct hda_pintbl[]) {
4491 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4495 .chain_id = ALC269_FIXUP_HEADSET_MIC
4497 [ALC269_FIXUP_ASUS_X101_FUNC] = {
4498 .type = HDA_FIXUP_FUNC,
4499 .v.func = alc269_fixup_x101_headset_mic,
4501 [ALC269_FIXUP_ASUS_X101_VERB] = {
4502 .type = HDA_FIXUP_VERBS,
4503 .v.verbs = (const struct hda_verb[]) {
4504 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4505 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
4506 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
4510 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
4512 [ALC269_FIXUP_ASUS_X101] = {
4513 .type = HDA_FIXUP_PINS,
4514 .v.pins = (const struct hda_pintbl[]) {
4515 { 0x18, 0x04a1182c }, /* Headset mic */
4519 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
4521 [ALC271_FIXUP_AMIC_MIC2] = {
4522 .type = HDA_FIXUP_PINS,
4523 .v.pins = (const struct hda_pintbl[]) {
4524 { 0x14, 0x99130110 }, /* speaker */
4525 { 0x19, 0x01a19c20 }, /* mic */
4526 { 0x1b, 0x99a7012f }, /* int-mic */
4527 { 0x21, 0x0121401f }, /* HP out */
4531 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
4532 .type = HDA_FIXUP_FUNC,
4533 .v.func = alc271_hp_gate_mic_jack,
4535 .chain_id = ALC271_FIXUP_AMIC_MIC2,
4537 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
4538 .type = HDA_FIXUP_FUNC,
4539 .v.func = alc269_fixup_limit_int_mic_boost,
4541 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
4543 [ALC269_FIXUP_ACER_AC700] = {
4544 .type = HDA_FIXUP_PINS,
4545 .v.pins = (const struct hda_pintbl[]) {
4546 { 0x12, 0x99a3092f }, /* int-mic */
4547 { 0x14, 0x99130110 }, /* speaker */
4548 { 0x18, 0x03a11c20 }, /* mic */
4549 { 0x1e, 0x0346101e }, /* SPDIF1 */
4550 { 0x21, 0x0321101f }, /* HP out */
4554 .chain_id = ALC271_FIXUP_DMIC,
4556 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
4557 .type = HDA_FIXUP_FUNC,
4558 .v.func = alc269_fixup_limit_int_mic_boost,
4560 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
4562 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
4563 .type = HDA_FIXUP_FUNC,
4564 .v.func = alc269_fixup_limit_int_mic_boost,
4566 .chain_id = ALC269VB_FIXUP_DMIC,
4568 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
4569 .type = HDA_FIXUP_VERBS,
4570 .v.verbs = (const struct hda_verb[]) {
4571 /* class-D output amp +5dB */
4572 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
4573 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
4577 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
4579 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
4580 .type = HDA_FIXUP_FUNC,
4581 .v.func = alc269_fixup_limit_int_mic_boost,
4583 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
4585 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
4586 .type = HDA_FIXUP_PINS,
4587 .v.pins = (const struct hda_pintbl[]) {
4588 { 0x12, 0x99a3092f }, /* int-mic */
4589 { 0x18, 0x03a11d20 }, /* mic */
4590 { 0x19, 0x411111f0 }, /* Unused bogus pin */
4594 [ALC283_FIXUP_CHROME_BOOK] = {
4595 .type = HDA_FIXUP_FUNC,
4596 .v.func = alc283_fixup_chromebook,
4598 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
4599 .type = HDA_FIXUP_FUNC,
4600 .v.func = alc283_fixup_sense_combo_jack,
4602 .chain_id = ALC283_FIXUP_CHROME_BOOK,
4604 [ALC282_FIXUP_ASUS_TX300] = {
4605 .type = HDA_FIXUP_FUNC,
4606 .v.func = alc282_fixup_asus_tx300,
4608 [ALC283_FIXUP_INT_MIC] = {
4609 .type = HDA_FIXUP_VERBS,
4610 .v.verbs = (const struct hda_verb[]) {
4611 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
4612 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
4616 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
4618 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
4619 .type = HDA_FIXUP_PINS,
4620 .v.pins = (const struct hda_pintbl[]) {
4621 { 0x17, 0x90170112 }, /* subwoofer */
4625 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
4627 [ALC290_FIXUP_SUBWOOFER] = {
4628 .type = HDA_FIXUP_PINS,
4629 .v.pins = (const struct hda_pintbl[]) {
4630 { 0x17, 0x90170112 }, /* subwoofer */
4634 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
4636 [ALC290_FIXUP_MONO_SPEAKERS] = {
4637 .type = HDA_FIXUP_FUNC,
4638 .v.func = alc290_fixup_mono_speakers,
4640 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
4641 .type = HDA_FIXUP_FUNC,
4642 .v.func = alc290_fixup_mono_speakers,
4644 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
4646 [ALC269_FIXUP_THINKPAD_ACPI] = {
4647 .type = HDA_FIXUP_FUNC,
4648 .v.func = hda_fixup_thinkpad_acpi,
4650 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
4651 .type = HDA_FIXUP_PINS,
4652 .v.pins = (const struct hda_pintbl[]) {
4653 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4654 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
4658 .chain_id = ALC255_FIXUP_HEADSET_MODE
4660 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
4661 .type = HDA_FIXUP_PINS,
4662 .v.pins = (const struct hda_pintbl[]) {
4663 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4667 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
4669 [ALC255_FIXUP_HEADSET_MODE] = {
4670 .type = HDA_FIXUP_FUNC,
4671 .v.func = alc_fixup_headset_mode_alc255,
4673 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
4674 .type = HDA_FIXUP_FUNC,
4675 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
4677 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
4678 .type = HDA_FIXUP_PINS,
4679 .v.pins = (const struct hda_pintbl[]) {
4680 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
4681 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4685 .chain_id = ALC269_FIXUP_HEADSET_MODE
4687 [ALC292_FIXUP_TPT440_DOCK] = {
4688 .type = HDA_FIXUP_PINS,
4689 .v.pins = (const struct hda_pintbl[]) {
4690 { 0x16, 0x21211010 }, /* dock headphone */
4691 { 0x19, 0x21a11010 }, /* dock mic */
4695 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
4697 [ALC283_FIXUP_BXBT2807_MIC] = {
4698 .type = HDA_FIXUP_PINS,
4699 .v.pins = (const struct hda_pintbl[]) {
4700 { 0x19, 0x04a110f0 },
4704 [ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED] = {
4705 .type = HDA_FIXUP_FUNC,
4706 .v.func = alc_fixup_dell_wmi,
4707 .chained_before = true,
4708 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
4710 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
4711 .type = HDA_FIXUP_PINS,
4712 .v.pins = (const struct hda_pintbl[]) {
4713 { 0x12, 0x90a60130 },
4714 { 0x14, 0x90170110 },
4715 { 0x17, 0x40000008 },
4716 { 0x18, 0x411111f0 },
4717 { 0x19, 0x411111f0 },
4718 { 0x1a, 0x411111f0 },
4719 { 0x1b, 0x411111f0 },
4720 { 0x1d, 0x40f89b2d },
4721 { 0x1e, 0x411111f0 },
4722 { 0x21, 0x0321101f },
4726 [ALC280_FIXUP_HP_GPIO4] = {
4727 .type = HDA_FIXUP_FUNC,
4728 .v.func = alc280_fixup_hp_gpio4,
4730 [ALC286_FIXUP_HP_GPIO_LED] = {
4731 .type = HDA_FIXUP_FUNC,
4732 .v.func = alc286_fixup_hp_gpio_led,
4736 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
4737 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
4738 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
4739 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
4740 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
4741 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
4742 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
4743 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
4744 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
4745 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
4746 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
4747 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4748 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4749 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4750 SND_PCI_QUIRK(0x1028, 0x0610, "Dell", ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED),
4751 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
4752 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
4753 SND_PCI_QUIRK(0x1028, 0x061f, "Dell", ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED),
4754 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
4755 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
4756 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
4757 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
4758 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
4759 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
4760 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
4761 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
4763 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4764 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4765 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4766 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4767 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4768 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4769 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4770 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4771 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4772 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4773 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4774 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
4775 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4776 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4777 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4778 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4779 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4780 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4781 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4783 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4784 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4785 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4786 SND_PCI_QUIRK(0x103c, 0x2246, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4787 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4788 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4789 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4790 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4791 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4792 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4793 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4794 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4795 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4796 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4797 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4798 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4799 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4800 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4801 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4802 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4803 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4804 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4805 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4806 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4807 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4808 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4809 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4810 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4811 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4812 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4813 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
4814 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4815 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4816 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
4817 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
4818 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
4819 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
4820 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
4821 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4822 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
4823 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
4824 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
4825 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
4826 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
4827 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
4828 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
4829 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
4830 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
4831 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
4832 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
4833 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
4834 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
4835 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
4836 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_BXBT2807_MIC),
4837 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
4838 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
4839 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
4840 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
4841 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
4842 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK),
4843 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
4844 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
4845 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
4846 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
4847 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
4848 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440_DOCK),
4849 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
4850 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
4851 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
4852 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
4853 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4854 SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP),
4855 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4856 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
4857 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
4858 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4859 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4860 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
4861 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
4862 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
4865 /* Below is a quirk table taken from the old code.
4866 * Basically the device should work as is without the fixup table.
4867 * If BIOS doesn't give a proper info, enable the corresponding
4870 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
4872 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
4873 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
4874 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
4875 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
4876 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
4877 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
4878 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
4879 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
4880 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
4881 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
4882 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
4883 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
4884 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
4885 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
4886 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
4887 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
4888 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
4889 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
4890 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
4891 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
4892 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
4893 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
4894 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
4895 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
4896 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
4897 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
4898 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
4899 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
4900 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
4901 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
4902 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
4903 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
4904 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
4905 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
4906 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
4907 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
4908 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
4909 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
4910 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
4915 static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
4916 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
4917 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
4918 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
4919 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
4923 static const struct hda_model_fixup alc269_fixup_models[] = {
4924 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
4925 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
4926 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
4927 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
4928 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
4929 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
4930 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
4931 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
4932 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
4933 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
4934 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
4935 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
4936 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
4940 #define ALC255_STANDARD_PINS \
4941 {0x18, 0x411111f0}, \
4942 {0x19, 0x411111f0}, \
4943 {0x1a, 0x411111f0}, \
4944 {0x1b, 0x411111f0}, \
4947 #define ALC282_STANDARD_PINS \
4948 {0x14, 0x90170110}, \
4949 {0x18, 0x411111f0}, \
4950 {0x1a, 0x411111f0}, \
4951 {0x1b, 0x411111f0}, \
4954 #define ALC290_STANDARD_PINS \
4955 {0x12, 0x99a30130}, \
4956 {0x13, 0x40000000}, \
4957 {0x16, 0x411111f0}, \
4958 {0x17, 0x411111f0}, \
4959 {0x19, 0x411111f0}, \
4960 {0x1b, 0x411111f0}, \
4963 #define ALC292_STANDARD_PINS \
4964 {0x14, 0x90170110}, \
4965 {0x15, 0x0221401f}, \
4966 {0x1a, 0x411111f0}, \
4967 {0x1b, 0x411111f0}, \
4968 {0x1d, 0x40700001}, \
4971 static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
4972 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
4973 ALC255_STANDARD_PINS,
4978 {0x21, 0x02211020}),
4979 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
4980 ALC255_STANDARD_PINS,
4985 {0x21, 0x02211020}),
4986 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
4987 ALC255_STANDARD_PINS,
4992 {0x21, 0x02211030}),
4993 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5003 {0x21, 0x0321102f}),
5004 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5005 ALC255_STANDARD_PINS,
5010 {0x21, 0x02211040}),
5011 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5012 ALC255_STANDARD_PINS,
5017 {0x21, 0x02211050}),
5018 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5019 ALC255_STANDARD_PINS,
5024 {0x21, 0x02211030}),
5025 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5026 ALC255_STANDARD_PINS,
5031 {0x21, 0x02211040}),
5032 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
5044 {0x1e, 0x411111f0}),
5045 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
5057 {0x1e, 0x411111f0}),
5058 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
5059 ALC282_STANDARD_PINS,
5064 {0x21, 0x0321101f}),
5065 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
5066 ALC282_STANDARD_PINS,
5071 {0x21, 0x03211040}),
5072 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
5073 ALC282_STANDARD_PINS,
5078 {0x21, 0x03211020}),
5079 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
5080 ALC282_STANDARD_PINS,
5085 {0x21, 0x03211020}),
5086 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
5087 ALC282_STANDARD_PINS,
5092 {0x21, 0x0421101f}),
5093 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
5094 ALC282_STANDARD_PINS,
5099 {0x21, 0x04211020}),
5100 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
5101 ALC282_STANDARD_PINS,
5106 {0x21, 0x04211020}),
5107 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
5108 ALC282_STANDARD_PINS,
5113 {0x21, 0x0321101f}),
5114 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
5124 {0x21, 0x02211030}),
5125 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
5126 ALC282_STANDARD_PINS,
5131 {0x21, 0x0321101f}),
5132 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
5133 ALC290_STANDARD_PINS,
5138 {0x1d, 0x4075812d}),
5139 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
5140 ALC290_STANDARD_PINS,
5145 {0x1d, 0x4075812d}),
5146 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
5147 ALC290_STANDARD_PINS,
5152 {0x1d, 0x4075812d}),
5153 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
5154 ALC290_STANDARD_PINS,
5159 {0x1d, 0x4076a12d}),
5160 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
5161 ALC290_STANDARD_PINS,
5166 {0x1d, 0x4076a12d}),
5167 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
5168 ALC290_STANDARD_PINS,
5173 {0x1d, 0x4076a12d}),
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(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
5182 ALC292_STANDARD_PINS,
5187 {0x19, 0x01a19030}),
5188 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
5189 ALC292_STANDARD_PINS,
5194 {0x19, 0x01a1903e}),
5195 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
5196 ALC292_STANDARD_PINS,
5201 {0x19, 0x411111f0}),
5202 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
5203 ALC292_STANDARD_PINS,
5208 {0x19, 0x21a19030}),
5209 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
5210 ALC292_STANDARD_PINS,
5215 {0x19, 0x411111f0}),
5219 static void alc269_fill_coef(struct hda_codec *codec)
5221 struct alc_spec *spec = codec->spec;
5224 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
5227 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
5228 alc_write_coef_idx(codec, 0xf, 0x960b);
5229 alc_write_coef_idx(codec, 0xe, 0x8817);
5232 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
5233 alc_write_coef_idx(codec, 0xf, 0x960b);
5234 alc_write_coef_idx(codec, 0xe, 0x8814);
5237 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
5238 /* Power up output pin */
5239 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
5242 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
5243 val = alc_read_coef_idx(codec, 0xd);
5244 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
5245 /* Capless ramp up clock control */
5246 alc_write_coef_idx(codec, 0xd, val | (1<<10));
5248 val = alc_read_coef_idx(codec, 0x17);
5249 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
5250 /* Class D power on reset */
5251 alc_write_coef_idx(codec, 0x17, val | (1<<7));
5256 alc_update_coef_idx(codec, 0xd, 0, 1<<14);
5259 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
5264 static int patch_alc269(struct hda_codec *codec)
5266 struct alc_spec *spec;
5269 err = alc_alloc_spec(codec, 0x0b);
5274 spec->gen.shared_mic_vref_pin = 0x18;
5276 snd_hda_pick_fixup(codec, alc269_fixup_models,
5277 alc269_fixup_tbl, alc269_fixups);
5278 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups);
5279 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
5281 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
5283 alc_auto_parse_customize_define(codec);
5285 if (has_cdefine_beep(codec))
5286 spec->gen.beep_nid = 0x01;
5288 switch (codec->vendor_id) {
5290 spec->codec_variant = ALC269_TYPE_ALC269VA;
5291 switch (alc_get_coef0(codec) & 0x00f0) {
5293 if (codec->bus->pci &&
5294 codec->bus->pci->subsystem_vendor == 0x1025 &&
5295 spec->cdefine.platform_type == 1)
5296 err = alc_codec_rename(codec, "ALC271X");
5297 spec->codec_variant = ALC269_TYPE_ALC269VB;
5300 if (codec->bus->pci &&
5301 codec->bus->pci->subsystem_vendor == 0x17aa &&
5302 codec->bus->pci->subsystem_device == 0x21f3)
5303 err = alc_codec_rename(codec, "ALC3202");
5304 spec->codec_variant = ALC269_TYPE_ALC269VC;
5307 spec->codec_variant = ALC269_TYPE_ALC269VD;
5310 alc_fix_pll_init(codec, 0x20, 0x04, 15);
5314 spec->init_hook = alc269_fill_coef;
5315 alc269_fill_coef(codec);
5320 spec->codec_variant = ALC269_TYPE_ALC280;
5323 spec->codec_variant = ALC269_TYPE_ALC282;
5324 spec->shutup = alc282_shutup;
5325 spec->init_hook = alc282_init;
5329 spec->codec_variant = ALC269_TYPE_ALC283;
5330 spec->shutup = alc283_shutup;
5331 spec->init_hook = alc283_init;
5335 spec->codec_variant = ALC269_TYPE_ALC284;
5339 spec->codec_variant = ALC269_TYPE_ALC285;
5343 spec->codec_variant = ALC269_TYPE_ALC286;
5344 spec->shutup = alc286_shutup;
5347 spec->codec_variant = ALC269_TYPE_ALC255;
5351 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
5352 spec->has_alc5505_dsp = 1;
5353 spec->init_hook = alc5505_dsp_init;
5356 /* automatic parse from the BIOS config */
5357 err = alc269_parse_auto_config(codec);
5361 if (!spec->gen.no_analog && spec->gen.beep_nid)
5362 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
5364 codec->patch_ops = alc_patch_ops;
5366 codec->patch_ops.suspend = alc269_suspend;
5367 codec->patch_ops.resume = alc269_resume;
5370 spec->shutup = alc269_shutup;
5372 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
5385 static int alc861_parse_auto_config(struct hda_codec *codec)
5387 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
5388 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
5389 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
5392 /* Pin config fixes */
5394 ALC861_FIXUP_FSC_AMILO_PI1505,
5395 ALC861_FIXUP_AMP_VREF_0F,
5396 ALC861_FIXUP_NO_JACK_DETECT,
5397 ALC861_FIXUP_ASUS_A6RP,
5398 ALC660_FIXUP_ASUS_W7J,
5401 /* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
5402 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
5403 const struct hda_fixup *fix, int action)
5405 struct alc_spec *spec = codec->spec;
5408 if (action != HDA_FIXUP_ACT_INIT)
5410 val = snd_hda_codec_get_pin_target(codec, 0x0f);
5411 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
5412 val |= AC_PINCTL_IN_EN;
5413 val |= AC_PINCTL_VREF_50;
5414 snd_hda_set_pin_ctl(codec, 0x0f, val);
5415 spec->gen.keep_vref_in_automute = 1;
5418 /* suppress the jack-detection */
5419 static void alc_fixup_no_jack_detect(struct hda_codec *codec,
5420 const struct hda_fixup *fix, int action)
5422 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5423 codec->no_jack_detect = 1;
5426 static const struct hda_fixup alc861_fixups[] = {
5427 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
5428 .type = HDA_FIXUP_PINS,
5429 .v.pins = (const struct hda_pintbl[]) {
5430 { 0x0b, 0x0221101f }, /* HP */
5431 { 0x0f, 0x90170310 }, /* speaker */
5435 [ALC861_FIXUP_AMP_VREF_0F] = {
5436 .type = HDA_FIXUP_FUNC,
5437 .v.func = alc861_fixup_asus_amp_vref_0f,
5439 [ALC861_FIXUP_NO_JACK_DETECT] = {
5440 .type = HDA_FIXUP_FUNC,
5441 .v.func = alc_fixup_no_jack_detect,
5443 [ALC861_FIXUP_ASUS_A6RP] = {
5444 .type = HDA_FIXUP_FUNC,
5445 .v.func = alc861_fixup_asus_amp_vref_0f,
5447 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
5449 [ALC660_FIXUP_ASUS_W7J] = {
5450 .type = HDA_FIXUP_VERBS,
5451 .v.verbs = (const struct hda_verb[]) {
5452 /* ASUS W7J needs a magic pin setup on unused NID 0x10
5453 * for enabling outputs
5455 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5461 static const struct snd_pci_quirk alc861_fixup_tbl[] = {
5462 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
5463 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
5464 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
5465 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
5466 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
5467 SND_PCI_QUIRK(0x1584, 0x2b01, "Haier W18", ALC861_FIXUP_AMP_VREF_0F),
5468 SND_PCI_QUIRK(0x1584, 0x0000, "Uniwill ECS M31EI", ALC861_FIXUP_AMP_VREF_0F),
5469 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
5475 static int patch_alc861(struct hda_codec *codec)
5477 struct alc_spec *spec;
5480 err = alc_alloc_spec(codec, 0x15);
5485 spec->gen.beep_nid = 0x23;
5487 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
5488 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
5490 /* automatic parse from the BIOS config */
5491 err = alc861_parse_auto_config(codec);
5495 if (!spec->gen.no_analog)
5496 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
5498 codec->patch_ops = alc_patch_ops;
5500 spec->power_hook = alc_power_eapd;
5503 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
5517 * In addition, an independent DAC
5519 static int alc861vd_parse_auto_config(struct hda_codec *codec)
5521 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
5522 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
5523 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
5527 ALC660VD_FIX_ASUS_GPIO1,
5528 ALC861VD_FIX_DALLAS,
5531 /* exclude VREF80 */
5532 static void alc861vd_fixup_dallas(struct hda_codec *codec,
5533 const struct hda_fixup *fix, int action)
5535 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5536 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
5537 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
5541 static const struct hda_fixup alc861vd_fixups[] = {
5542 [ALC660VD_FIX_ASUS_GPIO1] = {
5543 .type = HDA_FIXUP_VERBS,
5544 .v.verbs = (const struct hda_verb[]) {
5546 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
5547 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5548 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5552 [ALC861VD_FIX_DALLAS] = {
5553 .type = HDA_FIXUP_FUNC,
5554 .v.func = alc861vd_fixup_dallas,
5558 static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
5559 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
5560 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
5561 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
5567 static int patch_alc861vd(struct hda_codec *codec)
5569 struct alc_spec *spec;
5572 err = alc_alloc_spec(codec, 0x0b);
5577 spec->gen.beep_nid = 0x23;
5579 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
5580 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
5582 /* automatic parse from the BIOS config */
5583 err = alc861vd_parse_auto_config(codec);
5587 if (!spec->gen.no_analog)
5588 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5590 codec->patch_ops = alc_patch_ops;
5592 spec->shutup = alc_eapd_shutup;
5594 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
5606 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
5607 * configuration. Each pin widget can choose any input DACs and a mixer.
5608 * Each ADC is connected from a mixer of all inputs. This makes possible
5609 * 6-channel independent captures.
5611 * In addition, an independent DAC for the multi-playback (not used in this
5616 * BIOS auto configuration
5619 static int alc662_parse_auto_config(struct hda_codec *codec)
5621 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
5622 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
5623 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
5624 const hda_nid_t *ssids;
5626 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
5627 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670 ||
5628 codec->vendor_id == 0x10ec0671)
5629 ssids = alc663_ssids;
5631 ssids = alc662_ssids;
5632 return alc_parse_auto_config(codec, alc662_ignore, ssids);
5635 static void alc272_fixup_mario(struct hda_codec *codec,
5636 const struct hda_fixup *fix, int action)
5638 if (action != HDA_FIXUP_ACT_PRE_PROBE)
5640 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
5641 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
5642 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
5643 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
5644 (0 << AC_AMPCAP_MUTE_SHIFT)))
5645 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
5648 static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
5650 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
5652 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
5653 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
5657 /* override the 2.1 chmap */
5658 static void alc_fixup_bass_chmap(struct hda_codec *codec,
5659 const struct hda_fixup *fix, int action)
5661 if (action == HDA_FIXUP_ACT_BUILD) {
5662 struct alc_spec *spec = codec->spec;
5663 spec->gen.pcm_rec[0].stream[0].chmap = asus_pcm_2_1_chmaps;
5667 /* avoid D3 for keeping GPIO up */
5668 static unsigned int gpio_led_power_filter(struct hda_codec *codec,
5670 unsigned int power_state)
5672 struct alc_spec *spec = codec->spec;
5673 if (nid == codec->afg && power_state == AC_PWRST_D3 && spec->gpio_led)
5678 static void alc662_fixup_led_gpio1(struct hda_codec *codec,
5679 const struct hda_fixup *fix, int action)
5681 struct alc_spec *spec = codec->spec;
5682 static const struct hda_verb gpio_init[] = {
5683 { 0x01, AC_VERB_SET_GPIO_MASK, 0x01 },
5684 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01 },
5688 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5689 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
5691 spec->mute_led_polarity = 1;
5692 spec->gpio_mute_led_mask = 0x01;
5693 snd_hda_add_verbs(codec, gpio_init);
5694 codec->power_filter = gpio_led_power_filter;
5699 ALC662_FIXUP_ASPIRE,
5700 ALC662_FIXUP_LED_GPIO1,
5701 ALC662_FIXUP_IDEAPAD,
5703 ALC662_FIXUP_CZC_P10T,
5704 ALC662_FIXUP_SKU_IGNORE,
5705 ALC662_FIXUP_HP_RP5800,
5706 ALC662_FIXUP_ASUS_MODE1,
5707 ALC662_FIXUP_ASUS_MODE2,
5708 ALC662_FIXUP_ASUS_MODE3,
5709 ALC662_FIXUP_ASUS_MODE4,
5710 ALC662_FIXUP_ASUS_MODE5,
5711 ALC662_FIXUP_ASUS_MODE6,
5712 ALC662_FIXUP_ASUS_MODE7,
5713 ALC662_FIXUP_ASUS_MODE8,
5714 ALC662_FIXUP_NO_JACK_DETECT,
5715 ALC662_FIXUP_ZOTAC_Z68,
5716 ALC662_FIXUP_INV_DMIC,
5717 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
5718 ALC668_FIXUP_HEADSET_MODE,
5719 ALC662_FIXUP_BASS_MODE4_CHMAP,
5720 ALC662_FIXUP_BASS_16,
5721 ALC662_FIXUP_BASS_1A,
5722 ALC662_FIXUP_BASS_CHMAP,
5723 ALC668_FIXUP_AUTO_MUTE,
5724 ALC668_FIXUP_DELL_DISABLE_AAMIX,
5725 ALC668_FIXUP_DELL_XPS13,
5728 static const struct hda_fixup alc662_fixups[] = {
5729 [ALC662_FIXUP_ASPIRE] = {
5730 .type = HDA_FIXUP_PINS,
5731 .v.pins = (const struct hda_pintbl[]) {
5732 { 0x15, 0x99130112 }, /* subwoofer */
5736 [ALC662_FIXUP_LED_GPIO1] = {
5737 .type = HDA_FIXUP_FUNC,
5738 .v.func = alc662_fixup_led_gpio1,
5740 [ALC662_FIXUP_IDEAPAD] = {
5741 .type = HDA_FIXUP_PINS,
5742 .v.pins = (const struct hda_pintbl[]) {
5743 { 0x17, 0x99130112 }, /* subwoofer */
5747 .chain_id = ALC662_FIXUP_LED_GPIO1,
5749 [ALC272_FIXUP_MARIO] = {
5750 .type = HDA_FIXUP_FUNC,
5751 .v.func = alc272_fixup_mario,
5753 [ALC662_FIXUP_CZC_P10T] = {
5754 .type = HDA_FIXUP_VERBS,
5755 .v.verbs = (const struct hda_verb[]) {
5756 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
5760 [ALC662_FIXUP_SKU_IGNORE] = {
5761 .type = HDA_FIXUP_FUNC,
5762 .v.func = alc_fixup_sku_ignore,
5764 [ALC662_FIXUP_HP_RP5800] = {
5765 .type = HDA_FIXUP_PINS,
5766 .v.pins = (const struct hda_pintbl[]) {
5767 { 0x14, 0x0221201f }, /* HP out */
5771 .chain_id = ALC662_FIXUP_SKU_IGNORE
5773 [ALC662_FIXUP_ASUS_MODE1] = {
5774 .type = HDA_FIXUP_PINS,
5775 .v.pins = (const struct hda_pintbl[]) {
5776 { 0x14, 0x99130110 }, /* speaker */
5777 { 0x18, 0x01a19c20 }, /* mic */
5778 { 0x19, 0x99a3092f }, /* int-mic */
5779 { 0x21, 0x0121401f }, /* HP out */
5783 .chain_id = ALC662_FIXUP_SKU_IGNORE
5785 [ALC662_FIXUP_ASUS_MODE2] = {
5786 .type = HDA_FIXUP_PINS,
5787 .v.pins = (const struct hda_pintbl[]) {
5788 { 0x14, 0x99130110 }, /* speaker */
5789 { 0x18, 0x01a19820 }, /* mic */
5790 { 0x19, 0x99a3092f }, /* int-mic */
5791 { 0x1b, 0x0121401f }, /* HP out */
5795 .chain_id = ALC662_FIXUP_SKU_IGNORE
5797 [ALC662_FIXUP_ASUS_MODE3] = {
5798 .type = HDA_FIXUP_PINS,
5799 .v.pins = (const struct hda_pintbl[]) {
5800 { 0x14, 0x99130110 }, /* speaker */
5801 { 0x15, 0x0121441f }, /* HP */
5802 { 0x18, 0x01a19840 }, /* mic */
5803 { 0x19, 0x99a3094f }, /* int-mic */
5804 { 0x21, 0x01211420 }, /* HP2 */
5808 .chain_id = ALC662_FIXUP_SKU_IGNORE
5810 [ALC662_FIXUP_ASUS_MODE4] = {
5811 .type = HDA_FIXUP_PINS,
5812 .v.pins = (const struct hda_pintbl[]) {
5813 { 0x14, 0x99130110 }, /* speaker */
5814 { 0x16, 0x99130111 }, /* speaker */
5815 { 0x18, 0x01a19840 }, /* mic */
5816 { 0x19, 0x99a3094f }, /* int-mic */
5817 { 0x21, 0x0121441f }, /* HP */
5821 .chain_id = ALC662_FIXUP_SKU_IGNORE
5823 [ALC662_FIXUP_ASUS_MODE5] = {
5824 .type = HDA_FIXUP_PINS,
5825 .v.pins = (const struct hda_pintbl[]) {
5826 { 0x14, 0x99130110 }, /* speaker */
5827 { 0x15, 0x0121441f }, /* HP */
5828 { 0x16, 0x99130111 }, /* speaker */
5829 { 0x18, 0x01a19840 }, /* mic */
5830 { 0x19, 0x99a3094f }, /* int-mic */
5834 .chain_id = ALC662_FIXUP_SKU_IGNORE
5836 [ALC662_FIXUP_ASUS_MODE6] = {
5837 .type = HDA_FIXUP_PINS,
5838 .v.pins = (const struct hda_pintbl[]) {
5839 { 0x14, 0x99130110 }, /* speaker */
5840 { 0x15, 0x01211420 }, /* HP2 */
5841 { 0x18, 0x01a19840 }, /* mic */
5842 { 0x19, 0x99a3094f }, /* int-mic */
5843 { 0x1b, 0x0121441f }, /* HP */
5847 .chain_id = ALC662_FIXUP_SKU_IGNORE
5849 [ALC662_FIXUP_ASUS_MODE7] = {
5850 .type = HDA_FIXUP_PINS,
5851 .v.pins = (const struct hda_pintbl[]) {
5852 { 0x14, 0x99130110 }, /* speaker */
5853 { 0x17, 0x99130111 }, /* speaker */
5854 { 0x18, 0x01a19840 }, /* mic */
5855 { 0x19, 0x99a3094f }, /* int-mic */
5856 { 0x1b, 0x01214020 }, /* HP */
5857 { 0x21, 0x0121401f }, /* HP */
5861 .chain_id = ALC662_FIXUP_SKU_IGNORE
5863 [ALC662_FIXUP_ASUS_MODE8] = {
5864 .type = HDA_FIXUP_PINS,
5865 .v.pins = (const struct hda_pintbl[]) {
5866 { 0x14, 0x99130110 }, /* speaker */
5867 { 0x12, 0x99a30970 }, /* int-mic */
5868 { 0x15, 0x01214020 }, /* HP */
5869 { 0x17, 0x99130111 }, /* speaker */
5870 { 0x18, 0x01a19840 }, /* mic */
5871 { 0x21, 0x0121401f }, /* HP */
5875 .chain_id = ALC662_FIXUP_SKU_IGNORE
5877 [ALC662_FIXUP_NO_JACK_DETECT] = {
5878 .type = HDA_FIXUP_FUNC,
5879 .v.func = alc_fixup_no_jack_detect,
5881 [ALC662_FIXUP_ZOTAC_Z68] = {
5882 .type = HDA_FIXUP_PINS,
5883 .v.pins = (const struct hda_pintbl[]) {
5884 { 0x1b, 0x02214020 }, /* Front HP */
5888 [ALC662_FIXUP_INV_DMIC] = {
5889 .type = HDA_FIXUP_FUNC,
5890 .v.func = alc_fixup_inv_dmic,
5892 [ALC668_FIXUP_DELL_XPS13] = {
5893 .type = HDA_FIXUP_FUNC,
5894 .v.func = alc_fixup_dell_xps13,
5896 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
5898 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
5899 .type = HDA_FIXUP_FUNC,
5900 .v.func = alc_fixup_disable_aamix,
5902 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
5904 [ALC668_FIXUP_AUTO_MUTE] = {
5905 .type = HDA_FIXUP_FUNC,
5906 .v.func = alc_fixup_auto_mute_via_amp,
5908 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
5910 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
5911 .type = HDA_FIXUP_PINS,
5912 .v.pins = (const struct hda_pintbl[]) {
5913 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
5914 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
5918 .chain_id = ALC668_FIXUP_HEADSET_MODE
5920 [ALC668_FIXUP_HEADSET_MODE] = {
5921 .type = HDA_FIXUP_FUNC,
5922 .v.func = alc_fixup_headset_mode_alc668,
5924 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
5925 .type = HDA_FIXUP_FUNC,
5926 .v.func = alc_fixup_bass_chmap,
5928 .chain_id = ALC662_FIXUP_ASUS_MODE4
5930 [ALC662_FIXUP_BASS_16] = {
5931 .type = HDA_FIXUP_PINS,
5932 .v.pins = (const struct hda_pintbl[]) {
5933 {0x16, 0x80106111}, /* bass speaker */
5937 .chain_id = ALC662_FIXUP_BASS_CHMAP,
5939 [ALC662_FIXUP_BASS_1A] = {
5940 .type = HDA_FIXUP_PINS,
5941 .v.pins = (const struct hda_pintbl[]) {
5942 {0x1a, 0x80106111}, /* bass speaker */
5946 .chain_id = ALC662_FIXUP_BASS_CHMAP,
5948 [ALC662_FIXUP_BASS_CHMAP] = {
5949 .type = HDA_FIXUP_FUNC,
5950 .v.func = alc_fixup_bass_chmap,
5954 static const struct snd_pci_quirk alc662_fixup_tbl[] = {
5955 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
5956 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
5957 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
5958 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
5959 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
5960 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
5961 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
5962 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
5963 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
5964 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
5965 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
5966 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
5967 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
5968 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
5969 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
5970 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
5971 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
5972 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_BASS_1A),
5973 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
5974 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
5975 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
5976 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
5977 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
5978 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
5979 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
5980 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
5981 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
5982 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
5983 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
5986 /* Below is a quirk table taken from the old code.
5987 * Basically the device should work as is without the fixup table.
5988 * If BIOS doesn't give a proper info, enable the corresponding
5991 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
5992 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
5993 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
5994 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
5995 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
5996 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
5997 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
5998 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
5999 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
6000 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6001 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
6002 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
6003 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
6004 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
6005 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
6006 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6007 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
6008 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
6009 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6010 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
6011 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
6012 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6013 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
6014 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
6015 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
6016 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6017 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
6018 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
6019 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6020 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
6021 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6022 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6023 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
6024 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
6025 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
6026 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
6027 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
6028 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
6029 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
6030 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6031 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
6032 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
6033 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
6034 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
6035 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
6036 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
6037 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
6038 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
6039 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
6040 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
6045 static const struct hda_model_fixup alc662_fixup_models[] = {
6046 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
6047 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
6048 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
6049 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
6050 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
6051 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
6052 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
6053 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
6054 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
6055 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
6056 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
6060 static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
6061 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
6072 {0x1f, 0x411111f0}),
6073 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
6084 {0x1f, 0x411111f0}),
6085 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
6096 {0x1f, 0x411111f0}),
6097 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
6108 {0x1f, 0x411111f0}),
6109 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
6120 {0x1f, 0x411111f0}),
6124 static void alc662_fill_coef(struct hda_codec *codec)
6128 coef = alc_get_coef0(codec);
6130 switch (codec->vendor_id) {
6132 if ((coef & 0x00f0) == 0x0030)
6133 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
6142 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
6149 static int patch_alc662(struct hda_codec *codec)
6151 struct alc_spec *spec;
6154 err = alc_alloc_spec(codec, 0x0b);
6160 /* handle multiple HPs as is */
6161 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
6163 alc_fix_pll_init(codec, 0x20, 0x04, 15);
6165 spec->init_hook = alc662_fill_coef;
6166 alc662_fill_coef(codec);
6168 snd_hda_pick_fixup(codec, alc662_fixup_models,
6169 alc662_fixup_tbl, alc662_fixups);
6170 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups);
6171 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
6173 alc_auto_parse_customize_define(codec);
6175 if (has_cdefine_beep(codec))
6176 spec->gen.beep_nid = 0x01;
6178 if ((alc_get_coef0(codec) & (1 << 14)) &&
6179 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
6180 spec->cdefine.platform_type == 1) {
6181 err = alc_codec_rename(codec, "ALC272X");
6186 /* automatic parse from the BIOS config */
6187 err = alc662_parse_auto_config(codec);
6191 if (!spec->gen.no_analog && spec->gen.beep_nid) {
6192 switch (codec->vendor_id) {
6194 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
6200 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
6203 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
6208 codec->patch_ops = alc_patch_ops;
6209 spec->shutup = alc_eapd_shutup;
6211 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
6224 static int alc680_parse_auto_config(struct hda_codec *codec)
6226 return alc_parse_auto_config(codec, NULL, NULL);
6231 static int patch_alc680(struct hda_codec *codec)
6235 /* ALC680 has no aa-loopback mixer */
6236 err = alc_alloc_spec(codec, 0);
6240 /* automatic parse from the BIOS config */
6241 err = alc680_parse_auto_config(codec);
6247 codec->patch_ops = alc_patch_ops;
6255 static const struct hda_codec_preset snd_hda_preset_realtek[] = {
6256 { .id = 0x10ec0221, .name = "ALC221", .patch = patch_alc269 },
6257 { .id = 0x10ec0231, .name = "ALC231", .patch = patch_alc269 },
6258 { .id = 0x10ec0233, .name = "ALC233", .patch = patch_alc269 },
6259 { .id = 0x10ec0235, .name = "ALC233", .patch = patch_alc269 },
6260 { .id = 0x10ec0255, .name = "ALC255", .patch = patch_alc269 },
6261 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
6262 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
6263 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
6264 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
6265 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
6266 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
6267 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
6268 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
6269 { .id = 0x10ec0276, .name = "ALC276", .patch = patch_alc269 },
6270 { .id = 0x10ec0280, .name = "ALC280", .patch = patch_alc269 },
6271 { .id = 0x10ec0282, .name = "ALC282", .patch = patch_alc269 },
6272 { .id = 0x10ec0283, .name = "ALC283", .patch = patch_alc269 },
6273 { .id = 0x10ec0284, .name = "ALC284", .patch = patch_alc269 },
6274 { .id = 0x10ec0285, .name = "ALC285", .patch = patch_alc269 },
6275 { .id = 0x10ec0286, .name = "ALC286", .patch = patch_alc269 },
6276 { .id = 0x10ec0288, .name = "ALC288", .patch = patch_alc269 },
6277 { .id = 0x10ec0290, .name = "ALC290", .patch = patch_alc269 },
6278 { .id = 0x10ec0292, .name = "ALC292", .patch = patch_alc269 },
6279 { .id = 0x10ec0293, .name = "ALC293", .patch = patch_alc269 },
6280 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
6281 .patch = patch_alc861 },
6282 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
6283 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
6284 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
6285 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
6286 .patch = patch_alc882 },
6287 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
6288 .patch = patch_alc662 },
6289 { .id = 0x10ec0662, .rev = 0x100300, .name = "ALC662 rev3",
6290 .patch = patch_alc662 },
6291 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
6292 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
6293 { .id = 0x10ec0667, .name = "ALC667", .patch = patch_alc662 },
6294 { .id = 0x10ec0668, .name = "ALC668", .patch = patch_alc662 },
6295 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
6296 { .id = 0x10ec0671, .name = "ALC671", .patch = patch_alc662 },
6297 { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
6298 { .id = 0x10ec0867, .name = "ALC891", .patch = patch_alc882 },
6299 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
6300 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
6301 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
6302 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
6303 .patch = patch_alc882 },
6304 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
6305 .patch = patch_alc882 },
6306 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
6307 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
6308 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
6309 .patch = patch_alc882 },
6310 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc882 },
6311 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
6312 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
6313 { .id = 0x10ec0899, .name = "ALC898", .patch = patch_alc882 },
6314 { .id = 0x10ec0900, .name = "ALC1150", .patch = patch_alc882 },
6318 MODULE_ALIAS("snd-hda-codec-id:10ec*");
6320 MODULE_LICENSE("GPL");
6321 MODULE_DESCRIPTION("Realtek HD-audio codec");
6323 static struct hda_codec_preset_list realtek_list = {
6324 .preset = snd_hda_preset_realtek,
6325 .owner = THIS_MODULE,
6328 static int __init patch_realtek_init(void)
6330 return snd_hda_add_codec_preset(&realtek_list);
6333 static void __exit patch_realtek_exit(void)
6335 snd_hda_delete_codec_preset(&realtek_list);
6338 module_init(patch_realtek_init)
6339 module_exit(patch_realtek_exit)