2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for Realtek ALC codecs
6 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
8 * Takashi Iwai <tiwai@suse.de>
9 * Jonathan Woithe <jwoithe@just42.net>
11 * This driver is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <linux/dmi.h>
31 #include <linux/module.h>
32 #include <linux/input.h>
33 #include <sound/core.h>
34 #include <sound/jack.h>
35 #include "hda_codec.h"
36 #include "hda_local.h"
37 #include "hda_auto_parser.h"
39 #include "hda_generic.h"
41 /* keep halting ALC5505 DSP, for power saving */
42 #define HALT_REALTEK_ALC5505
45 #define GPIO_MASK 0x03
47 /* extra amp-initialization sequence types */
57 ALC_HEADSET_MODE_UNKNOWN,
58 ALC_HEADSET_MODE_UNPLUGGED,
59 ALC_HEADSET_MODE_HEADSET,
61 ALC_HEADSET_MODE_HEADPHONE,
65 ALC_HEADSET_TYPE_UNKNOWN,
66 ALC_HEADSET_TYPE_CTIA,
67 ALC_HEADSET_TYPE_OMTP,
71 ALC_KEY_MICMUTE_INDEX,
74 struct alc_customize_define {
76 unsigned char port_connectivity;
77 unsigned char check_sum;
78 unsigned char customization;
79 unsigned char external_amp;
80 unsigned int enable_pcbeep:1;
81 unsigned int platform_type:1;
83 unsigned int override:1;
84 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
88 struct hda_gen_spec gen; /* must be at head */
90 /* codec parameterization */
91 const struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
92 unsigned int num_mixers;
93 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
95 struct alc_customize_define cdefine;
96 unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
98 /* mute LED for HP laptops, see alc269_fixup_mic_mute_hook() */
99 int mute_led_polarity;
100 hda_nid_t mute_led_nid;
101 hda_nid_t cap_mute_led_nid;
103 unsigned int gpio_led; /* used for alc269_fixup_hp_gpio_led() */
104 unsigned int gpio_mute_led_mask;
105 unsigned int gpio_mic_led_mask;
107 hda_nid_t headset_mic_pin;
108 hda_nid_t headphone_mic_pin;
109 int current_headset_mode;
110 int current_headset_type;
113 void (*init_hook)(struct hda_codec *codec);
115 void (*power_hook)(struct hda_codec *codec);
117 void (*shutup)(struct hda_codec *codec);
118 void (*reboot_notify)(struct hda_codec *codec);
121 int codec_variant; /* flag for other variants */
122 unsigned int has_alc5505_dsp:1;
123 unsigned int no_depop_delay:1;
127 unsigned int pll_coef_idx, pll_coef_bit;
129 struct input_dev *kb_dev;
130 u8 alc_mute_keycode_map[1];
134 * COEF access helper functions
137 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
138 unsigned int coef_idx)
142 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
143 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
147 #define alc_read_coef_idx(codec, coef_idx) \
148 alc_read_coefex_idx(codec, 0x20, coef_idx)
150 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
151 unsigned int coef_idx, unsigned int coef_val)
153 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
154 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
157 #define alc_write_coef_idx(codec, coef_idx, coef_val) \
158 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
160 static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
161 unsigned int coef_idx, unsigned int mask,
162 unsigned int bits_set)
164 unsigned int val = alc_read_coefex_idx(codec, nid, coef_idx);
167 alc_write_coefex_idx(codec, nid, coef_idx,
168 (val & ~mask) | bits_set);
171 #define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
172 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
174 /* a special bypass for COEF 0; read the cached value at the second time */
175 static unsigned int alc_get_coef0(struct hda_codec *codec)
177 struct alc_spec *spec = codec->spec;
180 spec->coef0 = alc_read_coef_idx(codec, 0);
184 /* coef writes/updates batch */
192 #define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
193 { .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
194 #define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
195 #define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
196 #define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
198 static void alc_process_coef_fw(struct hda_codec *codec,
199 const struct coef_fw *fw)
201 for (; fw->nid; fw++) {
202 if (fw->mask == (unsigned short)-1)
203 alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
205 alc_update_coefex_idx(codec, fw->nid, fw->idx,
211 * Append the given mixer and verb elements for the later use
212 * The mixer array is referred in build_controls(), and init_verbs are
215 static void add_mixer(struct alc_spec *spec, const struct snd_kcontrol_new *mix)
217 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
219 spec->mixers[spec->num_mixers++] = mix;
223 * GPIO setup tables, used in initialization
225 /* Enable GPIO mask and set output */
226 static const struct hda_verb alc_gpio1_init_verbs[] = {
227 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
228 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
229 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
233 static const struct hda_verb alc_gpio2_init_verbs[] = {
234 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
235 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
236 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
240 static const struct hda_verb alc_gpio3_init_verbs[] = {
241 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
242 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
243 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
248 * Fix hardware PLL issue
249 * On some codecs, the analog PLL gating control must be off while
250 * the default value is 1.
252 static void alc_fix_pll(struct hda_codec *codec)
254 struct alc_spec *spec = codec->spec;
257 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
258 1 << spec->pll_coef_bit, 0);
261 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
262 unsigned int coef_idx, unsigned int coef_bit)
264 struct alc_spec *spec = codec->spec;
266 spec->pll_coef_idx = coef_idx;
267 spec->pll_coef_bit = coef_bit;
271 /* update the master volume per volume-knob's unsol event */
272 static void alc_update_knob_master(struct hda_codec *codec,
273 struct hda_jack_callback *jack)
276 struct snd_kcontrol *kctl;
277 struct snd_ctl_elem_value *uctl;
279 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
282 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
285 val = snd_hda_codec_read(codec, jack->nid, 0,
286 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
287 val &= HDA_AMP_VOLMASK;
288 uctl->value.integer.value[0] = val;
289 uctl->value.integer.value[1] = val;
290 kctl->put(kctl, uctl);
294 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
296 /* For some reason, the res given from ALC880 is broken.
297 Here we adjust it properly. */
298 snd_hda_jack_unsol_event(codec, res >> 2);
301 /* Change EAPD to verb control */
302 static void alc_fill_eapd_coef(struct hda_codec *codec)
306 coef = alc_get_coef0(codec);
308 switch (codec->core.vendor_id) {
310 alc_update_coef_idx(codec, 0x7, 0, 1<<5);
314 alc_update_coef_idx(codec, 0x7, 0, 1<<13);
317 if ((coef & 0x00f0) == 0x0010)
318 alc_update_coef_idx(codec, 0xd, 0, 1<<14);
319 if ((coef & 0x00f0) == 0x0020)
320 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
321 if ((coef & 0x00f0) == 0x0030)
322 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
328 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
341 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
345 alc_write_coef_idx(codec, 0x36, 0x5757);
346 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
350 alc_update_coef_idx(codec, 0xa, 1<<13, 0);
358 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
361 if ((coef & 0x00f0) == 0x0030)
362 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
371 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
374 alc_update_coef_idx(codec, 0x7, 3<<13, 0);
377 alc_update_coef_idx(codec, 0x4, 1<<10, 0);
380 if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
381 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
385 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
389 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
394 /* additional initialization for ALC888 variants */
395 static void alc888_coef_init(struct hda_codec *codec)
397 switch (alc_get_coef0(codec) & 0x00f0) {
402 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
407 /* turn on/off EAPD control (only if available) */
408 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
410 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
412 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
413 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
417 /* turn on/off EAPD controls of the codec */
418 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
420 /* We currently only handle front, HP */
421 static hda_nid_t pins[] = {
422 0x0f, 0x10, 0x14, 0x15, 0x17, 0
425 for (p = pins; *p; p++)
426 set_eapd(codec, *p, on);
429 /* generic shutup callback;
430 * just turning off EPAD and a little pause for avoiding pop-noise
432 static void alc_eapd_shutup(struct hda_codec *codec)
434 struct alc_spec *spec = codec->spec;
436 alc_auto_setup_eapd(codec, false);
437 if (!spec->no_depop_delay)
439 snd_hda_shutup_pins(codec);
442 /* generic EAPD initialization */
443 static void alc_auto_init_amp(struct hda_codec *codec, int type)
445 alc_fill_eapd_coef(codec);
446 alc_auto_setup_eapd(codec, true);
449 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
452 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
455 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
457 case ALC_INIT_DEFAULT:
458 switch (codec->core.vendor_id) {
460 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
466 alc_update_coef_idx(codec, 7, 0, 0x2030);
469 alc888_coef_init(codec);
478 * Realtek SSID verification
481 /* Could be any non-zero and even value. When used as fixup, tells
482 * the driver to ignore any present sku defines.
484 #define ALC_FIXUP_SKU_IGNORE (2)
486 static void alc_fixup_sku_ignore(struct hda_codec *codec,
487 const struct hda_fixup *fix, int action)
489 struct alc_spec *spec = codec->spec;
490 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
491 spec->cdefine.fixup = 1;
492 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
496 static void alc_fixup_no_depop_delay(struct hda_codec *codec,
497 const struct hda_fixup *fix, int action)
499 struct alc_spec *spec = codec->spec;
501 if (action == HDA_FIXUP_ACT_PROBE) {
502 spec->no_depop_delay = 1;
503 codec->depop_delay = 0;
507 static int alc_auto_parse_customize_define(struct hda_codec *codec)
509 unsigned int ass, tmp, i;
511 struct alc_spec *spec = codec->spec;
513 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
515 if (spec->cdefine.fixup) {
516 ass = spec->cdefine.sku_cfg;
517 if (ass == ALC_FIXUP_SKU_IGNORE)
522 if (!codec->bus->pci)
524 ass = codec->core.subsystem_id & 0xffff;
525 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
529 if (codec->core.vendor_id == 0x10ec0260)
531 ass = snd_hda_codec_get_pincfg(codec, nid);
534 codec_info(codec, "%s: SKU not ready 0x%08x\n",
535 codec->core.chip_name, ass);
541 for (i = 1; i < 16; i++) {
545 if (((ass >> 16) & 0xf) != tmp)
548 spec->cdefine.port_connectivity = ass >> 30;
549 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
550 spec->cdefine.check_sum = (ass >> 16) & 0xf;
551 spec->cdefine.customization = ass >> 8;
553 spec->cdefine.sku_cfg = ass;
554 spec->cdefine.external_amp = (ass & 0x38) >> 3;
555 spec->cdefine.platform_type = (ass & 0x4) >> 2;
556 spec->cdefine.swap = (ass & 0x2) >> 1;
557 spec->cdefine.override = ass & 0x1;
559 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
560 nid, spec->cdefine.sku_cfg);
561 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
562 spec->cdefine.port_connectivity);
563 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
564 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
565 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
566 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
567 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
568 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
569 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
574 /* return the position of NID in the list, or -1 if not found */
575 static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
578 for (i = 0; i < nums; i++)
583 /* return true if the given NID is found in the list */
584 static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
586 return find_idx_in_nid_list(nid, list, nums) >= 0;
589 /* check subsystem ID and set up device-specific initialization;
590 * return 1 if initialized, 0 if invalid SSID
592 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
593 * 31 ~ 16 : Manufacture ID
595 * 7 ~ 0 : Assembly ID
596 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
598 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
600 unsigned int ass, tmp, i;
602 struct alc_spec *spec = codec->spec;
604 if (spec->cdefine.fixup) {
605 ass = spec->cdefine.sku_cfg;
606 if (ass == ALC_FIXUP_SKU_IGNORE)
611 ass = codec->core.subsystem_id & 0xffff;
612 if (codec->bus->pci &&
613 ass != codec->bus->pci->subsystem_device && (ass & 1))
616 /* invalid SSID, check the special NID pin defcfg instead */
618 * 31~30 : port connectivity
621 * 19~16 : Check sum (15:1)
626 if (codec->core.vendor_id == 0x10ec0260)
628 ass = snd_hda_codec_get_pincfg(codec, nid);
630 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
634 if ((ass >> 30) != 1) /* no physical connection */
639 for (i = 1; i < 16; i++) {
643 if (((ass >> 16) & 0xf) != tmp)
646 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
647 ass & 0xffff, codec->core.vendor_id);
651 * 2 : 0 --> Desktop, 1 --> Laptop
652 * 3~5 : External Amplifier control
655 tmp = (ass & 0x38) >> 3; /* external Amp control */
658 spec->init_amp = ALC_INIT_GPIO1;
661 spec->init_amp = ALC_INIT_GPIO2;
664 spec->init_amp = ALC_INIT_GPIO3;
668 spec->init_amp = ALC_INIT_DEFAULT;
672 /* is laptop or Desktop and enable the function "Mute internal speaker
673 * when the external headphone out jack is plugged"
678 * 10~8 : Jack location
679 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
681 * 15 : 1 --> enable the function "Mute internal speaker
682 * when the external headphone out jack is plugged"
684 if (!spec->gen.autocfg.hp_pins[0] &&
685 !(spec->gen.autocfg.line_out_pins[0] &&
686 spec->gen.autocfg.line_out_type == AUTO_PIN_HP_OUT)) {
688 tmp = (ass >> 11) & 0x3; /* HP to chassis */
690 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
691 spec->gen.autocfg.line_outs))
693 spec->gen.autocfg.hp_pins[0] = nid;
698 /* Check the validity of ALC subsystem-id
699 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
700 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
702 if (!alc_subsystem_id(codec, ports)) {
703 struct alc_spec *spec = codec->spec;
705 "realtek: Enable default setup for auto mode as fallback\n");
706 spec->init_amp = ALC_INIT_DEFAULT;
713 static void alc_fixup_inv_dmic(struct hda_codec *codec,
714 const struct hda_fixup *fix, int action)
716 struct alc_spec *spec = codec->spec;
718 spec->gen.inv_dmic_split = 1;
722 #ifdef CONFIG_SND_HDA_INPUT_BEEP
723 /* additional beep mixers; the actual parameters are overwritten at build */
724 static const struct snd_kcontrol_new alc_beep_mixer[] = {
725 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
726 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
731 static int alc_build_controls(struct hda_codec *codec)
733 struct alc_spec *spec = codec->spec;
736 err = snd_hda_gen_build_controls(codec);
740 for (i = 0; i < spec->num_mixers; i++) {
741 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
746 #ifdef CONFIG_SND_HDA_INPUT_BEEP
747 /* create beep controls if needed */
748 if (spec->beep_amp) {
749 const struct snd_kcontrol_new *knew;
750 for (knew = alc_beep_mixer; knew->name; knew++) {
751 struct snd_kcontrol *kctl;
752 kctl = snd_ctl_new1(knew, codec);
755 kctl->private_value = spec->beep_amp;
756 err = snd_hda_ctl_add(codec, 0, kctl);
763 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
772 static int alc_init(struct hda_codec *codec)
774 struct alc_spec *spec = codec->spec;
777 spec->init_hook(codec);
779 spec->gen.skip_verbs = 1; /* applied in below */
780 snd_hda_gen_init(codec);
782 alc_auto_init_amp(codec, spec->init_amp);
783 snd_hda_apply_verbs(codec); /* apply verbs here after own init */
785 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
790 static inline void alc_shutup(struct hda_codec *codec)
792 struct alc_spec *spec = codec->spec;
794 if (spec && spec->shutup)
797 snd_hda_shutup_pins(codec);
800 static void alc_reboot_notify(struct hda_codec *codec)
802 struct alc_spec *spec = codec->spec;
804 if (spec && spec->reboot_notify)
805 spec->reboot_notify(codec);
810 /* power down codec to D3 at reboot/shutdown; set as reboot_notify ops */
811 static void alc_d3_at_reboot(struct hda_codec *codec)
813 snd_hda_codec_set_power_to_all(codec, codec->core.afg, AC_PWRST_D3);
814 snd_hda_codec_write(codec, codec->core.afg, 0,
815 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
819 #define alc_free snd_hda_gen_free
822 static void alc_power_eapd(struct hda_codec *codec)
824 alc_auto_setup_eapd(codec, false);
827 static int alc_suspend(struct hda_codec *codec)
829 struct alc_spec *spec = codec->spec;
831 if (spec && spec->power_hook)
832 spec->power_hook(codec);
838 static int alc_resume(struct hda_codec *codec)
840 struct alc_spec *spec = codec->spec;
842 if (!spec->no_depop_delay)
843 msleep(150); /* to avoid pop noise */
844 codec->patch_ops.init(codec);
845 regcache_sync(codec->core.regmap);
846 hda_call_check_power_status(codec, 0x01);
853 static const struct hda_codec_ops alc_patch_ops = {
854 .build_controls = alc_build_controls,
855 .build_pcms = snd_hda_gen_build_pcms,
858 .unsol_event = snd_hda_jack_unsol_event,
860 .resume = alc_resume,
861 .suspend = alc_suspend,
862 .check_power_status = snd_hda_gen_check_power_status,
864 .reboot_notify = alc_reboot_notify,
868 #define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
871 * Rename codecs appropriately from COEF value or subvendor id
873 struct alc_codec_rename_table {
874 unsigned int vendor_id;
875 unsigned short coef_mask;
876 unsigned short coef_bits;
880 struct alc_codec_rename_pci_table {
881 unsigned int codec_vendor_id;
882 unsigned short pci_subvendor;
883 unsigned short pci_subdevice;
887 static struct alc_codec_rename_table rename_tbl[] = {
888 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
889 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
890 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
891 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
892 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
893 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
894 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
895 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
896 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
897 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
898 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
899 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
900 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
901 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
902 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
903 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
904 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
908 static struct alc_codec_rename_pci_table rename_pci_tbl[] = {
909 { 0x10ec0280, 0x1028, 0, "ALC3220" },
910 { 0x10ec0282, 0x1028, 0, "ALC3221" },
911 { 0x10ec0283, 0x1028, 0, "ALC3223" },
912 { 0x10ec0288, 0x1028, 0, "ALC3263" },
913 { 0x10ec0292, 0x1028, 0, "ALC3226" },
914 { 0x10ec0293, 0x1028, 0, "ALC3235" },
915 { 0x10ec0255, 0x1028, 0, "ALC3234" },
916 { 0x10ec0668, 0x1028, 0, "ALC3661" },
917 { 0x10ec0275, 0x1028, 0, "ALC3260" },
918 { 0x10ec0899, 0x1028, 0, "ALC3861" },
919 { 0x10ec0298, 0x1028, 0, "ALC3266" },
920 { 0x10ec0236, 0x1028, 0, "ALC3204" },
921 { 0x10ec0256, 0x1028, 0, "ALC3246" },
922 { 0x10ec0225, 0x1028, 0, "ALC3253" },
923 { 0x10ec0295, 0x1028, 0, "ALC3254" },
924 { 0x10ec0299, 0x1028, 0, "ALC3271" },
925 { 0x10ec0670, 0x1025, 0, "ALC669X" },
926 { 0x10ec0676, 0x1025, 0, "ALC679X" },
927 { 0x10ec0282, 0x1043, 0, "ALC3229" },
928 { 0x10ec0233, 0x1043, 0, "ALC3236" },
929 { 0x10ec0280, 0x103c, 0, "ALC3228" },
930 { 0x10ec0282, 0x103c, 0, "ALC3227" },
931 { 0x10ec0286, 0x103c, 0, "ALC3242" },
932 { 0x10ec0290, 0x103c, 0, "ALC3241" },
933 { 0x10ec0668, 0x103c, 0, "ALC3662" },
934 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
935 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
939 static int alc_codec_rename_from_preset(struct hda_codec *codec)
941 const struct alc_codec_rename_table *p;
942 const struct alc_codec_rename_pci_table *q;
944 for (p = rename_tbl; p->vendor_id; p++) {
945 if (p->vendor_id != codec->core.vendor_id)
947 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
948 return alc_codec_rename(codec, p->name);
951 if (!codec->bus->pci)
953 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
954 if (q->codec_vendor_id != codec->core.vendor_id)
956 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
958 if (!q->pci_subdevice ||
959 q->pci_subdevice == codec->bus->pci->subsystem_device)
960 return alc_codec_rename(codec, q->name);
968 * Digital-beep handlers
970 #ifdef CONFIG_SND_HDA_INPUT_BEEP
971 #define set_beep_amp(spec, nid, idx, dir) \
972 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
974 static const struct snd_pci_quirk beep_white_list[] = {
975 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
976 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
977 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
978 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
979 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
980 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
981 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
982 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
983 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
984 /* blacklist -- no beep available */
985 SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
986 SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
990 static inline int has_cdefine_beep(struct hda_codec *codec)
992 struct alc_spec *spec = codec->spec;
993 const struct snd_pci_quirk *q;
994 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list);
997 return spec->cdefine.enable_pcbeep;
1000 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
1001 #define has_cdefine_beep(codec) 0
1004 /* parse the BIOS configuration and set up the alc_spec */
1005 /* return 1 if successful, 0 if the proper config is not found,
1006 * or a negative error code
1008 static int alc_parse_auto_config(struct hda_codec *codec,
1009 const hda_nid_t *ignore_nids,
1010 const hda_nid_t *ssid_nids)
1012 struct alc_spec *spec = codec->spec;
1013 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
1016 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1022 alc_ssid_check(codec, ssid_nids);
1024 err = snd_hda_gen_parse_auto_config(codec, cfg);
1031 /* common preparation job for alc_spec */
1032 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1034 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1040 snd_hda_gen_spec_init(&spec->gen);
1041 spec->gen.mixer_nid = mixer_nid;
1042 spec->gen.own_eapd_ctl = 1;
1043 codec->single_adc_amp = 1;
1044 /* FIXME: do we need this for all Realtek codec models? */
1045 codec->spdif_status_reset = 1;
1046 codec->patch_ops = alc_patch_ops;
1048 err = alc_codec_rename_from_preset(codec);
1056 static int alc880_parse_auto_config(struct hda_codec *codec)
1058 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
1059 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
1060 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1069 ALC880_FIXUP_MEDION_RIM,
1071 ALC880_FIXUP_LG_LW25,
1073 ALC880_FIXUP_EAPD_COEF,
1074 ALC880_FIXUP_TCL_S700,
1075 ALC880_FIXUP_VOL_KNOB,
1076 ALC880_FIXUP_FUJITSU,
1078 ALC880_FIXUP_UNIWILL,
1079 ALC880_FIXUP_UNIWILL_DIG,
1081 ALC880_FIXUP_ASUS_W5A,
1082 ALC880_FIXUP_3ST_BASE,
1084 ALC880_FIXUP_3ST_DIG,
1085 ALC880_FIXUP_5ST_BASE,
1087 ALC880_FIXUP_5ST_DIG,
1088 ALC880_FIXUP_6ST_BASE,
1090 ALC880_FIXUP_6ST_DIG,
1091 ALC880_FIXUP_6ST_AUTOMUTE,
1094 /* enable the volume-knob widget support on NID 0x21 */
1095 static void alc880_fixup_vol_knob(struct hda_codec *codec,
1096 const struct hda_fixup *fix, int action)
1098 if (action == HDA_FIXUP_ACT_PROBE)
1099 snd_hda_jack_detect_enable_callback(codec, 0x21,
1100 alc_update_knob_master);
1103 static const struct hda_fixup alc880_fixups[] = {
1104 [ALC880_FIXUP_GPIO1] = {
1105 .type = HDA_FIXUP_VERBS,
1106 .v.verbs = alc_gpio1_init_verbs,
1108 [ALC880_FIXUP_GPIO2] = {
1109 .type = HDA_FIXUP_VERBS,
1110 .v.verbs = alc_gpio2_init_verbs,
1112 [ALC880_FIXUP_MEDION_RIM] = {
1113 .type = HDA_FIXUP_VERBS,
1114 .v.verbs = (const struct hda_verb[]) {
1115 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1116 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1120 .chain_id = ALC880_FIXUP_GPIO2,
1122 [ALC880_FIXUP_LG] = {
1123 .type = HDA_FIXUP_PINS,
1124 .v.pins = (const struct hda_pintbl[]) {
1125 /* disable bogus unused pins */
1126 { 0x16, 0x411111f0 },
1127 { 0x18, 0x411111f0 },
1128 { 0x1a, 0x411111f0 },
1132 [ALC880_FIXUP_LG_LW25] = {
1133 .type = HDA_FIXUP_PINS,
1134 .v.pins = (const struct hda_pintbl[]) {
1135 { 0x1a, 0x0181344f }, /* line-in */
1136 { 0x1b, 0x0321403f }, /* headphone */
1140 [ALC880_FIXUP_W810] = {
1141 .type = HDA_FIXUP_PINS,
1142 .v.pins = (const struct hda_pintbl[]) {
1143 /* disable bogus unused pins */
1144 { 0x17, 0x411111f0 },
1148 .chain_id = ALC880_FIXUP_GPIO2,
1150 [ALC880_FIXUP_EAPD_COEF] = {
1151 .type = HDA_FIXUP_VERBS,
1152 .v.verbs = (const struct hda_verb[]) {
1153 /* change to EAPD mode */
1154 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1155 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1159 [ALC880_FIXUP_TCL_S700] = {
1160 .type = HDA_FIXUP_VERBS,
1161 .v.verbs = (const struct hda_verb[]) {
1162 /* change to EAPD mode */
1163 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1164 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1168 .chain_id = ALC880_FIXUP_GPIO2,
1170 [ALC880_FIXUP_VOL_KNOB] = {
1171 .type = HDA_FIXUP_FUNC,
1172 .v.func = alc880_fixup_vol_knob,
1174 [ALC880_FIXUP_FUJITSU] = {
1175 /* override all pins as BIOS on old Amilo is broken */
1176 .type = HDA_FIXUP_PINS,
1177 .v.pins = (const struct hda_pintbl[]) {
1178 { 0x14, 0x0121401f }, /* HP */
1179 { 0x15, 0x99030120 }, /* speaker */
1180 { 0x16, 0x99030130 }, /* bass speaker */
1181 { 0x17, 0x411111f0 }, /* N/A */
1182 { 0x18, 0x411111f0 }, /* N/A */
1183 { 0x19, 0x01a19950 }, /* mic-in */
1184 { 0x1a, 0x411111f0 }, /* N/A */
1185 { 0x1b, 0x411111f0 }, /* N/A */
1186 { 0x1c, 0x411111f0 }, /* N/A */
1187 { 0x1d, 0x411111f0 }, /* N/A */
1188 { 0x1e, 0x01454140 }, /* SPDIF out */
1192 .chain_id = ALC880_FIXUP_VOL_KNOB,
1194 [ALC880_FIXUP_F1734] = {
1195 /* almost compatible with FUJITSU, but no bass and SPDIF */
1196 .type = HDA_FIXUP_PINS,
1197 .v.pins = (const struct hda_pintbl[]) {
1198 { 0x14, 0x0121401f }, /* HP */
1199 { 0x15, 0x99030120 }, /* speaker */
1200 { 0x16, 0x411111f0 }, /* N/A */
1201 { 0x17, 0x411111f0 }, /* N/A */
1202 { 0x18, 0x411111f0 }, /* N/A */
1203 { 0x19, 0x01a19950 }, /* mic-in */
1204 { 0x1a, 0x411111f0 }, /* N/A */
1205 { 0x1b, 0x411111f0 }, /* N/A */
1206 { 0x1c, 0x411111f0 }, /* N/A */
1207 { 0x1d, 0x411111f0 }, /* N/A */
1208 { 0x1e, 0x411111f0 }, /* N/A */
1212 .chain_id = ALC880_FIXUP_VOL_KNOB,
1214 [ALC880_FIXUP_UNIWILL] = {
1215 /* need to fix HP and speaker pins to be parsed correctly */
1216 .type = HDA_FIXUP_PINS,
1217 .v.pins = (const struct hda_pintbl[]) {
1218 { 0x14, 0x0121411f }, /* HP */
1219 { 0x15, 0x99030120 }, /* speaker */
1220 { 0x16, 0x99030130 }, /* bass speaker */
1224 [ALC880_FIXUP_UNIWILL_DIG] = {
1225 .type = HDA_FIXUP_PINS,
1226 .v.pins = (const struct hda_pintbl[]) {
1227 /* disable bogus unused pins */
1228 { 0x17, 0x411111f0 },
1229 { 0x19, 0x411111f0 },
1230 { 0x1b, 0x411111f0 },
1231 { 0x1f, 0x411111f0 },
1235 [ALC880_FIXUP_Z71V] = {
1236 .type = HDA_FIXUP_PINS,
1237 .v.pins = (const struct hda_pintbl[]) {
1238 /* set up the whole pins as BIOS is utterly broken */
1239 { 0x14, 0x99030120 }, /* speaker */
1240 { 0x15, 0x0121411f }, /* HP */
1241 { 0x16, 0x411111f0 }, /* N/A */
1242 { 0x17, 0x411111f0 }, /* N/A */
1243 { 0x18, 0x01a19950 }, /* mic-in */
1244 { 0x19, 0x411111f0 }, /* N/A */
1245 { 0x1a, 0x01813031 }, /* line-in */
1246 { 0x1b, 0x411111f0 }, /* N/A */
1247 { 0x1c, 0x411111f0 }, /* N/A */
1248 { 0x1d, 0x411111f0 }, /* N/A */
1249 { 0x1e, 0x0144111e }, /* SPDIF */
1253 [ALC880_FIXUP_ASUS_W5A] = {
1254 .type = HDA_FIXUP_PINS,
1255 .v.pins = (const struct hda_pintbl[]) {
1256 /* set up the whole pins as BIOS is utterly broken */
1257 { 0x14, 0x0121411f }, /* HP */
1258 { 0x15, 0x411111f0 }, /* N/A */
1259 { 0x16, 0x411111f0 }, /* N/A */
1260 { 0x17, 0x411111f0 }, /* N/A */
1261 { 0x18, 0x90a60160 }, /* mic */
1262 { 0x19, 0x411111f0 }, /* N/A */
1263 { 0x1a, 0x411111f0 }, /* N/A */
1264 { 0x1b, 0x411111f0 }, /* N/A */
1265 { 0x1c, 0x411111f0 }, /* N/A */
1266 { 0x1d, 0x411111f0 }, /* N/A */
1267 { 0x1e, 0xb743111e }, /* SPDIF out */
1271 .chain_id = ALC880_FIXUP_GPIO1,
1273 [ALC880_FIXUP_3ST_BASE] = {
1274 .type = HDA_FIXUP_PINS,
1275 .v.pins = (const struct hda_pintbl[]) {
1276 { 0x14, 0x01014010 }, /* line-out */
1277 { 0x15, 0x411111f0 }, /* N/A */
1278 { 0x16, 0x411111f0 }, /* N/A */
1279 { 0x17, 0x411111f0 }, /* N/A */
1280 { 0x18, 0x01a19c30 }, /* mic-in */
1281 { 0x19, 0x0121411f }, /* HP */
1282 { 0x1a, 0x01813031 }, /* line-in */
1283 { 0x1b, 0x02a19c40 }, /* front-mic */
1284 { 0x1c, 0x411111f0 }, /* N/A */
1285 { 0x1d, 0x411111f0 }, /* N/A */
1286 /* 0x1e is filled in below */
1287 { 0x1f, 0x411111f0 }, /* N/A */
1291 [ALC880_FIXUP_3ST] = {
1292 .type = HDA_FIXUP_PINS,
1293 .v.pins = (const struct hda_pintbl[]) {
1294 { 0x1e, 0x411111f0 }, /* N/A */
1298 .chain_id = ALC880_FIXUP_3ST_BASE,
1300 [ALC880_FIXUP_3ST_DIG] = {
1301 .type = HDA_FIXUP_PINS,
1302 .v.pins = (const struct hda_pintbl[]) {
1303 { 0x1e, 0x0144111e }, /* SPDIF */
1307 .chain_id = ALC880_FIXUP_3ST_BASE,
1309 [ALC880_FIXUP_5ST_BASE] = {
1310 .type = HDA_FIXUP_PINS,
1311 .v.pins = (const struct hda_pintbl[]) {
1312 { 0x14, 0x01014010 }, /* front */
1313 { 0x15, 0x411111f0 }, /* N/A */
1314 { 0x16, 0x01011411 }, /* CLFE */
1315 { 0x17, 0x01016412 }, /* surr */
1316 { 0x18, 0x01a19c30 }, /* mic-in */
1317 { 0x19, 0x0121411f }, /* HP */
1318 { 0x1a, 0x01813031 }, /* line-in */
1319 { 0x1b, 0x02a19c40 }, /* front-mic */
1320 { 0x1c, 0x411111f0 }, /* N/A */
1321 { 0x1d, 0x411111f0 }, /* N/A */
1322 /* 0x1e is filled in below */
1323 { 0x1f, 0x411111f0 }, /* N/A */
1327 [ALC880_FIXUP_5ST] = {
1328 .type = HDA_FIXUP_PINS,
1329 .v.pins = (const struct hda_pintbl[]) {
1330 { 0x1e, 0x411111f0 }, /* N/A */
1334 .chain_id = ALC880_FIXUP_5ST_BASE,
1336 [ALC880_FIXUP_5ST_DIG] = {
1337 .type = HDA_FIXUP_PINS,
1338 .v.pins = (const struct hda_pintbl[]) {
1339 { 0x1e, 0x0144111e }, /* SPDIF */
1343 .chain_id = ALC880_FIXUP_5ST_BASE,
1345 [ALC880_FIXUP_6ST_BASE] = {
1346 .type = HDA_FIXUP_PINS,
1347 .v.pins = (const struct hda_pintbl[]) {
1348 { 0x14, 0x01014010 }, /* front */
1349 { 0x15, 0x01016412 }, /* surr */
1350 { 0x16, 0x01011411 }, /* CLFE */
1351 { 0x17, 0x01012414 }, /* side */
1352 { 0x18, 0x01a19c30 }, /* mic-in */
1353 { 0x19, 0x02a19c40 }, /* front-mic */
1354 { 0x1a, 0x01813031 }, /* line-in */
1355 { 0x1b, 0x0121411f }, /* HP */
1356 { 0x1c, 0x411111f0 }, /* N/A */
1357 { 0x1d, 0x411111f0 }, /* N/A */
1358 /* 0x1e is filled in below */
1359 { 0x1f, 0x411111f0 }, /* N/A */
1363 [ALC880_FIXUP_6ST] = {
1364 .type = HDA_FIXUP_PINS,
1365 .v.pins = (const struct hda_pintbl[]) {
1366 { 0x1e, 0x411111f0 }, /* N/A */
1370 .chain_id = ALC880_FIXUP_6ST_BASE,
1372 [ALC880_FIXUP_6ST_DIG] = {
1373 .type = HDA_FIXUP_PINS,
1374 .v.pins = (const struct hda_pintbl[]) {
1375 { 0x1e, 0x0144111e }, /* SPDIF */
1379 .chain_id = ALC880_FIXUP_6ST_BASE,
1381 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1382 .type = HDA_FIXUP_PINS,
1383 .v.pins = (const struct hda_pintbl[]) {
1384 { 0x1b, 0x0121401f }, /* HP with jack detect */
1387 .chained_before = true,
1388 .chain_id = ALC880_FIXUP_6ST_BASE,
1392 static const struct snd_pci_quirk alc880_fixup_tbl[] = {
1393 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
1394 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
1395 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
1396 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
1397 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
1398 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
1399 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
1400 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
1401 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
1402 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
1403 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
1404 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
1405 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
1406 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
1407 SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
1408 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
1409 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
1410 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
1411 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1412 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1413 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
1414 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
1415 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
1417 /* Below is the copied entries from alc880_quirks.c.
1418 * It's not quite sure whether BIOS sets the correct pin-config table
1419 * on these machines, thus they are kept to be compatible with
1420 * the old static quirks. Once when it's confirmed to work without
1421 * these overrides, it'd be better to remove.
1423 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1424 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1425 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1426 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1427 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1428 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1429 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1430 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1431 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1432 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1433 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1434 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1435 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1436 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1437 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1438 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1439 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1440 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1441 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1442 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1443 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1444 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1445 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1446 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1447 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1448 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1449 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1450 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1451 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1452 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1453 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1454 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1455 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1457 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1458 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1459 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1463 static const struct hda_model_fixup alc880_fixup_models[] = {
1464 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1465 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1466 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1467 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1468 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1469 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
1470 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
1476 * OK, here we have finally the patch for ALC880
1478 static int patch_alc880(struct hda_codec *codec)
1480 struct alc_spec *spec;
1483 err = alc_alloc_spec(codec, 0x0b);
1488 spec->gen.need_dac_fix = 1;
1489 spec->gen.beep_nid = 0x01;
1491 codec->patch_ops.unsol_event = alc880_unsol_event;
1493 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
1495 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1497 /* automatic parse from the BIOS config */
1498 err = alc880_parse_auto_config(codec);
1502 if (!spec->gen.no_analog)
1503 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1505 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1518 static int alc260_parse_auto_config(struct hda_codec *codec)
1520 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
1521 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1522 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
1529 ALC260_FIXUP_HP_DC5750,
1530 ALC260_FIXUP_HP_PIN_0F,
1533 ALC260_FIXUP_GPIO1_TOGGLE,
1534 ALC260_FIXUP_REPLACER,
1535 ALC260_FIXUP_HP_B1900,
1537 ALC260_FIXUP_FSC_S7020,
1538 ALC260_FIXUP_FSC_S7020_JWSE,
1539 ALC260_FIXUP_VAIO_PINS,
1542 static void alc260_gpio1_automute(struct hda_codec *codec)
1544 struct alc_spec *spec = codec->spec;
1545 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
1546 spec->gen.hp_jack_present);
1549 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1550 const struct hda_fixup *fix, int action)
1552 struct alc_spec *spec = codec->spec;
1553 if (action == HDA_FIXUP_ACT_PROBE) {
1554 /* although the machine has only one output pin, we need to
1555 * toggle GPIO1 according to the jack state
1557 spec->gen.automute_hook = alc260_gpio1_automute;
1558 spec->gen.detect_hp = 1;
1559 spec->gen.automute_speaker = 1;
1560 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
1561 snd_hda_jack_detect_enable_callback(codec, 0x0f,
1562 snd_hda_gen_hp_automute);
1563 snd_hda_add_verbs(codec, alc_gpio1_init_verbs);
1567 static void alc260_fixup_kn1(struct hda_codec *codec,
1568 const struct hda_fixup *fix, int action)
1570 struct alc_spec *spec = codec->spec;
1571 static const struct hda_pintbl pincfgs[] = {
1572 { 0x0f, 0x02214000 }, /* HP/speaker */
1573 { 0x12, 0x90a60160 }, /* int mic */
1574 { 0x13, 0x02a19000 }, /* ext mic */
1575 { 0x18, 0x01446000 }, /* SPDIF out */
1576 /* disable bogus I/O pins */
1577 { 0x10, 0x411111f0 },
1578 { 0x11, 0x411111f0 },
1579 { 0x14, 0x411111f0 },
1580 { 0x15, 0x411111f0 },
1581 { 0x16, 0x411111f0 },
1582 { 0x17, 0x411111f0 },
1583 { 0x19, 0x411111f0 },
1588 case HDA_FIXUP_ACT_PRE_PROBE:
1589 snd_hda_apply_pincfgs(codec, pincfgs);
1591 case HDA_FIXUP_ACT_PROBE:
1592 spec->init_amp = ALC_INIT_NONE;
1597 static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1598 const struct hda_fixup *fix, int action)
1600 struct alc_spec *spec = codec->spec;
1601 if (action == HDA_FIXUP_ACT_PROBE)
1602 spec->init_amp = ALC_INIT_NONE;
1605 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1606 const struct hda_fixup *fix, int action)
1608 struct alc_spec *spec = codec->spec;
1609 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1610 spec->gen.add_jack_modes = 1;
1611 spec->gen.hp_mic = 1;
1615 static const struct hda_fixup alc260_fixups[] = {
1616 [ALC260_FIXUP_HP_DC5750] = {
1617 .type = HDA_FIXUP_PINS,
1618 .v.pins = (const struct hda_pintbl[]) {
1619 { 0x11, 0x90130110 }, /* speaker */
1623 [ALC260_FIXUP_HP_PIN_0F] = {
1624 .type = HDA_FIXUP_PINS,
1625 .v.pins = (const struct hda_pintbl[]) {
1626 { 0x0f, 0x01214000 }, /* HP */
1630 [ALC260_FIXUP_COEF] = {
1631 .type = HDA_FIXUP_VERBS,
1632 .v.verbs = (const struct hda_verb[]) {
1633 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1634 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
1638 [ALC260_FIXUP_GPIO1] = {
1639 .type = HDA_FIXUP_VERBS,
1640 .v.verbs = alc_gpio1_init_verbs,
1642 [ALC260_FIXUP_GPIO1_TOGGLE] = {
1643 .type = HDA_FIXUP_FUNC,
1644 .v.func = alc260_fixup_gpio1_toggle,
1646 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1648 [ALC260_FIXUP_REPLACER] = {
1649 .type = HDA_FIXUP_VERBS,
1650 .v.verbs = (const struct hda_verb[]) {
1651 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1652 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
1656 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1658 [ALC260_FIXUP_HP_B1900] = {
1659 .type = HDA_FIXUP_FUNC,
1660 .v.func = alc260_fixup_gpio1_toggle,
1662 .chain_id = ALC260_FIXUP_COEF,
1664 [ALC260_FIXUP_KN1] = {
1665 .type = HDA_FIXUP_FUNC,
1666 .v.func = alc260_fixup_kn1,
1668 [ALC260_FIXUP_FSC_S7020] = {
1669 .type = HDA_FIXUP_FUNC,
1670 .v.func = alc260_fixup_fsc_s7020,
1672 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1673 .type = HDA_FIXUP_FUNC,
1674 .v.func = alc260_fixup_fsc_s7020_jwse,
1676 .chain_id = ALC260_FIXUP_FSC_S7020,
1678 [ALC260_FIXUP_VAIO_PINS] = {
1679 .type = HDA_FIXUP_PINS,
1680 .v.pins = (const struct hda_pintbl[]) {
1681 /* Pin configs are missing completely on some VAIOs */
1682 { 0x0f, 0x01211020 },
1683 { 0x10, 0x0001003f },
1684 { 0x11, 0x411111f0 },
1685 { 0x12, 0x01a15930 },
1686 { 0x13, 0x411111f0 },
1687 { 0x14, 0x411111f0 },
1688 { 0x15, 0x411111f0 },
1689 { 0x16, 0x411111f0 },
1690 { 0x17, 0x411111f0 },
1691 { 0x18, 0x411111f0 },
1692 { 0x19, 0x411111f0 },
1698 static const struct snd_pci_quirk alc260_fixup_tbl[] = {
1699 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
1700 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
1701 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
1702 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
1703 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
1704 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
1705 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
1706 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
1707 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
1708 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
1709 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
1710 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
1714 static const struct hda_model_fixup alc260_fixup_models[] = {
1715 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1716 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1717 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1718 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1724 static int patch_alc260(struct hda_codec *codec)
1726 struct alc_spec *spec;
1729 err = alc_alloc_spec(codec, 0x07);
1734 /* as quite a few machines require HP amp for speaker outputs,
1735 * it's easier to enable it unconditionally; even if it's unneeded,
1736 * it's almost harmless.
1738 spec->gen.prefer_hp_amp = 1;
1739 spec->gen.beep_nid = 0x01;
1741 spec->shutup = alc_eapd_shutup;
1743 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1745 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1747 /* automatic parse from the BIOS config */
1748 err = alc260_parse_auto_config(codec);
1752 if (!spec->gen.no_analog)
1753 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1755 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1766 * ALC882/883/885/888/889 support
1768 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1769 * configuration. Each pin widget can choose any input DACs and a mixer.
1770 * Each ADC is connected from a mixer of all inputs. This makes possible
1771 * 6-channel independent captures.
1773 * In addition, an independent DAC for the multi-playback (not used in this
1781 ALC882_FIXUP_ABIT_AW9D_MAX,
1782 ALC882_FIXUP_LENOVO_Y530,
1783 ALC882_FIXUP_PB_M5210,
1784 ALC882_FIXUP_ACER_ASPIRE_7736,
1785 ALC882_FIXUP_ASUS_W90V,
1787 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
1788 ALC889_FIXUP_VAIO_TT,
1789 ALC888_FIXUP_EEE1601,
1792 ALC883_FIXUP_ACER_EAPD,
1797 ALC882_FIXUP_ASUS_W2JC,
1798 ALC882_FIXUP_ACER_ASPIRE_4930G,
1799 ALC882_FIXUP_ACER_ASPIRE_8930G,
1800 ALC882_FIXUP_ASPIRE_8930G_VERBS,
1801 ALC885_FIXUP_MACPRO_GPIO,
1802 ALC889_FIXUP_DAC_ROUTE,
1803 ALC889_FIXUP_MBP_VREF,
1804 ALC889_FIXUP_IMAC91_VREF,
1805 ALC889_FIXUP_MBA11_VREF,
1806 ALC889_FIXUP_MBA21_VREF,
1807 ALC889_FIXUP_MP11_VREF,
1808 ALC889_FIXUP_MP41_VREF,
1809 ALC882_FIXUP_INV_DMIC,
1810 ALC882_FIXUP_NO_PRIMARY_HP,
1811 ALC887_FIXUP_ASUS_BASS,
1812 ALC887_FIXUP_BASS_CHMAP,
1815 static void alc889_fixup_coef(struct hda_codec *codec,
1816 const struct hda_fixup *fix, int action)
1818 if (action != HDA_FIXUP_ACT_INIT)
1820 alc_update_coef_idx(codec, 7, 0, 0x2030);
1823 /* toggle speaker-output according to the hp-jack state */
1824 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
1826 unsigned int gpiostate, gpiomask, gpiodir;
1828 gpiostate = snd_hda_codec_read(codec, codec->core.afg, 0,
1829 AC_VERB_GET_GPIO_DATA, 0);
1832 gpiostate |= (1 << pin);
1834 gpiostate &= ~(1 << pin);
1836 gpiomask = snd_hda_codec_read(codec, codec->core.afg, 0,
1837 AC_VERB_GET_GPIO_MASK, 0);
1838 gpiomask |= (1 << pin);
1840 gpiodir = snd_hda_codec_read(codec, codec->core.afg, 0,
1841 AC_VERB_GET_GPIO_DIRECTION, 0);
1842 gpiodir |= (1 << pin);
1845 snd_hda_codec_write(codec, codec->core.afg, 0,
1846 AC_VERB_SET_GPIO_MASK, gpiomask);
1847 snd_hda_codec_write(codec, codec->core.afg, 0,
1848 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
1852 snd_hda_codec_write(codec, codec->core.afg, 0,
1853 AC_VERB_SET_GPIO_DATA, gpiostate);
1856 /* set up GPIO at initialization */
1857 static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
1858 const struct hda_fixup *fix, int action)
1860 if (action != HDA_FIXUP_ACT_INIT)
1862 alc882_gpio_mute(codec, 0, 0);
1863 alc882_gpio_mute(codec, 1, 0);
1866 /* Fix the connection of some pins for ALC889:
1867 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
1868 * work correctly (bko#42740)
1870 static void alc889_fixup_dac_route(struct hda_codec *codec,
1871 const struct hda_fixup *fix, int action)
1873 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1874 /* fake the connections during parsing the tree */
1875 hda_nid_t conn1[2] = { 0x0c, 0x0d };
1876 hda_nid_t conn2[2] = { 0x0e, 0x0f };
1877 snd_hda_override_conn_list(codec, 0x14, 2, conn1);
1878 snd_hda_override_conn_list(codec, 0x15, 2, conn1);
1879 snd_hda_override_conn_list(codec, 0x18, 2, conn2);
1880 snd_hda_override_conn_list(codec, 0x1a, 2, conn2);
1881 } else if (action == HDA_FIXUP_ACT_PROBE) {
1882 /* restore the connections */
1883 hda_nid_t conn[5] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
1884 snd_hda_override_conn_list(codec, 0x14, 5, conn);
1885 snd_hda_override_conn_list(codec, 0x15, 5, conn);
1886 snd_hda_override_conn_list(codec, 0x18, 5, conn);
1887 snd_hda_override_conn_list(codec, 0x1a, 5, conn);
1891 /* Set VREF on HP pin */
1892 static void alc889_fixup_mbp_vref(struct hda_codec *codec,
1893 const struct hda_fixup *fix, int action)
1895 struct alc_spec *spec = codec->spec;
1896 static hda_nid_t nids[3] = { 0x14, 0x15, 0x19 };
1899 if (action != HDA_FIXUP_ACT_INIT)
1901 for (i = 0; i < ARRAY_SIZE(nids); i++) {
1902 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
1903 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
1905 val = snd_hda_codec_get_pin_target(codec, nids[i]);
1906 val |= AC_PINCTL_VREF_80;
1907 snd_hda_set_pin_ctl(codec, nids[i], val);
1908 spec->gen.keep_vref_in_automute = 1;
1913 static void alc889_fixup_mac_pins(struct hda_codec *codec,
1914 const hda_nid_t *nids, int num_nids)
1916 struct alc_spec *spec = codec->spec;
1919 for (i = 0; i < num_nids; i++) {
1921 val = snd_hda_codec_get_pin_target(codec, nids[i]);
1922 val |= AC_PINCTL_VREF_50;
1923 snd_hda_set_pin_ctl(codec, nids[i], val);
1925 spec->gen.keep_vref_in_automute = 1;
1928 /* Set VREF on speaker pins on imac91 */
1929 static void alc889_fixup_imac91_vref(struct hda_codec *codec,
1930 const struct hda_fixup *fix, int action)
1932 static hda_nid_t nids[2] = { 0x18, 0x1a };
1934 if (action == HDA_FIXUP_ACT_INIT)
1935 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1938 /* Set VREF on speaker pins on mba11 */
1939 static void alc889_fixup_mba11_vref(struct hda_codec *codec,
1940 const struct hda_fixup *fix, int action)
1942 static hda_nid_t nids[1] = { 0x18 };
1944 if (action == HDA_FIXUP_ACT_INIT)
1945 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1948 /* Set VREF on speaker pins on mba21 */
1949 static void alc889_fixup_mba21_vref(struct hda_codec *codec,
1950 const struct hda_fixup *fix, int action)
1952 static hda_nid_t nids[2] = { 0x18, 0x19 };
1954 if (action == HDA_FIXUP_ACT_INIT)
1955 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1958 /* Don't take HP output as primary
1959 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
1960 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
1962 static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
1963 const struct hda_fixup *fix, int action)
1965 struct alc_spec *spec = codec->spec;
1966 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1967 spec->gen.no_primary_hp = 1;
1968 spec->gen.no_multi_io = 1;
1972 static void alc_fixup_bass_chmap(struct hda_codec *codec,
1973 const struct hda_fixup *fix, int action);
1975 static const struct hda_fixup alc882_fixups[] = {
1976 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
1977 .type = HDA_FIXUP_PINS,
1978 .v.pins = (const struct hda_pintbl[]) {
1979 { 0x15, 0x01080104 }, /* side */
1980 { 0x16, 0x01011012 }, /* rear */
1981 { 0x17, 0x01016011 }, /* clfe */
1985 [ALC882_FIXUP_LENOVO_Y530] = {
1986 .type = HDA_FIXUP_PINS,
1987 .v.pins = (const struct hda_pintbl[]) {
1988 { 0x15, 0x99130112 }, /* rear int speakers */
1989 { 0x16, 0x99130111 }, /* subwoofer */
1993 [ALC882_FIXUP_PB_M5210] = {
1994 .type = HDA_FIXUP_PINCTLS,
1995 .v.pins = (const struct hda_pintbl[]) {
1996 { 0x19, PIN_VREF50 },
2000 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
2001 .type = HDA_FIXUP_FUNC,
2002 .v.func = alc_fixup_sku_ignore,
2004 [ALC882_FIXUP_ASUS_W90V] = {
2005 .type = HDA_FIXUP_PINS,
2006 .v.pins = (const struct hda_pintbl[]) {
2007 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
2011 [ALC889_FIXUP_CD] = {
2012 .type = HDA_FIXUP_PINS,
2013 .v.pins = (const struct hda_pintbl[]) {
2014 { 0x1c, 0x993301f0 }, /* CD */
2018 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2019 .type = HDA_FIXUP_PINS,
2020 .v.pins = (const struct hda_pintbl[]) {
2021 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2025 .chain_id = ALC889_FIXUP_CD,
2027 [ALC889_FIXUP_VAIO_TT] = {
2028 .type = HDA_FIXUP_PINS,
2029 .v.pins = (const struct hda_pintbl[]) {
2030 { 0x17, 0x90170111 }, /* hidden surround speaker */
2034 [ALC888_FIXUP_EEE1601] = {
2035 .type = HDA_FIXUP_VERBS,
2036 .v.verbs = (const struct hda_verb[]) {
2037 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2038 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
2042 [ALC882_FIXUP_EAPD] = {
2043 .type = HDA_FIXUP_VERBS,
2044 .v.verbs = (const struct hda_verb[]) {
2045 /* change to EAPD mode */
2046 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2047 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2051 [ALC883_FIXUP_EAPD] = {
2052 .type = HDA_FIXUP_VERBS,
2053 .v.verbs = (const struct hda_verb[]) {
2054 /* change to EAPD mode */
2055 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2056 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2060 [ALC883_FIXUP_ACER_EAPD] = {
2061 .type = HDA_FIXUP_VERBS,
2062 .v.verbs = (const struct hda_verb[]) {
2063 /* eanable EAPD on Acer laptops */
2064 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2065 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2069 [ALC882_FIXUP_GPIO1] = {
2070 .type = HDA_FIXUP_VERBS,
2071 .v.verbs = alc_gpio1_init_verbs,
2073 [ALC882_FIXUP_GPIO2] = {
2074 .type = HDA_FIXUP_VERBS,
2075 .v.verbs = alc_gpio2_init_verbs,
2077 [ALC882_FIXUP_GPIO3] = {
2078 .type = HDA_FIXUP_VERBS,
2079 .v.verbs = alc_gpio3_init_verbs,
2081 [ALC882_FIXUP_ASUS_W2JC] = {
2082 .type = HDA_FIXUP_VERBS,
2083 .v.verbs = alc_gpio1_init_verbs,
2085 .chain_id = ALC882_FIXUP_EAPD,
2087 [ALC889_FIXUP_COEF] = {
2088 .type = HDA_FIXUP_FUNC,
2089 .v.func = alc889_fixup_coef,
2091 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
2092 .type = HDA_FIXUP_PINS,
2093 .v.pins = (const struct hda_pintbl[]) {
2094 { 0x16, 0x99130111 }, /* CLFE speaker */
2095 { 0x17, 0x99130112 }, /* surround speaker */
2099 .chain_id = ALC882_FIXUP_GPIO1,
2101 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
2102 .type = HDA_FIXUP_PINS,
2103 .v.pins = (const struct hda_pintbl[]) {
2104 { 0x16, 0x99130111 }, /* CLFE speaker */
2105 { 0x1b, 0x99130112 }, /* surround speaker */
2109 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2111 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2112 /* additional init verbs for Acer Aspire 8930G */
2113 .type = HDA_FIXUP_VERBS,
2114 .v.verbs = (const struct hda_verb[]) {
2115 /* Enable all DACs */
2116 /* DAC DISABLE/MUTE 1? */
2117 /* setting bits 1-5 disables DAC nids 0x02-0x06
2118 * apparently. Init=0x38 */
2119 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2120 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2121 /* DAC DISABLE/MUTE 2? */
2122 /* some bit here disables the other DACs.
2124 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2125 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2127 * This laptop has a stereo digital microphone.
2128 * The mics are only 1cm apart which makes the stereo
2129 * useless. However, either the mic or the ALC889
2130 * makes the signal become a difference/sum signal
2131 * instead of standard stereo, which is annoying.
2132 * So instead we flip this bit which makes the
2133 * codec replicate the sum signal to both channels,
2134 * turning it into a normal mono mic.
2136 /* DMIC_CONTROL? Init value = 0x0001 */
2137 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2138 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2139 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2140 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2144 .chain_id = ALC882_FIXUP_GPIO1,
2146 [ALC885_FIXUP_MACPRO_GPIO] = {
2147 .type = HDA_FIXUP_FUNC,
2148 .v.func = alc885_fixup_macpro_gpio,
2150 [ALC889_FIXUP_DAC_ROUTE] = {
2151 .type = HDA_FIXUP_FUNC,
2152 .v.func = alc889_fixup_dac_route,
2154 [ALC889_FIXUP_MBP_VREF] = {
2155 .type = HDA_FIXUP_FUNC,
2156 .v.func = alc889_fixup_mbp_vref,
2158 .chain_id = ALC882_FIXUP_GPIO1,
2160 [ALC889_FIXUP_IMAC91_VREF] = {
2161 .type = HDA_FIXUP_FUNC,
2162 .v.func = alc889_fixup_imac91_vref,
2164 .chain_id = ALC882_FIXUP_GPIO1,
2166 [ALC889_FIXUP_MBA11_VREF] = {
2167 .type = HDA_FIXUP_FUNC,
2168 .v.func = alc889_fixup_mba11_vref,
2170 .chain_id = ALC889_FIXUP_MBP_VREF,
2172 [ALC889_FIXUP_MBA21_VREF] = {
2173 .type = HDA_FIXUP_FUNC,
2174 .v.func = alc889_fixup_mba21_vref,
2176 .chain_id = ALC889_FIXUP_MBP_VREF,
2178 [ALC889_FIXUP_MP11_VREF] = {
2179 .type = HDA_FIXUP_FUNC,
2180 .v.func = alc889_fixup_mba11_vref,
2182 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2184 [ALC889_FIXUP_MP41_VREF] = {
2185 .type = HDA_FIXUP_FUNC,
2186 .v.func = alc889_fixup_mbp_vref,
2188 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2190 [ALC882_FIXUP_INV_DMIC] = {
2191 .type = HDA_FIXUP_FUNC,
2192 .v.func = alc_fixup_inv_dmic,
2194 [ALC882_FIXUP_NO_PRIMARY_HP] = {
2195 .type = HDA_FIXUP_FUNC,
2196 .v.func = alc882_fixup_no_primary_hp,
2198 [ALC887_FIXUP_ASUS_BASS] = {
2199 .type = HDA_FIXUP_PINS,
2200 .v.pins = (const struct hda_pintbl[]) {
2201 {0x16, 0x99130130}, /* bass speaker */
2205 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2207 [ALC887_FIXUP_BASS_CHMAP] = {
2208 .type = HDA_FIXUP_FUNC,
2209 .v.func = alc_fixup_bass_chmap,
2213 static const struct snd_pci_quirk alc882_fixup_tbl[] = {
2214 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2215 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2216 SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2217 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2218 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2219 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2220 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
2221 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2222 ALC882_FIXUP_ACER_ASPIRE_4930G),
2223 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2224 ALC882_FIXUP_ACER_ASPIRE_4930G),
2225 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2226 ALC882_FIXUP_ACER_ASPIRE_8930G),
2227 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2228 ALC882_FIXUP_ACER_ASPIRE_8930G),
2229 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2230 ALC882_FIXUP_ACER_ASPIRE_4930G),
2231 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
2232 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2233 ALC882_FIXUP_ACER_ASPIRE_4930G),
2234 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2235 ALC882_FIXUP_ACER_ASPIRE_4930G),
2236 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2237 ALC882_FIXUP_ACER_ASPIRE_4930G),
2238 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
2239 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
2240 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
2241 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
2242 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
2243 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
2244 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
2245 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
2246 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
2247 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2248 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
2249 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
2250 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
2251 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
2253 /* All Apple entries are in codec SSIDs */
2254 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2255 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2256 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2257 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
2258 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2259 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
2260 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2261 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
2262 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
2263 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
2264 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
2265 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2266 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2267 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
2268 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2269 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2270 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
2271 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
2272 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
2273 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2274 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
2275 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
2277 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
2278 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
2279 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
2280 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
2281 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
2282 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2283 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
2284 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
2285 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
2289 static const struct hda_model_fixup alc882_fixup_models[] = {
2290 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2291 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2292 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
2293 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
2294 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
2299 * BIOS auto configuration
2301 /* almost identical with ALC880 parser... */
2302 static int alc882_parse_auto_config(struct hda_codec *codec)
2304 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
2305 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2306 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
2311 static int patch_alc882(struct hda_codec *codec)
2313 struct alc_spec *spec;
2316 err = alc_alloc_spec(codec, 0x0b);
2322 switch (codec->core.vendor_id) {
2328 /* ALC883 and variants */
2329 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2333 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
2335 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2337 alc_auto_parse_customize_define(codec);
2339 if (has_cdefine_beep(codec))
2340 spec->gen.beep_nid = 0x01;
2342 /* automatic parse from the BIOS config */
2343 err = alc882_parse_auto_config(codec);
2347 if (!spec->gen.no_analog && spec->gen.beep_nid)
2348 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2350 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2363 static int alc262_parse_auto_config(struct hda_codec *codec)
2365 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
2366 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2367 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
2374 ALC262_FIXUP_FSC_H270,
2375 ALC262_FIXUP_FSC_S7110,
2376 ALC262_FIXUP_HP_Z200,
2378 ALC262_FIXUP_LENOVO_3000,
2380 ALC262_FIXUP_BENQ_T31,
2381 ALC262_FIXUP_INV_DMIC,
2382 ALC262_FIXUP_INTEL_BAYLEYBAY,
2385 static const struct hda_fixup alc262_fixups[] = {
2386 [ALC262_FIXUP_FSC_H270] = {
2387 .type = HDA_FIXUP_PINS,
2388 .v.pins = (const struct hda_pintbl[]) {
2389 { 0x14, 0x99130110 }, /* speaker */
2390 { 0x15, 0x0221142f }, /* front HP */
2391 { 0x1b, 0x0121141f }, /* rear HP */
2395 [ALC262_FIXUP_FSC_S7110] = {
2396 .type = HDA_FIXUP_PINS,
2397 .v.pins = (const struct hda_pintbl[]) {
2398 { 0x15, 0x90170110 }, /* speaker */
2402 .chain_id = ALC262_FIXUP_BENQ,
2404 [ALC262_FIXUP_HP_Z200] = {
2405 .type = HDA_FIXUP_PINS,
2406 .v.pins = (const struct hda_pintbl[]) {
2407 { 0x16, 0x99130120 }, /* internal speaker */
2411 [ALC262_FIXUP_TYAN] = {
2412 .type = HDA_FIXUP_PINS,
2413 .v.pins = (const struct hda_pintbl[]) {
2414 { 0x14, 0x1993e1f0 }, /* int AUX */
2418 [ALC262_FIXUP_LENOVO_3000] = {
2419 .type = HDA_FIXUP_PINCTLS,
2420 .v.pins = (const struct hda_pintbl[]) {
2421 { 0x19, PIN_VREF50 },
2425 .chain_id = ALC262_FIXUP_BENQ,
2427 [ALC262_FIXUP_BENQ] = {
2428 .type = HDA_FIXUP_VERBS,
2429 .v.verbs = (const struct hda_verb[]) {
2430 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2431 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2435 [ALC262_FIXUP_BENQ_T31] = {
2436 .type = HDA_FIXUP_VERBS,
2437 .v.verbs = (const struct hda_verb[]) {
2438 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2439 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2443 [ALC262_FIXUP_INV_DMIC] = {
2444 .type = HDA_FIXUP_FUNC,
2445 .v.func = alc_fixup_inv_dmic,
2447 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2448 .type = HDA_FIXUP_FUNC,
2449 .v.func = alc_fixup_no_depop_delay,
2453 static const struct snd_pci_quirk alc262_fixup_tbl[] = {
2454 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
2455 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
2456 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
2457 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
2458 SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
2459 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
2460 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
2461 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2462 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
2463 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
2467 static const struct hda_model_fixup alc262_fixup_models[] = {
2468 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
2474 static int patch_alc262(struct hda_codec *codec)
2476 struct alc_spec *spec;
2479 err = alc_alloc_spec(codec, 0x0b);
2484 spec->gen.shared_mic_vref_pin = 0x18;
2486 spec->shutup = alc_eapd_shutup;
2489 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2492 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
2494 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2496 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
2498 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2500 alc_auto_parse_customize_define(codec);
2502 if (has_cdefine_beep(codec))
2503 spec->gen.beep_nid = 0x01;
2505 /* automatic parse from the BIOS config */
2506 err = alc262_parse_auto_config(codec);
2510 if (!spec->gen.no_analog && spec->gen.beep_nid)
2511 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2513 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2525 /* bind Beep switches of both NID 0x0f and 0x10 */
2526 static const struct hda_bind_ctls alc268_bind_beep_sw = {
2527 .ops = &snd_hda_bind_sw,
2529 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
2530 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
2535 static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2536 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
2537 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
2541 /* set PCBEEP vol = 0, mute connections */
2542 static const struct hda_verb alc268_beep_init_verbs[] = {
2543 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2544 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2545 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2550 ALC268_FIXUP_INV_DMIC,
2551 ALC268_FIXUP_HP_EAPD,
2555 static const struct hda_fixup alc268_fixups[] = {
2556 [ALC268_FIXUP_INV_DMIC] = {
2557 .type = HDA_FIXUP_FUNC,
2558 .v.func = alc_fixup_inv_dmic,
2560 [ALC268_FIXUP_HP_EAPD] = {
2561 .type = HDA_FIXUP_VERBS,
2562 .v.verbs = (const struct hda_verb[]) {
2563 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
2567 [ALC268_FIXUP_SPDIF] = {
2568 .type = HDA_FIXUP_PINS,
2569 .v.pins = (const struct hda_pintbl[]) {
2570 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
2576 static const struct hda_model_fixup alc268_fixup_models[] = {
2577 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
2578 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
2582 static const struct snd_pci_quirk alc268_fixup_tbl[] = {
2583 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
2584 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
2585 /* below is codec SSID since multiple Toshiba laptops have the
2586 * same PCI SSID 1179:ff00
2588 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
2593 * BIOS auto configuration
2595 static int alc268_parse_auto_config(struct hda_codec *codec)
2597 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2598 return alc_parse_auto_config(codec, NULL, alc268_ssids);
2603 static int patch_alc268(struct hda_codec *codec)
2605 struct alc_spec *spec;
2608 /* ALC268 has no aa-loopback mixer */
2609 err = alc_alloc_spec(codec, 0);
2614 spec->gen.beep_nid = 0x01;
2616 spec->shutup = alc_eapd_shutup;
2618 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
2619 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2621 /* automatic parse from the BIOS config */
2622 err = alc268_parse_auto_config(codec);
2626 if (err > 0 && !spec->gen.no_analog &&
2627 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
2628 add_mixer(spec, alc268_beep_mixer);
2629 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
2630 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
2631 /* override the amp caps for beep generator */
2632 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
2633 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
2634 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
2635 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
2636 (0 << AC_AMPCAP_MUTE_SHIFT));
2639 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2652 static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
2653 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
2656 static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
2657 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
2660 /* different alc269-variants */
2662 ALC269_TYPE_ALC269VA,
2663 ALC269_TYPE_ALC269VB,
2664 ALC269_TYPE_ALC269VC,
2665 ALC269_TYPE_ALC269VD,
2681 * BIOS auto configuration
2683 static int alc269_parse_auto_config(struct hda_codec *codec)
2685 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
2686 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
2687 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2688 struct alc_spec *spec = codec->spec;
2689 const hda_nid_t *ssids;
2691 switch (spec->codec_variant) {
2692 case ALC269_TYPE_ALC269VA:
2693 case ALC269_TYPE_ALC269VC:
2694 case ALC269_TYPE_ALC280:
2695 case ALC269_TYPE_ALC284:
2696 case ALC269_TYPE_ALC285:
2697 ssids = alc269va_ssids;
2699 case ALC269_TYPE_ALC269VB:
2700 case ALC269_TYPE_ALC269VD:
2701 case ALC269_TYPE_ALC282:
2702 case ALC269_TYPE_ALC283:
2703 case ALC269_TYPE_ALC286:
2704 case ALC269_TYPE_ALC298:
2705 case ALC269_TYPE_ALC255:
2706 case ALC269_TYPE_ALC256:
2707 case ALC269_TYPE_ALC225:
2708 case ALC269_TYPE_ALC294:
2709 case ALC269_TYPE_ALC700:
2710 ssids = alc269_ssids;
2713 ssids = alc269_ssids;
2717 return alc_parse_auto_config(codec, alc269_ignore, ssids);
2720 static int find_ext_mic_pin(struct hda_codec *codec);
2722 static void alc286_shutup(struct hda_codec *codec)
2725 int mic_pin = find_ext_mic_pin(codec);
2726 /* don't shut up pins when unloading the driver; otherwise it breaks
2727 * the default pin setup at the next load of the driver
2729 if (codec->bus->shutdown)
2731 for (i = 0; i < codec->init_pins.used; i++) {
2732 struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i);
2733 /* use read here for syncing after issuing each verb */
2734 if (pin->nid != mic_pin)
2735 snd_hda_codec_read(codec, pin->nid, 0,
2736 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
2738 codec->pins_shutup = 1;
2741 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
2743 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
2746 static void alc269_shutup(struct hda_codec *codec)
2748 struct alc_spec *spec = codec->spec;
2750 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
2751 alc269vb_toggle_power_output(codec, 0);
2752 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
2753 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
2756 snd_hda_shutup_pins(codec);
2759 static struct coef_fw alc282_coefs[] = {
2760 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
2761 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
2762 WRITE_COEF(0x07, 0x0200), /* DMIC control */
2763 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
2764 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
2765 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
2766 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
2767 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
2768 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
2769 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
2770 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
2771 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
2772 WRITE_COEF(0x34, 0xa0c0), /* ANC */
2773 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
2774 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
2775 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
2776 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
2777 WRITE_COEF(0x63, 0x2902), /* PLL */
2778 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
2779 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
2780 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
2781 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
2782 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
2783 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
2784 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
2785 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
2786 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
2787 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
2788 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
2792 static void alc282_restore_default_value(struct hda_codec *codec)
2794 alc_process_coef_fw(codec, alc282_coefs);
2797 static void alc282_init(struct hda_codec *codec)
2799 struct alc_spec *spec = codec->spec;
2800 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
2804 alc282_restore_default_value(codec);
2808 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
2809 coef78 = alc_read_coef_idx(codec, 0x78);
2811 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
2812 /* Headphone capless set to high power mode */
2813 alc_write_coef_idx(codec, 0x78, 0x9004);
2818 snd_hda_codec_write(codec, hp_pin, 0,
2819 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
2824 snd_hda_codec_write(codec, hp_pin, 0,
2825 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
2830 /* Headphone capless set to normal mode */
2831 alc_write_coef_idx(codec, 0x78, coef78);
2834 static void alc282_shutup(struct hda_codec *codec)
2836 struct alc_spec *spec = codec->spec;
2837 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
2842 alc269_shutup(codec);
2846 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
2847 coef78 = alc_read_coef_idx(codec, 0x78);
2848 alc_write_coef_idx(codec, 0x78, 0x9004);
2853 snd_hda_codec_write(codec, hp_pin, 0,
2854 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
2859 snd_hda_codec_write(codec, hp_pin, 0,
2860 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
2865 alc_auto_setup_eapd(codec, false);
2866 snd_hda_shutup_pins(codec);
2867 alc_write_coef_idx(codec, 0x78, coef78);
2870 static struct coef_fw alc283_coefs[] = {
2871 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
2872 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
2873 WRITE_COEF(0x07, 0x0200), /* DMIC control */
2874 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
2875 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
2876 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
2877 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
2878 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
2879 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
2880 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
2881 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
2882 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
2883 WRITE_COEF(0x22, 0xa0c0), /* ANC */
2884 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
2885 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
2886 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
2887 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
2888 WRITE_COEF(0x2e, 0x2902), /* PLL */
2889 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
2890 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
2891 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
2892 WRITE_COEF(0x36, 0x0), /* capless control 5 */
2893 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
2894 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
2895 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
2896 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
2897 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
2898 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
2899 WRITE_COEF(0x49, 0x0), /* test mode */
2900 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
2901 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
2902 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
2903 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
2907 static void alc283_restore_default_value(struct hda_codec *codec)
2909 alc_process_coef_fw(codec, alc283_coefs);
2912 static void alc283_init(struct hda_codec *codec)
2914 struct alc_spec *spec = codec->spec;
2915 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
2918 if (!spec->gen.autocfg.hp_outs) {
2919 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
2920 hp_pin = spec->gen.autocfg.line_out_pins[0];
2923 alc283_restore_default_value(codec);
2929 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
2931 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
2932 /* Headphone capless set to high power mode */
2933 alc_write_coef_idx(codec, 0x43, 0x9004);
2935 snd_hda_codec_write(codec, hp_pin, 0,
2936 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
2941 snd_hda_codec_write(codec, hp_pin, 0,
2942 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
2946 /* Index 0x46 Combo jack auto switch control 2 */
2947 /* 3k pull low control for Headset jack. */
2948 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
2949 /* Headphone capless set to normal mode */
2950 alc_write_coef_idx(codec, 0x43, 0x9614);
2953 static void alc283_shutup(struct hda_codec *codec)
2955 struct alc_spec *spec = codec->spec;
2956 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
2959 if (!spec->gen.autocfg.hp_outs) {
2960 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
2961 hp_pin = spec->gen.autocfg.line_out_pins[0];
2965 alc269_shutup(codec);
2969 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
2971 alc_write_coef_idx(codec, 0x43, 0x9004);
2973 /*depop hp during suspend*/
2974 alc_write_coef_idx(codec, 0x06, 0x2100);
2976 snd_hda_codec_write(codec, hp_pin, 0,
2977 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
2982 snd_hda_codec_write(codec, hp_pin, 0,
2983 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
2985 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
2989 alc_auto_setup_eapd(codec, false);
2990 snd_hda_shutup_pins(codec);
2991 alc_write_coef_idx(codec, 0x43, 0x9614);
2994 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
2997 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
2998 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
2999 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3002 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3006 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3007 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3009 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3014 static void alc5505_dsp_halt(struct hda_codec *codec)
3018 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3019 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3020 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3021 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3022 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3023 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3024 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3025 val = alc5505_coef_get(codec, 0x6220);
3026 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3029 static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3031 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3032 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3033 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3034 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3035 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3036 alc5505_coef_set(codec, 0x880c, 0x00000004);
3039 static void alc5505_dsp_init(struct hda_codec *codec)
3043 alc5505_dsp_halt(codec);
3044 alc5505_dsp_back_from_halt(codec);
3045 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3046 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3047 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3048 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3049 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3050 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3051 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3052 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3053 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3054 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3055 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3056 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3057 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3059 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3061 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3063 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3065 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3066 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3067 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3068 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3069 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3070 alc5505_coef_set(codec, 0x880c, 0x00000003);
3071 alc5505_coef_set(codec, 0x880c, 0x00000010);
3073 #ifdef HALT_REALTEK_ALC5505
3074 alc5505_dsp_halt(codec);
3078 #ifdef HALT_REALTEK_ALC5505
3079 #define alc5505_dsp_suspend(codec) /* NOP */
3080 #define alc5505_dsp_resume(codec) /* NOP */
3082 #define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
3083 #define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
3087 static int alc269_suspend(struct hda_codec *codec)
3089 struct alc_spec *spec = codec->spec;
3091 if (spec->has_alc5505_dsp)
3092 alc5505_dsp_suspend(codec);
3093 return alc_suspend(codec);
3096 static int alc269_resume(struct hda_codec *codec)
3098 struct alc_spec *spec = codec->spec;
3100 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3101 alc269vb_toggle_power_output(codec, 0);
3102 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3103 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
3107 codec->patch_ops.init(codec);
3109 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3110 alc269vb_toggle_power_output(codec, 1);
3111 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3112 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
3116 regcache_sync(codec->core.regmap);
3117 hda_call_check_power_status(codec, 0x01);
3119 /* on some machine, the BIOS will clear the codec gpio data when enter
3120 * suspend, and won't restore the data after resume, so we restore it
3124 snd_hda_codec_write(codec, codec->core.afg, 0, AC_VERB_SET_GPIO_DATA,
3127 if (spec->has_alc5505_dsp)
3128 alc5505_dsp_resume(codec);
3132 #endif /* CONFIG_PM */
3134 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
3135 const struct hda_fixup *fix, int action)
3137 struct alc_spec *spec = codec->spec;
3139 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3140 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
3143 static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
3144 const struct hda_fixup *fix,
3147 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
3148 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
3150 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
3151 snd_hda_codec_set_pincfg(codec, 0x19,
3152 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
3153 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
3156 static void alc269_fixup_hweq(struct hda_codec *codec,
3157 const struct hda_fixup *fix, int action)
3159 if (action == HDA_FIXUP_ACT_INIT)
3160 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
3163 static void alc269_fixup_headset_mic(struct hda_codec *codec,
3164 const struct hda_fixup *fix, int action)
3166 struct alc_spec *spec = codec->spec;
3168 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3169 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3172 static void alc271_fixup_dmic(struct hda_codec *codec,
3173 const struct hda_fixup *fix, int action)
3175 static const struct hda_verb verbs[] = {
3176 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
3177 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
3182 if (strcmp(codec->core.chip_name, "ALC271X") &&
3183 strcmp(codec->core.chip_name, "ALC269VB"))
3185 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
3186 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
3187 snd_hda_sequence_write(codec, verbs);
3190 static void alc269_fixup_pcm_44k(struct hda_codec *codec,
3191 const struct hda_fixup *fix, int action)
3193 struct alc_spec *spec = codec->spec;
3195 if (action != HDA_FIXUP_ACT_PROBE)
3198 /* Due to a hardware problem on Lenovo Ideadpad, we need to
3199 * fix the sample rate of analog I/O to 44.1kHz
3201 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
3202 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
3205 static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
3206 const struct hda_fixup *fix, int action)
3208 /* The digital-mic unit sends PDM (differential signal) instead of
3209 * the standard PCM, thus you can't record a valid mono stream as is.
3210 * Below is a workaround specific to ALC269 to control the dmic
3211 * signal source as mono.
3213 if (action == HDA_FIXUP_ACT_INIT)
3214 alc_update_coef_idx(codec, 0x07, 0, 0x80);
3217 static void alc269_quanta_automute(struct hda_codec *codec)
3219 snd_hda_gen_update_outputs(codec);
3221 alc_write_coef_idx(codec, 0x0c, 0x680);
3222 alc_write_coef_idx(codec, 0x0c, 0x480);
3225 static void alc269_fixup_quanta_mute(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_PROBE)
3231 spec->gen.automute_hook = alc269_quanta_automute;
3234 static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
3235 struct hda_jack_callback *jack)
3237 struct alc_spec *spec = codec->spec;
3240 snd_hda_gen_hp_automute(codec, jack);
3242 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
3244 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3247 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3251 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
3252 const struct hda_fixup *fix, int action)
3254 struct alc_spec *spec = codec->spec;
3255 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3256 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3257 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
3262 /* update mute-LED according to the speaker mute state via mic VREF pin */
3263 static void alc269_fixup_mic_mute_hook(void *private_data, int enabled)
3265 struct hda_codec *codec = private_data;
3266 struct alc_spec *spec = codec->spec;
3267 unsigned int pinval;
3269 if (spec->mute_led_polarity)
3271 pinval = snd_hda_codec_get_pin_target(codec, spec->mute_led_nid);
3272 pinval &= ~AC_PINCTL_VREFEN;
3273 pinval |= enabled ? AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80;
3274 if (spec->mute_led_nid) {
3275 /* temporarily power up/down for setting VREF */
3276 snd_hda_power_up_pm(codec);
3277 snd_hda_set_pin_ctl_cache(codec, spec->mute_led_nid, pinval);
3278 snd_hda_power_down_pm(codec);
3282 /* Make sure the led works even in runtime suspend */
3283 static unsigned int led_power_filter(struct hda_codec *codec,
3285 unsigned int power_state)
3287 struct alc_spec *spec = codec->spec;
3289 if (power_state != AC_PWRST_D3 || nid == 0 ||
3290 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
3293 /* Set pin ctl again, it might have just been set to 0 */
3294 snd_hda_set_pin_ctl(codec, nid,
3295 snd_hda_codec_get_pin_target(codec, nid));
3297 return snd_hda_gen_path_power_filter(codec, nid, power_state);
3300 static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
3301 const struct hda_fixup *fix, int action)
3303 struct alc_spec *spec = codec->spec;
3304 const struct dmi_device *dev = NULL;
3306 if (action != HDA_FIXUP_ACT_PRE_PROBE)
3309 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
3311 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
3313 if (pin < 0x0a || pin >= 0x10)
3315 spec->mute_led_polarity = pol;
3316 spec->mute_led_nid = pin - 0x0a + 0x18;
3317 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3318 spec->gen.vmaster_mute_enum = 1;
3319 codec->power_filter = led_power_filter;
3321 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
3322 spec->mute_led_polarity);
3327 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
3328 const struct hda_fixup *fix, int action)
3330 struct alc_spec *spec = codec->spec;
3331 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3332 spec->mute_led_polarity = 0;
3333 spec->mute_led_nid = 0x18;
3334 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3335 spec->gen.vmaster_mute_enum = 1;
3336 codec->power_filter = led_power_filter;
3340 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
3341 const struct hda_fixup *fix, int action)
3343 struct alc_spec *spec = codec->spec;
3344 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3345 spec->mute_led_polarity = 0;
3346 spec->mute_led_nid = 0x19;
3347 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3348 spec->gen.vmaster_mute_enum = 1;
3349 codec->power_filter = led_power_filter;
3353 /* update LED status via GPIO */
3354 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
3357 struct alc_spec *spec = codec->spec;
3358 unsigned int oldval = spec->gpio_led;
3360 if (spec->mute_led_polarity)
3364 spec->gpio_led &= ~mask;
3366 spec->gpio_led |= mask;
3367 if (spec->gpio_led != oldval)
3368 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
3372 /* turn on/off mute LED via GPIO per vmaster hook */
3373 static void alc_fixup_gpio_mute_hook(void *private_data, int enabled)
3375 struct hda_codec *codec = private_data;
3376 struct alc_spec *spec = codec->spec;
3378 alc_update_gpio_led(codec, spec->gpio_mute_led_mask, enabled);
3381 /* turn on/off mic-mute LED via GPIO per capture hook */
3382 static void alc_fixup_gpio_mic_mute_hook(struct hda_codec *codec,
3383 struct snd_kcontrol *kcontrol,
3384 struct snd_ctl_elem_value *ucontrol)
3386 struct alc_spec *spec = codec->spec;
3389 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
3390 ucontrol->value.integer.value[0] ||
3391 ucontrol->value.integer.value[1]);
3394 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
3395 const struct hda_fixup *fix, int action)
3397 struct alc_spec *spec = codec->spec;
3398 static const struct hda_verb gpio_init[] = {
3399 { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 },
3400 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 },
3404 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3405 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
3406 spec->gen.cap_sync_hook = alc_fixup_gpio_mic_mute_hook;
3408 spec->mute_led_polarity = 0;
3409 spec->gpio_mute_led_mask = 0x08;
3410 spec->gpio_mic_led_mask = 0x10;
3411 snd_hda_add_verbs(codec, gpio_init);
3415 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
3416 const struct hda_fixup *fix, int action)
3418 struct alc_spec *spec = codec->spec;
3419 static const struct hda_verb gpio_init[] = {
3420 { 0x01, AC_VERB_SET_GPIO_MASK, 0x22 },
3421 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x22 },
3425 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3426 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
3427 spec->gen.cap_sync_hook = alc_fixup_gpio_mic_mute_hook;
3429 spec->mute_led_polarity = 0;
3430 spec->gpio_mute_led_mask = 0x02;
3431 spec->gpio_mic_led_mask = 0x20;
3432 snd_hda_add_verbs(codec, gpio_init);
3436 /* turn on/off mic-mute LED per capture hook */
3437 static void alc269_fixup_hp_cap_mic_mute_hook(struct hda_codec *codec,
3438 struct snd_kcontrol *kcontrol,
3439 struct snd_ctl_elem_value *ucontrol)
3441 struct alc_spec *spec = codec->spec;
3442 unsigned int pinval, enable, disable;
3444 pinval = snd_hda_codec_get_pin_target(codec, spec->cap_mute_led_nid);
3445 pinval &= ~AC_PINCTL_VREFEN;
3446 enable = pinval | AC_PINCTL_VREF_80;
3447 disable = pinval | AC_PINCTL_VREF_HIZ;
3452 if (ucontrol->value.integer.value[0] ||
3453 ucontrol->value.integer.value[1])
3458 if (spec->cap_mute_led_nid)
3459 snd_hda_set_pin_ctl_cache(codec, spec->cap_mute_led_nid, pinval);
3462 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
3463 const struct hda_fixup *fix, int action)
3465 struct alc_spec *spec = codec->spec;
3466 static const struct hda_verb gpio_init[] = {
3467 { 0x01, AC_VERB_SET_GPIO_MASK, 0x08 },
3468 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x08 },
3472 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3473 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
3474 spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook;
3476 spec->mute_led_polarity = 0;
3477 spec->gpio_mute_led_mask = 0x08;
3478 spec->cap_mute_led_nid = 0x18;
3479 snd_hda_add_verbs(codec, gpio_init);
3480 codec->power_filter = led_power_filter;
3484 static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
3485 const struct hda_fixup *fix, int action)
3487 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to enable headphone amp */
3488 struct alc_spec *spec = codec->spec;
3489 static const struct hda_verb gpio_init[] = {
3490 { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 },
3491 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 },
3495 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3496 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
3497 spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook;
3499 spec->mute_led_polarity = 0;
3500 spec->gpio_mute_led_mask = 0x08;
3501 spec->cap_mute_led_nid = 0x18;
3502 snd_hda_add_verbs(codec, gpio_init);
3503 codec->power_filter = led_power_filter;
3507 #if IS_REACHABLE(CONFIG_INPUT)
3508 static void gpio2_mic_hotkey_event(struct hda_codec *codec,
3509 struct hda_jack_callback *event)
3511 struct alc_spec *spec = codec->spec;
3513 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
3514 send both key on and key off event for every interrupt. */
3515 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
3516 input_sync(spec->kb_dev);
3517 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
3518 input_sync(spec->kb_dev);
3521 static int alc_register_micmute_input_device(struct hda_codec *codec)
3523 struct alc_spec *spec = codec->spec;
3526 spec->kb_dev = input_allocate_device();
3527 if (!spec->kb_dev) {
3528 codec_err(codec, "Out of memory (input_allocate_device)\n");
3532 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
3534 spec->kb_dev->name = "Microphone Mute Button";
3535 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
3536 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
3537 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
3538 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
3539 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
3540 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
3542 if (input_register_device(spec->kb_dev)) {
3543 codec_err(codec, "input_register_device failed\n");
3544 input_free_device(spec->kb_dev);
3545 spec->kb_dev = NULL;
3552 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
3553 const struct hda_fixup *fix, int action)
3555 /* GPIO1 = set according to SKU external amp
3556 GPIO2 = mic mute hotkey
3558 GPIO4 = mic mute LED */
3559 static const struct hda_verb gpio_init[] = {
3560 { 0x01, AC_VERB_SET_GPIO_MASK, 0x1e },
3561 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x1a },
3562 { 0x01, AC_VERB_SET_GPIO_DATA, 0x02 },
3566 struct alc_spec *spec = codec->spec;
3568 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3569 if (alc_register_micmute_input_device(codec) != 0)
3572 snd_hda_add_verbs(codec, gpio_init);
3573 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
3574 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
3575 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
3576 gpio2_mic_hotkey_event);
3578 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
3579 spec->gen.cap_sync_hook = alc_fixup_gpio_mic_mute_hook;
3581 spec->mute_led_polarity = 0;
3582 spec->gpio_mute_led_mask = 0x08;
3583 spec->gpio_mic_led_mask = 0x10;
3591 case HDA_FIXUP_ACT_PROBE:
3592 spec->init_amp = ALC_INIT_DEFAULT;
3594 case HDA_FIXUP_ACT_FREE:
3595 input_unregister_device(spec->kb_dev);
3596 spec->kb_dev = NULL;
3600 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
3601 const struct hda_fixup *fix, int action)
3603 /* Line2 = mic mute hotkey
3604 GPIO2 = mic mute LED */
3605 static const struct hda_verb gpio_init[] = {
3606 { 0x01, AC_VERB_SET_GPIO_MASK, 0x04 },
3607 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04 },
3611 struct alc_spec *spec = codec->spec;
3613 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3614 if (alc_register_micmute_input_device(codec) != 0)
3617 snd_hda_add_verbs(codec, gpio_init);
3618 snd_hda_jack_detect_enable_callback(codec, 0x1b,
3619 gpio2_mic_hotkey_event);
3621 spec->gen.cap_sync_hook = alc_fixup_gpio_mic_mute_hook;
3623 spec->mute_led_polarity = 0;
3624 spec->gpio_mic_led_mask = 0x04;
3632 case HDA_FIXUP_ACT_PROBE:
3633 spec->init_amp = ALC_INIT_DEFAULT;
3635 case HDA_FIXUP_ACT_FREE:
3636 input_unregister_device(spec->kb_dev);
3637 spec->kb_dev = NULL;
3641 #define alc280_fixup_hp_gpio2_mic_hotkey NULL
3642 #define alc233_fixup_lenovo_line2_mic_hotkey NULL
3645 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
3646 const struct hda_fixup *fix, int action)
3648 struct alc_spec *spec = codec->spec;
3650 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3651 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3652 spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook;
3653 spec->mute_led_polarity = 0;
3654 spec->mute_led_nid = 0x1a;
3655 spec->cap_mute_led_nid = 0x18;
3656 spec->gen.vmaster_mute_enum = 1;
3657 codec->power_filter = led_power_filter;
3661 static void alc_headset_mode_unplugged(struct hda_codec *codec)
3663 static struct coef_fw coef0255[] = {
3664 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
3665 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
3666 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
3667 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
3670 static struct coef_fw coef0255_1[] = {
3671 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
3674 static struct coef_fw coef0256[] = {
3675 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
3678 static struct coef_fw coef0233[] = {
3679 WRITE_COEF(0x1b, 0x0c0b),
3680 WRITE_COEF(0x45, 0xc429),
3681 UPDATE_COEF(0x35, 0x4000, 0),
3682 WRITE_COEF(0x06, 0x2104),
3683 WRITE_COEF(0x1a, 0x0001),
3684 WRITE_COEF(0x26, 0x0004),
3685 WRITE_COEF(0x32, 0x42a3),
3688 static struct coef_fw coef0288[] = {
3689 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
3690 UPDATE_COEF(0x50, 0x2000, 0x2000),
3691 UPDATE_COEF(0x56, 0x0006, 0x0006),
3692 UPDATE_COEF(0x66, 0x0008, 0),
3693 UPDATE_COEF(0x67, 0x2000, 0),
3696 static struct coef_fw coef0292[] = {
3697 WRITE_COEF(0x76, 0x000e),
3698 WRITE_COEF(0x6c, 0x2400),
3699 WRITE_COEF(0x18, 0x7308),
3700 WRITE_COEF(0x6b, 0xc429),
3703 static struct coef_fw coef0293[] = {
3704 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
3705 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
3706 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
3707 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
3708 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
3709 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
3712 static struct coef_fw coef0668[] = {
3713 WRITE_COEF(0x15, 0x0d40),
3714 WRITE_COEF(0xb7, 0x802b),
3717 static struct coef_fw coef0225[] = {
3718 UPDATE_COEF(0x4a, 1<<8, 0),
3719 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
3720 UPDATE_COEF(0x63, 3<<14, 3<<14),
3721 UPDATE_COEF(0x4a, 3<<4, 2<<4),
3722 UPDATE_COEF(0x4a, 3<<10, 3<<10),
3723 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
3724 UPDATE_COEF(0x4a, 3<<10, 0),
3728 switch (codec->core.vendor_id) {
3730 alc_process_coef_fw(codec, coef0255_1);
3731 alc_process_coef_fw(codec, coef0255);
3735 alc_process_coef_fw(codec, coef0256);
3736 alc_process_coef_fw(codec, coef0255);
3740 alc_process_coef_fw(codec, coef0233);
3745 alc_process_coef_fw(codec, coef0288);
3748 alc_process_coef_fw(codec, coef0292);
3751 alc_process_coef_fw(codec, coef0293);
3754 alc_process_coef_fw(codec, coef0668);
3759 alc_process_coef_fw(codec, coef0225);
3762 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
3766 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
3769 static struct coef_fw coef0255[] = {
3770 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
3771 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
3774 static struct coef_fw coef0233[] = {
3775 UPDATE_COEF(0x35, 0, 1<<14),
3776 WRITE_COEF(0x06, 0x2100),
3777 WRITE_COEF(0x1a, 0x0021),
3778 WRITE_COEF(0x26, 0x008c),
3781 static struct coef_fw coef0288[] = {
3782 UPDATE_COEF(0x50, 0x2000, 0),
3783 UPDATE_COEF(0x56, 0x0006, 0),
3784 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
3785 UPDATE_COEF(0x66, 0x0008, 0x0008),
3786 UPDATE_COEF(0x67, 0x2000, 0x2000),
3789 static struct coef_fw coef0292[] = {
3790 WRITE_COEF(0x19, 0xa208),
3791 WRITE_COEF(0x2e, 0xacf0),
3794 static struct coef_fw coef0293[] = {
3795 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
3796 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
3797 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
3800 static struct coef_fw coef0688[] = {
3801 WRITE_COEF(0xb7, 0x802b),
3802 WRITE_COEF(0xb5, 0x1040),
3803 UPDATE_COEF(0xc3, 0, 1<<12),
3806 static struct coef_fw coef0225[] = {
3807 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
3808 UPDATE_COEF(0x4a, 3<<4, 2<<4),
3809 UPDATE_COEF(0x63, 3<<14, 0),
3814 switch (codec->core.vendor_id) {
3818 alc_write_coef_idx(codec, 0x45, 0xc489);
3819 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
3820 alc_process_coef_fw(codec, coef0255);
3821 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
3825 alc_write_coef_idx(codec, 0x45, 0xc429);
3826 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
3827 alc_process_coef_fw(codec, coef0233);
3828 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
3833 alc_update_coef_idx(codec, 0x4f, 0x000c, 0);
3834 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
3835 alc_process_coef_fw(codec, coef0288);
3836 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
3839 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
3840 alc_process_coef_fw(codec, coef0292);
3843 /* Set to TRS mode */
3844 alc_write_coef_idx(codec, 0x45, 0xc429);
3845 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
3846 alc_process_coef_fw(codec, coef0293);
3847 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
3850 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
3851 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
3854 alc_write_coef_idx(codec, 0x11, 0x0001);
3855 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
3856 alc_process_coef_fw(codec, coef0688);
3857 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
3862 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
3863 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
3864 alc_process_coef_fw(codec, coef0225);
3865 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
3868 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
3871 static void alc_headset_mode_default(struct hda_codec *codec)
3873 static struct coef_fw coef0225[] = {
3874 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
3877 static struct coef_fw coef0255[] = {
3878 WRITE_COEF(0x45, 0xc089),
3879 WRITE_COEF(0x45, 0xc489),
3880 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
3881 WRITE_COEF(0x49, 0x0049),
3884 static struct coef_fw coef0233[] = {
3885 WRITE_COEF(0x06, 0x2100),
3886 WRITE_COEF(0x32, 0x4ea3),
3889 static struct coef_fw coef0288[] = {
3890 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
3891 UPDATE_COEF(0x50, 0x2000, 0x2000),
3892 UPDATE_COEF(0x56, 0x0006, 0x0006),
3893 UPDATE_COEF(0x66, 0x0008, 0),
3894 UPDATE_COEF(0x67, 0x2000, 0),
3897 static struct coef_fw coef0292[] = {
3898 WRITE_COEF(0x76, 0x000e),
3899 WRITE_COEF(0x6c, 0x2400),
3900 WRITE_COEF(0x6b, 0xc429),
3901 WRITE_COEF(0x18, 0x7308),
3904 static struct coef_fw coef0293[] = {
3905 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
3906 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
3907 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
3910 static struct coef_fw coef0688[] = {
3911 WRITE_COEF(0x11, 0x0041),
3912 WRITE_COEF(0x15, 0x0d40),
3913 WRITE_COEF(0xb7, 0x802b),
3917 switch (codec->core.vendor_id) {
3921 alc_process_coef_fw(codec, coef0225);
3926 alc_process_coef_fw(codec, coef0255);
3930 alc_process_coef_fw(codec, coef0233);
3935 alc_process_coef_fw(codec, coef0288);
3938 alc_process_coef_fw(codec, coef0292);
3941 alc_process_coef_fw(codec, coef0293);
3944 alc_process_coef_fw(codec, coef0688);
3947 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
3951 static void alc_headset_mode_ctia(struct hda_codec *codec)
3953 static struct coef_fw coef0255[] = {
3954 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
3955 WRITE_COEF(0x1b, 0x0c2b),
3956 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
3959 static struct coef_fw coef0256[] = {
3960 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
3961 WRITE_COEF(0x1b, 0x0c6b),
3962 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
3965 static struct coef_fw coef0233[] = {
3966 WRITE_COEF(0x45, 0xd429),
3967 WRITE_COEF(0x1b, 0x0c2b),
3968 WRITE_COEF(0x32, 0x4ea3),
3971 static struct coef_fw coef0288[] = {
3972 UPDATE_COEF(0x50, 0x2000, 0x2000),
3973 UPDATE_COEF(0x56, 0x0006, 0x0006),
3974 UPDATE_COEF(0x66, 0x0008, 0),
3975 UPDATE_COEF(0x67, 0x2000, 0),
3978 static struct coef_fw coef0292[] = {
3979 WRITE_COEF(0x6b, 0xd429),
3980 WRITE_COEF(0x76, 0x0008),
3981 WRITE_COEF(0x18, 0x7388),
3984 static struct coef_fw coef0293[] = {
3985 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
3986 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
3989 static struct coef_fw coef0688[] = {
3990 WRITE_COEF(0x11, 0x0001),
3991 WRITE_COEF(0x15, 0x0d60),
3992 WRITE_COEF(0xc3, 0x0000),
3995 static struct coef_fw coef0225[] = {
3996 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
3997 UPDATE_COEF(0x49, 1<<8, 1<<8),
3998 UPDATE_COEF(0x4a, 7<<6, 7<<6),
3999 UPDATE_COEF(0x4a, 3<<4, 3<<4),
4003 switch (codec->core.vendor_id) {
4005 alc_process_coef_fw(codec, coef0255);
4009 alc_process_coef_fw(codec, coef0256);
4013 alc_process_coef_fw(codec, coef0233);
4016 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);/* Headset output enable */
4017 /* ALC298 jack type setting is the same with ALC286/ALC288 */
4020 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4022 alc_process_coef_fw(codec, coef0288);
4025 alc_process_coef_fw(codec, coef0292);
4028 alc_process_coef_fw(codec, coef0293);
4031 alc_process_coef_fw(codec, coef0688);
4036 alc_process_coef_fw(codec, coef0225);
4039 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
4043 static void alc_headset_mode_omtp(struct hda_codec *codec)
4045 static struct coef_fw coef0255[] = {
4046 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
4047 WRITE_COEF(0x1b, 0x0c2b),
4048 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4051 static struct coef_fw coef0256[] = {
4052 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
4053 WRITE_COEF(0x1b, 0x0c6b),
4054 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4057 static struct coef_fw coef0233[] = {
4058 WRITE_COEF(0x45, 0xe429),
4059 WRITE_COEF(0x1b, 0x0c2b),
4060 WRITE_COEF(0x32, 0x4ea3),
4063 static struct coef_fw coef0288[] = {
4064 UPDATE_COEF(0x50, 0x2000, 0x2000),
4065 UPDATE_COEF(0x56, 0x0006, 0x0006),
4066 UPDATE_COEF(0x66, 0x0008, 0),
4067 UPDATE_COEF(0x67, 0x2000, 0),
4070 static struct coef_fw coef0292[] = {
4071 WRITE_COEF(0x6b, 0xe429),
4072 WRITE_COEF(0x76, 0x0008),
4073 WRITE_COEF(0x18, 0x7388),
4076 static struct coef_fw coef0293[] = {
4077 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
4078 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
4081 static struct coef_fw coef0688[] = {
4082 WRITE_COEF(0x11, 0x0001),
4083 WRITE_COEF(0x15, 0x0d50),
4084 WRITE_COEF(0xc3, 0x0000),
4087 static struct coef_fw coef0225[] = {
4088 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
4089 UPDATE_COEF(0x49, 1<<8, 1<<8),
4090 UPDATE_COEF(0x4a, 7<<6, 7<<6),
4091 UPDATE_COEF(0x4a, 3<<4, 3<<4),
4095 switch (codec->core.vendor_id) {
4097 alc_process_coef_fw(codec, coef0255);
4101 alc_process_coef_fw(codec, coef0256);
4105 alc_process_coef_fw(codec, coef0233);
4108 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
4109 /* ALC298 jack type setting is the same with ALC286/ALC288 */
4112 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
4114 alc_process_coef_fw(codec, coef0288);
4117 alc_process_coef_fw(codec, coef0292);
4120 alc_process_coef_fw(codec, coef0293);
4123 alc_process_coef_fw(codec, coef0688);
4128 alc_process_coef_fw(codec, coef0225);
4131 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
4134 static void alc_determine_headset_type(struct hda_codec *codec)
4137 bool is_ctia = false;
4138 struct alc_spec *spec = codec->spec;
4139 static struct coef_fw coef0255[] = {
4140 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
4141 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
4145 static struct coef_fw coef0288[] = {
4146 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
4149 static struct coef_fw coef0293[] = {
4150 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
4151 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
4154 static struct coef_fw coef0688[] = {
4155 WRITE_COEF(0x11, 0x0001),
4156 WRITE_COEF(0xb7, 0x802b),
4157 WRITE_COEF(0x15, 0x0d60),
4158 WRITE_COEF(0xc3, 0x0c00),
4161 static struct coef_fw coef0225[] = {
4162 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4163 UPDATE_COEF(0x49, 1<<8, 1<<8),
4167 switch (codec->core.vendor_id) {
4171 alc_process_coef_fw(codec, coef0255);
4173 val = alc_read_coef_idx(codec, 0x46);
4174 is_ctia = (val & 0x0070) == 0x0070;
4178 alc_write_coef_idx(codec, 0x45, 0xd029);
4180 val = alc_read_coef_idx(codec, 0x46);
4181 is_ctia = (val & 0x0070) == 0x0070;
4184 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020); /* Headset output enable */
4185 /* ALC298 check jack type is the same with ALC286/ALC288 */
4188 alc_process_coef_fw(codec, coef0288);
4190 val = alc_read_coef_idx(codec, 0x50);
4191 is_ctia = (val & 0x0070) == 0x0070;
4194 alc_write_coef_idx(codec, 0x6b, 0xd429);
4196 val = alc_read_coef_idx(codec, 0x6c);
4197 is_ctia = (val & 0x001c) == 0x001c;
4200 alc_process_coef_fw(codec, coef0293);
4202 val = alc_read_coef_idx(codec, 0x46);
4203 is_ctia = (val & 0x0070) == 0x0070;
4206 alc_process_coef_fw(codec, coef0688);
4208 val = alc_read_coef_idx(codec, 0xbe);
4209 is_ctia = (val & 0x1c02) == 0x1c02;
4214 alc_process_coef_fw(codec, coef0225);
4216 val = alc_read_coef_idx(codec, 0x46);
4217 is_ctia = (val & 0x00f0) == 0x00f0;
4221 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
4222 is_ctia ? "yes" : "no");
4223 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
4226 static void alc_update_headset_mode(struct hda_codec *codec)
4228 struct alc_spec *spec = codec->spec;
4230 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
4231 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
4233 int new_headset_mode;
4235 if (!snd_hda_jack_detect(codec, hp_pin))
4236 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
4237 else if (mux_pin == spec->headset_mic_pin)
4238 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
4239 else if (mux_pin == spec->headphone_mic_pin)
4240 new_headset_mode = ALC_HEADSET_MODE_MIC;
4242 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
4244 if (new_headset_mode == spec->current_headset_mode) {
4245 snd_hda_gen_update_outputs(codec);
4249 switch (new_headset_mode) {
4250 case ALC_HEADSET_MODE_UNPLUGGED:
4251 alc_headset_mode_unplugged(codec);
4252 spec->gen.hp_jack_present = false;
4254 case ALC_HEADSET_MODE_HEADSET:
4255 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
4256 alc_determine_headset_type(codec);
4257 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
4258 alc_headset_mode_ctia(codec);
4259 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
4260 alc_headset_mode_omtp(codec);
4261 spec->gen.hp_jack_present = true;
4263 case ALC_HEADSET_MODE_MIC:
4264 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
4265 spec->gen.hp_jack_present = false;
4267 case ALC_HEADSET_MODE_HEADPHONE:
4268 alc_headset_mode_default(codec);
4269 spec->gen.hp_jack_present = true;
4272 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
4273 snd_hda_set_pin_ctl_cache(codec, hp_pin,
4274 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
4275 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
4276 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
4279 spec->current_headset_mode = new_headset_mode;
4281 snd_hda_gen_update_outputs(codec);
4284 static void alc_update_headset_mode_hook(struct hda_codec *codec,
4285 struct snd_kcontrol *kcontrol,
4286 struct snd_ctl_elem_value *ucontrol)
4288 alc_update_headset_mode(codec);
4291 static void alc_update_headset_jack_cb(struct hda_codec *codec,
4292 struct hda_jack_callback *jack)
4294 struct alc_spec *spec = codec->spec;
4295 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
4296 snd_hda_gen_hp_automute(codec, jack);
4297 alc_update_headset_mode(codec);
4300 static void alc_probe_headset_mode(struct hda_codec *codec)
4303 struct alc_spec *spec = codec->spec;
4304 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
4307 for (i = 0; i < cfg->num_inputs; i++) {
4308 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
4309 spec->headset_mic_pin = cfg->inputs[i].pin;
4310 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
4311 spec->headphone_mic_pin = cfg->inputs[i].pin;
4314 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
4315 spec->gen.automute_hook = alc_update_headset_mode;
4316 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
4319 static void alc_fixup_headset_mode(struct hda_codec *codec,
4320 const struct hda_fixup *fix, int action)
4322 struct alc_spec *spec = codec->spec;
4325 case HDA_FIXUP_ACT_PRE_PROBE:
4326 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
4328 case HDA_FIXUP_ACT_PROBE:
4329 alc_probe_headset_mode(codec);
4331 case HDA_FIXUP_ACT_INIT:
4332 spec->current_headset_mode = 0;
4333 alc_update_headset_mode(codec);
4338 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
4339 const struct hda_fixup *fix, int action)
4341 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4342 struct alc_spec *spec = codec->spec;
4343 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4346 alc_fixup_headset_mode(codec, fix, action);
4349 static void alc255_set_default_jack_type(struct hda_codec *codec)
4351 /* Set to iphone type */
4352 static struct coef_fw alc255fw[] = {
4353 WRITE_COEF(0x1b, 0x880b),
4354 WRITE_COEF(0x45, 0xd089),
4355 WRITE_COEF(0x1b, 0x080b),
4356 WRITE_COEF(0x46, 0x0004),
4357 WRITE_COEF(0x1b, 0x0c0b),
4360 static struct coef_fw alc256fw[] = {
4361 WRITE_COEF(0x1b, 0x884b),
4362 WRITE_COEF(0x45, 0xd089),
4363 WRITE_COEF(0x1b, 0x084b),
4364 WRITE_COEF(0x46, 0x0004),
4365 WRITE_COEF(0x1b, 0x0c4b),
4368 switch (codec->core.vendor_id) {
4370 alc_process_coef_fw(codec, alc255fw);
4374 alc_process_coef_fw(codec, alc256fw);
4380 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
4381 const struct hda_fixup *fix, int action)
4383 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4384 alc255_set_default_jack_type(codec);
4386 alc_fixup_headset_mode(codec, fix, action);
4389 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
4390 const struct hda_fixup *fix, int action)
4392 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4393 struct alc_spec *spec = codec->spec;
4394 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4395 alc255_set_default_jack_type(codec);
4398 alc_fixup_headset_mode(codec, fix, action);
4401 static void alc288_update_headset_jack_cb(struct hda_codec *codec,
4402 struct hda_jack_callback *jack)
4404 struct alc_spec *spec = codec->spec;
4407 alc_update_headset_jack_cb(codec, jack);
4408 /* Headset Mic enable or disable, only for Dell Dino */
4409 present = spec->gen.hp_jack_present ? 0x40 : 0;
4410 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
4414 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
4415 const struct hda_fixup *fix, int action)
4417 alc_fixup_headset_mode(codec, fix, action);
4418 if (action == HDA_FIXUP_ACT_PROBE) {
4419 struct alc_spec *spec = codec->spec;
4420 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
4424 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
4425 const struct hda_fixup *fix, int action)
4427 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4428 struct alc_spec *spec = codec->spec;
4429 spec->gen.auto_mute_via_amp = 1;
4433 static void alc_no_shutup(struct hda_codec *codec)
4437 static void alc_fixup_no_shutup(struct hda_codec *codec,
4438 const struct hda_fixup *fix, int action)
4440 if (action == HDA_FIXUP_ACT_PROBE) {
4441 struct alc_spec *spec = codec->spec;
4442 spec->shutup = alc_no_shutup;
4446 static void alc_fixup_disable_aamix(struct hda_codec *codec,
4447 const struct hda_fixup *fix, int action)
4449 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4450 struct alc_spec *spec = codec->spec;
4451 /* Disable AA-loopback as it causes white noise */
4452 spec->gen.mixer_nid = 0;
4456 /* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
4457 static void alc_fixup_tpt440_dock(struct hda_codec *codec,
4458 const struct hda_fixup *fix, int action)
4460 static const struct hda_pintbl pincfgs[] = {
4461 { 0x16, 0x21211010 }, /* dock headphone */
4462 { 0x19, 0x21a11010 }, /* dock mic */
4465 struct alc_spec *spec = codec->spec;
4467 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4468 spec->shutup = alc_no_shutup; /* reduce click noise */
4469 spec->reboot_notify = alc_d3_at_reboot; /* reduce noise */
4470 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
4471 codec->power_save_node = 0; /* avoid click noises */
4472 snd_hda_apply_pincfgs(codec, pincfgs);
4476 static void alc_shutup_dell_xps13(struct hda_codec *codec)
4478 struct alc_spec *spec = codec->spec;
4479 int hp_pin = spec->gen.autocfg.hp_pins[0];
4481 /* Prevent pop noises when headphones are plugged in */
4482 snd_hda_codec_write(codec, hp_pin, 0,
4483 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
4487 static void alc_fixup_dell_xps13(struct hda_codec *codec,
4488 const struct hda_fixup *fix, int action)
4490 struct alc_spec *spec = codec->spec;
4491 struct hda_input_mux *imux = &spec->gen.input_mux;
4495 case HDA_FIXUP_ACT_PRE_PROBE:
4496 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
4497 * it causes a click noise at start up
4499 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
4501 case HDA_FIXUP_ACT_PROBE:
4502 spec->shutup = alc_shutup_dell_xps13;
4504 /* Make the internal mic the default input source. */
4505 for (i = 0; i < imux->num_items; i++) {
4506 if (spec->gen.imux_pins[i] == 0x12) {
4507 spec->gen.cur_mux[0] = i;
4515 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
4516 const struct hda_fixup *fix, int action)
4518 struct alc_spec *spec = codec->spec;
4520 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4521 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4522 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
4524 /* Disable boost for mic-in permanently. (This code is only called
4525 from quirks that guarantee that the headphone is at NID 0x1b.) */
4526 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
4527 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
4529 alc_fixup_headset_mode(codec, fix, action);
4532 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
4533 const struct hda_fixup *fix, int action)
4535 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4536 alc_write_coef_idx(codec, 0xc4, 0x8000);
4537 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
4538 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
4540 alc_fixup_headset_mode(codec, fix, action);
4543 /* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
4544 static int find_ext_mic_pin(struct hda_codec *codec)
4546 struct alc_spec *spec = codec->spec;
4547 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
4549 unsigned int defcfg;
4552 for (i = 0; i < cfg->num_inputs; i++) {
4553 if (cfg->inputs[i].type != AUTO_PIN_MIC)
4555 nid = cfg->inputs[i].pin;
4556 defcfg = snd_hda_codec_get_pincfg(codec, nid);
4557 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
4565 static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
4566 const struct hda_fixup *fix,
4569 struct alc_spec *spec = codec->spec;
4571 if (action == HDA_FIXUP_ACT_PROBE) {
4572 int mic_pin = find_ext_mic_pin(codec);
4573 int hp_pin = spec->gen.autocfg.hp_pins[0];
4575 if (snd_BUG_ON(!mic_pin || !hp_pin))
4577 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
4581 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
4582 const struct hda_fixup *fix,
4585 struct alc_spec *spec = codec->spec;
4586 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
4589 /* The mic boosts on level 2 and 3 are too noisy
4590 on the internal mic input.
4591 Therefore limit the boost to 0 or 1. */
4593 if (action != HDA_FIXUP_ACT_PROBE)
4596 for (i = 0; i < cfg->num_inputs; i++) {
4597 hda_nid_t nid = cfg->inputs[i].pin;
4598 unsigned int defcfg;
4599 if (cfg->inputs[i].type != AUTO_PIN_MIC)
4601 defcfg = snd_hda_codec_get_pincfg(codec, nid);
4602 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
4605 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
4606 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
4607 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
4608 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
4609 (0 << AC_AMPCAP_MUTE_SHIFT));
4613 static void alc283_hp_automute_hook(struct hda_codec *codec,
4614 struct hda_jack_callback *jack)
4616 struct alc_spec *spec = codec->spec;
4620 snd_hda_gen_hp_automute(codec, jack);
4622 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4625 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4629 static void alc283_fixup_chromebook(struct hda_codec *codec,
4630 const struct hda_fixup *fix, int action)
4632 struct alc_spec *spec = codec->spec;
4635 case HDA_FIXUP_ACT_PRE_PROBE:
4636 snd_hda_override_wcaps(codec, 0x03, 0);
4637 /* Disable AA-loopback as it causes white noise */
4638 spec->gen.mixer_nid = 0;
4640 case HDA_FIXUP_ACT_INIT:
4641 /* MIC2-VREF control */
4642 /* Set to manual mode */
4643 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
4644 /* Enable Line1 input control by verb */
4645 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
4650 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
4651 const struct hda_fixup *fix, int action)
4653 struct alc_spec *spec = codec->spec;
4656 case HDA_FIXUP_ACT_PRE_PROBE:
4657 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
4659 case HDA_FIXUP_ACT_INIT:
4660 /* MIC2-VREF control */
4661 /* Set to manual mode */
4662 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
4667 /* mute tablet speaker pin (0x14) via dock plugging in addition */
4668 static void asus_tx300_automute(struct hda_codec *codec)
4670 struct alc_spec *spec = codec->spec;
4671 snd_hda_gen_update_outputs(codec);
4672 if (snd_hda_jack_detect(codec, 0x1b))
4673 spec->gen.mute_bits |= (1ULL << 0x14);
4676 static void alc282_fixup_asus_tx300(struct hda_codec *codec,
4677 const struct hda_fixup *fix, int action)
4679 struct alc_spec *spec = codec->spec;
4680 /* TX300 needs to set up GPIO2 for the speaker amp */
4681 static const struct hda_verb gpio2_verbs[] = {
4682 { 0x01, AC_VERB_SET_GPIO_MASK, 0x04 },
4683 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04 },
4684 { 0x01, AC_VERB_SET_GPIO_DATA, 0x04 },
4687 static const struct hda_pintbl dock_pins[] = {
4688 { 0x1b, 0x21114000 }, /* dock speaker pin */
4691 struct snd_kcontrol *kctl;
4694 case HDA_FIXUP_ACT_PRE_PROBE:
4695 snd_hda_add_verbs(codec, gpio2_verbs);
4696 snd_hda_apply_pincfgs(codec, dock_pins);
4697 spec->gen.auto_mute_via_amp = 1;
4698 spec->gen.automute_hook = asus_tx300_automute;
4699 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4700 snd_hda_gen_hp_automute);
4702 case HDA_FIXUP_ACT_BUILD:
4703 /* this is a bit tricky; give more sane names for the main
4704 * (tablet) speaker and the dock speaker, respectively
4706 kctl = snd_hda_find_mixer_ctl(codec, "Speaker Playback Switch");
4708 strcpy(kctl->id.name, "Dock Speaker Playback Switch");
4709 kctl = snd_hda_find_mixer_ctl(codec, "Bass Speaker Playback Switch");
4711 strcpy(kctl->id.name, "Speaker Playback Switch");
4716 static void alc290_fixup_mono_speakers(struct hda_codec *codec,
4717 const struct hda_fixup *fix, int action)
4719 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4720 /* DAC node 0x03 is giving mono output. We therefore want to
4721 make sure 0x14 (front speaker) and 0x15 (headphones) use the
4722 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
4723 hda_nid_t conn1[2] = { 0x0c };
4724 snd_hda_override_conn_list(codec, 0x14, 1, conn1);
4725 snd_hda_override_conn_list(codec, 0x15, 1, conn1);
4729 static void alc298_fixup_speaker_volume(struct hda_codec *codec,
4730 const struct hda_fixup *fix, int action)
4732 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4733 /* The speaker is routed to the Node 0x06 by a mistake, as a result
4734 we can't adjust the speaker's volume since this node does not has
4735 Amp-out capability. we change the speaker's route to:
4736 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
4737 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
4738 speaker's volume now. */
4740 hda_nid_t conn1[1] = { 0x0c };
4741 snd_hda_override_conn_list(codec, 0x17, 1, conn1);
4745 /* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
4746 static void alc295_fixup_disable_dac3(struct hda_codec *codec,
4747 const struct hda_fixup *fix, int action)
4749 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4750 hda_nid_t conn[2] = { 0x02, 0x03 };
4751 snd_hda_override_conn_list(codec, 0x17, 2, conn);
4755 /* Hook to update amp GPIO4 for automute */
4756 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
4757 struct hda_jack_callback *jack)
4759 struct alc_spec *spec = codec->spec;
4761 snd_hda_gen_hp_automute(codec, jack);
4762 /* mute_led_polarity is set to 0, so we pass inverted value here */
4763 alc_update_gpio_led(codec, 0x10, !spec->gen.hp_jack_present);
4766 /* Manage GPIOs for HP EliteBook Folio 9480m.
4768 * GPIO4 is the headphone amplifier power control
4769 * GPIO3 is the audio output mute indicator LED
4772 static void alc280_fixup_hp_9480m(struct hda_codec *codec,
4773 const struct hda_fixup *fix,
4776 struct alc_spec *spec = codec->spec;
4777 static const struct hda_verb gpio_init[] = {
4778 { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 },
4779 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 },
4783 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4784 /* Set the hooks to turn the headphone amp on/off
4787 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
4788 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
4790 /* The GPIOs are currently off */
4793 /* GPIO3 is connected to the output mute LED,
4794 * high is on, low is off
4796 spec->mute_led_polarity = 0;
4797 spec->gpio_mute_led_mask = 0x08;
4799 /* Initialize GPIO configuration */
4800 snd_hda_add_verbs(codec, gpio_init);
4804 static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
4805 const struct hda_fixup *fix, int action)
4807 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4808 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
4811 /* for hda_fixup_thinkpad_acpi() */
4812 #include "thinkpad_helper.c"
4814 /* for dell wmi mic mute led */
4815 #include "dell_wmi_helper.c"
4818 ALC269_FIXUP_SONY_VAIO,
4819 ALC275_FIXUP_SONY_VAIO_GPIO2,
4820 ALC269_FIXUP_DELL_M101Z,
4821 ALC269_FIXUP_SKU_IGNORE,
4822 ALC269_FIXUP_ASUS_G73JW,
4823 ALC269_FIXUP_LENOVO_EAPD,
4824 ALC275_FIXUP_SONY_HWEQ,
4825 ALC275_FIXUP_SONY_DISABLE_AAMIX,
4827 ALC269_FIXUP_PCM_44K,
4828 ALC269_FIXUP_STEREO_DMIC,
4829 ALC269_FIXUP_HEADSET_MIC,
4830 ALC269_FIXUP_QUANTA_MUTE,
4831 ALC269_FIXUP_LIFEBOOK,
4832 ALC269_FIXUP_LIFEBOOK_EXTMIC,
4833 ALC269_FIXUP_LIFEBOOK_HP_PIN,
4834 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
4835 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
4838 ALC269VB_FIXUP_AMIC,
4839 ALC269VB_FIXUP_DMIC,
4840 ALC269_FIXUP_HP_MUTE_LED,
4841 ALC269_FIXUP_HP_MUTE_LED_MIC1,
4842 ALC269_FIXUP_HP_MUTE_LED_MIC2,
4843 ALC269_FIXUP_HP_GPIO_LED,
4844 ALC269_FIXUP_HP_GPIO_MIC1_LED,
4845 ALC269_FIXUP_HP_LINE1_MIC1_LED,
4846 ALC269_FIXUP_INV_DMIC,
4847 ALC269_FIXUP_LENOVO_DOCK,
4848 ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
4849 ALC269_FIXUP_NO_SHUTUP,
4850 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
4851 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
4852 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
4853 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
4854 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
4855 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
4856 ALC269_FIXUP_HEADSET_MODE,
4857 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
4858 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
4859 ALC269_FIXUP_ASUS_X101_FUNC,
4860 ALC269_FIXUP_ASUS_X101_VERB,
4861 ALC269_FIXUP_ASUS_X101,
4862 ALC271_FIXUP_AMIC_MIC2,
4863 ALC271_FIXUP_HP_GATE_MIC_JACK,
4864 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
4865 ALC269_FIXUP_ACER_AC700,
4866 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
4867 ALC269VB_FIXUP_ASUS_ZENBOOK,
4868 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
4869 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
4870 ALC269VB_FIXUP_ORDISSIMO_EVE2,
4871 ALC283_FIXUP_CHROME_BOOK,
4872 ALC283_FIXUP_SENSE_COMBO_JACK,
4873 ALC282_FIXUP_ASUS_TX300,
4874 ALC283_FIXUP_INT_MIC,
4875 ALC290_FIXUP_MONO_SPEAKERS,
4876 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
4877 ALC290_FIXUP_SUBWOOFER,
4878 ALC290_FIXUP_SUBWOOFER_HSJACK,
4879 ALC269_FIXUP_THINKPAD_ACPI,
4880 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
4881 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
4882 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
4883 ALC255_FIXUP_HEADSET_MODE,
4884 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
4885 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
4886 ALC292_FIXUP_TPT440_DOCK,
4887 ALC292_FIXUP_TPT440,
4888 ALC283_FIXUP_BXBT2807_MIC,
4889 ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED,
4890 ALC282_FIXUP_ASPIRE_V5_PINS,
4891 ALC280_FIXUP_HP_GPIO4,
4892 ALC286_FIXUP_HP_GPIO_LED,
4893 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
4894 ALC280_FIXUP_HP_DOCK_PINS,
4895 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
4896 ALC280_FIXUP_HP_9480M,
4897 ALC288_FIXUP_DELL_HEADSET_MODE,
4898 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
4899 ALC288_FIXUP_DELL_XPS_13_GPIO6,
4900 ALC288_FIXUP_DELL_XPS_13,
4901 ALC288_FIXUP_DISABLE_AAMIX,
4902 ALC292_FIXUP_DELL_E7X,
4903 ALC292_FIXUP_DISABLE_AAMIX,
4904 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
4905 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
4906 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
4907 ALC275_FIXUP_DELL_XPS,
4908 ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE,
4909 ALC293_FIXUP_LENOVO_SPK_NOISE,
4910 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
4911 ALC255_FIXUP_DELL_SPK_NOISE,
4912 ALC225_FIXUP_DISABLE_MIC_VREF,
4913 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
4914 ALC295_FIXUP_DISABLE_DAC3,
4915 ALC280_FIXUP_HP_HEADSET_MIC,
4916 ALC221_FIXUP_HP_FRONT_MIC,
4917 ALC292_FIXUP_TPT460,
4918 ALC298_FIXUP_SPK_VOLUME,
4919 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
4922 static const struct hda_fixup alc269_fixups[] = {
4923 [ALC269_FIXUP_SONY_VAIO] = {
4924 .type = HDA_FIXUP_PINCTLS,
4925 .v.pins = (const struct hda_pintbl[]) {
4926 {0x19, PIN_VREFGRD},
4930 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
4931 .type = HDA_FIXUP_VERBS,
4932 .v.verbs = (const struct hda_verb[]) {
4933 {0x01, AC_VERB_SET_GPIO_MASK, 0x04},
4934 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04},
4935 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4939 .chain_id = ALC269_FIXUP_SONY_VAIO
4941 [ALC269_FIXUP_DELL_M101Z] = {
4942 .type = HDA_FIXUP_VERBS,
4943 .v.verbs = (const struct hda_verb[]) {
4944 /* Enables internal speaker */
4945 {0x20, AC_VERB_SET_COEF_INDEX, 13},
4946 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
4950 [ALC269_FIXUP_SKU_IGNORE] = {
4951 .type = HDA_FIXUP_FUNC,
4952 .v.func = alc_fixup_sku_ignore,
4954 [ALC269_FIXUP_ASUS_G73JW] = {
4955 .type = HDA_FIXUP_PINS,
4956 .v.pins = (const struct hda_pintbl[]) {
4957 { 0x17, 0x99130111 }, /* subwoofer */
4961 [ALC269_FIXUP_LENOVO_EAPD] = {
4962 .type = HDA_FIXUP_VERBS,
4963 .v.verbs = (const struct hda_verb[]) {
4964 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
4968 [ALC275_FIXUP_SONY_HWEQ] = {
4969 .type = HDA_FIXUP_FUNC,
4970 .v.func = alc269_fixup_hweq,
4972 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
4974 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
4975 .type = HDA_FIXUP_FUNC,
4976 .v.func = alc_fixup_disable_aamix,
4978 .chain_id = ALC269_FIXUP_SONY_VAIO
4980 [ALC271_FIXUP_DMIC] = {
4981 .type = HDA_FIXUP_FUNC,
4982 .v.func = alc271_fixup_dmic,
4984 [ALC269_FIXUP_PCM_44K] = {
4985 .type = HDA_FIXUP_FUNC,
4986 .v.func = alc269_fixup_pcm_44k,
4988 .chain_id = ALC269_FIXUP_QUANTA_MUTE
4990 [ALC269_FIXUP_STEREO_DMIC] = {
4991 .type = HDA_FIXUP_FUNC,
4992 .v.func = alc269_fixup_stereo_dmic,
4994 [ALC269_FIXUP_HEADSET_MIC] = {
4995 .type = HDA_FIXUP_FUNC,
4996 .v.func = alc269_fixup_headset_mic,
4998 [ALC269_FIXUP_QUANTA_MUTE] = {
4999 .type = HDA_FIXUP_FUNC,
5000 .v.func = alc269_fixup_quanta_mute,
5002 [ALC269_FIXUP_LIFEBOOK] = {
5003 .type = HDA_FIXUP_PINS,
5004 .v.pins = (const struct hda_pintbl[]) {
5005 { 0x1a, 0x2101103f }, /* dock line-out */
5006 { 0x1b, 0x23a11040 }, /* dock mic-in */
5010 .chain_id = ALC269_FIXUP_QUANTA_MUTE
5012 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
5013 .type = HDA_FIXUP_PINS,
5014 .v.pins = (const struct hda_pintbl[]) {
5015 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
5019 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
5020 .type = HDA_FIXUP_PINS,
5021 .v.pins = (const struct hda_pintbl[]) {
5022 { 0x21, 0x0221102f }, /* HP out */
5026 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
5027 .type = HDA_FIXUP_FUNC,
5028 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
5030 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
5031 .type = HDA_FIXUP_FUNC,
5032 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
5034 [ALC269_FIXUP_AMIC] = {
5035 .type = HDA_FIXUP_PINS,
5036 .v.pins = (const struct hda_pintbl[]) {
5037 { 0x14, 0x99130110 }, /* speaker */
5038 { 0x15, 0x0121401f }, /* HP out */
5039 { 0x18, 0x01a19c20 }, /* mic */
5040 { 0x19, 0x99a3092f }, /* int-mic */
5044 [ALC269_FIXUP_DMIC] = {
5045 .type = HDA_FIXUP_PINS,
5046 .v.pins = (const struct hda_pintbl[]) {
5047 { 0x12, 0x99a3092f }, /* int-mic */
5048 { 0x14, 0x99130110 }, /* speaker */
5049 { 0x15, 0x0121401f }, /* HP out */
5050 { 0x18, 0x01a19c20 }, /* mic */
5054 [ALC269VB_FIXUP_AMIC] = {
5055 .type = HDA_FIXUP_PINS,
5056 .v.pins = (const struct hda_pintbl[]) {
5057 { 0x14, 0x99130110 }, /* speaker */
5058 { 0x18, 0x01a19c20 }, /* mic */
5059 { 0x19, 0x99a3092f }, /* int-mic */
5060 { 0x21, 0x0121401f }, /* HP out */
5064 [ALC269VB_FIXUP_DMIC] = {
5065 .type = HDA_FIXUP_PINS,
5066 .v.pins = (const struct hda_pintbl[]) {
5067 { 0x12, 0x99a3092f }, /* int-mic */
5068 { 0x14, 0x99130110 }, /* speaker */
5069 { 0x18, 0x01a19c20 }, /* mic */
5070 { 0x21, 0x0121401f }, /* HP out */
5074 [ALC269_FIXUP_HP_MUTE_LED] = {
5075 .type = HDA_FIXUP_FUNC,
5076 .v.func = alc269_fixup_hp_mute_led,
5078 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
5079 .type = HDA_FIXUP_FUNC,
5080 .v.func = alc269_fixup_hp_mute_led_mic1,
5082 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
5083 .type = HDA_FIXUP_FUNC,
5084 .v.func = alc269_fixup_hp_mute_led_mic2,
5086 [ALC269_FIXUP_HP_GPIO_LED] = {
5087 .type = HDA_FIXUP_FUNC,
5088 .v.func = alc269_fixup_hp_gpio_led,
5090 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
5091 .type = HDA_FIXUP_FUNC,
5092 .v.func = alc269_fixup_hp_gpio_mic1_led,
5094 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
5095 .type = HDA_FIXUP_FUNC,
5096 .v.func = alc269_fixup_hp_line1_mic1_led,
5098 [ALC269_FIXUP_INV_DMIC] = {
5099 .type = HDA_FIXUP_FUNC,
5100 .v.func = alc_fixup_inv_dmic,
5102 [ALC269_FIXUP_NO_SHUTUP] = {
5103 .type = HDA_FIXUP_FUNC,
5104 .v.func = alc_fixup_no_shutup,
5106 [ALC269_FIXUP_LENOVO_DOCK] = {
5107 .type = HDA_FIXUP_PINS,
5108 .v.pins = (const struct hda_pintbl[]) {
5109 { 0x19, 0x23a11040 }, /* dock mic */
5110 { 0x1b, 0x2121103f }, /* dock headphone */
5114 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
5116 [ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
5117 .type = HDA_FIXUP_FUNC,
5118 .v.func = alc269_fixup_limit_int_mic_boost,
5120 .chain_id = ALC269_FIXUP_LENOVO_DOCK,
5122 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
5123 .type = HDA_FIXUP_FUNC,
5124 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
5126 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
5128 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
5129 .type = HDA_FIXUP_PINS,
5130 .v.pins = (const struct hda_pintbl[]) {
5131 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5132 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5136 .chain_id = ALC269_FIXUP_HEADSET_MODE
5138 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
5139 .type = HDA_FIXUP_PINS,
5140 .v.pins = (const struct hda_pintbl[]) {
5141 { 0x16, 0x21014020 }, /* dock line out */
5142 { 0x19, 0x21a19030 }, /* dock mic */
5143 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5147 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
5149 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
5150 .type = HDA_FIXUP_PINS,
5151 .v.pins = (const struct hda_pintbl[]) {
5152 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5156 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
5158 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
5159 .type = HDA_FIXUP_PINS,
5160 .v.pins = (const struct hda_pintbl[]) {
5161 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5162 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5166 .chain_id = ALC269_FIXUP_HEADSET_MODE
5168 [ALC269_FIXUP_HEADSET_MODE] = {
5169 .type = HDA_FIXUP_FUNC,
5170 .v.func = alc_fixup_headset_mode,
5172 .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
5174 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
5175 .type = HDA_FIXUP_FUNC,
5176 .v.func = alc_fixup_headset_mode_no_hp_mic,
5178 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
5179 .type = HDA_FIXUP_PINS,
5180 .v.pins = (const struct hda_pintbl[]) {
5181 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
5185 .chain_id = ALC269_FIXUP_HEADSET_MODE,
5187 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
5188 .type = HDA_FIXUP_PINS,
5189 .v.pins = (const struct hda_pintbl[]) {
5190 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5194 .chain_id = ALC269_FIXUP_HEADSET_MIC
5196 [ALC269_FIXUP_ASUS_X101_FUNC] = {
5197 .type = HDA_FIXUP_FUNC,
5198 .v.func = alc269_fixup_x101_headset_mic,
5200 [ALC269_FIXUP_ASUS_X101_VERB] = {
5201 .type = HDA_FIXUP_VERBS,
5202 .v.verbs = (const struct hda_verb[]) {
5203 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5204 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
5205 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
5209 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
5211 [ALC269_FIXUP_ASUS_X101] = {
5212 .type = HDA_FIXUP_PINS,
5213 .v.pins = (const struct hda_pintbl[]) {
5214 { 0x18, 0x04a1182c }, /* Headset mic */
5218 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
5220 [ALC271_FIXUP_AMIC_MIC2] = {
5221 .type = HDA_FIXUP_PINS,
5222 .v.pins = (const struct hda_pintbl[]) {
5223 { 0x14, 0x99130110 }, /* speaker */
5224 { 0x19, 0x01a19c20 }, /* mic */
5225 { 0x1b, 0x99a7012f }, /* int-mic */
5226 { 0x21, 0x0121401f }, /* HP out */
5230 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
5231 .type = HDA_FIXUP_FUNC,
5232 .v.func = alc271_hp_gate_mic_jack,
5234 .chain_id = ALC271_FIXUP_AMIC_MIC2,
5236 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
5237 .type = HDA_FIXUP_FUNC,
5238 .v.func = alc269_fixup_limit_int_mic_boost,
5240 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
5242 [ALC269_FIXUP_ACER_AC700] = {
5243 .type = HDA_FIXUP_PINS,
5244 .v.pins = (const struct hda_pintbl[]) {
5245 { 0x12, 0x99a3092f }, /* int-mic */
5246 { 0x14, 0x99130110 }, /* speaker */
5247 { 0x18, 0x03a11c20 }, /* mic */
5248 { 0x1e, 0x0346101e }, /* SPDIF1 */
5249 { 0x21, 0x0321101f }, /* HP out */
5253 .chain_id = ALC271_FIXUP_DMIC,
5255 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
5256 .type = HDA_FIXUP_FUNC,
5257 .v.func = alc269_fixup_limit_int_mic_boost,
5259 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
5261 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
5262 .type = HDA_FIXUP_FUNC,
5263 .v.func = alc269_fixup_limit_int_mic_boost,
5265 .chain_id = ALC269VB_FIXUP_DMIC,
5267 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
5268 .type = HDA_FIXUP_VERBS,
5269 .v.verbs = (const struct hda_verb[]) {
5270 /* class-D output amp +5dB */
5271 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
5272 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
5276 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
5278 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
5279 .type = HDA_FIXUP_FUNC,
5280 .v.func = alc269_fixup_limit_int_mic_boost,
5282 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
5284 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
5285 .type = HDA_FIXUP_PINS,
5286 .v.pins = (const struct hda_pintbl[]) {
5287 { 0x12, 0x99a3092f }, /* int-mic */
5288 { 0x18, 0x03a11d20 }, /* mic */
5289 { 0x19, 0x411111f0 }, /* Unused bogus pin */
5293 [ALC283_FIXUP_CHROME_BOOK] = {
5294 .type = HDA_FIXUP_FUNC,
5295 .v.func = alc283_fixup_chromebook,
5297 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
5298 .type = HDA_FIXUP_FUNC,
5299 .v.func = alc283_fixup_sense_combo_jack,
5301 .chain_id = ALC283_FIXUP_CHROME_BOOK,
5303 [ALC282_FIXUP_ASUS_TX300] = {
5304 .type = HDA_FIXUP_FUNC,
5305 .v.func = alc282_fixup_asus_tx300,
5307 [ALC283_FIXUP_INT_MIC] = {
5308 .type = HDA_FIXUP_VERBS,
5309 .v.verbs = (const struct hda_verb[]) {
5310 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
5311 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
5315 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
5317 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
5318 .type = HDA_FIXUP_PINS,
5319 .v.pins = (const struct hda_pintbl[]) {
5320 { 0x17, 0x90170112 }, /* subwoofer */
5324 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
5326 [ALC290_FIXUP_SUBWOOFER] = {
5327 .type = HDA_FIXUP_PINS,
5328 .v.pins = (const struct hda_pintbl[]) {
5329 { 0x17, 0x90170112 }, /* subwoofer */
5333 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
5335 [ALC290_FIXUP_MONO_SPEAKERS] = {
5336 .type = HDA_FIXUP_FUNC,
5337 .v.func = alc290_fixup_mono_speakers,
5339 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
5340 .type = HDA_FIXUP_FUNC,
5341 .v.func = alc290_fixup_mono_speakers,
5343 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
5345 [ALC269_FIXUP_THINKPAD_ACPI] = {
5346 .type = HDA_FIXUP_FUNC,
5347 .v.func = hda_fixup_thinkpad_acpi,
5349 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
5350 .type = HDA_FIXUP_FUNC,
5351 .v.func = alc_fixup_inv_dmic,
5353 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
5355 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
5356 .type = HDA_FIXUP_PINS,
5357 .v.pins = (const struct hda_pintbl[]) {
5358 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5359 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5363 .chain_id = ALC255_FIXUP_HEADSET_MODE
5365 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
5366 .type = HDA_FIXUP_PINS,
5367 .v.pins = (const struct hda_pintbl[]) {
5368 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5372 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
5374 [ALC255_FIXUP_HEADSET_MODE] = {
5375 .type = HDA_FIXUP_FUNC,
5376 .v.func = alc_fixup_headset_mode_alc255,
5378 .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
5380 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
5381 .type = HDA_FIXUP_FUNC,
5382 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
5384 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
5385 .type = HDA_FIXUP_PINS,
5386 .v.pins = (const struct hda_pintbl[]) {
5387 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5388 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5392 .chain_id = ALC269_FIXUP_HEADSET_MODE
5394 [ALC292_FIXUP_TPT440_DOCK] = {
5395 .type = HDA_FIXUP_FUNC,
5396 .v.func = alc_fixup_tpt440_dock,
5398 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
5400 [ALC292_FIXUP_TPT440] = {
5401 .type = HDA_FIXUP_FUNC,
5402 .v.func = alc_fixup_disable_aamix,
5404 .chain_id = ALC292_FIXUP_TPT440_DOCK,
5406 [ALC283_FIXUP_BXBT2807_MIC] = {
5407 .type = HDA_FIXUP_PINS,
5408 .v.pins = (const struct hda_pintbl[]) {
5409 { 0x19, 0x04a110f0 },
5413 [ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED] = {
5414 .type = HDA_FIXUP_FUNC,
5415 .v.func = alc_fixup_dell_wmi,
5417 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
5418 .type = HDA_FIXUP_PINS,
5419 .v.pins = (const struct hda_pintbl[]) {
5420 { 0x12, 0x90a60130 },
5421 { 0x14, 0x90170110 },
5422 { 0x17, 0x40000008 },
5423 { 0x18, 0x411111f0 },
5424 { 0x19, 0x01a1913c },
5425 { 0x1a, 0x411111f0 },
5426 { 0x1b, 0x411111f0 },
5427 { 0x1d, 0x40f89b2d },
5428 { 0x1e, 0x411111f0 },
5429 { 0x21, 0x0321101f },
5433 [ALC280_FIXUP_HP_GPIO4] = {
5434 .type = HDA_FIXUP_FUNC,
5435 .v.func = alc280_fixup_hp_gpio4,
5437 [ALC286_FIXUP_HP_GPIO_LED] = {
5438 .type = HDA_FIXUP_FUNC,
5439 .v.func = alc286_fixup_hp_gpio_led,
5441 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
5442 .type = HDA_FIXUP_FUNC,
5443 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
5445 [ALC280_FIXUP_HP_DOCK_PINS] = {
5446 .type = HDA_FIXUP_PINS,
5447 .v.pins = (const struct hda_pintbl[]) {
5448 { 0x1b, 0x21011020 }, /* line-out */
5449 { 0x1a, 0x01a1903c }, /* headset mic */
5450 { 0x18, 0x2181103f }, /* line-in */
5454 .chain_id = ALC280_FIXUP_HP_GPIO4
5456 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
5457 .type = HDA_FIXUP_PINS,
5458 .v.pins = (const struct hda_pintbl[]) {
5459 { 0x1b, 0x21011020 }, /* line-out */
5460 { 0x18, 0x2181103f }, /* line-in */
5464 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
5466 [ALC280_FIXUP_HP_9480M] = {
5467 .type = HDA_FIXUP_FUNC,
5468 .v.func = alc280_fixup_hp_9480m,
5470 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
5471 .type = HDA_FIXUP_FUNC,
5472 .v.func = alc_fixup_headset_mode_dell_alc288,
5474 .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
5476 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
5477 .type = HDA_FIXUP_PINS,
5478 .v.pins = (const struct hda_pintbl[]) {
5479 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5480 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5484 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
5486 [ALC288_FIXUP_DELL_XPS_13_GPIO6] = {
5487 .type = HDA_FIXUP_VERBS,
5488 .v.verbs = (const struct hda_verb[]) {
5489 {0x01, AC_VERB_SET_GPIO_MASK, 0x40},
5490 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x40},
5491 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5495 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
5497 [ALC288_FIXUP_DISABLE_AAMIX] = {
5498 .type = HDA_FIXUP_FUNC,
5499 .v.func = alc_fixup_disable_aamix,
5501 .chain_id = ALC288_FIXUP_DELL_XPS_13_GPIO6
5503 [ALC288_FIXUP_DELL_XPS_13] = {
5504 .type = HDA_FIXUP_FUNC,
5505 .v.func = alc_fixup_dell_xps13,
5507 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
5509 [ALC292_FIXUP_DISABLE_AAMIX] = {
5510 .type = HDA_FIXUP_FUNC,
5511 .v.func = alc_fixup_disable_aamix,
5513 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
5515 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
5516 .type = HDA_FIXUP_FUNC,
5517 .v.func = alc_fixup_disable_aamix,
5519 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
5521 [ALC292_FIXUP_DELL_E7X] = {
5522 .type = HDA_FIXUP_FUNC,
5523 .v.func = alc_fixup_dell_xps13,
5525 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
5527 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
5528 .type = HDA_FIXUP_PINS,
5529 .v.pins = (const struct hda_pintbl[]) {
5530 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5531 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5535 .chain_id = ALC269_FIXUP_HEADSET_MODE
5537 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
5538 .type = HDA_FIXUP_PINS,
5539 .v.pins = (const struct hda_pintbl[]) {
5540 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5544 .chain_id = ALC269_FIXUP_HEADSET_MODE
5546 [ALC275_FIXUP_DELL_XPS] = {
5547 .type = HDA_FIXUP_VERBS,
5548 .v.verbs = (const struct hda_verb[]) {
5549 /* Enables internal speaker */
5550 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
5551 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
5552 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
5553 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
5557 [ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE] = {
5558 .type = HDA_FIXUP_VERBS,
5559 .v.verbs = (const struct hda_verb[]) {
5560 /* Disable pass-through path for FRONT 14h */
5561 {0x20, AC_VERB_SET_COEF_INDEX, 0x36},
5562 {0x20, AC_VERB_SET_PROC_COEF, 0x1737},
5566 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
5568 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
5569 .type = HDA_FIXUP_FUNC,
5570 .v.func = alc_fixup_disable_aamix,
5572 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
5574 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
5575 .type = HDA_FIXUP_FUNC,
5576 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
5578 [ALC255_FIXUP_DELL_SPK_NOISE] = {
5579 .type = HDA_FIXUP_FUNC,
5580 .v.func = alc_fixup_disable_aamix,
5582 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
5584 [ALC225_FIXUP_DISABLE_MIC_VREF] = {
5585 .type = HDA_FIXUP_FUNC,
5586 .v.func = alc_fixup_disable_mic_vref,
5588 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
5590 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
5591 .type = HDA_FIXUP_VERBS,
5592 .v.verbs = (const struct hda_verb[]) {
5593 /* Disable pass-through path for FRONT 14h */
5594 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
5595 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
5599 .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
5601 [ALC280_FIXUP_HP_HEADSET_MIC] = {
5602 .type = HDA_FIXUP_FUNC,
5603 .v.func = alc_fixup_disable_aamix,
5605 .chain_id = ALC269_FIXUP_HEADSET_MIC,
5607 [ALC221_FIXUP_HP_FRONT_MIC] = {
5608 .type = HDA_FIXUP_PINS,
5609 .v.pins = (const struct hda_pintbl[]) {
5610 { 0x19, 0x02a19020 }, /* Front Mic */
5614 [ALC292_FIXUP_TPT460] = {
5615 .type = HDA_FIXUP_FUNC,
5616 .v.func = alc_fixup_tpt440_dock,
5618 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
5620 [ALC298_FIXUP_SPK_VOLUME] = {
5621 .type = HDA_FIXUP_FUNC,
5622 .v.func = alc298_fixup_speaker_volume,
5624 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
5626 [ALC295_FIXUP_DISABLE_DAC3] = {
5627 .type = HDA_FIXUP_FUNC,
5628 .v.func = alc295_fixup_disable_dac3,
5630 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
5631 .type = HDA_FIXUP_PINS,
5632 .v.pins = (const struct hda_pintbl[]) {
5633 { 0x1b, 0x90170151 },
5637 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
5641 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
5642 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
5643 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
5644 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
5645 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
5646 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
5647 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
5648 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
5649 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
5650 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
5651 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
5652 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
5653 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
5654 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
5655 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
5656 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
5657 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
5658 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
5659 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
5660 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
5661 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
5662 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
5663 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
5664 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
5665 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
5666 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
5667 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
5668 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
5669 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
5670 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
5671 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
5672 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
5673 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
5674 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
5675 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
5676 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
5677 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
5678 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
5679 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
5680 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
5681 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
5682 SND_PCI_QUIRK(0x1028, 0x0704, "Dell XPS 13 9350", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
5683 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
5684 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
5685 SND_PCI_QUIRK(0x1028, 0x075b, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
5686 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
5687 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
5688 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
5689 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
5690 SND_PCI_QUIRK(0x1028, 0x082a, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
5691 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
5692 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
5693 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
5694 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
5695 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
5696 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
5698 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5699 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5700 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5701 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
5702 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
5703 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
5704 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
5705 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
5706 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5707 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5708 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5709 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5710 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
5711 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
5712 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
5713 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5714 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5715 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5716 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5717 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5718 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
5719 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5720 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5722 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5723 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5724 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5725 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5726 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5727 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5728 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5729 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5730 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5731 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
5732 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5733 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5734 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5735 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5736 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5737 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5738 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5739 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5740 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5741 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5742 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5743 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5744 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5745 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5746 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5747 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5748 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5749 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5750 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5751 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
5752 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
5753 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
5754 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
5755 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
5756 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
5757 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
5758 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
5759 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
5760 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
5761 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
5762 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
5763 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
5764 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
5765 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
5766 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
5767 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
5768 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
5769 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
5770 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
5771 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
5772 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
5773 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
5774 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
5775 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
5776 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
5777 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
5778 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
5779 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
5780 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_BXBT2807_MIC),
5781 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
5782 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
5783 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
5784 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
5785 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
5786 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
5787 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
5788 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
5789 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
5790 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
5791 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
5792 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
5793 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
5794 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
5795 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
5796 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
5797 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
5798 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
5799 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
5800 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
5801 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
5802 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
5803 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
5804 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
5805 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
5806 SND_PCI_QUIRK(0x17aa, 0x3112, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
5807 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
5808 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
5809 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
5810 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
5811 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
5812 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
5813 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
5814 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
5815 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
5816 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
5817 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
5818 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
5819 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
5820 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
5821 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
5822 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
5823 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
5824 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
5825 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
5828 /* Below is a quirk table taken from the old code.
5829 * Basically the device should work as is without the fixup table.
5830 * If BIOS doesn't give a proper info, enable the corresponding
5833 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
5835 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
5836 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
5837 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
5838 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
5839 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
5840 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
5841 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
5842 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
5843 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
5844 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
5845 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
5846 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
5847 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
5848 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
5849 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
5850 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
5851 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
5852 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
5853 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
5854 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
5855 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
5856 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
5857 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
5858 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
5859 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
5860 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
5861 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
5862 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
5863 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
5864 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
5865 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
5866 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
5867 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
5868 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
5869 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
5870 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
5871 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
5872 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
5873 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
5878 static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
5879 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
5880 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
5881 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
5882 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
5886 static const struct hda_model_fixup alc269_fixup_models[] = {
5887 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
5888 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
5889 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
5890 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
5891 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
5892 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
5893 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
5894 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
5895 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
5896 {.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
5897 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
5898 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
5899 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
5900 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
5901 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
5902 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
5903 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
5904 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
5905 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
5908 #define ALC225_STANDARD_PINS \
5911 #define ALC256_STANDARD_PINS \
5912 {0x12, 0x90a60140}, \
5913 {0x14, 0x90170110}, \
5916 #define ALC282_STANDARD_PINS \
5919 #define ALC290_STANDARD_PINS \
5922 #define ALC292_STANDARD_PINS \
5923 {0x14, 0x90170110}, \
5926 #define ALC295_STANDARD_PINS \
5927 {0x12, 0xb7a60130}, \
5928 {0x14, 0x90170110}, \
5931 #define ALC298_STANDARD_PINS \
5932 {0x12, 0x90a60130}, \
5935 static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
5936 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
5937 ALC225_STANDARD_PINS,
5939 {0x14, 0x901701a0}),
5940 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
5941 ALC225_STANDARD_PINS,
5943 {0x14, 0x901701b0}),
5944 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
5945 ALC225_STANDARD_PINS,
5947 {0x14, 0x901701a0}),
5948 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
5949 ALC225_STANDARD_PINS,
5951 {0x14, 0x901701b0}),
5952 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
5953 ALC225_STANDARD_PINS,
5955 {0x1b, 0x90170110}),
5956 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5959 {0x21, 0x02211020}),
5960 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5963 {0x21, 0x02211020}),
5964 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
5966 {0x21, 0x02211020}),
5967 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5969 {0x21, 0x02211040}),
5970 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5973 {0x21, 0x02211020}),
5974 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5977 {0x21, 0x02211030}),
5978 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5981 {0x21, 0x0221101f}),
5982 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5985 {0x21, 0x0221101f}),
5986 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5989 {0x21, 0x0221103f}),
5990 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5993 {0x21, 0x0221103f}),
5994 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5997 {0x21, 0x0221103f}),
5998 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6001 {0x21, 0x0221105f}),
6002 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6005 {0x21, 0x0221101f}),
6006 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6010 {0x21, 0x0321102f}),
6011 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6014 {0x21, 0x02211040}),
6015 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6018 {0x21, 0x02211050}),
6019 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6022 {0x21, 0x02211030}),
6023 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6026 {0x21, 0x02211040}),
6027 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6030 {0x21, 0x02211040}),
6031 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6034 {0x21, 0x02211050}),
6035 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6038 {0x21, 0x02211040}),
6039 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6042 {0x21, 0x02211030}),
6043 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6045 {0x21, 0x02211010}),
6046 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6050 {0x21, 0x0221101f}),
6051 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6054 {0x21, 0x02211030}),
6055 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6058 {0x21, 0x02211030}),
6059 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell Inspiron 5468", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6062 {0x21, 0x02211030}),
6063 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6066 {0x21, 0x02211020}),
6067 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6071 {0x21, 0x0221101f}),
6072 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6073 ALC256_STANDARD_PINS),
6074 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
6078 {0x1a, 0x04a11020}),
6079 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
6085 {0x1b, 0x02011020}),
6086 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
6087 ALC282_STANDARD_PINS,
6090 {0x21, 0x0321101f}),
6091 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
6092 ALC282_STANDARD_PINS,
6095 {0x21, 0x03211040}),
6096 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
6097 ALC282_STANDARD_PINS,
6100 {0x21, 0x03211020}),
6101 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
6102 ALC282_STANDARD_PINS,
6105 {0x21, 0x0421101f}),
6106 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
6107 ALC282_STANDARD_PINS,
6110 {0x21, 0x04211020}),
6111 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6112 ALC282_STANDARD_PINS,
6114 {0x21, 0x0321101f}),
6115 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6118 {0x21, 0x02211030}),
6119 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6120 ALC282_STANDARD_PINS,
6123 {0x21, 0x0321101f}),
6124 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL_XPS_13_GPIO6,
6127 {0x21, 0x0321101f}),
6128 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
6131 {0x21, 0x04211020}),
6132 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
6133 ALC290_STANDARD_PINS,
6136 {0x1a, 0x04a11020}),
6137 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
6138 ALC290_STANDARD_PINS,
6141 {0x1a, 0x04a11020}),
6142 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
6143 ALC290_STANDARD_PINS,
6145 {0x1a, 0x04a11020}),
6146 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
6147 ALC290_STANDARD_PINS,
6149 {0x1a, 0x04a11040}),
6150 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
6151 ALC290_STANDARD_PINS,
6154 {0x1a, 0x04a11040}),
6155 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
6156 ALC290_STANDARD_PINS,
6159 {0x1a, 0x04a11020}),
6160 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
6161 ALC290_STANDARD_PINS,
6164 {0x1a, 0x04a11020}),
6165 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
6166 ALC292_STANDARD_PINS,
6169 {0x19, 0x01a19030}),
6170 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
6171 ALC292_STANDARD_PINS,
6175 {0x19, 0x01a1903e}),
6176 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
6177 ALC292_STANDARD_PINS,
6178 {0x12, 0x90a60140}),
6179 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
6180 ALC292_STANDARD_PINS,
6183 {0x19, 0x21a19030}),
6184 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
6185 ALC292_STANDARD_PINS,
6186 {0x13, 0x90a60140}),
6187 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6188 ALC295_STANDARD_PINS,
6190 {0x18, 0x21a19030}),
6191 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6192 ALC295_STANDARD_PINS,
6194 {0x18, 0x21a19050}),
6195 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6196 ALC295_STANDARD_PINS),
6197 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
6198 ALC298_STANDARD_PINS,
6199 {0x17, 0x90170110}),
6200 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
6201 ALC298_STANDARD_PINS,
6202 {0x17, 0x90170140}),
6203 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
6204 ALC298_STANDARD_PINS,
6205 {0x17, 0x90170150}),
6206 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
6211 {0x21, 0x03211030}),
6212 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
6213 ALC225_STANDARD_PINS,
6215 {0x17, 0x90170110}),
6219 static void alc269_fill_coef(struct hda_codec *codec)
6221 struct alc_spec *spec = codec->spec;
6224 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
6227 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
6228 alc_write_coef_idx(codec, 0xf, 0x960b);
6229 alc_write_coef_idx(codec, 0xe, 0x8817);
6232 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
6233 alc_write_coef_idx(codec, 0xf, 0x960b);
6234 alc_write_coef_idx(codec, 0xe, 0x8814);
6237 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
6238 /* Power up output pin */
6239 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
6242 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
6243 val = alc_read_coef_idx(codec, 0xd);
6244 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
6245 /* Capless ramp up clock control */
6246 alc_write_coef_idx(codec, 0xd, val | (1<<10));
6248 val = alc_read_coef_idx(codec, 0x17);
6249 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
6250 /* Class D power on reset */
6251 alc_write_coef_idx(codec, 0x17, val | (1<<7));
6256 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
6261 static int patch_alc269(struct hda_codec *codec)
6263 struct alc_spec *spec;
6266 err = alc_alloc_spec(codec, 0x0b);
6271 spec->gen.shared_mic_vref_pin = 0x18;
6272 codec->power_save_node = 0;
6275 codec->patch_ops.suspend = alc269_suspend;
6276 codec->patch_ops.resume = alc269_resume;
6278 spec->shutup = alc269_shutup;
6280 snd_hda_pick_fixup(codec, alc269_fixup_models,
6281 alc269_fixup_tbl, alc269_fixups);
6282 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups);
6283 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
6285 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
6287 alc_auto_parse_customize_define(codec);
6289 if (has_cdefine_beep(codec))
6290 spec->gen.beep_nid = 0x01;
6292 switch (codec->core.vendor_id) {
6294 spec->codec_variant = ALC269_TYPE_ALC269VA;
6295 switch (alc_get_coef0(codec) & 0x00f0) {
6297 if (codec->bus->pci &&
6298 codec->bus->pci->subsystem_vendor == 0x1025 &&
6299 spec->cdefine.platform_type == 1)
6300 err = alc_codec_rename(codec, "ALC271X");
6301 spec->codec_variant = ALC269_TYPE_ALC269VB;
6304 if (codec->bus->pci &&
6305 codec->bus->pci->subsystem_vendor == 0x17aa &&
6306 codec->bus->pci->subsystem_device == 0x21f3)
6307 err = alc_codec_rename(codec, "ALC3202");
6308 spec->codec_variant = ALC269_TYPE_ALC269VC;
6311 spec->codec_variant = ALC269_TYPE_ALC269VD;
6314 alc_fix_pll_init(codec, 0x20, 0x04, 15);
6318 spec->init_hook = alc269_fill_coef;
6319 alc269_fill_coef(codec);
6324 spec->codec_variant = ALC269_TYPE_ALC280;
6327 spec->codec_variant = ALC269_TYPE_ALC282;
6328 spec->shutup = alc282_shutup;
6329 spec->init_hook = alc282_init;
6333 spec->codec_variant = ALC269_TYPE_ALC283;
6334 spec->shutup = alc283_shutup;
6335 spec->init_hook = alc283_init;
6339 spec->codec_variant = ALC269_TYPE_ALC284;
6343 spec->codec_variant = ALC269_TYPE_ALC285;
6347 spec->codec_variant = ALC269_TYPE_ALC286;
6348 spec->shutup = alc286_shutup;
6351 spec->codec_variant = ALC269_TYPE_ALC298;
6355 spec->codec_variant = ALC269_TYPE_ALC255;
6359 spec->codec_variant = ALC269_TYPE_ALC256;
6360 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
6361 alc_update_coef_idx(codec, 0x36, 1 << 13, 1 << 5); /* Switch pcbeep path to Line in path*/
6365 spec->codec_variant = ALC269_TYPE_ALC225;
6368 spec->codec_variant = ALC269_TYPE_ALC225;
6369 spec->gen.mixer_nid = 0; /* no loopback on ALC299 */
6374 spec->codec_variant = ALC269_TYPE_ALC294;
6379 spec->codec_variant = ALC269_TYPE_ALC700;
6380 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
6381 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
6386 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
6387 spec->has_alc5505_dsp = 1;
6388 spec->init_hook = alc5505_dsp_init;
6391 /* automatic parse from the BIOS config */
6392 err = alc269_parse_auto_config(codec);
6396 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid)
6397 set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
6399 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
6412 static int alc861_parse_auto_config(struct hda_codec *codec)
6414 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
6415 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
6416 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
6419 /* Pin config fixes */
6421 ALC861_FIXUP_FSC_AMILO_PI1505,
6422 ALC861_FIXUP_AMP_VREF_0F,
6423 ALC861_FIXUP_NO_JACK_DETECT,
6424 ALC861_FIXUP_ASUS_A6RP,
6425 ALC660_FIXUP_ASUS_W7J,
6428 /* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
6429 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
6430 const struct hda_fixup *fix, int action)
6432 struct alc_spec *spec = codec->spec;
6435 if (action != HDA_FIXUP_ACT_INIT)
6437 val = snd_hda_codec_get_pin_target(codec, 0x0f);
6438 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
6439 val |= AC_PINCTL_IN_EN;
6440 val |= AC_PINCTL_VREF_50;
6441 snd_hda_set_pin_ctl(codec, 0x0f, val);
6442 spec->gen.keep_vref_in_automute = 1;
6445 /* suppress the jack-detection */
6446 static void alc_fixup_no_jack_detect(struct hda_codec *codec,
6447 const struct hda_fixup *fix, int action)
6449 if (action == HDA_FIXUP_ACT_PRE_PROBE)
6450 codec->no_jack_detect = 1;
6453 static const struct hda_fixup alc861_fixups[] = {
6454 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
6455 .type = HDA_FIXUP_PINS,
6456 .v.pins = (const struct hda_pintbl[]) {
6457 { 0x0b, 0x0221101f }, /* HP */
6458 { 0x0f, 0x90170310 }, /* speaker */
6462 [ALC861_FIXUP_AMP_VREF_0F] = {
6463 .type = HDA_FIXUP_FUNC,
6464 .v.func = alc861_fixup_asus_amp_vref_0f,
6466 [ALC861_FIXUP_NO_JACK_DETECT] = {
6467 .type = HDA_FIXUP_FUNC,
6468 .v.func = alc_fixup_no_jack_detect,
6470 [ALC861_FIXUP_ASUS_A6RP] = {
6471 .type = HDA_FIXUP_FUNC,
6472 .v.func = alc861_fixup_asus_amp_vref_0f,
6474 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
6476 [ALC660_FIXUP_ASUS_W7J] = {
6477 .type = HDA_FIXUP_VERBS,
6478 .v.verbs = (const struct hda_verb[]) {
6479 /* ASUS W7J needs a magic pin setup on unused NID 0x10
6480 * for enabling outputs
6482 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6488 static const struct snd_pci_quirk alc861_fixup_tbl[] = {
6489 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
6490 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
6491 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
6492 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
6493 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
6494 SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F),
6495 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
6501 static int patch_alc861(struct hda_codec *codec)
6503 struct alc_spec *spec;
6506 err = alc_alloc_spec(codec, 0x15);
6511 spec->gen.beep_nid = 0x23;
6514 spec->power_hook = alc_power_eapd;
6517 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
6518 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
6520 /* automatic parse from the BIOS config */
6521 err = alc861_parse_auto_config(codec);
6525 if (!spec->gen.no_analog)
6526 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
6528 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
6542 * In addition, an independent DAC
6544 static int alc861vd_parse_auto_config(struct hda_codec *codec)
6546 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
6547 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
6548 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
6552 ALC660VD_FIX_ASUS_GPIO1,
6553 ALC861VD_FIX_DALLAS,
6556 /* exclude VREF80 */
6557 static void alc861vd_fixup_dallas(struct hda_codec *codec,
6558 const struct hda_fixup *fix, int action)
6560 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6561 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
6562 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
6566 static const struct hda_fixup alc861vd_fixups[] = {
6567 [ALC660VD_FIX_ASUS_GPIO1] = {
6568 .type = HDA_FIXUP_VERBS,
6569 .v.verbs = (const struct hda_verb[]) {
6571 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
6572 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6573 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6577 [ALC861VD_FIX_DALLAS] = {
6578 .type = HDA_FIXUP_FUNC,
6579 .v.func = alc861vd_fixup_dallas,
6583 static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
6584 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
6585 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
6586 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
6592 static int patch_alc861vd(struct hda_codec *codec)
6594 struct alc_spec *spec;
6597 err = alc_alloc_spec(codec, 0x0b);
6602 spec->gen.beep_nid = 0x23;
6604 spec->shutup = alc_eapd_shutup;
6606 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
6607 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
6609 /* automatic parse from the BIOS config */
6610 err = alc861vd_parse_auto_config(codec);
6614 if (!spec->gen.no_analog)
6615 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
6617 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
6629 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
6630 * configuration. Each pin widget can choose any input DACs and a mixer.
6631 * Each ADC is connected from a mixer of all inputs. This makes possible
6632 * 6-channel independent captures.
6634 * In addition, an independent DAC for the multi-playback (not used in this
6639 * BIOS auto configuration
6642 static int alc662_parse_auto_config(struct hda_codec *codec)
6644 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
6645 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
6646 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
6647 const hda_nid_t *ssids;
6649 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
6650 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
6651 codec->core.vendor_id == 0x10ec0671)
6652 ssids = alc663_ssids;
6654 ssids = alc662_ssids;
6655 return alc_parse_auto_config(codec, alc662_ignore, ssids);
6658 static void alc272_fixup_mario(struct hda_codec *codec,
6659 const struct hda_fixup *fix, int action)
6661 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6663 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
6664 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
6665 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
6666 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
6667 (0 << AC_AMPCAP_MUTE_SHIFT)))
6668 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
6671 static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
6673 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
6675 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
6676 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
6680 /* override the 2.1 chmap */
6681 static void alc_fixup_bass_chmap(struct hda_codec *codec,
6682 const struct hda_fixup *fix, int action)
6684 if (action == HDA_FIXUP_ACT_BUILD) {
6685 struct alc_spec *spec = codec->spec;
6686 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
6690 /* avoid D3 for keeping GPIO up */
6691 static unsigned int gpio_led_power_filter(struct hda_codec *codec,
6693 unsigned int power_state)
6695 struct alc_spec *spec = codec->spec;
6696 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_led)
6701 static void alc662_fixup_led_gpio1(struct hda_codec *codec,
6702 const struct hda_fixup *fix, int action)
6704 struct alc_spec *spec = codec->spec;
6705 static const struct hda_verb gpio_init[] = {
6706 { 0x01, AC_VERB_SET_GPIO_MASK, 0x01 },
6707 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01 },
6711 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6712 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
6714 spec->mute_led_polarity = 1;
6715 spec->gpio_mute_led_mask = 0x01;
6716 snd_hda_add_verbs(codec, gpio_init);
6717 codec->power_filter = gpio_led_power_filter;
6721 static struct coef_fw alc668_coefs[] = {
6722 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
6723 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
6724 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
6725 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
6726 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
6727 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
6728 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
6729 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
6730 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
6731 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
6732 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
6733 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
6734 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
6735 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
6736 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
6737 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
6738 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
6739 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
6740 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
6741 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
6745 static void alc668_restore_default_value(struct hda_codec *codec)
6747 alc_process_coef_fw(codec, alc668_coefs);
6751 ALC662_FIXUP_ASPIRE,
6752 ALC662_FIXUP_LED_GPIO1,
6753 ALC662_FIXUP_IDEAPAD,
6755 ALC662_FIXUP_CZC_P10T,
6756 ALC662_FIXUP_SKU_IGNORE,
6757 ALC662_FIXUP_HP_RP5800,
6758 ALC662_FIXUP_ASUS_MODE1,
6759 ALC662_FIXUP_ASUS_MODE2,
6760 ALC662_FIXUP_ASUS_MODE3,
6761 ALC662_FIXUP_ASUS_MODE4,
6762 ALC662_FIXUP_ASUS_MODE5,
6763 ALC662_FIXUP_ASUS_MODE6,
6764 ALC662_FIXUP_ASUS_MODE7,
6765 ALC662_FIXUP_ASUS_MODE8,
6766 ALC662_FIXUP_NO_JACK_DETECT,
6767 ALC662_FIXUP_ZOTAC_Z68,
6768 ALC662_FIXUP_INV_DMIC,
6769 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
6770 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
6771 ALC662_FIXUP_HEADSET_MODE,
6772 ALC668_FIXUP_HEADSET_MODE,
6773 ALC662_FIXUP_BASS_MODE4_CHMAP,
6774 ALC662_FIXUP_BASS_16,
6775 ALC662_FIXUP_BASS_1A,
6776 ALC662_FIXUP_BASS_CHMAP,
6777 ALC668_FIXUP_AUTO_MUTE,
6778 ALC668_FIXUP_DELL_DISABLE_AAMIX,
6779 ALC668_FIXUP_DELL_XPS13,
6780 ALC662_FIXUP_ASUS_Nx50,
6781 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
6782 ALC668_FIXUP_ASUS_Nx51,
6785 static const struct hda_fixup alc662_fixups[] = {
6786 [ALC662_FIXUP_ASPIRE] = {
6787 .type = HDA_FIXUP_PINS,
6788 .v.pins = (const struct hda_pintbl[]) {
6789 { 0x15, 0x99130112 }, /* subwoofer */
6793 [ALC662_FIXUP_LED_GPIO1] = {
6794 .type = HDA_FIXUP_FUNC,
6795 .v.func = alc662_fixup_led_gpio1,
6797 [ALC662_FIXUP_IDEAPAD] = {
6798 .type = HDA_FIXUP_PINS,
6799 .v.pins = (const struct hda_pintbl[]) {
6800 { 0x17, 0x99130112 }, /* subwoofer */
6804 .chain_id = ALC662_FIXUP_LED_GPIO1,
6806 [ALC272_FIXUP_MARIO] = {
6807 .type = HDA_FIXUP_FUNC,
6808 .v.func = alc272_fixup_mario,
6810 [ALC662_FIXUP_CZC_P10T] = {
6811 .type = HDA_FIXUP_VERBS,
6812 .v.verbs = (const struct hda_verb[]) {
6813 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
6817 [ALC662_FIXUP_SKU_IGNORE] = {
6818 .type = HDA_FIXUP_FUNC,
6819 .v.func = alc_fixup_sku_ignore,
6821 [ALC662_FIXUP_HP_RP5800] = {
6822 .type = HDA_FIXUP_PINS,
6823 .v.pins = (const struct hda_pintbl[]) {
6824 { 0x14, 0x0221201f }, /* HP out */
6828 .chain_id = ALC662_FIXUP_SKU_IGNORE
6830 [ALC662_FIXUP_ASUS_MODE1] = {
6831 .type = HDA_FIXUP_PINS,
6832 .v.pins = (const struct hda_pintbl[]) {
6833 { 0x14, 0x99130110 }, /* speaker */
6834 { 0x18, 0x01a19c20 }, /* mic */
6835 { 0x19, 0x99a3092f }, /* int-mic */
6836 { 0x21, 0x0121401f }, /* HP out */
6840 .chain_id = ALC662_FIXUP_SKU_IGNORE
6842 [ALC662_FIXUP_ASUS_MODE2] = {
6843 .type = HDA_FIXUP_PINS,
6844 .v.pins = (const struct hda_pintbl[]) {
6845 { 0x14, 0x99130110 }, /* speaker */
6846 { 0x18, 0x01a19820 }, /* mic */
6847 { 0x19, 0x99a3092f }, /* int-mic */
6848 { 0x1b, 0x0121401f }, /* HP out */
6852 .chain_id = ALC662_FIXUP_SKU_IGNORE
6854 [ALC662_FIXUP_ASUS_MODE3] = {
6855 .type = HDA_FIXUP_PINS,
6856 .v.pins = (const struct hda_pintbl[]) {
6857 { 0x14, 0x99130110 }, /* speaker */
6858 { 0x15, 0x0121441f }, /* HP */
6859 { 0x18, 0x01a19840 }, /* mic */
6860 { 0x19, 0x99a3094f }, /* int-mic */
6861 { 0x21, 0x01211420 }, /* HP2 */
6865 .chain_id = ALC662_FIXUP_SKU_IGNORE
6867 [ALC662_FIXUP_ASUS_MODE4] = {
6868 .type = HDA_FIXUP_PINS,
6869 .v.pins = (const struct hda_pintbl[]) {
6870 { 0x14, 0x99130110 }, /* speaker */
6871 { 0x16, 0x99130111 }, /* speaker */
6872 { 0x18, 0x01a19840 }, /* mic */
6873 { 0x19, 0x99a3094f }, /* int-mic */
6874 { 0x21, 0x0121441f }, /* HP */
6878 .chain_id = ALC662_FIXUP_SKU_IGNORE
6880 [ALC662_FIXUP_ASUS_MODE5] = {
6881 .type = HDA_FIXUP_PINS,
6882 .v.pins = (const struct hda_pintbl[]) {
6883 { 0x14, 0x99130110 }, /* speaker */
6884 { 0x15, 0x0121441f }, /* HP */
6885 { 0x16, 0x99130111 }, /* speaker */
6886 { 0x18, 0x01a19840 }, /* mic */
6887 { 0x19, 0x99a3094f }, /* int-mic */
6891 .chain_id = ALC662_FIXUP_SKU_IGNORE
6893 [ALC662_FIXUP_ASUS_MODE6] = {
6894 .type = HDA_FIXUP_PINS,
6895 .v.pins = (const struct hda_pintbl[]) {
6896 { 0x14, 0x99130110 }, /* speaker */
6897 { 0x15, 0x01211420 }, /* HP2 */
6898 { 0x18, 0x01a19840 }, /* mic */
6899 { 0x19, 0x99a3094f }, /* int-mic */
6900 { 0x1b, 0x0121441f }, /* HP */
6904 .chain_id = ALC662_FIXUP_SKU_IGNORE
6906 [ALC662_FIXUP_ASUS_MODE7] = {
6907 .type = HDA_FIXUP_PINS,
6908 .v.pins = (const struct hda_pintbl[]) {
6909 { 0x14, 0x99130110 }, /* speaker */
6910 { 0x17, 0x99130111 }, /* speaker */
6911 { 0x18, 0x01a19840 }, /* mic */
6912 { 0x19, 0x99a3094f }, /* int-mic */
6913 { 0x1b, 0x01214020 }, /* HP */
6914 { 0x21, 0x0121401f }, /* HP */
6918 .chain_id = ALC662_FIXUP_SKU_IGNORE
6920 [ALC662_FIXUP_ASUS_MODE8] = {
6921 .type = HDA_FIXUP_PINS,
6922 .v.pins = (const struct hda_pintbl[]) {
6923 { 0x14, 0x99130110 }, /* speaker */
6924 { 0x12, 0x99a30970 }, /* int-mic */
6925 { 0x15, 0x01214020 }, /* HP */
6926 { 0x17, 0x99130111 }, /* speaker */
6927 { 0x18, 0x01a19840 }, /* mic */
6928 { 0x21, 0x0121401f }, /* HP */
6932 .chain_id = ALC662_FIXUP_SKU_IGNORE
6934 [ALC662_FIXUP_NO_JACK_DETECT] = {
6935 .type = HDA_FIXUP_FUNC,
6936 .v.func = alc_fixup_no_jack_detect,
6938 [ALC662_FIXUP_ZOTAC_Z68] = {
6939 .type = HDA_FIXUP_PINS,
6940 .v.pins = (const struct hda_pintbl[]) {
6941 { 0x1b, 0x02214020 }, /* Front HP */
6945 [ALC662_FIXUP_INV_DMIC] = {
6946 .type = HDA_FIXUP_FUNC,
6947 .v.func = alc_fixup_inv_dmic,
6949 [ALC668_FIXUP_DELL_XPS13] = {
6950 .type = HDA_FIXUP_FUNC,
6951 .v.func = alc_fixup_dell_xps13,
6953 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
6955 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
6956 .type = HDA_FIXUP_FUNC,
6957 .v.func = alc_fixup_disable_aamix,
6959 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
6961 [ALC668_FIXUP_AUTO_MUTE] = {
6962 .type = HDA_FIXUP_FUNC,
6963 .v.func = alc_fixup_auto_mute_via_amp,
6965 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
6967 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
6968 .type = HDA_FIXUP_PINS,
6969 .v.pins = (const struct hda_pintbl[]) {
6970 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
6971 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
6975 .chain_id = ALC662_FIXUP_HEADSET_MODE
6977 [ALC662_FIXUP_HEADSET_MODE] = {
6978 .type = HDA_FIXUP_FUNC,
6979 .v.func = alc_fixup_headset_mode_alc662,
6981 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
6982 .type = HDA_FIXUP_PINS,
6983 .v.pins = (const struct hda_pintbl[]) {
6984 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
6985 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
6989 .chain_id = ALC668_FIXUP_HEADSET_MODE
6991 [ALC668_FIXUP_HEADSET_MODE] = {
6992 .type = HDA_FIXUP_FUNC,
6993 .v.func = alc_fixup_headset_mode_alc668,
6995 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
6996 .type = HDA_FIXUP_FUNC,
6997 .v.func = alc_fixup_bass_chmap,
6999 .chain_id = ALC662_FIXUP_ASUS_MODE4
7001 [ALC662_FIXUP_BASS_16] = {
7002 .type = HDA_FIXUP_PINS,
7003 .v.pins = (const struct hda_pintbl[]) {
7004 {0x16, 0x80106111}, /* bass speaker */
7008 .chain_id = ALC662_FIXUP_BASS_CHMAP,
7010 [ALC662_FIXUP_BASS_1A] = {
7011 .type = HDA_FIXUP_PINS,
7012 .v.pins = (const struct hda_pintbl[]) {
7013 {0x1a, 0x80106111}, /* bass speaker */
7017 .chain_id = ALC662_FIXUP_BASS_CHMAP,
7019 [ALC662_FIXUP_BASS_CHMAP] = {
7020 .type = HDA_FIXUP_FUNC,
7021 .v.func = alc_fixup_bass_chmap,
7023 [ALC662_FIXUP_ASUS_Nx50] = {
7024 .type = HDA_FIXUP_FUNC,
7025 .v.func = alc_fixup_auto_mute_via_amp,
7027 .chain_id = ALC662_FIXUP_BASS_1A
7029 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
7030 .type = HDA_FIXUP_FUNC,
7031 .v.func = alc_fixup_headset_mode_alc668,
7032 .chain_id = ALC662_FIXUP_BASS_CHMAP
7034 [ALC668_FIXUP_ASUS_Nx51] = {
7035 .type = HDA_FIXUP_PINS,
7036 .v.pins = (const struct hda_pintbl[]) {
7037 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
7038 { 0x1a, 0x90170151 }, /* bass speaker */
7039 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
7043 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
7047 static const struct snd_pci_quirk alc662_fixup_tbl[] = {
7048 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
7049 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
7050 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
7051 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
7052 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
7053 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
7054 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
7055 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
7056 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
7057 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
7058 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
7059 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
7060 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
7061 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
7062 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
7063 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
7064 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
7065 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
7066 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
7067 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
7068 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
7069 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
7070 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
7071 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
7072 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
7073 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
7074 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
7075 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
7076 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
7077 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
7078 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
7079 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
7080 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
7081 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
7082 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
7083 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
7084 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
7087 /* Below is a quirk table taken from the old code.
7088 * Basically the device should work as is without the fixup table.
7089 * If BIOS doesn't give a proper info, enable the corresponding
7092 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
7093 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
7094 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
7095 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
7096 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
7097 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
7098 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
7099 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
7100 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
7101 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
7102 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
7103 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
7104 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
7105 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
7106 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
7107 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
7108 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
7109 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
7110 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
7111 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
7112 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
7113 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
7114 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
7115 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
7116 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
7117 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
7118 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
7119 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
7120 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
7121 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
7122 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
7123 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
7124 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
7125 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
7126 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
7127 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
7128 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
7129 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
7130 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
7131 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
7132 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
7133 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
7134 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
7135 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
7136 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
7137 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
7138 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
7139 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
7140 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
7141 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
7146 static const struct hda_model_fixup alc662_fixup_models[] = {
7147 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
7148 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
7149 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
7150 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
7151 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
7152 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
7153 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
7154 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
7155 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
7156 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
7157 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
7161 static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
7162 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
7166 {0x1b, 0x0221401f}),
7167 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
7171 {0x16, 0x03011020}),
7172 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
7176 {0x16, 0x03011020}),
7177 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
7181 {0x16, 0x03011020}),
7182 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
7185 {0x16, 0x03011020}),
7186 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
7189 {0x15, 0x0321101f}),
7195 static int patch_alc662(struct hda_codec *codec)
7197 struct alc_spec *spec;
7200 err = alc_alloc_spec(codec, 0x0b);
7206 spec->shutup = alc_eapd_shutup;
7208 /* handle multiple HPs as is */
7209 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
7211 alc_fix_pll_init(codec, 0x20, 0x04, 15);
7213 switch (codec->core.vendor_id) {
7215 spec->init_hook = alc668_restore_default_value;
7219 snd_hda_pick_fixup(codec, alc662_fixup_models,
7220 alc662_fixup_tbl, alc662_fixups);
7221 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups);
7222 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
7224 alc_auto_parse_customize_define(codec);
7226 if (has_cdefine_beep(codec))
7227 spec->gen.beep_nid = 0x01;
7229 if ((alc_get_coef0(codec) & (1 << 14)) &&
7230 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
7231 spec->cdefine.platform_type == 1) {
7232 err = alc_codec_rename(codec, "ALC272X");
7237 /* automatic parse from the BIOS config */
7238 err = alc662_parse_auto_config(codec);
7242 if (!spec->gen.no_analog && spec->gen.beep_nid) {
7243 switch (codec->core.vendor_id) {
7245 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
7251 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
7254 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
7259 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
7272 static int alc680_parse_auto_config(struct hda_codec *codec)
7274 return alc_parse_auto_config(codec, NULL, NULL);
7279 static int patch_alc680(struct hda_codec *codec)
7283 /* ALC680 has no aa-loopback mixer */
7284 err = alc_alloc_spec(codec, 0);
7288 /* automatic parse from the BIOS config */
7289 err = alc680_parse_auto_config(codec);
7301 static const struct hda_device_id snd_hda_id_realtek[] = {
7302 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
7303 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
7304 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
7305 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
7306 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
7307 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
7308 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
7309 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
7310 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
7311 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
7312 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
7313 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
7314 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
7315 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
7316 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
7317 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
7318 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
7319 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
7320 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
7321 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
7322 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
7323 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
7324 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
7325 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
7326 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
7327 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
7328 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
7329 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
7330 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
7331 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
7332 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
7333 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
7334 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
7335 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
7336 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
7337 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
7338 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
7339 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
7340 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
7341 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
7342 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
7343 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
7344 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
7345 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
7346 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
7347 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
7348 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
7349 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
7350 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
7351 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
7352 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc882),
7353 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
7354 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
7355 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
7356 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
7357 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
7358 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
7359 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
7360 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
7361 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
7362 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
7363 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
7364 HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
7365 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
7366 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
7369 MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
7371 MODULE_LICENSE("GPL");
7372 MODULE_DESCRIPTION("Realtek HD-audio codec");
7374 static struct hda_codec_driver realtek_driver = {
7375 .id = snd_hda_id_realtek,
7378 module_hda_codec_driver(realtek_driver);