2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for Realtek ALC codecs
6 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
8 * Takashi Iwai <tiwai@suse.de>
9 * Jonathan Woithe <jwoithe@just42.net>
11 * This driver is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <linux/dmi.h>
31 #include <linux/module.h>
32 #include <sound/core.h>
33 #include <sound/jack.h>
34 #include "hda_codec.h"
35 #include "hda_local.h"
36 #include "hda_auto_parser.h"
38 #include "hda_generic.h"
40 /* keep halting ALC5505 DSP, for power saving */
41 #define HALT_REALTEK_ALC5505
44 #define GPIO_MASK 0x03
46 /* extra amp-initialization sequence types */
56 ALC_HEADSET_MODE_UNKNOWN,
57 ALC_HEADSET_MODE_UNPLUGGED,
58 ALC_HEADSET_MODE_HEADSET,
60 ALC_HEADSET_MODE_HEADPHONE,
64 ALC_HEADSET_TYPE_UNKNOWN,
65 ALC_HEADSET_TYPE_CTIA,
66 ALC_HEADSET_TYPE_OMTP,
69 struct alc_customize_define {
71 unsigned char port_connectivity;
72 unsigned char check_sum;
73 unsigned char customization;
74 unsigned char external_amp;
75 unsigned int enable_pcbeep:1;
76 unsigned int platform_type:1;
78 unsigned int override:1;
79 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
83 struct hda_gen_spec gen; /* must be at head */
85 /* codec parameterization */
86 const struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
87 unsigned int num_mixers;
88 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
90 struct alc_customize_define cdefine;
91 unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
93 /* mute LED for HP laptops, see alc269_fixup_mic_mute_hook() */
94 int mute_led_polarity;
95 hda_nid_t mute_led_nid;
96 hda_nid_t cap_mute_led_nid;
98 unsigned int gpio_led; /* used for alc269_fixup_hp_gpio_led() */
100 hda_nid_t headset_mic_pin;
101 hda_nid_t headphone_mic_pin;
102 int current_headset_mode;
103 int current_headset_type;
106 void (*init_hook)(struct hda_codec *codec);
108 void (*power_hook)(struct hda_codec *codec);
110 void (*shutup)(struct hda_codec *codec);
113 int codec_variant; /* flag for other variants */
114 unsigned int has_alc5505_dsp:1;
115 unsigned int no_depop_delay:1;
119 unsigned int pll_coef_idx, pll_coef_bit;
124 * COEF access helper functions
127 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
128 unsigned int coef_idx)
132 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
133 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
137 #define alc_read_coef_idx(codec, coef_idx) \
138 alc_read_coefex_idx(codec, 0x20, coef_idx)
140 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
141 unsigned int coef_idx, unsigned int coef_val)
143 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
144 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
147 #define alc_write_coef_idx(codec, coef_idx, coef_val) \
148 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
150 static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
151 unsigned int coef_idx, unsigned int mask,
152 unsigned int bits_set)
154 unsigned int val = alc_read_coefex_idx(codec, nid, coef_idx);
157 alc_write_coefex_idx(codec, nid, coef_idx,
158 (val & ~mask) | bits_set);
161 #define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
162 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
164 /* a special bypass for COEF 0; read the cached value at the second time */
165 static unsigned int alc_get_coef0(struct hda_codec *codec)
167 struct alc_spec *spec = codec->spec;
170 spec->coef0 = alc_read_coef_idx(codec, 0);
174 /* coef writes/updates batch */
182 #define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
183 { .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
184 #define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
185 #define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
186 #define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
188 static void alc_process_coef_fw(struct hda_codec *codec,
189 const struct coef_fw *fw)
191 for (; fw->nid; fw++) {
192 if (fw->mask == (unsigned short)-1)
193 alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
195 alc_update_coefex_idx(codec, fw->nid, fw->idx,
201 * Append the given mixer and verb elements for the later use
202 * The mixer array is referred in build_controls(), and init_verbs are
205 static void add_mixer(struct alc_spec *spec, const struct snd_kcontrol_new *mix)
207 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
209 spec->mixers[spec->num_mixers++] = mix;
213 * GPIO setup tables, used in initialization
215 /* Enable GPIO mask and set output */
216 static const struct hda_verb alc_gpio1_init_verbs[] = {
217 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
218 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
219 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
223 static const struct hda_verb alc_gpio2_init_verbs[] = {
224 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
225 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
226 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
230 static const struct hda_verb alc_gpio3_init_verbs[] = {
231 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
232 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
233 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
238 * Fix hardware PLL issue
239 * On some codecs, the analog PLL gating control must be off while
240 * the default value is 1.
242 static void alc_fix_pll(struct hda_codec *codec)
244 struct alc_spec *spec = codec->spec;
247 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
248 1 << spec->pll_coef_bit, 0);
251 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
252 unsigned int coef_idx, unsigned int coef_bit)
254 struct alc_spec *spec = codec->spec;
256 spec->pll_coef_idx = coef_idx;
257 spec->pll_coef_bit = coef_bit;
261 /* update the master volume per volume-knob's unsol event */
262 static void alc_update_knob_master(struct hda_codec *codec,
263 struct hda_jack_callback *jack)
266 struct snd_kcontrol *kctl;
267 struct snd_ctl_elem_value *uctl;
269 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
272 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
275 val = snd_hda_codec_read(codec, jack->tbl->nid, 0,
276 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
277 val &= HDA_AMP_VOLMASK;
278 uctl->value.integer.value[0] = val;
279 uctl->value.integer.value[1] = val;
280 kctl->put(kctl, uctl);
284 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
286 /* For some reason, the res given from ALC880 is broken.
287 Here we adjust it properly. */
288 snd_hda_jack_unsol_event(codec, res >> 2);
291 /* additional initialization for ALC888 variants */
292 static void alc888_coef_init(struct hda_codec *codec)
294 switch (alc_get_coef0(codec) & 0x00f0) {
299 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
304 /* turn on/off EAPD control (only if available) */
305 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
307 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
309 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
310 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
314 /* turn on/off EAPD controls of the codec */
315 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
317 /* We currently only handle front, HP */
318 static hda_nid_t pins[] = {
319 0x0f, 0x10, 0x14, 0x15, 0
322 for (p = pins; *p; p++)
323 set_eapd(codec, *p, on);
326 /* generic shutup callback;
327 * just turning off EPAD and a little pause for avoiding pop-noise
329 static void alc_eapd_shutup(struct hda_codec *codec)
331 struct alc_spec *spec = codec->spec;
333 alc_auto_setup_eapd(codec, false);
334 if (!spec->no_depop_delay)
336 snd_hda_shutup_pins(codec);
339 /* generic EAPD initialization */
340 static void alc_auto_init_amp(struct hda_codec *codec, int type)
342 alc_auto_setup_eapd(codec, true);
345 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
348 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
351 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
353 case ALC_INIT_DEFAULT:
354 switch (codec->vendor_id) {
356 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
362 alc_update_coef_idx(codec, 7, 0, 0x2030);
365 alc888_coef_init(codec);
374 * Realtek SSID verification
377 /* Could be any non-zero and even value. When used as fixup, tells
378 * the driver to ignore any present sku defines.
380 #define ALC_FIXUP_SKU_IGNORE (2)
382 static void alc_fixup_sku_ignore(struct hda_codec *codec,
383 const struct hda_fixup *fix, int action)
385 struct alc_spec *spec = codec->spec;
386 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
387 spec->cdefine.fixup = 1;
388 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
392 static void alc_fixup_no_depop_delay(struct hda_codec *codec,
393 const struct hda_fixup *fix, int action)
395 struct alc_spec *spec = codec->spec;
397 if (action == HDA_FIXUP_ACT_PROBE) {
398 spec->no_depop_delay = 1;
399 codec->depop_delay = 0;
403 static int alc_auto_parse_customize_define(struct hda_codec *codec)
405 unsigned int ass, tmp, i;
407 struct alc_spec *spec = codec->spec;
409 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
411 if (spec->cdefine.fixup) {
412 ass = spec->cdefine.sku_cfg;
413 if (ass == ALC_FIXUP_SKU_IGNORE)
418 if (!codec->bus->pci)
420 ass = codec->subsystem_id & 0xffff;
421 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
425 if (codec->vendor_id == 0x10ec0260)
427 ass = snd_hda_codec_get_pincfg(codec, nid);
430 codec_info(codec, "%s: SKU not ready 0x%08x\n",
431 codec->chip_name, ass);
437 for (i = 1; i < 16; i++) {
441 if (((ass >> 16) & 0xf) != tmp)
444 spec->cdefine.port_connectivity = ass >> 30;
445 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
446 spec->cdefine.check_sum = (ass >> 16) & 0xf;
447 spec->cdefine.customization = ass >> 8;
449 spec->cdefine.sku_cfg = ass;
450 spec->cdefine.external_amp = (ass & 0x38) >> 3;
451 spec->cdefine.platform_type = (ass & 0x4) >> 2;
452 spec->cdefine.swap = (ass & 0x2) >> 1;
453 spec->cdefine.override = ass & 0x1;
455 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
456 nid, spec->cdefine.sku_cfg);
457 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
458 spec->cdefine.port_connectivity);
459 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
460 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
461 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
462 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
463 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
464 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
465 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
470 /* return the position of NID in the list, or -1 if not found */
471 static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
474 for (i = 0; i < nums; i++)
479 /* return true if the given NID is found in the list */
480 static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
482 return find_idx_in_nid_list(nid, list, nums) >= 0;
485 /* check subsystem ID and set up device-specific initialization;
486 * return 1 if initialized, 0 if invalid SSID
488 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
489 * 31 ~ 16 : Manufacture ID
491 * 7 ~ 0 : Assembly ID
492 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
494 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
496 unsigned int ass, tmp, i;
498 struct alc_spec *spec = codec->spec;
500 if (spec->cdefine.fixup) {
501 ass = spec->cdefine.sku_cfg;
502 if (ass == ALC_FIXUP_SKU_IGNORE)
507 ass = codec->subsystem_id & 0xffff;
508 if (codec->bus->pci &&
509 ass != codec->bus->pci->subsystem_device && (ass & 1))
512 /* invalid SSID, check the special NID pin defcfg instead */
514 * 31~30 : port connectivity
517 * 19~16 : Check sum (15:1)
522 if (codec->vendor_id == 0x10ec0260)
524 ass = snd_hda_codec_get_pincfg(codec, nid);
526 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
530 if ((ass >> 30) != 1) /* no physical connection */
535 for (i = 1; i < 16; i++) {
539 if (((ass >> 16) & 0xf) != tmp)
542 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
543 ass & 0xffff, codec->vendor_id);
547 * 2 : 0 --> Desktop, 1 --> Laptop
548 * 3~5 : External Amplifier control
551 tmp = (ass & 0x38) >> 3; /* external Amp control */
554 spec->init_amp = ALC_INIT_GPIO1;
557 spec->init_amp = ALC_INIT_GPIO2;
560 spec->init_amp = ALC_INIT_GPIO3;
564 spec->init_amp = ALC_INIT_DEFAULT;
568 /* is laptop or Desktop and enable the function "Mute internal speaker
569 * when the external headphone out jack is plugged"
574 * 10~8 : Jack location
575 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
577 * 15 : 1 --> enable the function "Mute internal speaker
578 * when the external headphone out jack is plugged"
580 if (!spec->gen.autocfg.hp_pins[0] &&
581 !(spec->gen.autocfg.line_out_pins[0] &&
582 spec->gen.autocfg.line_out_type == AUTO_PIN_HP_OUT)) {
584 tmp = (ass >> 11) & 0x3; /* HP to chassis */
586 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
587 spec->gen.autocfg.line_outs))
589 spec->gen.autocfg.hp_pins[0] = nid;
594 /* Check the validity of ALC subsystem-id
595 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
596 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
598 if (!alc_subsystem_id(codec, ports)) {
599 struct alc_spec *spec = codec->spec;
601 "realtek: Enable default setup for auto mode as fallback\n");
602 spec->init_amp = ALC_INIT_DEFAULT;
609 static void alc_fixup_inv_dmic(struct hda_codec *codec,
610 const struct hda_fixup *fix, int action)
612 struct alc_spec *spec = codec->spec;
614 spec->gen.inv_dmic_split = 1;
618 #ifdef CONFIG_SND_HDA_INPUT_BEEP
619 /* additional beep mixers; the actual parameters are overwritten at build */
620 static const struct snd_kcontrol_new alc_beep_mixer[] = {
621 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
622 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
627 static int alc_build_controls(struct hda_codec *codec)
629 struct alc_spec *spec = codec->spec;
632 err = snd_hda_gen_build_controls(codec);
636 for (i = 0; i < spec->num_mixers; i++) {
637 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
642 #ifdef CONFIG_SND_HDA_INPUT_BEEP
643 /* create beep controls if needed */
644 if (spec->beep_amp) {
645 const struct snd_kcontrol_new *knew;
646 for (knew = alc_beep_mixer; knew->name; knew++) {
647 struct snd_kcontrol *kctl;
648 kctl = snd_ctl_new1(knew, codec);
651 kctl->private_value = spec->beep_amp;
652 err = snd_hda_ctl_add(codec, 0, kctl);
659 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
668 static int alc_init(struct hda_codec *codec)
670 struct alc_spec *spec = codec->spec;
673 spec->init_hook(codec);
676 alc_auto_init_amp(codec, spec->init_amp);
678 snd_hda_gen_init(codec);
680 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
685 static inline void alc_shutup(struct hda_codec *codec)
687 struct alc_spec *spec = codec->spec;
689 if (spec && spec->shutup)
692 snd_hda_shutup_pins(codec);
695 #define alc_free snd_hda_gen_free
698 static void alc_power_eapd(struct hda_codec *codec)
700 alc_auto_setup_eapd(codec, false);
703 static int alc_suspend(struct hda_codec *codec)
705 struct alc_spec *spec = codec->spec;
707 if (spec && spec->power_hook)
708 spec->power_hook(codec);
714 static int alc_resume(struct hda_codec *codec)
716 struct alc_spec *spec = codec->spec;
718 if (!spec->no_depop_delay)
719 msleep(150); /* to avoid pop noise */
720 codec->patch_ops.init(codec);
721 snd_hda_codec_resume_amp(codec);
722 snd_hda_codec_resume_cache(codec);
723 hda_call_check_power_status(codec, 0x01);
730 static const struct hda_codec_ops alc_patch_ops = {
731 .build_controls = alc_build_controls,
732 .build_pcms = snd_hda_gen_build_pcms,
735 .unsol_event = snd_hda_jack_unsol_event,
737 .resume = alc_resume,
738 .suspend = alc_suspend,
739 .check_power_status = snd_hda_gen_check_power_status,
741 .reboot_notify = alc_shutup,
745 /* replace the codec chip_name with the given string */
746 static int alc_codec_rename(struct hda_codec *codec, const char *name)
748 kfree(codec->chip_name);
749 codec->chip_name = kstrdup(name, GFP_KERNEL);
750 if (!codec->chip_name) {
758 * Rename codecs appropriately from COEF value or subvendor id
760 struct alc_codec_rename_table {
761 unsigned int vendor_id;
762 unsigned short coef_mask;
763 unsigned short coef_bits;
767 struct alc_codec_rename_pci_table {
768 unsigned int codec_vendor_id;
769 unsigned short pci_subvendor;
770 unsigned short pci_subdevice;
774 static struct alc_codec_rename_table rename_tbl[] = {
775 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
776 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
777 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
778 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
779 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
780 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
781 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
782 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
783 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
784 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
785 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
786 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
787 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
788 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
789 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
790 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
791 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
795 static struct alc_codec_rename_pci_table rename_pci_tbl[] = {
796 { 0x10ec0280, 0x1028, 0, "ALC3220" },
797 { 0x10ec0282, 0x1028, 0, "ALC3221" },
798 { 0x10ec0283, 0x1028, 0, "ALC3223" },
799 { 0x10ec0288, 0x1028, 0, "ALC3263" },
800 { 0x10ec0292, 0x1028, 0, "ALC3226" },
801 { 0x10ec0293, 0x1028, 0, "ALC3235" },
802 { 0x10ec0255, 0x1028, 0, "ALC3234" },
803 { 0x10ec0668, 0x1028, 0, "ALC3661" },
804 { 0x10ec0275, 0x1028, 0, "ALC3260" },
805 { 0x10ec0899, 0x1028, 0, "ALC3861" },
806 { 0x10ec0670, 0x1025, 0, "ALC669X" },
807 { 0x10ec0676, 0x1025, 0, "ALC679X" },
808 { 0x10ec0282, 0x1043, 0, "ALC3229" },
809 { 0x10ec0233, 0x1043, 0, "ALC3236" },
810 { 0x10ec0280, 0x103c, 0, "ALC3228" },
811 { 0x10ec0282, 0x103c, 0, "ALC3227" },
812 { 0x10ec0286, 0x103c, 0, "ALC3242" },
813 { 0x10ec0290, 0x103c, 0, "ALC3241" },
814 { 0x10ec0668, 0x103c, 0, "ALC3662" },
815 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
816 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
820 static int alc_codec_rename_from_preset(struct hda_codec *codec)
822 const struct alc_codec_rename_table *p;
823 const struct alc_codec_rename_pci_table *q;
825 for (p = rename_tbl; p->vendor_id; p++) {
826 if (p->vendor_id != codec->vendor_id)
828 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
829 return alc_codec_rename(codec, p->name);
832 if (!codec->bus->pci)
834 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
835 if (q->codec_vendor_id != codec->vendor_id)
837 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
839 if (!q->pci_subdevice ||
840 q->pci_subdevice == codec->bus->pci->subsystem_device)
841 return alc_codec_rename(codec, q->name);
849 * Digital-beep handlers
851 #ifdef CONFIG_SND_HDA_INPUT_BEEP
852 #define set_beep_amp(spec, nid, idx, dir) \
853 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
855 static const struct snd_pci_quirk beep_white_list[] = {
856 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
857 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
858 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
859 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
860 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
861 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
862 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
863 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
864 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
868 static inline int has_cdefine_beep(struct hda_codec *codec)
870 struct alc_spec *spec = codec->spec;
871 const struct snd_pci_quirk *q;
872 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list);
875 return spec->cdefine.enable_pcbeep;
878 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
879 #define has_cdefine_beep(codec) 0
882 /* parse the BIOS configuration and set up the alc_spec */
883 /* return 1 if successful, 0 if the proper config is not found,
884 * or a negative error code
886 static int alc_parse_auto_config(struct hda_codec *codec,
887 const hda_nid_t *ignore_nids,
888 const hda_nid_t *ssid_nids)
890 struct alc_spec *spec = codec->spec;
891 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
894 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
900 alc_ssid_check(codec, ssid_nids);
902 err = snd_hda_gen_parse_auto_config(codec, cfg);
909 /* common preparation job for alc_spec */
910 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
912 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
918 snd_hda_gen_spec_init(&spec->gen);
919 spec->gen.mixer_nid = mixer_nid;
920 spec->gen.own_eapd_ctl = 1;
921 codec->single_adc_amp = 1;
922 /* FIXME: do we need this for all Realtek codec models? */
923 codec->spdif_status_reset = 1;
925 err = alc_codec_rename_from_preset(codec);
933 static int alc880_parse_auto_config(struct hda_codec *codec)
935 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
936 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
937 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
946 ALC880_FIXUP_MEDION_RIM,
948 ALC880_FIXUP_LG_LW25,
950 ALC880_FIXUP_EAPD_COEF,
951 ALC880_FIXUP_TCL_S700,
952 ALC880_FIXUP_VOL_KNOB,
953 ALC880_FIXUP_FUJITSU,
955 ALC880_FIXUP_UNIWILL,
956 ALC880_FIXUP_UNIWILL_DIG,
958 ALC880_FIXUP_ASUS_W5A,
959 ALC880_FIXUP_3ST_BASE,
961 ALC880_FIXUP_3ST_DIG,
962 ALC880_FIXUP_5ST_BASE,
964 ALC880_FIXUP_5ST_DIG,
965 ALC880_FIXUP_6ST_BASE,
967 ALC880_FIXUP_6ST_DIG,
968 ALC880_FIXUP_6ST_AUTOMUTE,
971 /* enable the volume-knob widget support on NID 0x21 */
972 static void alc880_fixup_vol_knob(struct hda_codec *codec,
973 const struct hda_fixup *fix, int action)
975 if (action == HDA_FIXUP_ACT_PROBE)
976 snd_hda_jack_detect_enable_callback(codec, 0x21,
977 alc_update_knob_master);
980 static const struct hda_fixup alc880_fixups[] = {
981 [ALC880_FIXUP_GPIO1] = {
982 .type = HDA_FIXUP_VERBS,
983 .v.verbs = alc_gpio1_init_verbs,
985 [ALC880_FIXUP_GPIO2] = {
986 .type = HDA_FIXUP_VERBS,
987 .v.verbs = alc_gpio2_init_verbs,
989 [ALC880_FIXUP_MEDION_RIM] = {
990 .type = HDA_FIXUP_VERBS,
991 .v.verbs = (const struct hda_verb[]) {
992 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
993 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
997 .chain_id = ALC880_FIXUP_GPIO2,
999 [ALC880_FIXUP_LG] = {
1000 .type = HDA_FIXUP_PINS,
1001 .v.pins = (const struct hda_pintbl[]) {
1002 /* disable bogus unused pins */
1003 { 0x16, 0x411111f0 },
1004 { 0x18, 0x411111f0 },
1005 { 0x1a, 0x411111f0 },
1009 [ALC880_FIXUP_LG_LW25] = {
1010 .type = HDA_FIXUP_PINS,
1011 .v.pins = (const struct hda_pintbl[]) {
1012 { 0x1a, 0x0181344f }, /* line-in */
1013 { 0x1b, 0x0321403f }, /* headphone */
1017 [ALC880_FIXUP_W810] = {
1018 .type = HDA_FIXUP_PINS,
1019 .v.pins = (const struct hda_pintbl[]) {
1020 /* disable bogus unused pins */
1021 { 0x17, 0x411111f0 },
1025 .chain_id = ALC880_FIXUP_GPIO2,
1027 [ALC880_FIXUP_EAPD_COEF] = {
1028 .type = HDA_FIXUP_VERBS,
1029 .v.verbs = (const struct hda_verb[]) {
1030 /* change to EAPD mode */
1031 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1032 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1036 [ALC880_FIXUP_TCL_S700] = {
1037 .type = HDA_FIXUP_VERBS,
1038 .v.verbs = (const struct hda_verb[]) {
1039 /* change to EAPD mode */
1040 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1041 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1045 .chain_id = ALC880_FIXUP_GPIO2,
1047 [ALC880_FIXUP_VOL_KNOB] = {
1048 .type = HDA_FIXUP_FUNC,
1049 .v.func = alc880_fixup_vol_knob,
1051 [ALC880_FIXUP_FUJITSU] = {
1052 /* override all pins as BIOS on old Amilo is broken */
1053 .type = HDA_FIXUP_PINS,
1054 .v.pins = (const struct hda_pintbl[]) {
1055 { 0x14, 0x0121411f }, /* HP */
1056 { 0x15, 0x99030120 }, /* speaker */
1057 { 0x16, 0x99030130 }, /* bass speaker */
1058 { 0x17, 0x411111f0 }, /* N/A */
1059 { 0x18, 0x411111f0 }, /* N/A */
1060 { 0x19, 0x01a19950 }, /* mic-in */
1061 { 0x1a, 0x411111f0 }, /* N/A */
1062 { 0x1b, 0x411111f0 }, /* N/A */
1063 { 0x1c, 0x411111f0 }, /* N/A */
1064 { 0x1d, 0x411111f0 }, /* N/A */
1065 { 0x1e, 0x01454140 }, /* SPDIF out */
1069 .chain_id = ALC880_FIXUP_VOL_KNOB,
1071 [ALC880_FIXUP_F1734] = {
1072 /* almost compatible with FUJITSU, but no bass and SPDIF */
1073 .type = HDA_FIXUP_PINS,
1074 .v.pins = (const struct hda_pintbl[]) {
1075 { 0x14, 0x0121411f }, /* HP */
1076 { 0x15, 0x99030120 }, /* speaker */
1077 { 0x16, 0x411111f0 }, /* N/A */
1078 { 0x17, 0x411111f0 }, /* N/A */
1079 { 0x18, 0x411111f0 }, /* N/A */
1080 { 0x19, 0x01a19950 }, /* mic-in */
1081 { 0x1a, 0x411111f0 }, /* N/A */
1082 { 0x1b, 0x411111f0 }, /* N/A */
1083 { 0x1c, 0x411111f0 }, /* N/A */
1084 { 0x1d, 0x411111f0 }, /* N/A */
1085 { 0x1e, 0x411111f0 }, /* N/A */
1089 .chain_id = ALC880_FIXUP_VOL_KNOB,
1091 [ALC880_FIXUP_UNIWILL] = {
1092 /* need to fix HP and speaker pins to be parsed correctly */
1093 .type = HDA_FIXUP_PINS,
1094 .v.pins = (const struct hda_pintbl[]) {
1095 { 0x14, 0x0121411f }, /* HP */
1096 { 0x15, 0x99030120 }, /* speaker */
1097 { 0x16, 0x99030130 }, /* bass speaker */
1101 [ALC880_FIXUP_UNIWILL_DIG] = {
1102 .type = HDA_FIXUP_PINS,
1103 .v.pins = (const struct hda_pintbl[]) {
1104 /* disable bogus unused pins */
1105 { 0x17, 0x411111f0 },
1106 { 0x19, 0x411111f0 },
1107 { 0x1b, 0x411111f0 },
1108 { 0x1f, 0x411111f0 },
1112 [ALC880_FIXUP_Z71V] = {
1113 .type = HDA_FIXUP_PINS,
1114 .v.pins = (const struct hda_pintbl[]) {
1115 /* set up the whole pins as BIOS is utterly broken */
1116 { 0x14, 0x99030120 }, /* speaker */
1117 { 0x15, 0x0121411f }, /* HP */
1118 { 0x16, 0x411111f0 }, /* N/A */
1119 { 0x17, 0x411111f0 }, /* N/A */
1120 { 0x18, 0x01a19950 }, /* mic-in */
1121 { 0x19, 0x411111f0 }, /* N/A */
1122 { 0x1a, 0x01813031 }, /* line-in */
1123 { 0x1b, 0x411111f0 }, /* N/A */
1124 { 0x1c, 0x411111f0 }, /* N/A */
1125 { 0x1d, 0x411111f0 }, /* N/A */
1126 { 0x1e, 0x0144111e }, /* SPDIF */
1130 [ALC880_FIXUP_ASUS_W5A] = {
1131 .type = HDA_FIXUP_PINS,
1132 .v.pins = (const struct hda_pintbl[]) {
1133 /* set up the whole pins as BIOS is utterly broken */
1134 { 0x14, 0x0121411f }, /* HP */
1135 { 0x15, 0x411111f0 }, /* N/A */
1136 { 0x16, 0x411111f0 }, /* N/A */
1137 { 0x17, 0x411111f0 }, /* N/A */
1138 { 0x18, 0x90a60160 }, /* mic */
1139 { 0x19, 0x411111f0 }, /* N/A */
1140 { 0x1a, 0x411111f0 }, /* N/A */
1141 { 0x1b, 0x411111f0 }, /* N/A */
1142 { 0x1c, 0x411111f0 }, /* N/A */
1143 { 0x1d, 0x411111f0 }, /* N/A */
1144 { 0x1e, 0xb743111e }, /* SPDIF out */
1148 .chain_id = ALC880_FIXUP_GPIO1,
1150 [ALC880_FIXUP_3ST_BASE] = {
1151 .type = HDA_FIXUP_PINS,
1152 .v.pins = (const struct hda_pintbl[]) {
1153 { 0x14, 0x01014010 }, /* line-out */
1154 { 0x15, 0x411111f0 }, /* N/A */
1155 { 0x16, 0x411111f0 }, /* N/A */
1156 { 0x17, 0x411111f0 }, /* N/A */
1157 { 0x18, 0x01a19c30 }, /* mic-in */
1158 { 0x19, 0x0121411f }, /* HP */
1159 { 0x1a, 0x01813031 }, /* line-in */
1160 { 0x1b, 0x02a19c40 }, /* front-mic */
1161 { 0x1c, 0x411111f0 }, /* N/A */
1162 { 0x1d, 0x411111f0 }, /* N/A */
1163 /* 0x1e is filled in below */
1164 { 0x1f, 0x411111f0 }, /* N/A */
1168 [ALC880_FIXUP_3ST] = {
1169 .type = HDA_FIXUP_PINS,
1170 .v.pins = (const struct hda_pintbl[]) {
1171 { 0x1e, 0x411111f0 }, /* N/A */
1175 .chain_id = ALC880_FIXUP_3ST_BASE,
1177 [ALC880_FIXUP_3ST_DIG] = {
1178 .type = HDA_FIXUP_PINS,
1179 .v.pins = (const struct hda_pintbl[]) {
1180 { 0x1e, 0x0144111e }, /* SPDIF */
1184 .chain_id = ALC880_FIXUP_3ST_BASE,
1186 [ALC880_FIXUP_5ST_BASE] = {
1187 .type = HDA_FIXUP_PINS,
1188 .v.pins = (const struct hda_pintbl[]) {
1189 { 0x14, 0x01014010 }, /* front */
1190 { 0x15, 0x411111f0 }, /* N/A */
1191 { 0x16, 0x01011411 }, /* CLFE */
1192 { 0x17, 0x01016412 }, /* surr */
1193 { 0x18, 0x01a19c30 }, /* mic-in */
1194 { 0x19, 0x0121411f }, /* HP */
1195 { 0x1a, 0x01813031 }, /* line-in */
1196 { 0x1b, 0x02a19c40 }, /* front-mic */
1197 { 0x1c, 0x411111f0 }, /* N/A */
1198 { 0x1d, 0x411111f0 }, /* N/A */
1199 /* 0x1e is filled in below */
1200 { 0x1f, 0x411111f0 }, /* N/A */
1204 [ALC880_FIXUP_5ST] = {
1205 .type = HDA_FIXUP_PINS,
1206 .v.pins = (const struct hda_pintbl[]) {
1207 { 0x1e, 0x411111f0 }, /* N/A */
1211 .chain_id = ALC880_FIXUP_5ST_BASE,
1213 [ALC880_FIXUP_5ST_DIG] = {
1214 .type = HDA_FIXUP_PINS,
1215 .v.pins = (const struct hda_pintbl[]) {
1216 { 0x1e, 0x0144111e }, /* SPDIF */
1220 .chain_id = ALC880_FIXUP_5ST_BASE,
1222 [ALC880_FIXUP_6ST_BASE] = {
1223 .type = HDA_FIXUP_PINS,
1224 .v.pins = (const struct hda_pintbl[]) {
1225 { 0x14, 0x01014010 }, /* front */
1226 { 0x15, 0x01016412 }, /* surr */
1227 { 0x16, 0x01011411 }, /* CLFE */
1228 { 0x17, 0x01012414 }, /* side */
1229 { 0x18, 0x01a19c30 }, /* mic-in */
1230 { 0x19, 0x02a19c40 }, /* front-mic */
1231 { 0x1a, 0x01813031 }, /* line-in */
1232 { 0x1b, 0x0121411f }, /* HP */
1233 { 0x1c, 0x411111f0 }, /* N/A */
1234 { 0x1d, 0x411111f0 }, /* N/A */
1235 /* 0x1e is filled in below */
1236 { 0x1f, 0x411111f0 }, /* N/A */
1240 [ALC880_FIXUP_6ST] = {
1241 .type = HDA_FIXUP_PINS,
1242 .v.pins = (const struct hda_pintbl[]) {
1243 { 0x1e, 0x411111f0 }, /* N/A */
1247 .chain_id = ALC880_FIXUP_6ST_BASE,
1249 [ALC880_FIXUP_6ST_DIG] = {
1250 .type = HDA_FIXUP_PINS,
1251 .v.pins = (const struct hda_pintbl[]) {
1252 { 0x1e, 0x0144111e }, /* SPDIF */
1256 .chain_id = ALC880_FIXUP_6ST_BASE,
1258 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1259 .type = HDA_FIXUP_PINS,
1260 .v.pins = (const struct hda_pintbl[]) {
1261 { 0x1b, 0x0121401f }, /* HP with jack detect */
1264 .chained_before = true,
1265 .chain_id = ALC880_FIXUP_6ST_BASE,
1269 static const struct snd_pci_quirk alc880_fixup_tbl[] = {
1270 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
1271 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
1272 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
1273 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
1274 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
1275 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
1276 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
1277 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
1278 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
1279 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
1280 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
1281 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
1282 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
1283 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
1284 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_FIXUP_F1734),
1285 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
1286 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
1287 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
1288 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1289 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1290 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
1291 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
1292 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
1294 /* Below is the copied entries from alc880_quirks.c.
1295 * It's not quite sure whether BIOS sets the correct pin-config table
1296 * on these machines, thus they are kept to be compatible with
1297 * the old static quirks. Once when it's confirmed to work without
1298 * these overrides, it'd be better to remove.
1300 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1301 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1302 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1303 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1304 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1305 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1306 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1307 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1308 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1309 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1310 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1311 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1312 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1313 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1314 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1315 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1316 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1317 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1318 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1319 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1320 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1321 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1322 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1323 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1324 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1325 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1326 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1327 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1328 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1329 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1330 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1331 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1332 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1334 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1335 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1336 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1340 static const struct hda_model_fixup alc880_fixup_models[] = {
1341 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1342 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1343 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1344 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1345 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1346 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
1347 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
1353 * OK, here we have finally the patch for ALC880
1355 static int patch_alc880(struct hda_codec *codec)
1357 struct alc_spec *spec;
1360 err = alc_alloc_spec(codec, 0x0b);
1365 spec->gen.need_dac_fix = 1;
1366 spec->gen.beep_nid = 0x01;
1368 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
1370 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1372 /* automatic parse from the BIOS config */
1373 err = alc880_parse_auto_config(codec);
1377 if (!spec->gen.no_analog)
1378 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1380 codec->patch_ops = alc_patch_ops;
1381 codec->patch_ops.unsol_event = alc880_unsol_event;
1384 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1397 static int alc260_parse_auto_config(struct hda_codec *codec)
1399 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
1400 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1401 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
1408 ALC260_FIXUP_HP_DC5750,
1409 ALC260_FIXUP_HP_PIN_0F,
1412 ALC260_FIXUP_GPIO1_TOGGLE,
1413 ALC260_FIXUP_REPLACER,
1414 ALC260_FIXUP_HP_B1900,
1416 ALC260_FIXUP_FSC_S7020,
1417 ALC260_FIXUP_FSC_S7020_JWSE,
1418 ALC260_FIXUP_VAIO_PINS,
1421 static void alc260_gpio1_automute(struct hda_codec *codec)
1423 struct alc_spec *spec = codec->spec;
1424 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
1425 spec->gen.hp_jack_present);
1428 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1429 const struct hda_fixup *fix, int action)
1431 struct alc_spec *spec = codec->spec;
1432 if (action == HDA_FIXUP_ACT_PROBE) {
1433 /* although the machine has only one output pin, we need to
1434 * toggle GPIO1 according to the jack state
1436 spec->gen.automute_hook = alc260_gpio1_automute;
1437 spec->gen.detect_hp = 1;
1438 spec->gen.automute_speaker = 1;
1439 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
1440 snd_hda_jack_detect_enable_callback(codec, 0x0f,
1441 snd_hda_gen_hp_automute);
1442 snd_hda_add_verbs(codec, alc_gpio1_init_verbs);
1446 static void alc260_fixup_kn1(struct hda_codec *codec,
1447 const struct hda_fixup *fix, int action)
1449 struct alc_spec *spec = codec->spec;
1450 static const struct hda_pintbl pincfgs[] = {
1451 { 0x0f, 0x02214000 }, /* HP/speaker */
1452 { 0x12, 0x90a60160 }, /* int mic */
1453 { 0x13, 0x02a19000 }, /* ext mic */
1454 { 0x18, 0x01446000 }, /* SPDIF out */
1455 /* disable bogus I/O pins */
1456 { 0x10, 0x411111f0 },
1457 { 0x11, 0x411111f0 },
1458 { 0x14, 0x411111f0 },
1459 { 0x15, 0x411111f0 },
1460 { 0x16, 0x411111f0 },
1461 { 0x17, 0x411111f0 },
1462 { 0x19, 0x411111f0 },
1467 case HDA_FIXUP_ACT_PRE_PROBE:
1468 snd_hda_apply_pincfgs(codec, pincfgs);
1470 case HDA_FIXUP_ACT_PROBE:
1471 spec->init_amp = ALC_INIT_NONE;
1476 static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1477 const struct hda_fixup *fix, int action)
1479 struct alc_spec *spec = codec->spec;
1480 if (action == HDA_FIXUP_ACT_PROBE)
1481 spec->init_amp = ALC_INIT_NONE;
1484 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1485 const struct hda_fixup *fix, int action)
1487 struct alc_spec *spec = codec->spec;
1488 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1489 spec->gen.add_jack_modes = 1;
1490 spec->gen.hp_mic = 1;
1494 static const struct hda_fixup alc260_fixups[] = {
1495 [ALC260_FIXUP_HP_DC5750] = {
1496 .type = HDA_FIXUP_PINS,
1497 .v.pins = (const struct hda_pintbl[]) {
1498 { 0x11, 0x90130110 }, /* speaker */
1502 [ALC260_FIXUP_HP_PIN_0F] = {
1503 .type = HDA_FIXUP_PINS,
1504 .v.pins = (const struct hda_pintbl[]) {
1505 { 0x0f, 0x01214000 }, /* HP */
1509 [ALC260_FIXUP_COEF] = {
1510 .type = HDA_FIXUP_VERBS,
1511 .v.verbs = (const struct hda_verb[]) {
1512 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1513 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
1517 [ALC260_FIXUP_GPIO1] = {
1518 .type = HDA_FIXUP_VERBS,
1519 .v.verbs = alc_gpio1_init_verbs,
1521 [ALC260_FIXUP_GPIO1_TOGGLE] = {
1522 .type = HDA_FIXUP_FUNC,
1523 .v.func = alc260_fixup_gpio1_toggle,
1525 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1527 [ALC260_FIXUP_REPLACER] = {
1528 .type = HDA_FIXUP_VERBS,
1529 .v.verbs = (const struct hda_verb[]) {
1530 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1531 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
1535 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1537 [ALC260_FIXUP_HP_B1900] = {
1538 .type = HDA_FIXUP_FUNC,
1539 .v.func = alc260_fixup_gpio1_toggle,
1541 .chain_id = ALC260_FIXUP_COEF,
1543 [ALC260_FIXUP_KN1] = {
1544 .type = HDA_FIXUP_FUNC,
1545 .v.func = alc260_fixup_kn1,
1547 [ALC260_FIXUP_FSC_S7020] = {
1548 .type = HDA_FIXUP_FUNC,
1549 .v.func = alc260_fixup_fsc_s7020,
1551 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1552 .type = HDA_FIXUP_FUNC,
1553 .v.func = alc260_fixup_fsc_s7020_jwse,
1555 .chain_id = ALC260_FIXUP_FSC_S7020,
1557 [ALC260_FIXUP_VAIO_PINS] = {
1558 .type = HDA_FIXUP_PINS,
1559 .v.pins = (const struct hda_pintbl[]) {
1560 /* Pin configs are missing completely on some VAIOs */
1561 { 0x0f, 0x01211020 },
1562 { 0x10, 0x0001003f },
1563 { 0x11, 0x411111f0 },
1564 { 0x12, 0x01a15930 },
1565 { 0x13, 0x411111f0 },
1566 { 0x14, 0x411111f0 },
1567 { 0x15, 0x411111f0 },
1568 { 0x16, 0x411111f0 },
1569 { 0x17, 0x411111f0 },
1570 { 0x18, 0x411111f0 },
1571 { 0x19, 0x411111f0 },
1577 static const struct snd_pci_quirk alc260_fixup_tbl[] = {
1578 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
1579 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
1580 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
1581 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
1582 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
1583 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
1584 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
1585 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
1586 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
1587 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
1588 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
1589 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
1593 static const struct hda_model_fixup alc260_fixup_models[] = {
1594 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1595 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1596 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1597 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1603 static int patch_alc260(struct hda_codec *codec)
1605 struct alc_spec *spec;
1608 err = alc_alloc_spec(codec, 0x07);
1613 /* as quite a few machines require HP amp for speaker outputs,
1614 * it's easier to enable it unconditionally; even if it's unneeded,
1615 * it's almost harmless.
1617 spec->gen.prefer_hp_amp = 1;
1618 spec->gen.beep_nid = 0x01;
1620 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1622 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1624 /* automatic parse from the BIOS config */
1625 err = alc260_parse_auto_config(codec);
1629 if (!spec->gen.no_analog)
1630 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1632 codec->patch_ops = alc_patch_ops;
1633 spec->shutup = alc_eapd_shutup;
1635 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1646 * ALC882/883/885/888/889 support
1648 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1649 * configuration. Each pin widget can choose any input DACs and a mixer.
1650 * Each ADC is connected from a mixer of all inputs. This makes possible
1651 * 6-channel independent captures.
1653 * In addition, an independent DAC for the multi-playback (not used in this
1661 ALC882_FIXUP_ABIT_AW9D_MAX,
1662 ALC882_FIXUP_LENOVO_Y530,
1663 ALC882_FIXUP_PB_M5210,
1664 ALC882_FIXUP_ACER_ASPIRE_7736,
1665 ALC882_FIXUP_ASUS_W90V,
1667 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
1668 ALC889_FIXUP_VAIO_TT,
1669 ALC888_FIXUP_EEE1601,
1672 ALC883_FIXUP_ACER_EAPD,
1677 ALC882_FIXUP_ASUS_W2JC,
1678 ALC882_FIXUP_ACER_ASPIRE_4930G,
1679 ALC882_FIXUP_ACER_ASPIRE_8930G,
1680 ALC882_FIXUP_ASPIRE_8930G_VERBS,
1681 ALC885_FIXUP_MACPRO_GPIO,
1682 ALC889_FIXUP_DAC_ROUTE,
1683 ALC889_FIXUP_MBP_VREF,
1684 ALC889_FIXUP_IMAC91_VREF,
1685 ALC889_FIXUP_MBA11_VREF,
1686 ALC889_FIXUP_MBA21_VREF,
1687 ALC889_FIXUP_MP11_VREF,
1688 ALC882_FIXUP_INV_DMIC,
1689 ALC882_FIXUP_NO_PRIMARY_HP,
1690 ALC887_FIXUP_ASUS_BASS,
1691 ALC887_FIXUP_BASS_CHMAP,
1694 static void alc889_fixup_coef(struct hda_codec *codec,
1695 const struct hda_fixup *fix, int action)
1697 if (action != HDA_FIXUP_ACT_INIT)
1699 alc_update_coef_idx(codec, 7, 0, 0x2030);
1702 /* toggle speaker-output according to the hp-jack state */
1703 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
1705 unsigned int gpiostate, gpiomask, gpiodir;
1707 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
1708 AC_VERB_GET_GPIO_DATA, 0);
1711 gpiostate |= (1 << pin);
1713 gpiostate &= ~(1 << pin);
1715 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
1716 AC_VERB_GET_GPIO_MASK, 0);
1717 gpiomask |= (1 << pin);
1719 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
1720 AC_VERB_GET_GPIO_DIRECTION, 0);
1721 gpiodir |= (1 << pin);
1724 snd_hda_codec_write(codec, codec->afg, 0,
1725 AC_VERB_SET_GPIO_MASK, gpiomask);
1726 snd_hda_codec_write(codec, codec->afg, 0,
1727 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
1731 snd_hda_codec_write(codec, codec->afg, 0,
1732 AC_VERB_SET_GPIO_DATA, gpiostate);
1735 /* set up GPIO at initialization */
1736 static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
1737 const struct hda_fixup *fix, int action)
1739 if (action != HDA_FIXUP_ACT_INIT)
1741 alc882_gpio_mute(codec, 0, 0);
1742 alc882_gpio_mute(codec, 1, 0);
1745 /* Fix the connection of some pins for ALC889:
1746 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
1747 * work correctly (bko#42740)
1749 static void alc889_fixup_dac_route(struct hda_codec *codec,
1750 const struct hda_fixup *fix, int action)
1752 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1753 /* fake the connections during parsing the tree */
1754 hda_nid_t conn1[2] = { 0x0c, 0x0d };
1755 hda_nid_t conn2[2] = { 0x0e, 0x0f };
1756 snd_hda_override_conn_list(codec, 0x14, 2, conn1);
1757 snd_hda_override_conn_list(codec, 0x15, 2, conn1);
1758 snd_hda_override_conn_list(codec, 0x18, 2, conn2);
1759 snd_hda_override_conn_list(codec, 0x1a, 2, conn2);
1760 } else if (action == HDA_FIXUP_ACT_PROBE) {
1761 /* restore the connections */
1762 hda_nid_t conn[5] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
1763 snd_hda_override_conn_list(codec, 0x14, 5, conn);
1764 snd_hda_override_conn_list(codec, 0x15, 5, conn);
1765 snd_hda_override_conn_list(codec, 0x18, 5, conn);
1766 snd_hda_override_conn_list(codec, 0x1a, 5, conn);
1770 /* Set VREF on HP pin */
1771 static void alc889_fixup_mbp_vref(struct hda_codec *codec,
1772 const struct hda_fixup *fix, int action)
1774 struct alc_spec *spec = codec->spec;
1775 static hda_nid_t nids[2] = { 0x14, 0x15 };
1778 if (action != HDA_FIXUP_ACT_INIT)
1780 for (i = 0; i < ARRAY_SIZE(nids); i++) {
1781 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
1782 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
1784 val = snd_hda_codec_get_pin_target(codec, nids[i]);
1785 val |= AC_PINCTL_VREF_80;
1786 snd_hda_set_pin_ctl(codec, nids[i], val);
1787 spec->gen.keep_vref_in_automute = 1;
1792 static void alc889_fixup_mac_pins(struct hda_codec *codec,
1793 const hda_nid_t *nids, int num_nids)
1795 struct alc_spec *spec = codec->spec;
1798 for (i = 0; i < num_nids; i++) {
1800 val = snd_hda_codec_get_pin_target(codec, nids[i]);
1801 val |= AC_PINCTL_VREF_50;
1802 snd_hda_set_pin_ctl(codec, nids[i], val);
1804 spec->gen.keep_vref_in_automute = 1;
1807 /* Set VREF on speaker pins on imac91 */
1808 static void alc889_fixup_imac91_vref(struct hda_codec *codec,
1809 const struct hda_fixup *fix, int action)
1811 static hda_nid_t nids[2] = { 0x18, 0x1a };
1813 if (action == HDA_FIXUP_ACT_INIT)
1814 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1817 /* Set VREF on speaker pins on mba11 */
1818 static void alc889_fixup_mba11_vref(struct hda_codec *codec,
1819 const struct hda_fixup *fix, int action)
1821 static hda_nid_t nids[1] = { 0x18 };
1823 if (action == HDA_FIXUP_ACT_INIT)
1824 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1827 /* Set VREF on speaker pins on mba21 */
1828 static void alc889_fixup_mba21_vref(struct hda_codec *codec,
1829 const struct hda_fixup *fix, int action)
1831 static hda_nid_t nids[2] = { 0x18, 0x19 };
1833 if (action == HDA_FIXUP_ACT_INIT)
1834 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1837 /* Don't take HP output as primary
1838 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
1839 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
1841 static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
1842 const struct hda_fixup *fix, int action)
1844 struct alc_spec *spec = codec->spec;
1845 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1846 spec->gen.no_primary_hp = 1;
1847 spec->gen.no_multi_io = 1;
1851 static void alc_fixup_bass_chmap(struct hda_codec *codec,
1852 const struct hda_fixup *fix, int action);
1854 static const struct hda_fixup alc882_fixups[] = {
1855 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
1856 .type = HDA_FIXUP_PINS,
1857 .v.pins = (const struct hda_pintbl[]) {
1858 { 0x15, 0x01080104 }, /* side */
1859 { 0x16, 0x01011012 }, /* rear */
1860 { 0x17, 0x01016011 }, /* clfe */
1864 [ALC882_FIXUP_LENOVO_Y530] = {
1865 .type = HDA_FIXUP_PINS,
1866 .v.pins = (const struct hda_pintbl[]) {
1867 { 0x15, 0x99130112 }, /* rear int speakers */
1868 { 0x16, 0x99130111 }, /* subwoofer */
1872 [ALC882_FIXUP_PB_M5210] = {
1873 .type = HDA_FIXUP_PINCTLS,
1874 .v.pins = (const struct hda_pintbl[]) {
1875 { 0x19, PIN_VREF50 },
1879 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
1880 .type = HDA_FIXUP_FUNC,
1881 .v.func = alc_fixup_sku_ignore,
1883 [ALC882_FIXUP_ASUS_W90V] = {
1884 .type = HDA_FIXUP_PINS,
1885 .v.pins = (const struct hda_pintbl[]) {
1886 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
1890 [ALC889_FIXUP_CD] = {
1891 .type = HDA_FIXUP_PINS,
1892 .v.pins = (const struct hda_pintbl[]) {
1893 { 0x1c, 0x993301f0 }, /* CD */
1897 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
1898 .type = HDA_FIXUP_PINS,
1899 .v.pins = (const struct hda_pintbl[]) {
1900 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
1904 .chain_id = ALC889_FIXUP_CD,
1906 [ALC889_FIXUP_VAIO_TT] = {
1907 .type = HDA_FIXUP_PINS,
1908 .v.pins = (const struct hda_pintbl[]) {
1909 { 0x17, 0x90170111 }, /* hidden surround speaker */
1913 [ALC888_FIXUP_EEE1601] = {
1914 .type = HDA_FIXUP_VERBS,
1915 .v.verbs = (const struct hda_verb[]) {
1916 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
1917 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
1921 [ALC882_FIXUP_EAPD] = {
1922 .type = HDA_FIXUP_VERBS,
1923 .v.verbs = (const struct hda_verb[]) {
1924 /* change to EAPD mode */
1925 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1926 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1930 [ALC883_FIXUP_EAPD] = {
1931 .type = HDA_FIXUP_VERBS,
1932 .v.verbs = (const struct hda_verb[]) {
1933 /* change to EAPD mode */
1934 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1935 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1939 [ALC883_FIXUP_ACER_EAPD] = {
1940 .type = HDA_FIXUP_VERBS,
1941 .v.verbs = (const struct hda_verb[]) {
1942 /* eanable EAPD on Acer laptops */
1943 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1944 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
1948 [ALC882_FIXUP_GPIO1] = {
1949 .type = HDA_FIXUP_VERBS,
1950 .v.verbs = alc_gpio1_init_verbs,
1952 [ALC882_FIXUP_GPIO2] = {
1953 .type = HDA_FIXUP_VERBS,
1954 .v.verbs = alc_gpio2_init_verbs,
1956 [ALC882_FIXUP_GPIO3] = {
1957 .type = HDA_FIXUP_VERBS,
1958 .v.verbs = alc_gpio3_init_verbs,
1960 [ALC882_FIXUP_ASUS_W2JC] = {
1961 .type = HDA_FIXUP_VERBS,
1962 .v.verbs = alc_gpio1_init_verbs,
1964 .chain_id = ALC882_FIXUP_EAPD,
1966 [ALC889_FIXUP_COEF] = {
1967 .type = HDA_FIXUP_FUNC,
1968 .v.func = alc889_fixup_coef,
1970 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
1971 .type = HDA_FIXUP_PINS,
1972 .v.pins = (const struct hda_pintbl[]) {
1973 { 0x16, 0x99130111 }, /* CLFE speaker */
1974 { 0x17, 0x99130112 }, /* surround speaker */
1978 .chain_id = ALC882_FIXUP_GPIO1,
1980 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
1981 .type = HDA_FIXUP_PINS,
1982 .v.pins = (const struct hda_pintbl[]) {
1983 { 0x16, 0x99130111 }, /* CLFE speaker */
1984 { 0x1b, 0x99130112 }, /* surround speaker */
1988 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
1990 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
1991 /* additional init verbs for Acer Aspire 8930G */
1992 .type = HDA_FIXUP_VERBS,
1993 .v.verbs = (const struct hda_verb[]) {
1994 /* Enable all DACs */
1995 /* DAC DISABLE/MUTE 1? */
1996 /* setting bits 1-5 disables DAC nids 0x02-0x06
1997 * apparently. Init=0x38 */
1998 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
1999 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2000 /* DAC DISABLE/MUTE 2? */
2001 /* some bit here disables the other DACs.
2003 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2004 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2006 * This laptop has a stereo digital microphone.
2007 * The mics are only 1cm apart which makes the stereo
2008 * useless. However, either the mic or the ALC889
2009 * makes the signal become a difference/sum signal
2010 * instead of standard stereo, which is annoying.
2011 * So instead we flip this bit which makes the
2012 * codec replicate the sum signal to both channels,
2013 * turning it into a normal mono mic.
2015 /* DMIC_CONTROL? Init value = 0x0001 */
2016 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2017 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2018 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2019 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2023 .chain_id = ALC882_FIXUP_GPIO1,
2025 [ALC885_FIXUP_MACPRO_GPIO] = {
2026 .type = HDA_FIXUP_FUNC,
2027 .v.func = alc885_fixup_macpro_gpio,
2029 [ALC889_FIXUP_DAC_ROUTE] = {
2030 .type = HDA_FIXUP_FUNC,
2031 .v.func = alc889_fixup_dac_route,
2033 [ALC889_FIXUP_MBP_VREF] = {
2034 .type = HDA_FIXUP_FUNC,
2035 .v.func = alc889_fixup_mbp_vref,
2037 .chain_id = ALC882_FIXUP_GPIO1,
2039 [ALC889_FIXUP_IMAC91_VREF] = {
2040 .type = HDA_FIXUP_FUNC,
2041 .v.func = alc889_fixup_imac91_vref,
2043 .chain_id = ALC882_FIXUP_GPIO1,
2045 [ALC889_FIXUP_MBA11_VREF] = {
2046 .type = HDA_FIXUP_FUNC,
2047 .v.func = alc889_fixup_mba11_vref,
2049 .chain_id = ALC889_FIXUP_MBP_VREF,
2051 [ALC889_FIXUP_MBA21_VREF] = {
2052 .type = HDA_FIXUP_FUNC,
2053 .v.func = alc889_fixup_mba21_vref,
2055 .chain_id = ALC889_FIXUP_MBP_VREF,
2057 [ALC889_FIXUP_MP11_VREF] = {
2058 .type = HDA_FIXUP_FUNC,
2059 .v.func = alc889_fixup_mba11_vref,
2061 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2063 [ALC882_FIXUP_INV_DMIC] = {
2064 .type = HDA_FIXUP_FUNC,
2065 .v.func = alc_fixup_inv_dmic,
2067 [ALC882_FIXUP_NO_PRIMARY_HP] = {
2068 .type = HDA_FIXUP_FUNC,
2069 .v.func = alc882_fixup_no_primary_hp,
2071 [ALC887_FIXUP_ASUS_BASS] = {
2072 .type = HDA_FIXUP_PINS,
2073 .v.pins = (const struct hda_pintbl[]) {
2074 {0x16, 0x99130130}, /* bass speaker */
2078 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2080 [ALC887_FIXUP_BASS_CHMAP] = {
2081 .type = HDA_FIXUP_FUNC,
2082 .v.func = alc_fixup_bass_chmap,
2086 static const struct snd_pci_quirk alc882_fixup_tbl[] = {
2087 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2088 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2089 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2090 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2091 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2092 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
2093 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2094 ALC882_FIXUP_ACER_ASPIRE_4930G),
2095 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2096 ALC882_FIXUP_ACER_ASPIRE_4930G),
2097 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2098 ALC882_FIXUP_ACER_ASPIRE_8930G),
2099 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2100 ALC882_FIXUP_ACER_ASPIRE_8930G),
2101 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2102 ALC882_FIXUP_ACER_ASPIRE_4930G),
2103 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2104 ALC882_FIXUP_ACER_ASPIRE_4930G),
2105 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2106 ALC882_FIXUP_ACER_ASPIRE_4930G),
2107 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
2108 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2109 ALC882_FIXUP_ACER_ASPIRE_4930G),
2110 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
2111 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
2112 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
2113 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
2114 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
2115 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
2116 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
2117 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
2118 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
2119 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
2120 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2122 /* All Apple entries are in codec SSIDs */
2123 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2124 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2125 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2126 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
2127 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2128 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
2129 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2130 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
2131 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
2132 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
2133 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
2134 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2135 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2136 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
2137 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2138 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2139 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
2140 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 5,1", ALC885_FIXUP_MACPRO_GPIO),
2141 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
2142 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2143 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
2144 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_IMAC91_VREF),
2146 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
2147 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
2148 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
2149 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
2150 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
2151 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2152 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
2153 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
2154 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
2158 static const struct hda_model_fixup alc882_fixup_models[] = {
2159 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2160 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2161 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
2162 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
2163 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
2168 * BIOS auto configuration
2170 /* almost identical with ALC880 parser... */
2171 static int alc882_parse_auto_config(struct hda_codec *codec)
2173 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
2174 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2175 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
2180 static int patch_alc882(struct hda_codec *codec)
2182 struct alc_spec *spec;
2185 err = alc_alloc_spec(codec, 0x0b);
2191 switch (codec->vendor_id) {
2197 /* ALC883 and variants */
2198 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2202 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
2204 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2206 alc_auto_parse_customize_define(codec);
2208 if (has_cdefine_beep(codec))
2209 spec->gen.beep_nid = 0x01;
2211 /* automatic parse from the BIOS config */
2212 err = alc882_parse_auto_config(codec);
2216 if (!spec->gen.no_analog && spec->gen.beep_nid)
2217 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2219 codec->patch_ops = alc_patch_ops;
2221 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2234 static int alc262_parse_auto_config(struct hda_codec *codec)
2236 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
2237 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2238 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
2245 ALC262_FIXUP_FSC_H270,
2246 ALC262_FIXUP_FSC_S7110,
2247 ALC262_FIXUP_HP_Z200,
2249 ALC262_FIXUP_LENOVO_3000,
2251 ALC262_FIXUP_BENQ_T31,
2252 ALC262_FIXUP_INV_DMIC,
2253 ALC262_FIXUP_INTEL_BAYLEYBAY,
2256 static const struct hda_fixup alc262_fixups[] = {
2257 [ALC262_FIXUP_FSC_H270] = {
2258 .type = HDA_FIXUP_PINS,
2259 .v.pins = (const struct hda_pintbl[]) {
2260 { 0x14, 0x99130110 }, /* speaker */
2261 { 0x15, 0x0221142f }, /* front HP */
2262 { 0x1b, 0x0121141f }, /* rear HP */
2266 [ALC262_FIXUP_FSC_S7110] = {
2267 .type = HDA_FIXUP_PINS,
2268 .v.pins = (const struct hda_pintbl[]) {
2269 { 0x15, 0x90170110 }, /* speaker */
2273 .chain_id = ALC262_FIXUP_BENQ,
2275 [ALC262_FIXUP_HP_Z200] = {
2276 .type = HDA_FIXUP_PINS,
2277 .v.pins = (const struct hda_pintbl[]) {
2278 { 0x16, 0x99130120 }, /* internal speaker */
2282 [ALC262_FIXUP_TYAN] = {
2283 .type = HDA_FIXUP_PINS,
2284 .v.pins = (const struct hda_pintbl[]) {
2285 { 0x14, 0x1993e1f0 }, /* int AUX */
2289 [ALC262_FIXUP_LENOVO_3000] = {
2290 .type = HDA_FIXUP_PINCTLS,
2291 .v.pins = (const struct hda_pintbl[]) {
2292 { 0x19, PIN_VREF50 },
2296 .chain_id = ALC262_FIXUP_BENQ,
2298 [ALC262_FIXUP_BENQ] = {
2299 .type = HDA_FIXUP_VERBS,
2300 .v.verbs = (const struct hda_verb[]) {
2301 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2302 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2306 [ALC262_FIXUP_BENQ_T31] = {
2307 .type = HDA_FIXUP_VERBS,
2308 .v.verbs = (const struct hda_verb[]) {
2309 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2310 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2314 [ALC262_FIXUP_INV_DMIC] = {
2315 .type = HDA_FIXUP_FUNC,
2316 .v.func = alc_fixup_inv_dmic,
2318 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2319 .type = HDA_FIXUP_FUNC,
2320 .v.func = alc_fixup_no_depop_delay,
2324 static const struct snd_pci_quirk alc262_fixup_tbl[] = {
2325 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
2326 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
2327 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
2328 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
2329 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
2330 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
2331 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2332 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
2333 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
2337 static const struct hda_model_fixup alc262_fixup_models[] = {
2338 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
2344 static int patch_alc262(struct hda_codec *codec)
2346 struct alc_spec *spec;
2349 err = alc_alloc_spec(codec, 0x0b);
2354 spec->gen.shared_mic_vref_pin = 0x18;
2357 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2360 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
2362 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2364 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
2366 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2368 alc_auto_parse_customize_define(codec);
2370 if (has_cdefine_beep(codec))
2371 spec->gen.beep_nid = 0x01;
2373 /* automatic parse from the BIOS config */
2374 err = alc262_parse_auto_config(codec);
2378 if (!spec->gen.no_analog && spec->gen.beep_nid)
2379 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2381 codec->patch_ops = alc_patch_ops;
2382 spec->shutup = alc_eapd_shutup;
2384 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2396 /* bind Beep switches of both NID 0x0f and 0x10 */
2397 static const struct hda_bind_ctls alc268_bind_beep_sw = {
2398 .ops = &snd_hda_bind_sw,
2400 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
2401 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
2406 static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2407 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
2408 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
2412 /* set PCBEEP vol = 0, mute connections */
2413 static const struct hda_verb alc268_beep_init_verbs[] = {
2414 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2415 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2416 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2421 ALC268_FIXUP_INV_DMIC,
2422 ALC268_FIXUP_HP_EAPD,
2426 static const struct hda_fixup alc268_fixups[] = {
2427 [ALC268_FIXUP_INV_DMIC] = {
2428 .type = HDA_FIXUP_FUNC,
2429 .v.func = alc_fixup_inv_dmic,
2431 [ALC268_FIXUP_HP_EAPD] = {
2432 .type = HDA_FIXUP_VERBS,
2433 .v.verbs = (const struct hda_verb[]) {
2434 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
2438 [ALC268_FIXUP_SPDIF] = {
2439 .type = HDA_FIXUP_PINS,
2440 .v.pins = (const struct hda_pintbl[]) {
2441 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
2447 static const struct hda_model_fixup alc268_fixup_models[] = {
2448 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
2449 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
2453 static const struct snd_pci_quirk alc268_fixup_tbl[] = {
2454 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
2455 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
2456 /* below is codec SSID since multiple Toshiba laptops have the
2457 * same PCI SSID 1179:ff00
2459 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
2464 * BIOS auto configuration
2466 static int alc268_parse_auto_config(struct hda_codec *codec)
2468 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2469 return alc_parse_auto_config(codec, NULL, alc268_ssids);
2474 static int patch_alc268(struct hda_codec *codec)
2476 struct alc_spec *spec;
2479 /* ALC268 has no aa-loopback mixer */
2480 err = alc_alloc_spec(codec, 0);
2485 spec->gen.beep_nid = 0x01;
2487 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
2488 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2490 /* automatic parse from the BIOS config */
2491 err = alc268_parse_auto_config(codec);
2495 if (err > 0 && !spec->gen.no_analog &&
2496 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
2497 add_mixer(spec, alc268_beep_mixer);
2498 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
2499 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
2500 /* override the amp caps for beep generator */
2501 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
2502 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
2503 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
2504 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
2505 (0 << AC_AMPCAP_MUTE_SHIFT));
2508 codec->patch_ops = alc_patch_ops;
2509 spec->shutup = alc_eapd_shutup;
2511 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2524 static int playback_pcm_open(struct hda_pcm_stream *hinfo,
2525 struct hda_codec *codec,
2526 struct snd_pcm_substream *substream)
2528 struct hda_gen_spec *spec = codec->spec;
2529 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2533 static int playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2534 struct hda_codec *codec,
2535 unsigned int stream_tag,
2536 unsigned int format,
2537 struct snd_pcm_substream *substream)
2539 struct hda_gen_spec *spec = codec->spec;
2540 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2541 stream_tag, format, substream);
2544 static int playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2545 struct hda_codec *codec,
2546 struct snd_pcm_substream *substream)
2548 struct hda_gen_spec *spec = codec->spec;
2549 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2552 static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
2556 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
2557 /* NID is set in alc_build_pcms */
2559 .open = playback_pcm_open,
2560 .prepare = playback_pcm_prepare,
2561 .cleanup = playback_pcm_cleanup
2565 static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
2569 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
2570 /* NID is set in alc_build_pcms */
2573 /* different alc269-variants */
2575 ALC269_TYPE_ALC269VA,
2576 ALC269_TYPE_ALC269VB,
2577 ALC269_TYPE_ALC269VC,
2578 ALC269_TYPE_ALC269VD,
2589 * BIOS auto configuration
2591 static int alc269_parse_auto_config(struct hda_codec *codec)
2593 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
2594 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
2595 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2596 struct alc_spec *spec = codec->spec;
2597 const hda_nid_t *ssids;
2599 switch (spec->codec_variant) {
2600 case ALC269_TYPE_ALC269VA:
2601 case ALC269_TYPE_ALC269VC:
2602 case ALC269_TYPE_ALC280:
2603 case ALC269_TYPE_ALC284:
2604 case ALC269_TYPE_ALC285:
2605 ssids = alc269va_ssids;
2607 case ALC269_TYPE_ALC269VB:
2608 case ALC269_TYPE_ALC269VD:
2609 case ALC269_TYPE_ALC282:
2610 case ALC269_TYPE_ALC283:
2611 case ALC269_TYPE_ALC286:
2612 case ALC269_TYPE_ALC255:
2613 ssids = alc269_ssids;
2616 ssids = alc269_ssids;
2620 return alc_parse_auto_config(codec, alc269_ignore, ssids);
2623 static int find_ext_mic_pin(struct hda_codec *codec);
2625 static void alc286_shutup(struct hda_codec *codec)
2628 int mic_pin = find_ext_mic_pin(codec);
2629 /* don't shut up pins when unloading the driver; otherwise it breaks
2630 * the default pin setup at the next load of the driver
2632 if (codec->bus->shutdown)
2634 for (i = 0; i < codec->init_pins.used; i++) {
2635 struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i);
2636 /* use read here for syncing after issuing each verb */
2637 if (pin->nid != mic_pin)
2638 snd_hda_codec_read(codec, pin->nid, 0,
2639 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
2641 codec->pins_shutup = 1;
2644 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
2646 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
2649 static void alc269_shutup(struct hda_codec *codec)
2651 struct alc_spec *spec = codec->spec;
2653 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
2654 alc269vb_toggle_power_output(codec, 0);
2655 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
2656 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
2659 snd_hda_shutup_pins(codec);
2662 static struct coef_fw alc282_coefs[] = {
2663 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
2664 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
2665 WRITE_COEF(0x07, 0x0200), /* DMIC control */
2666 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
2667 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
2668 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
2669 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
2670 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
2671 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
2672 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
2673 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
2674 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
2675 WRITE_COEF(0x34, 0xa0c0), /* ANC */
2676 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
2677 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
2678 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
2679 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
2680 WRITE_COEF(0x63, 0x2902), /* PLL */
2681 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
2682 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
2683 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
2684 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
2685 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
2686 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
2687 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
2688 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
2689 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
2690 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
2691 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
2695 static void alc282_restore_default_value(struct hda_codec *codec)
2697 alc_process_coef_fw(codec, alc282_coefs);
2700 static void alc282_init(struct hda_codec *codec)
2702 struct alc_spec *spec = codec->spec;
2703 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
2707 alc282_restore_default_value(codec);
2711 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
2712 coef78 = alc_read_coef_idx(codec, 0x78);
2714 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
2715 /* Headphone capless set to high power mode */
2716 alc_write_coef_idx(codec, 0x78, 0x9004);
2721 snd_hda_codec_write(codec, hp_pin, 0,
2722 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
2727 snd_hda_codec_write(codec, hp_pin, 0,
2728 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
2733 /* Headphone capless set to normal mode */
2734 alc_write_coef_idx(codec, 0x78, coef78);
2737 static void alc282_shutup(struct hda_codec *codec)
2739 struct alc_spec *spec = codec->spec;
2740 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
2745 alc269_shutup(codec);
2749 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
2750 coef78 = alc_read_coef_idx(codec, 0x78);
2751 alc_write_coef_idx(codec, 0x78, 0x9004);
2756 snd_hda_codec_write(codec, hp_pin, 0,
2757 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
2762 snd_hda_codec_write(codec, hp_pin, 0,
2763 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
2768 alc_auto_setup_eapd(codec, false);
2769 snd_hda_shutup_pins(codec);
2770 alc_write_coef_idx(codec, 0x78, coef78);
2773 static struct coef_fw alc283_coefs[] = {
2774 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
2775 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
2776 WRITE_COEF(0x07, 0x0200), /* DMIC control */
2777 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
2778 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
2779 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
2780 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
2781 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
2782 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
2783 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
2784 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
2785 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
2786 WRITE_COEF(0x22, 0xa0c0), /* ANC */
2787 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
2788 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
2789 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
2790 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
2791 WRITE_COEF(0x2e, 0x2902), /* PLL */
2792 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
2793 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
2794 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
2795 WRITE_COEF(0x36, 0x0), /* capless control 5 */
2796 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
2797 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
2798 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
2799 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
2800 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
2801 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
2802 WRITE_COEF(0x49, 0x0), /* test mode */
2803 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
2804 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
2805 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
2806 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
2810 static void alc283_restore_default_value(struct hda_codec *codec)
2812 alc_process_coef_fw(codec, alc283_coefs);
2815 static void alc283_init(struct hda_codec *codec)
2817 struct alc_spec *spec = codec->spec;
2818 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
2821 if (!spec->gen.autocfg.hp_outs) {
2822 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
2823 hp_pin = spec->gen.autocfg.line_out_pins[0];
2826 alc283_restore_default_value(codec);
2830 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
2832 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
2833 /* Headphone capless set to high power mode */
2834 alc_write_coef_idx(codec, 0x43, 0x9004);
2836 snd_hda_codec_write(codec, hp_pin, 0,
2837 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
2842 snd_hda_codec_write(codec, hp_pin, 0,
2843 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
2847 /* Index 0x46 Combo jack auto switch control 2 */
2848 /* 3k pull low control for Headset jack. */
2849 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
2850 /* Headphone capless set to normal mode */
2851 alc_write_coef_idx(codec, 0x43, 0x9614);
2854 static void alc283_shutup(struct hda_codec *codec)
2856 struct alc_spec *spec = codec->spec;
2857 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
2860 if (!spec->gen.autocfg.hp_outs) {
2861 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
2862 hp_pin = spec->gen.autocfg.line_out_pins[0];
2866 alc269_shutup(codec);
2870 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
2872 alc_write_coef_idx(codec, 0x43, 0x9004);
2874 /*depop hp during suspend*/
2875 alc_write_coef_idx(codec, 0x06, 0x2100);
2877 snd_hda_codec_write(codec, hp_pin, 0,
2878 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
2883 snd_hda_codec_write(codec, hp_pin, 0,
2884 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
2886 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
2890 alc_auto_setup_eapd(codec, false);
2891 snd_hda_shutup_pins(codec);
2892 alc_write_coef_idx(codec, 0x43, 0x9614);
2895 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
2898 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
2899 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
2900 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
2903 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
2907 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
2908 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
2910 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
2915 static void alc5505_dsp_halt(struct hda_codec *codec)
2919 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
2920 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
2921 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
2922 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
2923 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
2924 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
2925 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
2926 val = alc5505_coef_get(codec, 0x6220);
2927 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
2930 static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
2932 alc5505_coef_set(codec, 0x61b8, 0x04133302);
2933 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
2934 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
2935 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
2936 alc5505_coef_set(codec, 0x6220, 0x2002010f);
2937 alc5505_coef_set(codec, 0x880c, 0x00000004);
2940 static void alc5505_dsp_init(struct hda_codec *codec)
2944 alc5505_dsp_halt(codec);
2945 alc5505_dsp_back_from_halt(codec);
2946 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
2947 alc5505_coef_set(codec, 0x61b0, 0x5b16);
2948 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
2949 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
2950 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
2951 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
2952 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
2953 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
2954 alc5505_coef_set(codec, 0x61b8, 0x04173302);
2955 alc5505_coef_set(codec, 0x61b8, 0x04163302);
2956 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
2957 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
2958 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
2960 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
2962 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
2964 alc5505_coef_set(codec, 0x6220, 0x6002018f);
2966 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
2967 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
2968 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
2969 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
2970 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
2971 alc5505_coef_set(codec, 0x880c, 0x00000003);
2972 alc5505_coef_set(codec, 0x880c, 0x00000010);
2974 #ifdef HALT_REALTEK_ALC5505
2975 alc5505_dsp_halt(codec);
2979 #ifdef HALT_REALTEK_ALC5505
2980 #define alc5505_dsp_suspend(codec) /* NOP */
2981 #define alc5505_dsp_resume(codec) /* NOP */
2983 #define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
2984 #define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
2988 static int alc269_suspend(struct hda_codec *codec)
2990 struct alc_spec *spec = codec->spec;
2992 if (spec->has_alc5505_dsp)
2993 alc5505_dsp_suspend(codec);
2994 return alc_suspend(codec);
2997 static int alc269_resume(struct hda_codec *codec)
2999 struct alc_spec *spec = codec->spec;
3001 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3002 alc269vb_toggle_power_output(codec, 0);
3003 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3004 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
3008 codec->patch_ops.init(codec);
3010 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3011 alc269vb_toggle_power_output(codec, 1);
3012 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3013 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
3017 snd_hda_codec_resume_amp(codec);
3018 snd_hda_codec_resume_cache(codec);
3019 hda_call_check_power_status(codec, 0x01);
3021 /* on some machine, the BIOS will clear the codec gpio data when enter
3022 * suspend, and won't restore the data after resume, so we restore it
3026 snd_hda_codec_write(codec, codec->afg, 0, AC_VERB_SET_GPIO_DATA,
3029 if (spec->has_alc5505_dsp)
3030 alc5505_dsp_resume(codec);
3034 #endif /* CONFIG_PM */
3036 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
3037 const struct hda_fixup *fix, int action)
3039 struct alc_spec *spec = codec->spec;
3041 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3042 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
3045 static void alc269_fixup_hweq(struct hda_codec *codec,
3046 const struct hda_fixup *fix, int action)
3048 if (action == HDA_FIXUP_ACT_INIT)
3049 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
3052 static void alc269_fixup_headset_mic(struct hda_codec *codec,
3053 const struct hda_fixup *fix, int action)
3055 struct alc_spec *spec = codec->spec;
3057 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3058 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3061 static void alc271_fixup_dmic(struct hda_codec *codec,
3062 const struct hda_fixup *fix, int action)
3064 static const struct hda_verb verbs[] = {
3065 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
3066 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
3071 if (strcmp(codec->chip_name, "ALC271X") &&
3072 strcmp(codec->chip_name, "ALC269VB"))
3074 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
3075 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
3076 snd_hda_sequence_write(codec, verbs);
3079 static void alc269_fixup_pcm_44k(struct hda_codec *codec,
3080 const struct hda_fixup *fix, int action)
3082 struct alc_spec *spec = codec->spec;
3084 if (action != HDA_FIXUP_ACT_PROBE)
3087 /* Due to a hardware problem on Lenovo Ideadpad, we need to
3088 * fix the sample rate of analog I/O to 44.1kHz
3090 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
3091 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
3094 static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
3095 const struct hda_fixup *fix, int action)
3097 /* The digital-mic unit sends PDM (differential signal) instead of
3098 * the standard PCM, thus you can't record a valid mono stream as is.
3099 * Below is a workaround specific to ALC269 to control the dmic
3100 * signal source as mono.
3102 if (action == HDA_FIXUP_ACT_INIT)
3103 alc_update_coef_idx(codec, 0x07, 0, 0x80);
3106 static void alc269_quanta_automute(struct hda_codec *codec)
3108 snd_hda_gen_update_outputs(codec);
3110 alc_write_coef_idx(codec, 0x0c, 0x680);
3111 alc_write_coef_idx(codec, 0x0c, 0x480);
3114 static void alc269_fixup_quanta_mute(struct hda_codec *codec,
3115 const struct hda_fixup *fix, int action)
3117 struct alc_spec *spec = codec->spec;
3118 if (action != HDA_FIXUP_ACT_PROBE)
3120 spec->gen.automute_hook = alc269_quanta_automute;
3123 static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
3124 struct hda_jack_callback *jack)
3126 struct alc_spec *spec = codec->spec;
3129 snd_hda_gen_hp_automute(codec, jack);
3131 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
3133 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3136 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3140 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
3141 const struct hda_fixup *fix, int action)
3143 struct alc_spec *spec = codec->spec;
3144 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3145 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3146 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
3151 /* update mute-LED according to the speaker mute state via mic VREF pin */
3152 static void alc269_fixup_mic_mute_hook(void *private_data, int enabled)
3154 struct hda_codec *codec = private_data;
3155 struct alc_spec *spec = codec->spec;
3156 unsigned int pinval;
3158 if (spec->mute_led_polarity)
3160 pinval = snd_hda_codec_get_pin_target(codec, spec->mute_led_nid);
3161 pinval &= ~AC_PINCTL_VREFEN;
3162 pinval |= enabled ? AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80;
3163 if (spec->mute_led_nid)
3164 snd_hda_set_pin_ctl_cache(codec, spec->mute_led_nid, pinval);
3167 /* Make sure the led works even in runtime suspend */
3168 static unsigned int led_power_filter(struct hda_codec *codec,
3170 unsigned int power_state)
3172 struct alc_spec *spec = codec->spec;
3174 if (power_state != AC_PWRST_D3 || nid == 0 ||
3175 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
3178 /* Set pin ctl again, it might have just been set to 0 */
3179 snd_hda_set_pin_ctl(codec, nid,
3180 snd_hda_codec_get_pin_target(codec, nid));
3185 static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
3186 const struct hda_fixup *fix, int action)
3188 struct alc_spec *spec = codec->spec;
3189 const struct dmi_device *dev = NULL;
3191 if (action != HDA_FIXUP_ACT_PRE_PROBE)
3194 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
3196 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
3198 if (pin < 0x0a || pin >= 0x10)
3200 spec->mute_led_polarity = pol;
3201 spec->mute_led_nid = pin - 0x0a + 0x18;
3202 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3203 spec->gen.vmaster_mute_enum = 1;
3204 codec->power_filter = led_power_filter;
3206 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
3207 spec->mute_led_polarity);
3212 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
3213 const struct hda_fixup *fix, int action)
3215 struct alc_spec *spec = codec->spec;
3216 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3217 spec->mute_led_polarity = 0;
3218 spec->mute_led_nid = 0x18;
3219 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3220 spec->gen.vmaster_mute_enum = 1;
3221 codec->power_filter = led_power_filter;
3225 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
3226 const struct hda_fixup *fix, int action)
3228 struct alc_spec *spec = codec->spec;
3229 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3230 spec->mute_led_polarity = 0;
3231 spec->mute_led_nid = 0x19;
3232 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3233 spec->gen.vmaster_mute_enum = 1;
3234 codec->power_filter = led_power_filter;
3238 /* turn on/off mute LED per vmaster hook */
3239 static void alc269_fixup_hp_gpio_mute_hook(void *private_data, int enabled)
3241 struct hda_codec *codec = private_data;
3242 struct alc_spec *spec = codec->spec;
3243 unsigned int oldval = spec->gpio_led;
3246 spec->gpio_led &= ~0x08;
3248 spec->gpio_led |= 0x08;
3249 if (spec->gpio_led != oldval)
3250 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
3254 /* turn on/off mic-mute LED per capture hook */
3255 static void alc269_fixup_hp_gpio_mic_mute_hook(struct hda_codec *codec,
3256 struct snd_kcontrol *kcontrol,
3257 struct snd_ctl_elem_value *ucontrol)
3259 struct alc_spec *spec = codec->spec;
3260 unsigned int oldval = spec->gpio_led;
3265 if (ucontrol->value.integer.value[0] ||
3266 ucontrol->value.integer.value[1])
3267 spec->gpio_led &= ~0x10;
3269 spec->gpio_led |= 0x10;
3270 if (spec->gpio_led != oldval)
3271 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
3275 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
3276 const struct hda_fixup *fix, int action)
3278 struct alc_spec *spec = codec->spec;
3279 static const struct hda_verb gpio_init[] = {
3280 { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 },
3281 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 },
3285 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3286 spec->gen.vmaster_mute.hook = alc269_fixup_hp_gpio_mute_hook;
3287 spec->gen.cap_sync_hook = alc269_fixup_hp_gpio_mic_mute_hook;
3289 snd_hda_add_verbs(codec, gpio_init);
3293 /* turn on/off mic-mute LED per capture hook */
3294 static void alc269_fixup_hp_cap_mic_mute_hook(struct hda_codec *codec,
3295 struct snd_kcontrol *kcontrol,
3296 struct snd_ctl_elem_value *ucontrol)
3298 struct alc_spec *spec = codec->spec;
3299 unsigned int pinval, enable, disable;
3301 pinval = snd_hda_codec_get_pin_target(codec, spec->cap_mute_led_nid);
3302 pinval &= ~AC_PINCTL_VREFEN;
3303 enable = pinval | AC_PINCTL_VREF_80;
3304 disable = pinval | AC_PINCTL_VREF_HIZ;
3309 if (ucontrol->value.integer.value[0] ||
3310 ucontrol->value.integer.value[1])
3315 if (spec->cap_mute_led_nid)
3316 snd_hda_set_pin_ctl_cache(codec, spec->cap_mute_led_nid, pinval);
3319 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
3320 const struct hda_fixup *fix, int action)
3322 struct alc_spec *spec = codec->spec;
3323 static const struct hda_verb gpio_init[] = {
3324 { 0x01, AC_VERB_SET_GPIO_MASK, 0x08 },
3325 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x08 },
3329 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3330 spec->gen.vmaster_mute.hook = alc269_fixup_hp_gpio_mute_hook;
3331 spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook;
3333 spec->cap_mute_led_nid = 0x18;
3334 snd_hda_add_verbs(codec, gpio_init);
3335 codec->power_filter = led_power_filter;
3339 static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
3340 const struct hda_fixup *fix, int action)
3342 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to enable headphone amp */
3343 struct alc_spec *spec = codec->spec;
3344 static const struct hda_verb gpio_init[] = {
3345 { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 },
3346 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 },
3350 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3351 spec->gen.vmaster_mute.hook = alc269_fixup_hp_gpio_mute_hook;
3352 spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook;
3354 spec->cap_mute_led_nid = 0x18;
3355 snd_hda_add_verbs(codec, gpio_init);
3356 codec->power_filter = led_power_filter;
3360 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
3361 const struct hda_fixup *fix, int action)
3363 struct alc_spec *spec = codec->spec;
3365 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3366 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3367 spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook;
3368 spec->mute_led_polarity = 0;
3369 spec->mute_led_nid = 0x1a;
3370 spec->cap_mute_led_nid = 0x18;
3371 spec->gen.vmaster_mute_enum = 1;
3372 codec->power_filter = led_power_filter;
3376 static void alc_headset_mode_unplugged(struct hda_codec *codec)
3378 static struct coef_fw coef0255[] = {
3379 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
3380 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
3381 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
3382 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
3383 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
3386 static struct coef_fw coef0233[] = {
3387 WRITE_COEF(0x1b, 0x0c0b),
3388 WRITE_COEF(0x45, 0xc429),
3389 UPDATE_COEF(0x35, 0x4000, 0),
3390 WRITE_COEF(0x06, 0x2104),
3391 WRITE_COEF(0x1a, 0x0001),
3392 WRITE_COEF(0x26, 0x0004),
3393 WRITE_COEF(0x32, 0x42a3),
3396 static struct coef_fw coef0292[] = {
3397 WRITE_COEF(0x76, 0x000e),
3398 WRITE_COEF(0x6c, 0x2400),
3399 WRITE_COEF(0x18, 0x7308),
3400 WRITE_COEF(0x6b, 0xc429),
3403 static struct coef_fw coef0293[] = {
3404 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
3405 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
3406 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
3407 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
3408 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
3409 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
3412 static struct coef_fw coef0668[] = {
3413 WRITE_COEF(0x15, 0x0d40),
3414 WRITE_COEF(0xb7, 0x802b),
3418 switch (codec->vendor_id) {
3420 alc_process_coef_fw(codec, coef0255);
3424 alc_process_coef_fw(codec, coef0233);
3427 alc_process_coef_fw(codec, coef0292);
3430 alc_process_coef_fw(codec, coef0293);
3433 alc_process_coef_fw(codec, coef0668);
3436 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
3440 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
3443 static struct coef_fw coef0255[] = {
3444 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
3445 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
3448 static struct coef_fw coef0233[] = {
3449 UPDATE_COEF(0x35, 0, 1<<14),
3450 WRITE_COEF(0x06, 0x2100),
3451 WRITE_COEF(0x1a, 0x0021),
3452 WRITE_COEF(0x26, 0x008c),
3455 static struct coef_fw coef0292[] = {
3456 WRITE_COEF(0x19, 0xa208),
3457 WRITE_COEF(0x2e, 0xacf0),
3460 static struct coef_fw coef0293[] = {
3461 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
3462 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
3463 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
3466 static struct coef_fw coef0688[] = {
3467 WRITE_COEF(0xb7, 0x802b),
3468 WRITE_COEF(0xb5, 0x1040),
3469 UPDATE_COEF(0xc3, 0, 1<<12),
3473 switch (codec->vendor_id) {
3475 alc_write_coef_idx(codec, 0x45, 0xc489);
3476 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
3477 alc_process_coef_fw(codec, coef0255);
3478 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
3482 alc_write_coef_idx(codec, 0x45, 0xc429);
3483 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
3484 alc_process_coef_fw(codec, coef0233);
3485 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
3488 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
3489 alc_process_coef_fw(codec, coef0292);
3492 /* Set to TRS mode */
3493 alc_write_coef_idx(codec, 0x45, 0xc429);
3494 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
3495 alc_process_coef_fw(codec, coef0293);
3496 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
3499 alc_write_coef_idx(codec, 0x11, 0x0001);
3500 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
3501 alc_process_coef_fw(codec, coef0688);
3502 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
3505 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
3508 static void alc_headset_mode_default(struct hda_codec *codec)
3510 static struct coef_fw coef0255[] = {
3511 WRITE_COEF(0x45, 0xc089),
3512 WRITE_COEF(0x45, 0xc489),
3513 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
3514 WRITE_COEF(0x49, 0x0049),
3517 static struct coef_fw coef0233[] = {
3518 WRITE_COEF(0x06, 0x2100),
3519 WRITE_COEF(0x32, 0x4ea3),
3522 static struct coef_fw coef0292[] = {
3523 WRITE_COEF(0x76, 0x000e),
3524 WRITE_COEF(0x6c, 0x2400),
3525 WRITE_COEF(0x6b, 0xc429),
3526 WRITE_COEF(0x18, 0x7308),
3529 static struct coef_fw coef0293[] = {
3530 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
3531 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
3532 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
3535 static struct coef_fw coef0688[] = {
3536 WRITE_COEF(0x11, 0x0041),
3537 WRITE_COEF(0x15, 0x0d40),
3538 WRITE_COEF(0xb7, 0x802b),
3542 switch (codec->vendor_id) {
3544 alc_process_coef_fw(codec, coef0255);
3548 alc_process_coef_fw(codec, coef0233);
3551 alc_process_coef_fw(codec, coef0292);
3554 alc_process_coef_fw(codec, coef0293);
3557 alc_process_coef_fw(codec, coef0688);
3560 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
3564 static void alc_headset_mode_ctia(struct hda_codec *codec)
3566 static struct coef_fw coef0255[] = {
3567 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
3568 WRITE_COEF(0x1b, 0x0c2b),
3569 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
3572 static struct coef_fw coef0233[] = {
3573 WRITE_COEF(0x45, 0xd429),
3574 WRITE_COEF(0x1b, 0x0c2b),
3575 WRITE_COEF(0x32, 0x4ea3),
3578 static struct coef_fw coef0292[] = {
3579 WRITE_COEF(0x6b, 0xd429),
3580 WRITE_COEF(0x76, 0x0008),
3581 WRITE_COEF(0x18, 0x7388),
3584 static struct coef_fw coef0293[] = {
3585 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
3586 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
3589 static struct coef_fw coef0688[] = {
3590 WRITE_COEF(0x11, 0x0001),
3591 WRITE_COEF(0x15, 0x0d60),
3592 WRITE_COEF(0xc3, 0x0000),
3596 switch (codec->vendor_id) {
3598 alc_process_coef_fw(codec, coef0255);
3602 alc_process_coef_fw(codec, coef0233);
3605 alc_process_coef_fw(codec, coef0292);
3608 alc_process_coef_fw(codec, coef0293);
3611 alc_process_coef_fw(codec, coef0688);
3614 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
3618 static void alc_headset_mode_omtp(struct hda_codec *codec)
3620 static struct coef_fw coef0255[] = {
3621 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
3622 WRITE_COEF(0x1b, 0x0c2b),
3623 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
3626 static struct coef_fw coef0233[] = {
3627 WRITE_COEF(0x45, 0xe429),
3628 WRITE_COEF(0x1b, 0x0c2b),
3629 WRITE_COEF(0x32, 0x4ea3),
3632 static struct coef_fw coef0292[] = {
3633 WRITE_COEF(0x6b, 0xe429),
3634 WRITE_COEF(0x76, 0x0008),
3635 WRITE_COEF(0x18, 0x7388),
3638 static struct coef_fw coef0293[] = {
3639 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
3640 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
3643 static struct coef_fw coef0688[] = {
3644 WRITE_COEF(0x11, 0x0001),
3645 WRITE_COEF(0x15, 0x0d50),
3646 WRITE_COEF(0xc3, 0x0000),
3650 switch (codec->vendor_id) {
3652 alc_process_coef_fw(codec, coef0255);
3656 alc_process_coef_fw(codec, coef0233);
3659 alc_process_coef_fw(codec, coef0292);
3662 alc_process_coef_fw(codec, coef0293);
3665 alc_process_coef_fw(codec, coef0688);
3668 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
3671 static void alc_determine_headset_type(struct hda_codec *codec)
3674 bool is_ctia = false;
3675 struct alc_spec *spec = codec->spec;
3676 static struct coef_fw coef0255[] = {
3677 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
3678 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
3682 static struct coef_fw coef0293[] = {
3683 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
3684 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
3687 static struct coef_fw coef0688[] = {
3688 WRITE_COEF(0x11, 0x0001),
3689 WRITE_COEF(0xb7, 0x802b),
3690 WRITE_COEF(0x15, 0x0d60),
3691 WRITE_COEF(0xc3, 0x0c00),
3695 switch (codec->vendor_id) {
3697 alc_process_coef_fw(codec, coef0255);
3699 val = alc_read_coef_idx(codec, 0x46);
3700 is_ctia = (val & 0x0070) == 0x0070;
3704 alc_write_coef_idx(codec, 0x45, 0xd029);
3706 val = alc_read_coef_idx(codec, 0x46);
3707 is_ctia = (val & 0x0070) == 0x0070;
3710 alc_write_coef_idx(codec, 0x6b, 0xd429);
3712 val = alc_read_coef_idx(codec, 0x6c);
3713 is_ctia = (val & 0x001c) == 0x001c;
3716 alc_process_coef_fw(codec, coef0293);
3718 val = alc_read_coef_idx(codec, 0x46);
3719 is_ctia = (val & 0x0070) == 0x0070;
3722 alc_process_coef_fw(codec, coef0688);
3724 val = alc_read_coef_idx(codec, 0xbe);
3725 is_ctia = (val & 0x1c02) == 0x1c02;
3729 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
3730 is_ctia ? "yes" : "no");
3731 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
3734 static void alc_update_headset_mode(struct hda_codec *codec)
3736 struct alc_spec *spec = codec->spec;
3738 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
3739 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3741 int new_headset_mode;
3743 if (!snd_hda_jack_detect(codec, hp_pin))
3744 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
3745 else if (mux_pin == spec->headset_mic_pin)
3746 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
3747 else if (mux_pin == spec->headphone_mic_pin)
3748 new_headset_mode = ALC_HEADSET_MODE_MIC;
3750 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
3752 if (new_headset_mode == spec->current_headset_mode) {
3753 snd_hda_gen_update_outputs(codec);
3757 switch (new_headset_mode) {
3758 case ALC_HEADSET_MODE_UNPLUGGED:
3759 alc_headset_mode_unplugged(codec);
3760 spec->gen.hp_jack_present = false;
3762 case ALC_HEADSET_MODE_HEADSET:
3763 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
3764 alc_determine_headset_type(codec);
3765 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
3766 alc_headset_mode_ctia(codec);
3767 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
3768 alc_headset_mode_omtp(codec);
3769 spec->gen.hp_jack_present = true;
3771 case ALC_HEADSET_MODE_MIC:
3772 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
3773 spec->gen.hp_jack_present = false;
3775 case ALC_HEADSET_MODE_HEADPHONE:
3776 alc_headset_mode_default(codec);
3777 spec->gen.hp_jack_present = true;
3780 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
3781 snd_hda_set_pin_ctl_cache(codec, hp_pin,
3782 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
3783 if (spec->headphone_mic_pin)
3784 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
3787 spec->current_headset_mode = new_headset_mode;
3789 snd_hda_gen_update_outputs(codec);
3792 static void alc_update_headset_mode_hook(struct hda_codec *codec,
3793 struct snd_kcontrol *kcontrol,
3794 struct snd_ctl_elem_value *ucontrol)
3796 alc_update_headset_mode(codec);
3799 static void alc_update_headset_jack_cb(struct hda_codec *codec,
3800 struct hda_jack_callback *jack)
3802 struct alc_spec *spec = codec->spec;
3803 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
3804 snd_hda_gen_hp_automute(codec, jack);
3807 static void alc_probe_headset_mode(struct hda_codec *codec)
3810 struct alc_spec *spec = codec->spec;
3811 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
3814 for (i = 0; i < cfg->num_inputs; i++) {
3815 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
3816 spec->headset_mic_pin = cfg->inputs[i].pin;
3817 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
3818 spec->headphone_mic_pin = cfg->inputs[i].pin;
3821 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
3822 spec->gen.automute_hook = alc_update_headset_mode;
3823 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
3826 static void alc_fixup_headset_mode(struct hda_codec *codec,
3827 const struct hda_fixup *fix, int action)
3829 struct alc_spec *spec = codec->spec;
3832 case HDA_FIXUP_ACT_PRE_PROBE:
3833 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
3835 case HDA_FIXUP_ACT_PROBE:
3836 alc_probe_headset_mode(codec);
3838 case HDA_FIXUP_ACT_INIT:
3839 spec->current_headset_mode = 0;
3840 alc_update_headset_mode(codec);
3845 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
3846 const struct hda_fixup *fix, int action)
3848 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3849 struct alc_spec *spec = codec->spec;
3850 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3853 alc_fixup_headset_mode(codec, fix, action);
3856 static void alc255_set_default_jack_type(struct hda_codec *codec)
3858 /* Set to iphone type */
3859 static struct coef_fw fw[] = {
3860 WRITE_COEF(0x1b, 0x880b),
3861 WRITE_COEF(0x45, 0xd089),
3862 WRITE_COEF(0x1b, 0x080b),
3863 WRITE_COEF(0x46, 0x0004),
3864 WRITE_COEF(0x1b, 0x0c0b),
3867 alc_process_coef_fw(codec, fw);
3871 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
3872 const struct hda_fixup *fix, int action)
3874 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3875 alc255_set_default_jack_type(codec);
3877 alc_fixup_headset_mode(codec, fix, action);
3880 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
3881 const struct hda_fixup *fix, int action)
3883 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3884 struct alc_spec *spec = codec->spec;
3885 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3886 alc255_set_default_jack_type(codec);
3889 alc_fixup_headset_mode(codec, fix, action);
3892 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
3893 const struct hda_fixup *fix, int action)
3895 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3896 struct alc_spec *spec = codec->spec;
3897 spec->gen.auto_mute_via_amp = 1;
3901 static void alc_no_shutup(struct hda_codec *codec)
3905 static void alc_fixup_no_shutup(struct hda_codec *codec,
3906 const struct hda_fixup *fix, int action)
3908 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3909 struct alc_spec *spec = codec->spec;
3910 spec->shutup = alc_no_shutup;
3914 static void alc_fixup_disable_aamix(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 /* Disable AA-loopback as it causes white noise */
3920 spec->gen.mixer_nid = 0;
3924 static unsigned int alc_power_filter_xps13(struct hda_codec *codec,
3926 unsigned int power_state)
3928 struct alc_spec *spec = codec->spec;
3930 /* Avoid pop noises when headphones are plugged in */
3931 if (spec->gen.hp_jack_present)
3932 if (nid == codec->afg || nid == 0x02 || nid == 0x15)
3937 static void alc_fixup_dell_xps13(struct hda_codec *codec,
3938 const struct hda_fixup *fix, int action)
3940 if (action == HDA_FIXUP_ACT_PROBE) {
3941 struct alc_spec *spec = codec->spec;
3942 struct hda_input_mux *imux = &spec->gen.input_mux;
3945 spec->shutup = alc_no_shutup;
3946 codec->power_filter = alc_power_filter_xps13;
3948 /* Make the internal mic the default input source. */
3949 for (i = 0; i < imux->num_items; i++) {
3950 if (spec->gen.imux_pins[i] == 0x12) {
3951 spec->gen.cur_mux[0] = i;
3958 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
3959 const struct hda_fixup *fix, int action)
3961 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3962 alc_write_coef_idx(codec, 0xc4, 0x8000);
3963 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
3964 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
3966 alc_fixup_headset_mode(codec, fix, action);
3969 /* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
3970 static int find_ext_mic_pin(struct hda_codec *codec)
3972 struct alc_spec *spec = codec->spec;
3973 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
3975 unsigned int defcfg;
3978 for (i = 0; i < cfg->num_inputs; i++) {
3979 if (cfg->inputs[i].type != AUTO_PIN_MIC)
3981 nid = cfg->inputs[i].pin;
3982 defcfg = snd_hda_codec_get_pincfg(codec, nid);
3983 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
3991 static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
3992 const struct hda_fixup *fix,
3995 struct alc_spec *spec = codec->spec;
3997 if (action == HDA_FIXUP_ACT_PROBE) {
3998 int mic_pin = find_ext_mic_pin(codec);
3999 int hp_pin = spec->gen.autocfg.hp_pins[0];
4001 if (snd_BUG_ON(!mic_pin || !hp_pin))
4003 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
4007 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
4008 const struct hda_fixup *fix,
4011 struct alc_spec *spec = codec->spec;
4012 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
4015 /* The mic boosts on level 2 and 3 are too noisy
4016 on the internal mic input.
4017 Therefore limit the boost to 0 or 1. */
4019 if (action != HDA_FIXUP_ACT_PROBE)
4022 for (i = 0; i < cfg->num_inputs; i++) {
4023 hda_nid_t nid = cfg->inputs[i].pin;
4024 unsigned int defcfg;
4025 if (cfg->inputs[i].type != AUTO_PIN_MIC)
4027 defcfg = snd_hda_codec_get_pincfg(codec, nid);
4028 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
4031 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
4032 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
4033 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
4034 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
4035 (0 << AC_AMPCAP_MUTE_SHIFT));
4039 static void alc283_hp_automute_hook(struct hda_codec *codec,
4040 struct hda_jack_callback *jack)
4042 struct alc_spec *spec = codec->spec;
4046 snd_hda_gen_hp_automute(codec, jack);
4048 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4051 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4055 static void alc283_fixup_chromebook(struct hda_codec *codec,
4056 const struct hda_fixup *fix, int action)
4058 struct alc_spec *spec = codec->spec;
4061 case HDA_FIXUP_ACT_PRE_PROBE:
4062 snd_hda_override_wcaps(codec, 0x03, 0);
4063 /* Disable AA-loopback as it causes white noise */
4064 spec->gen.mixer_nid = 0;
4066 case HDA_FIXUP_ACT_INIT:
4067 /* MIC2-VREF control */
4068 /* Set to manual mode */
4069 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
4070 /* Enable Line1 input control by verb */
4071 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
4076 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
4077 const struct hda_fixup *fix, int action)
4079 struct alc_spec *spec = codec->spec;
4082 case HDA_FIXUP_ACT_PRE_PROBE:
4083 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
4085 case HDA_FIXUP_ACT_INIT:
4086 /* MIC2-VREF control */
4087 /* Set to manual mode */
4088 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
4093 /* mute tablet speaker pin (0x14) via dock plugging in addition */
4094 static void asus_tx300_automute(struct hda_codec *codec)
4096 struct alc_spec *spec = codec->spec;
4097 snd_hda_gen_update_outputs(codec);
4098 if (snd_hda_jack_detect(codec, 0x1b))
4099 spec->gen.mute_bits |= (1ULL << 0x14);
4102 static void alc282_fixup_asus_tx300(struct hda_codec *codec,
4103 const struct hda_fixup *fix, int action)
4105 struct alc_spec *spec = codec->spec;
4106 /* TX300 needs to set up GPIO2 for the speaker amp */
4107 static const struct hda_verb gpio2_verbs[] = {
4108 { 0x01, AC_VERB_SET_GPIO_MASK, 0x04 },
4109 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04 },
4110 { 0x01, AC_VERB_SET_GPIO_DATA, 0x04 },
4113 static const struct hda_pintbl dock_pins[] = {
4114 { 0x1b, 0x21114000 }, /* dock speaker pin */
4117 struct snd_kcontrol *kctl;
4120 case HDA_FIXUP_ACT_PRE_PROBE:
4121 snd_hda_add_verbs(codec, gpio2_verbs);
4122 snd_hda_apply_pincfgs(codec, dock_pins);
4123 spec->gen.auto_mute_via_amp = 1;
4124 spec->gen.automute_hook = asus_tx300_automute;
4125 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4126 snd_hda_gen_hp_automute);
4128 case HDA_FIXUP_ACT_BUILD:
4129 /* this is a bit tricky; give more sane names for the main
4130 * (tablet) speaker and the dock speaker, respectively
4132 kctl = snd_hda_find_mixer_ctl(codec, "Speaker Playback Switch");
4134 strcpy(kctl->id.name, "Dock Speaker Playback Switch");
4135 kctl = snd_hda_find_mixer_ctl(codec, "Bass Speaker Playback Switch");
4137 strcpy(kctl->id.name, "Speaker Playback Switch");
4142 static void alc290_fixup_mono_speakers(struct hda_codec *codec,
4143 const struct hda_fixup *fix, int action)
4145 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4146 /* DAC node 0x03 is giving mono output. We therefore want to
4147 make sure 0x14 (front speaker) and 0x15 (headphones) use the
4148 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
4149 hda_nid_t conn1[2] = { 0x0c };
4150 snd_hda_override_conn_list(codec, 0x14, 1, conn1);
4151 snd_hda_override_conn_list(codec, 0x15, 1, conn1);
4155 /* for hda_fixup_thinkpad_acpi() */
4156 #include "thinkpad_helper.c"
4158 /* for dell wmi mic mute led */
4159 #include "dell_wmi_helper.c"
4162 ALC269_FIXUP_SONY_VAIO,
4163 ALC275_FIXUP_SONY_VAIO_GPIO2,
4164 ALC269_FIXUP_DELL_M101Z,
4165 ALC269_FIXUP_SKU_IGNORE,
4166 ALC269_FIXUP_ASUS_G73JW,
4167 ALC269_FIXUP_LENOVO_EAPD,
4168 ALC275_FIXUP_SONY_HWEQ,
4169 ALC275_FIXUP_SONY_DISABLE_AAMIX,
4171 ALC269_FIXUP_PCM_44K,
4172 ALC269_FIXUP_STEREO_DMIC,
4173 ALC269_FIXUP_HEADSET_MIC,
4174 ALC269_FIXUP_QUANTA_MUTE,
4175 ALC269_FIXUP_LIFEBOOK,
4176 ALC269_FIXUP_LIFEBOOK_EXTMIC,
4179 ALC269VB_FIXUP_AMIC,
4180 ALC269VB_FIXUP_DMIC,
4181 ALC269_FIXUP_HP_MUTE_LED,
4182 ALC269_FIXUP_HP_MUTE_LED_MIC1,
4183 ALC269_FIXUP_HP_MUTE_LED_MIC2,
4184 ALC269_FIXUP_HP_GPIO_LED,
4185 ALC269_FIXUP_HP_GPIO_MIC1_LED,
4186 ALC269_FIXUP_HP_LINE1_MIC1_LED,
4187 ALC269_FIXUP_INV_DMIC,
4188 ALC269_FIXUP_LENOVO_DOCK,
4189 ALC269_FIXUP_NO_SHUTUP,
4190 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
4191 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
4192 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
4193 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
4194 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
4195 ALC269_FIXUP_HEADSET_MODE,
4196 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
4197 ALC269_FIXUP_ASUS_X101_FUNC,
4198 ALC269_FIXUP_ASUS_X101_VERB,
4199 ALC269_FIXUP_ASUS_X101,
4200 ALC271_FIXUP_AMIC_MIC2,
4201 ALC271_FIXUP_HP_GATE_MIC_JACK,
4202 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
4203 ALC269_FIXUP_ACER_AC700,
4204 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
4205 ALC269VB_FIXUP_ASUS_ZENBOOK,
4206 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
4207 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
4208 ALC269VB_FIXUP_ORDISSIMO_EVE2,
4209 ALC283_FIXUP_CHROME_BOOK,
4210 ALC283_FIXUP_SENSE_COMBO_JACK,
4211 ALC282_FIXUP_ASUS_TX300,
4212 ALC283_FIXUP_INT_MIC,
4213 ALC290_FIXUP_MONO_SPEAKERS,
4214 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
4215 ALC290_FIXUP_SUBWOOFER,
4216 ALC290_FIXUP_SUBWOOFER_HSJACK,
4217 ALC269_FIXUP_THINKPAD_ACPI,
4218 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
4219 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
4220 ALC255_FIXUP_HEADSET_MODE,
4221 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
4222 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
4223 ALC292_FIXUP_TPT440_DOCK,
4224 ALC283_FIXUP_BXBT2807_MIC,
4225 ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED,
4226 ALC282_FIXUP_ASPIRE_V5_PINS,
4227 ALC280_FIXUP_HP_GPIO4,
4230 static const struct hda_fixup alc269_fixups[] = {
4231 [ALC269_FIXUP_SONY_VAIO] = {
4232 .type = HDA_FIXUP_PINCTLS,
4233 .v.pins = (const struct hda_pintbl[]) {
4234 {0x19, PIN_VREFGRD},
4238 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
4239 .type = HDA_FIXUP_VERBS,
4240 .v.verbs = (const struct hda_verb[]) {
4241 {0x01, AC_VERB_SET_GPIO_MASK, 0x04},
4242 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04},
4243 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4247 .chain_id = ALC269_FIXUP_SONY_VAIO
4249 [ALC269_FIXUP_DELL_M101Z] = {
4250 .type = HDA_FIXUP_VERBS,
4251 .v.verbs = (const struct hda_verb[]) {
4252 /* Enables internal speaker */
4253 {0x20, AC_VERB_SET_COEF_INDEX, 13},
4254 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
4258 [ALC269_FIXUP_SKU_IGNORE] = {
4259 .type = HDA_FIXUP_FUNC,
4260 .v.func = alc_fixup_sku_ignore,
4262 [ALC269_FIXUP_ASUS_G73JW] = {
4263 .type = HDA_FIXUP_PINS,
4264 .v.pins = (const struct hda_pintbl[]) {
4265 { 0x17, 0x99130111 }, /* subwoofer */
4269 [ALC269_FIXUP_LENOVO_EAPD] = {
4270 .type = HDA_FIXUP_VERBS,
4271 .v.verbs = (const struct hda_verb[]) {
4272 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
4276 [ALC275_FIXUP_SONY_HWEQ] = {
4277 .type = HDA_FIXUP_FUNC,
4278 .v.func = alc269_fixup_hweq,
4280 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
4282 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
4283 .type = HDA_FIXUP_FUNC,
4284 .v.func = alc_fixup_disable_aamix,
4286 .chain_id = ALC269_FIXUP_SONY_VAIO
4288 [ALC271_FIXUP_DMIC] = {
4289 .type = HDA_FIXUP_FUNC,
4290 .v.func = alc271_fixup_dmic,
4292 [ALC269_FIXUP_PCM_44K] = {
4293 .type = HDA_FIXUP_FUNC,
4294 .v.func = alc269_fixup_pcm_44k,
4296 .chain_id = ALC269_FIXUP_QUANTA_MUTE
4298 [ALC269_FIXUP_STEREO_DMIC] = {
4299 .type = HDA_FIXUP_FUNC,
4300 .v.func = alc269_fixup_stereo_dmic,
4302 [ALC269_FIXUP_HEADSET_MIC] = {
4303 .type = HDA_FIXUP_FUNC,
4304 .v.func = alc269_fixup_headset_mic,
4306 [ALC269_FIXUP_QUANTA_MUTE] = {
4307 .type = HDA_FIXUP_FUNC,
4308 .v.func = alc269_fixup_quanta_mute,
4310 [ALC269_FIXUP_LIFEBOOK] = {
4311 .type = HDA_FIXUP_PINS,
4312 .v.pins = (const struct hda_pintbl[]) {
4313 { 0x1a, 0x2101103f }, /* dock line-out */
4314 { 0x1b, 0x23a11040 }, /* dock mic-in */
4318 .chain_id = ALC269_FIXUP_QUANTA_MUTE
4320 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
4321 .type = HDA_FIXUP_PINS,
4322 .v.pins = (const struct hda_pintbl[]) {
4323 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
4327 [ALC269_FIXUP_AMIC] = {
4328 .type = HDA_FIXUP_PINS,
4329 .v.pins = (const struct hda_pintbl[]) {
4330 { 0x14, 0x99130110 }, /* speaker */
4331 { 0x15, 0x0121401f }, /* HP out */
4332 { 0x18, 0x01a19c20 }, /* mic */
4333 { 0x19, 0x99a3092f }, /* int-mic */
4337 [ALC269_FIXUP_DMIC] = {
4338 .type = HDA_FIXUP_PINS,
4339 .v.pins = (const struct hda_pintbl[]) {
4340 { 0x12, 0x99a3092f }, /* int-mic */
4341 { 0x14, 0x99130110 }, /* speaker */
4342 { 0x15, 0x0121401f }, /* HP out */
4343 { 0x18, 0x01a19c20 }, /* mic */
4347 [ALC269VB_FIXUP_AMIC] = {
4348 .type = HDA_FIXUP_PINS,
4349 .v.pins = (const struct hda_pintbl[]) {
4350 { 0x14, 0x99130110 }, /* speaker */
4351 { 0x18, 0x01a19c20 }, /* mic */
4352 { 0x19, 0x99a3092f }, /* int-mic */
4353 { 0x21, 0x0121401f }, /* HP out */
4357 [ALC269VB_FIXUP_DMIC] = {
4358 .type = HDA_FIXUP_PINS,
4359 .v.pins = (const struct hda_pintbl[]) {
4360 { 0x12, 0x99a3092f }, /* int-mic */
4361 { 0x14, 0x99130110 }, /* speaker */
4362 { 0x18, 0x01a19c20 }, /* mic */
4363 { 0x21, 0x0121401f }, /* HP out */
4367 [ALC269_FIXUP_HP_MUTE_LED] = {
4368 .type = HDA_FIXUP_FUNC,
4369 .v.func = alc269_fixup_hp_mute_led,
4371 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
4372 .type = HDA_FIXUP_FUNC,
4373 .v.func = alc269_fixup_hp_mute_led_mic1,
4375 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
4376 .type = HDA_FIXUP_FUNC,
4377 .v.func = alc269_fixup_hp_mute_led_mic2,
4379 [ALC269_FIXUP_HP_GPIO_LED] = {
4380 .type = HDA_FIXUP_FUNC,
4381 .v.func = alc269_fixup_hp_gpio_led,
4383 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
4384 .type = HDA_FIXUP_FUNC,
4385 .v.func = alc269_fixup_hp_gpio_mic1_led,
4387 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
4388 .type = HDA_FIXUP_FUNC,
4389 .v.func = alc269_fixup_hp_line1_mic1_led,
4391 [ALC269_FIXUP_INV_DMIC] = {
4392 .type = HDA_FIXUP_FUNC,
4393 .v.func = alc_fixup_inv_dmic,
4395 [ALC269_FIXUP_NO_SHUTUP] = {
4396 .type = HDA_FIXUP_FUNC,
4397 .v.func = alc_fixup_no_shutup,
4399 [ALC269_FIXUP_LENOVO_DOCK] = {
4400 .type = HDA_FIXUP_PINS,
4401 .v.pins = (const struct hda_pintbl[]) {
4402 { 0x19, 0x23a11040 }, /* dock mic */
4403 { 0x1b, 0x2121103f }, /* dock headphone */
4407 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
4409 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
4410 .type = HDA_FIXUP_FUNC,
4411 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
4413 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
4415 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
4416 .type = HDA_FIXUP_PINS,
4417 .v.pins = (const struct hda_pintbl[]) {
4418 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4419 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
4423 .chain_id = ALC269_FIXUP_HEADSET_MODE
4425 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
4426 .type = HDA_FIXUP_PINS,
4427 .v.pins = (const struct hda_pintbl[]) {
4428 { 0x16, 0x21014020 }, /* dock line out */
4429 { 0x19, 0x21a19030 }, /* dock mic */
4430 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4434 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
4436 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
4437 .type = HDA_FIXUP_PINS,
4438 .v.pins = (const struct hda_pintbl[]) {
4439 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4443 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
4445 [ALC269_FIXUP_HEADSET_MODE] = {
4446 .type = HDA_FIXUP_FUNC,
4447 .v.func = alc_fixup_headset_mode,
4449 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
4450 .type = HDA_FIXUP_FUNC,
4451 .v.func = alc_fixup_headset_mode_no_hp_mic,
4453 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
4454 .type = HDA_FIXUP_PINS,
4455 .v.pins = (const struct hda_pintbl[]) {
4456 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4460 .chain_id = ALC269_FIXUP_HEADSET_MIC
4462 [ALC269_FIXUP_ASUS_X101_FUNC] = {
4463 .type = HDA_FIXUP_FUNC,
4464 .v.func = alc269_fixup_x101_headset_mic,
4466 [ALC269_FIXUP_ASUS_X101_VERB] = {
4467 .type = HDA_FIXUP_VERBS,
4468 .v.verbs = (const struct hda_verb[]) {
4469 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4470 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
4471 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
4475 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
4477 [ALC269_FIXUP_ASUS_X101] = {
4478 .type = HDA_FIXUP_PINS,
4479 .v.pins = (const struct hda_pintbl[]) {
4480 { 0x18, 0x04a1182c }, /* Headset mic */
4484 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
4486 [ALC271_FIXUP_AMIC_MIC2] = {
4487 .type = HDA_FIXUP_PINS,
4488 .v.pins = (const struct hda_pintbl[]) {
4489 { 0x14, 0x99130110 }, /* speaker */
4490 { 0x19, 0x01a19c20 }, /* mic */
4491 { 0x1b, 0x99a7012f }, /* int-mic */
4492 { 0x21, 0x0121401f }, /* HP out */
4496 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
4497 .type = HDA_FIXUP_FUNC,
4498 .v.func = alc271_hp_gate_mic_jack,
4500 .chain_id = ALC271_FIXUP_AMIC_MIC2,
4502 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
4503 .type = HDA_FIXUP_FUNC,
4504 .v.func = alc269_fixup_limit_int_mic_boost,
4506 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
4508 [ALC269_FIXUP_ACER_AC700] = {
4509 .type = HDA_FIXUP_PINS,
4510 .v.pins = (const struct hda_pintbl[]) {
4511 { 0x12, 0x99a3092f }, /* int-mic */
4512 { 0x14, 0x99130110 }, /* speaker */
4513 { 0x18, 0x03a11c20 }, /* mic */
4514 { 0x1e, 0x0346101e }, /* SPDIF1 */
4515 { 0x21, 0x0321101f }, /* HP out */
4519 .chain_id = ALC271_FIXUP_DMIC,
4521 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
4522 .type = HDA_FIXUP_FUNC,
4523 .v.func = alc269_fixup_limit_int_mic_boost,
4525 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
4527 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
4528 .type = HDA_FIXUP_FUNC,
4529 .v.func = alc269_fixup_limit_int_mic_boost,
4531 .chain_id = ALC269VB_FIXUP_DMIC,
4533 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
4534 .type = HDA_FIXUP_VERBS,
4535 .v.verbs = (const struct hda_verb[]) {
4536 /* class-D output amp +5dB */
4537 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
4538 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
4542 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
4544 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
4545 .type = HDA_FIXUP_FUNC,
4546 .v.func = alc269_fixup_limit_int_mic_boost,
4548 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
4550 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
4551 .type = HDA_FIXUP_PINS,
4552 .v.pins = (const struct hda_pintbl[]) {
4553 { 0x12, 0x99a3092f }, /* int-mic */
4554 { 0x18, 0x03a11d20 }, /* mic */
4555 { 0x19, 0x411111f0 }, /* Unused bogus pin */
4559 [ALC283_FIXUP_CHROME_BOOK] = {
4560 .type = HDA_FIXUP_FUNC,
4561 .v.func = alc283_fixup_chromebook,
4563 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
4564 .type = HDA_FIXUP_FUNC,
4565 .v.func = alc283_fixup_sense_combo_jack,
4567 .chain_id = ALC283_FIXUP_CHROME_BOOK,
4569 [ALC282_FIXUP_ASUS_TX300] = {
4570 .type = HDA_FIXUP_FUNC,
4571 .v.func = alc282_fixup_asus_tx300,
4573 [ALC283_FIXUP_INT_MIC] = {
4574 .type = HDA_FIXUP_VERBS,
4575 .v.verbs = (const struct hda_verb[]) {
4576 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
4577 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
4581 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
4583 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
4584 .type = HDA_FIXUP_PINS,
4585 .v.pins = (const struct hda_pintbl[]) {
4586 { 0x17, 0x90170112 }, /* subwoofer */
4590 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
4592 [ALC290_FIXUP_SUBWOOFER] = {
4593 .type = HDA_FIXUP_PINS,
4594 .v.pins = (const struct hda_pintbl[]) {
4595 { 0x17, 0x90170112 }, /* subwoofer */
4599 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
4601 [ALC290_FIXUP_MONO_SPEAKERS] = {
4602 .type = HDA_FIXUP_FUNC,
4603 .v.func = alc290_fixup_mono_speakers,
4605 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
4606 .type = HDA_FIXUP_FUNC,
4607 .v.func = alc290_fixup_mono_speakers,
4609 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
4611 [ALC269_FIXUP_THINKPAD_ACPI] = {
4612 .type = HDA_FIXUP_FUNC,
4613 .v.func = hda_fixup_thinkpad_acpi,
4615 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
4616 .type = HDA_FIXUP_PINS,
4617 .v.pins = (const struct hda_pintbl[]) {
4618 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4619 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
4623 .chain_id = ALC255_FIXUP_HEADSET_MODE
4625 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
4626 .type = HDA_FIXUP_PINS,
4627 .v.pins = (const struct hda_pintbl[]) {
4628 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4632 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
4634 [ALC255_FIXUP_HEADSET_MODE] = {
4635 .type = HDA_FIXUP_FUNC,
4636 .v.func = alc_fixup_headset_mode_alc255,
4638 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
4639 .type = HDA_FIXUP_FUNC,
4640 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
4642 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
4643 .type = HDA_FIXUP_PINS,
4644 .v.pins = (const struct hda_pintbl[]) {
4645 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
4646 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4650 .chain_id = ALC269_FIXUP_HEADSET_MODE
4652 [ALC292_FIXUP_TPT440_DOCK] = {
4653 .type = HDA_FIXUP_PINS,
4654 .v.pins = (const struct hda_pintbl[]) {
4655 { 0x16, 0x21211010 }, /* dock headphone */
4656 { 0x19, 0x21a11010 }, /* dock mic */
4660 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
4662 [ALC283_FIXUP_BXBT2807_MIC] = {
4663 .type = HDA_FIXUP_PINS,
4664 .v.pins = (const struct hda_pintbl[]) {
4665 { 0x19, 0x04a110f0 },
4669 [ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED] = {
4670 .type = HDA_FIXUP_FUNC,
4671 .v.func = alc_fixup_dell_wmi,
4672 .chained_before = true,
4673 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
4675 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
4676 .type = HDA_FIXUP_PINS,
4677 .v.pins = (const struct hda_pintbl[]) {
4678 { 0x12, 0x90a60130 },
4679 { 0x14, 0x90170110 },
4680 { 0x17, 0x40000008 },
4681 { 0x18, 0x411111f0 },
4682 { 0x19, 0x411111f0 },
4683 { 0x1a, 0x411111f0 },
4684 { 0x1b, 0x411111f0 },
4685 { 0x1d, 0x40f89b2d },
4686 { 0x1e, 0x411111f0 },
4687 { 0x21, 0x0321101f },
4691 [ALC280_FIXUP_HP_GPIO4] = {
4692 .type = HDA_FIXUP_FUNC,
4693 .v.func = alc280_fixup_hp_gpio4,
4697 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
4698 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
4699 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
4700 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
4701 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
4702 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
4703 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
4704 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
4705 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
4706 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
4707 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
4708 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4709 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4710 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4711 SND_PCI_QUIRK(0x1028, 0x0610, "Dell", ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED),
4712 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
4713 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
4714 SND_PCI_QUIRK(0x1028, 0x061f, "Dell", ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED),
4715 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
4716 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
4717 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
4718 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
4719 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
4720 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
4721 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
4722 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
4724 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4725 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4726 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4727 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4728 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4729 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4730 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4731 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4732 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4733 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4734 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4735 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4736 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4737 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4738 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4739 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4740 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4741 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4743 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4744 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4745 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4746 SND_PCI_QUIRK(0x103c, 0x2246, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4747 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4748 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4749 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4750 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4751 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4752 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4753 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4754 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4755 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4756 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4757 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4758 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4759 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4760 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4761 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4762 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4763 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4764 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4765 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4766 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4767 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4768 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4769 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4770 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4771 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4772 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4773 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
4774 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4775 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4776 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
4777 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
4778 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
4779 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
4780 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
4781 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4782 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
4783 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
4784 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
4785 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
4786 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
4787 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
4788 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
4789 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
4790 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
4791 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
4792 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
4793 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
4794 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
4795 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
4796 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_BXBT2807_MIC),
4797 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
4798 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
4799 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
4800 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
4801 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
4802 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK),
4803 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
4804 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
4805 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
4806 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
4807 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
4808 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440_DOCK),
4809 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
4810 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
4811 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
4812 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
4813 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4814 SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP),
4815 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4816 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
4817 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
4818 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4819 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4820 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
4821 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
4822 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
4825 /* Below is a quirk table taken from the old code.
4826 * Basically the device should work as is without the fixup table.
4827 * If BIOS doesn't give a proper info, enable the corresponding
4830 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
4832 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
4833 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
4834 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
4835 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
4836 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
4837 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
4838 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
4839 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
4840 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
4841 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
4842 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
4843 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
4844 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
4845 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
4846 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
4847 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
4848 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
4849 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
4850 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
4851 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
4852 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
4853 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
4854 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
4855 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
4856 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
4857 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
4858 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
4859 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
4860 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
4861 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
4862 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
4863 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
4864 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
4865 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
4866 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
4867 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
4868 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
4869 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
4870 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
4875 static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
4876 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
4877 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
4878 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
4879 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
4883 static const struct hda_model_fixup alc269_fixup_models[] = {
4884 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
4885 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
4886 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
4887 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
4888 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
4889 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
4890 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
4891 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
4892 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
4893 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
4894 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
4895 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
4896 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
4900 #define ALC255_STANDARD_PINS \
4901 {0x18, 0x411111f0}, \
4902 {0x19, 0x411111f0}, \
4903 {0x1a, 0x411111f0}, \
4904 {0x1b, 0x411111f0}, \
4907 #define ALC282_STANDARD_PINS \
4908 {0x14, 0x90170110}, \
4909 {0x18, 0x411111f0}, \
4910 {0x1a, 0x411111f0}, \
4911 {0x1b, 0x411111f0}, \
4914 #define ALC290_STANDARD_PINS \
4915 {0x12, 0x99a30130}, \
4916 {0x13, 0x40000000}, \
4917 {0x16, 0x411111f0}, \
4918 {0x17, 0x411111f0}, \
4919 {0x19, 0x411111f0}, \
4920 {0x1b, 0x411111f0}, \
4923 #define ALC292_STANDARD_PINS \
4924 {0x14, 0x90170110}, \
4925 {0x15, 0x0221401f}, \
4926 {0x1a, 0x411111f0}, \
4927 {0x1b, 0x411111f0}, \
4928 {0x1d, 0x40700001}, \
4931 static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
4932 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
4933 ALC255_STANDARD_PINS,
4938 {0x21, 0x02211020}),
4939 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
4940 ALC255_STANDARD_PINS,
4945 {0x21, 0x02211020}),
4946 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
4947 ALC255_STANDARD_PINS,
4952 {0x21, 0x02211030}),
4953 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
4963 {0x21, 0x0321102f}),
4964 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
4965 ALC255_STANDARD_PINS,
4970 {0x21, 0x02211040}),
4971 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
4972 ALC255_STANDARD_PINS,
4977 {0x21, 0x02211050}),
4978 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
4979 ALC255_STANDARD_PINS,
4984 {0x21, 0x02211030}),
4985 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
4986 ALC255_STANDARD_PINS,
4991 {0x21, 0x02211040}),
4992 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
5004 {0x1e, 0x411111f0}),
5005 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
5017 {0x1e, 0x411111f0}),
5018 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
5019 ALC282_STANDARD_PINS,
5024 {0x21, 0x0321101f}),
5025 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
5026 ALC282_STANDARD_PINS,
5031 {0x21, 0x03211040}),
5032 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
5033 ALC282_STANDARD_PINS,
5038 {0x21, 0x03211020}),
5039 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
5040 ALC282_STANDARD_PINS,
5045 {0x21, 0x03211020}),
5046 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
5047 ALC282_STANDARD_PINS,
5052 {0x21, 0x0421101f}),
5053 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
5054 ALC282_STANDARD_PINS,
5059 {0x21, 0x04211020}),
5060 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
5061 ALC282_STANDARD_PINS,
5066 {0x21, 0x04211020}),
5067 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
5068 ALC282_STANDARD_PINS,
5073 {0x21, 0x0321101f}),
5074 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
5084 {0x21, 0x02211030}),
5085 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
5086 ALC282_STANDARD_PINS,
5091 {0x21, 0x0321101f}),
5092 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
5093 ALC290_STANDARD_PINS,
5098 {0x1d, 0x4075812d}),
5099 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
5100 ALC290_STANDARD_PINS,
5105 {0x1d, 0x4075812d}),
5106 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
5107 ALC290_STANDARD_PINS,
5112 {0x1d, 0x4075812d}),
5113 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
5114 ALC290_STANDARD_PINS,
5119 {0x1d, 0x4076a12d}),
5120 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
5121 ALC290_STANDARD_PINS,
5126 {0x1d, 0x4076a12d}),
5127 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
5128 ALC290_STANDARD_PINS,
5133 {0x1d, 0x4076a12d}),
5134 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
5135 ALC290_STANDARD_PINS,
5140 {0x1d, 0x4075812d}),
5141 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
5142 ALC292_STANDARD_PINS,
5147 {0x19, 0x01a19030}),
5148 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
5149 ALC292_STANDARD_PINS,
5154 {0x19, 0x01a1903e}),
5155 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
5156 ALC292_STANDARD_PINS,
5161 {0x19, 0x411111f0}),
5162 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
5163 ALC292_STANDARD_PINS,
5168 {0x19, 0x21a19030}),
5169 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
5170 ALC292_STANDARD_PINS,
5175 {0x19, 0x411111f0}),
5179 static void alc269_fill_coef(struct hda_codec *codec)
5181 struct alc_spec *spec = codec->spec;
5184 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
5187 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
5188 alc_write_coef_idx(codec, 0xf, 0x960b);
5189 alc_write_coef_idx(codec, 0xe, 0x8817);
5192 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
5193 alc_write_coef_idx(codec, 0xf, 0x960b);
5194 alc_write_coef_idx(codec, 0xe, 0x8814);
5197 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
5198 /* Power up output pin */
5199 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
5202 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
5203 val = alc_read_coef_idx(codec, 0xd);
5204 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
5205 /* Capless ramp up clock control */
5206 alc_write_coef_idx(codec, 0xd, val | (1<<10));
5208 val = alc_read_coef_idx(codec, 0x17);
5209 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
5210 /* Class D power on reset */
5211 alc_write_coef_idx(codec, 0x17, val | (1<<7));
5216 alc_update_coef_idx(codec, 0xd, 0, 1<<14);
5219 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
5224 static int patch_alc269(struct hda_codec *codec)
5226 struct alc_spec *spec;
5229 err = alc_alloc_spec(codec, 0x0b);
5234 spec->gen.shared_mic_vref_pin = 0x18;
5236 snd_hda_pick_fixup(codec, alc269_fixup_models,
5237 alc269_fixup_tbl, alc269_fixups);
5238 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups);
5239 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
5241 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
5243 alc_auto_parse_customize_define(codec);
5245 if (has_cdefine_beep(codec))
5246 spec->gen.beep_nid = 0x01;
5248 switch (codec->vendor_id) {
5250 spec->codec_variant = ALC269_TYPE_ALC269VA;
5251 switch (alc_get_coef0(codec) & 0x00f0) {
5253 if (codec->bus->pci &&
5254 codec->bus->pci->subsystem_vendor == 0x1025 &&
5255 spec->cdefine.platform_type == 1)
5256 err = alc_codec_rename(codec, "ALC271X");
5257 spec->codec_variant = ALC269_TYPE_ALC269VB;
5260 if (codec->bus->pci &&
5261 codec->bus->pci->subsystem_vendor == 0x17aa &&
5262 codec->bus->pci->subsystem_device == 0x21f3)
5263 err = alc_codec_rename(codec, "ALC3202");
5264 spec->codec_variant = ALC269_TYPE_ALC269VC;
5267 spec->codec_variant = ALC269_TYPE_ALC269VD;
5270 alc_fix_pll_init(codec, 0x20, 0x04, 15);
5274 spec->init_hook = alc269_fill_coef;
5275 alc269_fill_coef(codec);
5280 spec->codec_variant = ALC269_TYPE_ALC280;
5283 spec->codec_variant = ALC269_TYPE_ALC282;
5284 spec->shutup = alc282_shutup;
5285 spec->init_hook = alc282_init;
5289 spec->codec_variant = ALC269_TYPE_ALC283;
5290 spec->shutup = alc283_shutup;
5291 spec->init_hook = alc283_init;
5295 spec->codec_variant = ALC269_TYPE_ALC284;
5299 spec->codec_variant = ALC269_TYPE_ALC285;
5303 spec->codec_variant = ALC269_TYPE_ALC286;
5304 spec->shutup = alc286_shutup;
5307 spec->codec_variant = ALC269_TYPE_ALC255;
5311 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
5312 spec->has_alc5505_dsp = 1;
5313 spec->init_hook = alc5505_dsp_init;
5316 /* automatic parse from the BIOS config */
5317 err = alc269_parse_auto_config(codec);
5321 if (!spec->gen.no_analog && spec->gen.beep_nid)
5322 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
5324 codec->patch_ops = alc_patch_ops;
5326 codec->patch_ops.suspend = alc269_suspend;
5327 codec->patch_ops.resume = alc269_resume;
5330 spec->shutup = alc269_shutup;
5332 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
5345 static int alc861_parse_auto_config(struct hda_codec *codec)
5347 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
5348 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
5349 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
5352 /* Pin config fixes */
5354 ALC861_FIXUP_FSC_AMILO_PI1505,
5355 ALC861_FIXUP_AMP_VREF_0F,
5356 ALC861_FIXUP_NO_JACK_DETECT,
5357 ALC861_FIXUP_ASUS_A6RP,
5358 ALC660_FIXUP_ASUS_W7J,
5361 /* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
5362 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
5363 const struct hda_fixup *fix, int action)
5365 struct alc_spec *spec = codec->spec;
5368 if (action != HDA_FIXUP_ACT_INIT)
5370 val = snd_hda_codec_get_pin_target(codec, 0x0f);
5371 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
5372 val |= AC_PINCTL_IN_EN;
5373 val |= AC_PINCTL_VREF_50;
5374 snd_hda_set_pin_ctl(codec, 0x0f, val);
5375 spec->gen.keep_vref_in_automute = 1;
5378 /* suppress the jack-detection */
5379 static void alc_fixup_no_jack_detect(struct hda_codec *codec,
5380 const struct hda_fixup *fix, int action)
5382 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5383 codec->no_jack_detect = 1;
5386 static const struct hda_fixup alc861_fixups[] = {
5387 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
5388 .type = HDA_FIXUP_PINS,
5389 .v.pins = (const struct hda_pintbl[]) {
5390 { 0x0b, 0x0221101f }, /* HP */
5391 { 0x0f, 0x90170310 }, /* speaker */
5395 [ALC861_FIXUP_AMP_VREF_0F] = {
5396 .type = HDA_FIXUP_FUNC,
5397 .v.func = alc861_fixup_asus_amp_vref_0f,
5399 [ALC861_FIXUP_NO_JACK_DETECT] = {
5400 .type = HDA_FIXUP_FUNC,
5401 .v.func = alc_fixup_no_jack_detect,
5403 [ALC861_FIXUP_ASUS_A6RP] = {
5404 .type = HDA_FIXUP_FUNC,
5405 .v.func = alc861_fixup_asus_amp_vref_0f,
5407 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
5409 [ALC660_FIXUP_ASUS_W7J] = {
5410 .type = HDA_FIXUP_VERBS,
5411 .v.verbs = (const struct hda_verb[]) {
5412 /* ASUS W7J needs a magic pin setup on unused NID 0x10
5413 * for enabling outputs
5415 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5421 static const struct snd_pci_quirk alc861_fixup_tbl[] = {
5422 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
5423 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
5424 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
5425 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
5426 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
5427 SND_PCI_QUIRK(0x1584, 0x2b01, "Haier W18", ALC861_FIXUP_AMP_VREF_0F),
5428 SND_PCI_QUIRK(0x1584, 0x0000, "Uniwill ECS M31EI", ALC861_FIXUP_AMP_VREF_0F),
5429 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
5435 static int patch_alc861(struct hda_codec *codec)
5437 struct alc_spec *spec;
5440 err = alc_alloc_spec(codec, 0x15);
5445 spec->gen.beep_nid = 0x23;
5447 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
5448 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
5450 /* automatic parse from the BIOS config */
5451 err = alc861_parse_auto_config(codec);
5455 if (!spec->gen.no_analog)
5456 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
5458 codec->patch_ops = alc_patch_ops;
5460 spec->power_hook = alc_power_eapd;
5463 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
5477 * In addition, an independent DAC
5479 static int alc861vd_parse_auto_config(struct hda_codec *codec)
5481 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
5482 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
5483 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
5487 ALC660VD_FIX_ASUS_GPIO1,
5488 ALC861VD_FIX_DALLAS,
5491 /* exclude VREF80 */
5492 static void alc861vd_fixup_dallas(struct hda_codec *codec,
5493 const struct hda_fixup *fix, int action)
5495 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5496 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
5497 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
5501 static const struct hda_fixup alc861vd_fixups[] = {
5502 [ALC660VD_FIX_ASUS_GPIO1] = {
5503 .type = HDA_FIXUP_VERBS,
5504 .v.verbs = (const struct hda_verb[]) {
5506 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
5507 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5508 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5512 [ALC861VD_FIX_DALLAS] = {
5513 .type = HDA_FIXUP_FUNC,
5514 .v.func = alc861vd_fixup_dallas,
5518 static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
5519 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
5520 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
5521 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
5527 static int patch_alc861vd(struct hda_codec *codec)
5529 struct alc_spec *spec;
5532 err = alc_alloc_spec(codec, 0x0b);
5537 spec->gen.beep_nid = 0x23;
5539 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
5540 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
5542 /* automatic parse from the BIOS config */
5543 err = alc861vd_parse_auto_config(codec);
5547 if (!spec->gen.no_analog)
5548 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5550 codec->patch_ops = alc_patch_ops;
5552 spec->shutup = alc_eapd_shutup;
5554 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
5566 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
5567 * configuration. Each pin widget can choose any input DACs and a mixer.
5568 * Each ADC is connected from a mixer of all inputs. This makes possible
5569 * 6-channel independent captures.
5571 * In addition, an independent DAC for the multi-playback (not used in this
5576 * BIOS auto configuration
5579 static int alc662_parse_auto_config(struct hda_codec *codec)
5581 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
5582 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
5583 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
5584 const hda_nid_t *ssids;
5586 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
5587 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670 ||
5588 codec->vendor_id == 0x10ec0671)
5589 ssids = alc663_ssids;
5591 ssids = alc662_ssids;
5592 return alc_parse_auto_config(codec, alc662_ignore, ssids);
5595 static void alc272_fixup_mario(struct hda_codec *codec,
5596 const struct hda_fixup *fix, int action)
5598 if (action != HDA_FIXUP_ACT_PRE_PROBE)
5600 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
5601 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
5602 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
5603 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
5604 (0 << AC_AMPCAP_MUTE_SHIFT)))
5605 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
5608 static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
5610 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
5612 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
5613 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
5617 /* override the 2.1 chmap */
5618 static void alc_fixup_bass_chmap(struct hda_codec *codec,
5619 const struct hda_fixup *fix, int action)
5621 if (action == HDA_FIXUP_ACT_BUILD) {
5622 struct alc_spec *spec = codec->spec;
5623 spec->gen.pcm_rec[0].stream[0].chmap = asus_pcm_2_1_chmaps;
5627 /* turn on/off mute LED per vmaster hook */
5628 static void alc662_led_gpio1_mute_hook(void *private_data, int enabled)
5630 struct hda_codec *codec = private_data;
5631 struct alc_spec *spec = codec->spec;
5632 unsigned int oldval = spec->gpio_led;
5635 spec->gpio_led |= 0x01;
5637 spec->gpio_led &= ~0x01;
5638 if (spec->gpio_led != oldval)
5639 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
5643 /* avoid D3 for keeping GPIO up */
5644 static unsigned int gpio_led_power_filter(struct hda_codec *codec,
5646 unsigned int power_state)
5648 struct alc_spec *spec = codec->spec;
5649 if (nid == codec->afg && power_state == AC_PWRST_D3 && spec->gpio_led)
5654 static void alc662_fixup_led_gpio1(struct hda_codec *codec,
5655 const struct hda_fixup *fix, int action)
5657 struct alc_spec *spec = codec->spec;
5658 static const struct hda_verb gpio_init[] = {
5659 { 0x01, AC_VERB_SET_GPIO_MASK, 0x01 },
5660 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01 },
5664 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5665 spec->gen.vmaster_mute.hook = alc662_led_gpio1_mute_hook;
5667 snd_hda_add_verbs(codec, gpio_init);
5668 codec->power_filter = gpio_led_power_filter;
5672 static struct coef_fw alc668_coefs[] = {
5673 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
5674 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
5675 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
5676 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
5677 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
5678 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
5679 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
5680 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
5681 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
5682 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
5683 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
5684 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
5685 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
5686 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
5687 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
5688 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
5689 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
5690 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
5691 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
5692 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
5696 static void alc668_restore_default_value(struct hda_codec *codec)
5698 alc_process_coef_fw(codec, alc668_coefs);
5702 ALC662_FIXUP_ASPIRE,
5703 ALC662_FIXUP_LED_GPIO1,
5704 ALC662_FIXUP_IDEAPAD,
5706 ALC662_FIXUP_CZC_P10T,
5707 ALC662_FIXUP_SKU_IGNORE,
5708 ALC662_FIXUP_HP_RP5800,
5709 ALC662_FIXUP_ASUS_MODE1,
5710 ALC662_FIXUP_ASUS_MODE2,
5711 ALC662_FIXUP_ASUS_MODE3,
5712 ALC662_FIXUP_ASUS_MODE4,
5713 ALC662_FIXUP_ASUS_MODE5,
5714 ALC662_FIXUP_ASUS_MODE6,
5715 ALC662_FIXUP_ASUS_MODE7,
5716 ALC662_FIXUP_ASUS_MODE8,
5717 ALC662_FIXUP_NO_JACK_DETECT,
5718 ALC662_FIXUP_ZOTAC_Z68,
5719 ALC662_FIXUP_INV_DMIC,
5720 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
5721 ALC668_FIXUP_HEADSET_MODE,
5722 ALC662_FIXUP_BASS_MODE4_CHMAP,
5723 ALC662_FIXUP_BASS_16,
5724 ALC662_FIXUP_BASS_1A,
5725 ALC662_FIXUP_BASS_CHMAP,
5726 ALC668_FIXUP_AUTO_MUTE,
5727 ALC668_FIXUP_DELL_DISABLE_AAMIX,
5728 ALC668_FIXUP_DELL_XPS13,
5731 static const struct hda_fixup alc662_fixups[] = {
5732 [ALC662_FIXUP_ASPIRE] = {
5733 .type = HDA_FIXUP_PINS,
5734 .v.pins = (const struct hda_pintbl[]) {
5735 { 0x15, 0x99130112 }, /* subwoofer */
5739 [ALC662_FIXUP_LED_GPIO1] = {
5740 .type = HDA_FIXUP_FUNC,
5741 .v.func = alc662_fixup_led_gpio1,
5743 [ALC662_FIXUP_IDEAPAD] = {
5744 .type = HDA_FIXUP_PINS,
5745 .v.pins = (const struct hda_pintbl[]) {
5746 { 0x17, 0x99130112 }, /* subwoofer */
5750 .chain_id = ALC662_FIXUP_LED_GPIO1,
5752 [ALC272_FIXUP_MARIO] = {
5753 .type = HDA_FIXUP_FUNC,
5754 .v.func = alc272_fixup_mario,
5756 [ALC662_FIXUP_CZC_P10T] = {
5757 .type = HDA_FIXUP_VERBS,
5758 .v.verbs = (const struct hda_verb[]) {
5759 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
5763 [ALC662_FIXUP_SKU_IGNORE] = {
5764 .type = HDA_FIXUP_FUNC,
5765 .v.func = alc_fixup_sku_ignore,
5767 [ALC662_FIXUP_HP_RP5800] = {
5768 .type = HDA_FIXUP_PINS,
5769 .v.pins = (const struct hda_pintbl[]) {
5770 { 0x14, 0x0221201f }, /* HP out */
5774 .chain_id = ALC662_FIXUP_SKU_IGNORE
5776 [ALC662_FIXUP_ASUS_MODE1] = {
5777 .type = HDA_FIXUP_PINS,
5778 .v.pins = (const struct hda_pintbl[]) {
5779 { 0x14, 0x99130110 }, /* speaker */
5780 { 0x18, 0x01a19c20 }, /* mic */
5781 { 0x19, 0x99a3092f }, /* int-mic */
5782 { 0x21, 0x0121401f }, /* HP out */
5786 .chain_id = ALC662_FIXUP_SKU_IGNORE
5788 [ALC662_FIXUP_ASUS_MODE2] = {
5789 .type = HDA_FIXUP_PINS,
5790 .v.pins = (const struct hda_pintbl[]) {
5791 { 0x14, 0x99130110 }, /* speaker */
5792 { 0x18, 0x01a19820 }, /* mic */
5793 { 0x19, 0x99a3092f }, /* int-mic */
5794 { 0x1b, 0x0121401f }, /* HP out */
5798 .chain_id = ALC662_FIXUP_SKU_IGNORE
5800 [ALC662_FIXUP_ASUS_MODE3] = {
5801 .type = HDA_FIXUP_PINS,
5802 .v.pins = (const struct hda_pintbl[]) {
5803 { 0x14, 0x99130110 }, /* speaker */
5804 { 0x15, 0x0121441f }, /* HP */
5805 { 0x18, 0x01a19840 }, /* mic */
5806 { 0x19, 0x99a3094f }, /* int-mic */
5807 { 0x21, 0x01211420 }, /* HP2 */
5811 .chain_id = ALC662_FIXUP_SKU_IGNORE
5813 [ALC662_FIXUP_ASUS_MODE4] = {
5814 .type = HDA_FIXUP_PINS,
5815 .v.pins = (const struct hda_pintbl[]) {
5816 { 0x14, 0x99130110 }, /* speaker */
5817 { 0x16, 0x99130111 }, /* speaker */
5818 { 0x18, 0x01a19840 }, /* mic */
5819 { 0x19, 0x99a3094f }, /* int-mic */
5820 { 0x21, 0x0121441f }, /* HP */
5824 .chain_id = ALC662_FIXUP_SKU_IGNORE
5826 [ALC662_FIXUP_ASUS_MODE5] = {
5827 .type = HDA_FIXUP_PINS,
5828 .v.pins = (const struct hda_pintbl[]) {
5829 { 0x14, 0x99130110 }, /* speaker */
5830 { 0x15, 0x0121441f }, /* HP */
5831 { 0x16, 0x99130111 }, /* speaker */
5832 { 0x18, 0x01a19840 }, /* mic */
5833 { 0x19, 0x99a3094f }, /* int-mic */
5837 .chain_id = ALC662_FIXUP_SKU_IGNORE
5839 [ALC662_FIXUP_ASUS_MODE6] = {
5840 .type = HDA_FIXUP_PINS,
5841 .v.pins = (const struct hda_pintbl[]) {
5842 { 0x14, 0x99130110 }, /* speaker */
5843 { 0x15, 0x01211420 }, /* HP2 */
5844 { 0x18, 0x01a19840 }, /* mic */
5845 { 0x19, 0x99a3094f }, /* int-mic */
5846 { 0x1b, 0x0121441f }, /* HP */
5850 .chain_id = ALC662_FIXUP_SKU_IGNORE
5852 [ALC662_FIXUP_ASUS_MODE7] = {
5853 .type = HDA_FIXUP_PINS,
5854 .v.pins = (const struct hda_pintbl[]) {
5855 { 0x14, 0x99130110 }, /* speaker */
5856 { 0x17, 0x99130111 }, /* speaker */
5857 { 0x18, 0x01a19840 }, /* mic */
5858 { 0x19, 0x99a3094f }, /* int-mic */
5859 { 0x1b, 0x01214020 }, /* HP */
5860 { 0x21, 0x0121401f }, /* HP */
5864 .chain_id = ALC662_FIXUP_SKU_IGNORE
5866 [ALC662_FIXUP_ASUS_MODE8] = {
5867 .type = HDA_FIXUP_PINS,
5868 .v.pins = (const struct hda_pintbl[]) {
5869 { 0x14, 0x99130110 }, /* speaker */
5870 { 0x12, 0x99a30970 }, /* int-mic */
5871 { 0x15, 0x01214020 }, /* HP */
5872 { 0x17, 0x99130111 }, /* speaker */
5873 { 0x18, 0x01a19840 }, /* mic */
5874 { 0x21, 0x0121401f }, /* HP */
5878 .chain_id = ALC662_FIXUP_SKU_IGNORE
5880 [ALC662_FIXUP_NO_JACK_DETECT] = {
5881 .type = HDA_FIXUP_FUNC,
5882 .v.func = alc_fixup_no_jack_detect,
5884 [ALC662_FIXUP_ZOTAC_Z68] = {
5885 .type = HDA_FIXUP_PINS,
5886 .v.pins = (const struct hda_pintbl[]) {
5887 { 0x1b, 0x02214020 }, /* Front HP */
5891 [ALC662_FIXUP_INV_DMIC] = {
5892 .type = HDA_FIXUP_FUNC,
5893 .v.func = alc_fixup_inv_dmic,
5895 [ALC668_FIXUP_DELL_XPS13] = {
5896 .type = HDA_FIXUP_FUNC,
5897 .v.func = alc_fixup_dell_xps13,
5899 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
5901 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
5902 .type = HDA_FIXUP_FUNC,
5903 .v.func = alc_fixup_disable_aamix,
5905 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
5907 [ALC668_FIXUP_AUTO_MUTE] = {
5908 .type = HDA_FIXUP_FUNC,
5909 .v.func = alc_fixup_auto_mute_via_amp,
5911 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
5913 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
5914 .type = HDA_FIXUP_PINS,
5915 .v.pins = (const struct hda_pintbl[]) {
5916 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
5917 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
5921 .chain_id = ALC668_FIXUP_HEADSET_MODE
5923 [ALC668_FIXUP_HEADSET_MODE] = {
5924 .type = HDA_FIXUP_FUNC,
5925 .v.func = alc_fixup_headset_mode_alc668,
5927 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
5928 .type = HDA_FIXUP_FUNC,
5929 .v.func = alc_fixup_bass_chmap,
5931 .chain_id = ALC662_FIXUP_ASUS_MODE4
5933 [ALC662_FIXUP_BASS_16] = {
5934 .type = HDA_FIXUP_PINS,
5935 .v.pins = (const struct hda_pintbl[]) {
5936 {0x16, 0x80106111}, /* bass speaker */
5940 .chain_id = ALC662_FIXUP_BASS_CHMAP,
5942 [ALC662_FIXUP_BASS_1A] = {
5943 .type = HDA_FIXUP_PINS,
5944 .v.pins = (const struct hda_pintbl[]) {
5945 {0x1a, 0x80106111}, /* bass speaker */
5949 .chain_id = ALC662_FIXUP_BASS_CHMAP,
5951 [ALC662_FIXUP_BASS_CHMAP] = {
5952 .type = HDA_FIXUP_FUNC,
5953 .v.func = alc_fixup_bass_chmap,
5957 static const struct snd_pci_quirk alc662_fixup_tbl[] = {
5958 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
5959 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
5960 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
5961 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
5962 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
5963 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
5964 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
5965 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
5966 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
5967 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
5968 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
5969 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
5970 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
5971 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
5972 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
5973 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
5974 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
5975 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_BASS_1A),
5976 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
5977 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
5978 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
5979 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
5980 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
5981 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
5982 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
5983 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
5984 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
5985 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
5986 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
5989 /* Below is a quirk table taken from the old code.
5990 * Basically the device should work as is without the fixup table.
5991 * If BIOS doesn't give a proper info, enable the corresponding
5994 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
5995 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
5996 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
5997 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
5998 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
5999 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6000 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
6001 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
6002 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
6003 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6004 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
6005 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
6006 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
6007 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
6008 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
6009 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6010 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
6011 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
6012 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6013 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
6014 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
6015 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6016 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
6017 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
6018 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
6019 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6020 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
6021 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
6022 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6023 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
6024 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6025 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6026 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
6027 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
6028 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
6029 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
6030 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
6031 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
6032 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
6033 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6034 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
6035 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
6036 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
6037 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
6038 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
6039 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
6040 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
6041 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
6042 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
6043 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
6048 static const struct hda_model_fixup alc662_fixup_models[] = {
6049 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
6050 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
6051 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
6052 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
6053 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
6054 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
6055 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
6056 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
6057 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
6058 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
6059 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
6063 static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
6064 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
6075 {0x1f, 0x411111f0}),
6076 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
6087 {0x1f, 0x411111f0}),
6088 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
6099 {0x1f, 0x411111f0}),
6100 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
6111 {0x1f, 0x411111f0}),
6112 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
6123 {0x1f, 0x411111f0}),
6127 static void alc662_fill_coef(struct hda_codec *codec)
6131 coef = alc_get_coef0(codec);
6133 switch (codec->vendor_id) {
6135 if ((coef & 0x00f0) == 0x0030)
6136 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
6145 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
6152 static int patch_alc662(struct hda_codec *codec)
6154 struct alc_spec *spec;
6157 err = alc_alloc_spec(codec, 0x0b);
6163 /* handle multiple HPs as is */
6164 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
6166 alc_fix_pll_init(codec, 0x20, 0x04, 15);
6168 switch (codec->vendor_id) {
6170 spec->init_hook = alc668_restore_default_value;
6173 spec->init_hook = alc662_fill_coef;
6174 alc662_fill_coef(codec);
6178 snd_hda_pick_fixup(codec, alc662_fixup_models,
6179 alc662_fixup_tbl, alc662_fixups);
6180 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups);
6181 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
6183 alc_auto_parse_customize_define(codec);
6185 if (has_cdefine_beep(codec))
6186 spec->gen.beep_nid = 0x01;
6188 if ((alc_get_coef0(codec) & (1 << 14)) &&
6189 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
6190 spec->cdefine.platform_type == 1) {
6191 err = alc_codec_rename(codec, "ALC272X");
6196 /* automatic parse from the BIOS config */
6197 err = alc662_parse_auto_config(codec);
6201 if (!spec->gen.no_analog && spec->gen.beep_nid) {
6202 switch (codec->vendor_id) {
6204 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
6210 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
6213 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
6218 codec->patch_ops = alc_patch_ops;
6219 spec->shutup = alc_eapd_shutup;
6221 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
6234 static int alc680_parse_auto_config(struct hda_codec *codec)
6236 return alc_parse_auto_config(codec, NULL, NULL);
6241 static int patch_alc680(struct hda_codec *codec)
6245 /* ALC680 has no aa-loopback mixer */
6246 err = alc_alloc_spec(codec, 0);
6250 /* automatic parse from the BIOS config */
6251 err = alc680_parse_auto_config(codec);
6257 codec->patch_ops = alc_patch_ops;
6265 static const struct hda_codec_preset snd_hda_preset_realtek[] = {
6266 { .id = 0x10ec0221, .name = "ALC221", .patch = patch_alc269 },
6267 { .id = 0x10ec0231, .name = "ALC231", .patch = patch_alc269 },
6268 { .id = 0x10ec0233, .name = "ALC233", .patch = patch_alc269 },
6269 { .id = 0x10ec0235, .name = "ALC233", .patch = patch_alc269 },
6270 { .id = 0x10ec0255, .name = "ALC255", .patch = patch_alc269 },
6271 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
6272 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
6273 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
6274 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
6275 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
6276 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
6277 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
6278 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
6279 { .id = 0x10ec0276, .name = "ALC276", .patch = patch_alc269 },
6280 { .id = 0x10ec0280, .name = "ALC280", .patch = patch_alc269 },
6281 { .id = 0x10ec0282, .name = "ALC282", .patch = patch_alc269 },
6282 { .id = 0x10ec0283, .name = "ALC283", .patch = patch_alc269 },
6283 { .id = 0x10ec0284, .name = "ALC284", .patch = patch_alc269 },
6284 { .id = 0x10ec0285, .name = "ALC285", .patch = patch_alc269 },
6285 { .id = 0x10ec0286, .name = "ALC286", .patch = patch_alc269 },
6286 { .id = 0x10ec0288, .name = "ALC288", .patch = patch_alc269 },
6287 { .id = 0x10ec0290, .name = "ALC290", .patch = patch_alc269 },
6288 { .id = 0x10ec0292, .name = "ALC292", .patch = patch_alc269 },
6289 { .id = 0x10ec0293, .name = "ALC293", .patch = patch_alc269 },
6290 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
6291 .patch = patch_alc861 },
6292 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
6293 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
6294 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
6295 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
6296 .patch = patch_alc882 },
6297 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
6298 .patch = patch_alc662 },
6299 { .id = 0x10ec0662, .rev = 0x100300, .name = "ALC662 rev3",
6300 .patch = patch_alc662 },
6301 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
6302 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
6303 { .id = 0x10ec0667, .name = "ALC667", .patch = patch_alc662 },
6304 { .id = 0x10ec0668, .name = "ALC668", .patch = patch_alc662 },
6305 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
6306 { .id = 0x10ec0671, .name = "ALC671", .patch = patch_alc662 },
6307 { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
6308 { .id = 0x10ec0867, .name = "ALC891", .patch = patch_alc882 },
6309 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
6310 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
6311 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
6312 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
6313 .patch = patch_alc882 },
6314 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
6315 .patch = patch_alc882 },
6316 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
6317 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
6318 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
6319 .patch = patch_alc882 },
6320 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc882 },
6321 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
6322 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
6323 { .id = 0x10ec0899, .name = "ALC898", .patch = patch_alc882 },
6324 { .id = 0x10ec0900, .name = "ALC1150", .patch = patch_alc882 },
6328 MODULE_ALIAS("snd-hda-codec-id:10ec*");
6330 MODULE_LICENSE("GPL");
6331 MODULE_DESCRIPTION("Realtek HD-audio codec");
6333 static struct hda_codec_preset_list realtek_list = {
6334 .preset = snd_hda_preset_realtek,
6335 .owner = THIS_MODULE,
6338 static int __init patch_realtek_init(void)
6340 return snd_hda_add_codec_preset(&realtek_list);
6343 static void __exit patch_realtek_exit(void)
6345 snd_hda_delete_codec_preset(&realtek_list);
6348 module_init(patch_realtek_init)
6349 module_exit(patch_realtek_exit)