2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for Realtek ALC codecs
6 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
8 * Takashi Iwai <tiwai@suse.de>
9 * Jonathan Woithe <jwoithe@just42.net>
11 * This driver is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <linux/dmi.h>
31 #include <linux/module.h>
32 #include <linux/input.h>
33 #include <sound/core.h>
34 #include <sound/jack.h>
35 #include "hda_codec.h"
36 #include "hda_local.h"
37 #include "hda_auto_parser.h"
39 #include "hda_generic.h"
41 /* keep halting ALC5505 DSP, for power saving */
42 #define HALT_REALTEK_ALC5505
44 /* extra amp-initialization sequence types */
54 ALC_HEADSET_MODE_UNKNOWN,
55 ALC_HEADSET_MODE_UNPLUGGED,
56 ALC_HEADSET_MODE_HEADSET,
58 ALC_HEADSET_MODE_HEADPHONE,
62 ALC_HEADSET_TYPE_UNKNOWN,
63 ALC_HEADSET_TYPE_CTIA,
64 ALC_HEADSET_TYPE_OMTP,
68 ALC_KEY_MICMUTE_INDEX,
71 struct alc_customize_define {
73 unsigned char port_connectivity;
74 unsigned char check_sum;
75 unsigned char customization;
76 unsigned char external_amp;
77 unsigned int enable_pcbeep:1;
78 unsigned int platform_type:1;
80 unsigned int override:1;
81 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
85 struct hda_gen_spec gen; /* must be at head */
87 /* codec parameterization */
88 const struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
89 unsigned int num_mixers;
90 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
92 struct alc_customize_define cdefine;
93 unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
95 /* mute LED for HP laptops, see alc269_fixup_mic_mute_hook() */
96 int mute_led_polarity;
97 hda_nid_t mute_led_nid;
98 hda_nid_t cap_mute_led_nid;
100 unsigned int gpio_led; /* used for alc269_fixup_hp_gpio_led() */
101 unsigned int gpio_mute_led_mask;
102 unsigned int gpio_mic_led_mask;
104 hda_nid_t headset_mic_pin;
105 hda_nid_t headphone_mic_pin;
106 int current_headset_mode;
107 int current_headset_type;
110 void (*init_hook)(struct hda_codec *codec);
112 void (*power_hook)(struct hda_codec *codec);
114 void (*shutup)(struct hda_codec *codec);
115 void (*reboot_notify)(struct hda_codec *codec);
118 int codec_variant; /* flag for other variants */
119 unsigned int has_alc5505_dsp:1;
120 unsigned int no_depop_delay:1;
124 unsigned int pll_coef_idx, pll_coef_bit;
126 struct input_dev *kb_dev;
127 u8 alc_mute_keycode_map[1];
131 * COEF access helper functions
134 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
135 unsigned int coef_idx)
139 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
140 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
144 #define alc_read_coef_idx(codec, coef_idx) \
145 alc_read_coefex_idx(codec, 0x20, coef_idx)
147 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
148 unsigned int coef_idx, unsigned int coef_val)
150 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
151 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
154 #define alc_write_coef_idx(codec, coef_idx, coef_val) \
155 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
157 static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
158 unsigned int coef_idx, unsigned int mask,
159 unsigned int bits_set)
161 unsigned int val = alc_read_coefex_idx(codec, nid, coef_idx);
164 alc_write_coefex_idx(codec, nid, coef_idx,
165 (val & ~mask) | bits_set);
168 #define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
169 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
171 /* a special bypass for COEF 0; read the cached value at the second time */
172 static unsigned int alc_get_coef0(struct hda_codec *codec)
174 struct alc_spec *spec = codec->spec;
177 spec->coef0 = alc_read_coef_idx(codec, 0);
181 /* coef writes/updates batch */
189 #define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
190 { .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
191 #define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
192 #define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
193 #define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
195 static void alc_process_coef_fw(struct hda_codec *codec,
196 const struct coef_fw *fw)
198 for (; fw->nid; fw++) {
199 if (fw->mask == (unsigned short)-1)
200 alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
202 alc_update_coefex_idx(codec, fw->nid, fw->idx,
208 * Append the given mixer and verb elements for the later use
209 * The mixer array is referred in build_controls(), and init_verbs are
212 static void add_mixer(struct alc_spec *spec, const struct snd_kcontrol_new *mix)
214 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
216 spec->mixers[spec->num_mixers++] = mix;
220 * GPIO setup tables, used in initialization
222 /* Enable GPIO mask and set output */
223 static const struct hda_verb alc_gpio1_init_verbs[] = {
224 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
225 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
226 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
230 static const struct hda_verb alc_gpio2_init_verbs[] = {
231 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
232 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
233 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
237 static const struct hda_verb alc_gpio3_init_verbs[] = {
238 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
239 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
240 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
245 * Fix hardware PLL issue
246 * On some codecs, the analog PLL gating control must be off while
247 * the default value is 1.
249 static void alc_fix_pll(struct hda_codec *codec)
251 struct alc_spec *spec = codec->spec;
254 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
255 1 << spec->pll_coef_bit, 0);
258 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
259 unsigned int coef_idx, unsigned int coef_bit)
261 struct alc_spec *spec = codec->spec;
263 spec->pll_coef_idx = coef_idx;
264 spec->pll_coef_bit = coef_bit;
268 /* update the master volume per volume-knob's unsol event */
269 static void alc_update_knob_master(struct hda_codec *codec,
270 struct hda_jack_callback *jack)
273 struct snd_kcontrol *kctl;
274 struct snd_ctl_elem_value *uctl;
276 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
279 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
282 val = snd_hda_codec_read(codec, jack->nid, 0,
283 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
284 val &= HDA_AMP_VOLMASK;
285 uctl->value.integer.value[0] = val;
286 uctl->value.integer.value[1] = val;
287 kctl->put(kctl, uctl);
291 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
293 /* For some reason, the res given from ALC880 is broken.
294 Here we adjust it properly. */
295 snd_hda_jack_unsol_event(codec, res >> 2);
298 /* Change EAPD to verb control */
299 static void alc_fill_eapd_coef(struct hda_codec *codec)
303 coef = alc_get_coef0(codec);
305 switch (codec->core.vendor_id) {
307 alc_update_coef_idx(codec, 0x7, 0, 1<<5);
311 alc_update_coef_idx(codec, 0x7, 0, 1<<13);
314 if ((coef & 0x00f0) == 0x0010)
315 alc_update_coef_idx(codec, 0xd, 0, 1<<14);
316 if ((coef & 0x00f0) == 0x0020)
317 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
318 if ((coef & 0x00f0) == 0x0030)
319 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
325 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
330 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
347 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
350 alc_update_coef_idx(codec, 0xe, 0, 1<<0);
353 alc_update_coef_idx(codec, 0xa, 1<<13, 0);
361 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
364 if ((coef & 0x00f0) == 0x0030)
365 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
374 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
377 alc_update_coef_idx(codec, 0x7, 3<<13, 0);
380 alc_update_coef_idx(codec, 0x4, 1<<10, 0);
383 if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
384 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
387 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
393 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
398 /* additional initialization for ALC888 variants */
399 static void alc888_coef_init(struct hda_codec *codec)
401 switch (alc_get_coef0(codec) & 0x00f0) {
406 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
411 /* turn on/off EAPD control (only if available) */
412 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
414 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
416 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
417 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
421 /* turn on/off EAPD controls of the codec */
422 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
424 /* We currently only handle front, HP */
425 static hda_nid_t pins[] = {
426 0x0f, 0x10, 0x14, 0x15, 0x17, 0
429 for (p = pins; *p; p++)
430 set_eapd(codec, *p, on);
433 /* generic shutup callback;
434 * just turning off EAPD and a little pause for avoiding pop-noise
436 static void alc_eapd_shutup(struct hda_codec *codec)
438 struct alc_spec *spec = codec->spec;
440 alc_auto_setup_eapd(codec, false);
441 if (!spec->no_depop_delay)
443 snd_hda_shutup_pins(codec);
446 /* generic EAPD initialization */
447 static void alc_auto_init_amp(struct hda_codec *codec, int type)
449 alc_fill_eapd_coef(codec);
450 alc_auto_setup_eapd(codec, true);
453 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
456 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
459 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
461 case ALC_INIT_DEFAULT:
462 switch (codec->core.vendor_id) {
464 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
470 alc_update_coef_idx(codec, 7, 0, 0x2030);
473 alc888_coef_init(codec);
482 * Realtek SSID verification
485 /* Could be any non-zero and even value. When used as fixup, tells
486 * the driver to ignore any present sku defines.
488 #define ALC_FIXUP_SKU_IGNORE (2)
490 static void alc_fixup_sku_ignore(struct hda_codec *codec,
491 const struct hda_fixup *fix, int action)
493 struct alc_spec *spec = codec->spec;
494 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
495 spec->cdefine.fixup = 1;
496 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
500 static void alc_fixup_no_depop_delay(struct hda_codec *codec,
501 const struct hda_fixup *fix, int action)
503 struct alc_spec *spec = codec->spec;
505 if (action == HDA_FIXUP_ACT_PROBE) {
506 spec->no_depop_delay = 1;
507 codec->depop_delay = 0;
511 static int alc_auto_parse_customize_define(struct hda_codec *codec)
513 unsigned int ass, tmp, i;
515 struct alc_spec *spec = codec->spec;
517 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
519 if (spec->cdefine.fixup) {
520 ass = spec->cdefine.sku_cfg;
521 if (ass == ALC_FIXUP_SKU_IGNORE)
526 if (!codec->bus->pci)
528 ass = codec->core.subsystem_id & 0xffff;
529 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
533 if (codec->core.vendor_id == 0x10ec0260)
535 ass = snd_hda_codec_get_pincfg(codec, nid);
538 codec_info(codec, "%s: SKU not ready 0x%08x\n",
539 codec->core.chip_name, ass);
545 for (i = 1; i < 16; i++) {
549 if (((ass >> 16) & 0xf) != tmp)
552 spec->cdefine.port_connectivity = ass >> 30;
553 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
554 spec->cdefine.check_sum = (ass >> 16) & 0xf;
555 spec->cdefine.customization = ass >> 8;
557 spec->cdefine.sku_cfg = ass;
558 spec->cdefine.external_amp = (ass & 0x38) >> 3;
559 spec->cdefine.platform_type = (ass & 0x4) >> 2;
560 spec->cdefine.swap = (ass & 0x2) >> 1;
561 spec->cdefine.override = ass & 0x1;
563 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
564 nid, spec->cdefine.sku_cfg);
565 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
566 spec->cdefine.port_connectivity);
567 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
568 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
569 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
570 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
571 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
572 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
573 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
578 /* return the position of NID in the list, or -1 if not found */
579 static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
582 for (i = 0; i < nums; i++)
587 /* return true if the given NID is found in the list */
588 static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
590 return find_idx_in_nid_list(nid, list, nums) >= 0;
593 /* check subsystem ID and set up device-specific initialization;
594 * return 1 if initialized, 0 if invalid SSID
596 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
597 * 31 ~ 16 : Manufacture ID
599 * 7 ~ 0 : Assembly ID
600 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
602 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
604 unsigned int ass, tmp, i;
606 struct alc_spec *spec = codec->spec;
608 if (spec->cdefine.fixup) {
609 ass = spec->cdefine.sku_cfg;
610 if (ass == ALC_FIXUP_SKU_IGNORE)
615 ass = codec->core.subsystem_id & 0xffff;
616 if (codec->bus->pci &&
617 ass != codec->bus->pci->subsystem_device && (ass & 1))
620 /* invalid SSID, check the special NID pin defcfg instead */
622 * 31~30 : port connectivity
625 * 19~16 : Check sum (15:1)
630 if (codec->core.vendor_id == 0x10ec0260)
632 ass = snd_hda_codec_get_pincfg(codec, nid);
634 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
638 if ((ass >> 30) != 1) /* no physical connection */
643 for (i = 1; i < 16; i++) {
647 if (((ass >> 16) & 0xf) != tmp)
650 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
651 ass & 0xffff, codec->core.vendor_id);
655 * 2 : 0 --> Desktop, 1 --> Laptop
656 * 3~5 : External Amplifier control
659 tmp = (ass & 0x38) >> 3; /* external Amp control */
662 spec->init_amp = ALC_INIT_GPIO1;
665 spec->init_amp = ALC_INIT_GPIO2;
668 spec->init_amp = ALC_INIT_GPIO3;
672 spec->init_amp = ALC_INIT_DEFAULT;
676 /* is laptop or Desktop and enable the function "Mute internal speaker
677 * when the external headphone out jack is plugged"
682 * 10~8 : Jack location
683 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
685 * 15 : 1 --> enable the function "Mute internal speaker
686 * when the external headphone out jack is plugged"
688 if (!spec->gen.autocfg.hp_pins[0] &&
689 !(spec->gen.autocfg.line_out_pins[0] &&
690 spec->gen.autocfg.line_out_type == AUTO_PIN_HP_OUT)) {
692 tmp = (ass >> 11) & 0x3; /* HP to chassis */
694 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
695 spec->gen.autocfg.line_outs))
697 spec->gen.autocfg.hp_pins[0] = nid;
702 /* Check the validity of ALC subsystem-id
703 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
704 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
706 if (!alc_subsystem_id(codec, ports)) {
707 struct alc_spec *spec = codec->spec;
709 "realtek: Enable default setup for auto mode as fallback\n");
710 spec->init_amp = ALC_INIT_DEFAULT;
717 static void alc_fixup_inv_dmic(struct hda_codec *codec,
718 const struct hda_fixup *fix, int action)
720 struct alc_spec *spec = codec->spec;
722 spec->gen.inv_dmic_split = 1;
726 #ifdef CONFIG_SND_HDA_INPUT_BEEP
727 /* additional beep mixers; the actual parameters are overwritten at build */
728 static const struct snd_kcontrol_new alc_beep_mixer[] = {
729 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
730 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
735 static int alc_build_controls(struct hda_codec *codec)
737 struct alc_spec *spec = codec->spec;
740 err = snd_hda_gen_build_controls(codec);
744 for (i = 0; i < spec->num_mixers; i++) {
745 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
750 #ifdef CONFIG_SND_HDA_INPUT_BEEP
751 /* create beep controls if needed */
752 if (spec->beep_amp) {
753 const struct snd_kcontrol_new *knew;
754 for (knew = alc_beep_mixer; knew->name; knew++) {
755 struct snd_kcontrol *kctl;
756 kctl = snd_ctl_new1(knew, codec);
759 kctl->private_value = spec->beep_amp;
760 err = snd_hda_ctl_add(codec, 0, kctl);
767 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
776 static int alc_init(struct hda_codec *codec)
778 struct alc_spec *spec = codec->spec;
781 spec->init_hook(codec);
784 alc_auto_init_amp(codec, spec->init_amp);
786 snd_hda_gen_init(codec);
788 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
793 static inline void alc_shutup(struct hda_codec *codec)
795 struct alc_spec *spec = codec->spec;
797 if (spec && spec->shutup)
800 snd_hda_shutup_pins(codec);
803 static void alc_reboot_notify(struct hda_codec *codec)
805 struct alc_spec *spec = codec->spec;
807 if (spec && spec->reboot_notify)
808 spec->reboot_notify(codec);
813 /* power down codec to D3 at reboot/shutdown; set as reboot_notify ops */
814 static void alc_d3_at_reboot(struct hda_codec *codec)
816 snd_hda_codec_set_power_to_all(codec, codec->core.afg, AC_PWRST_D3);
817 snd_hda_codec_write(codec, codec->core.afg, 0,
818 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
822 #define alc_free snd_hda_gen_free
825 static void alc_power_eapd(struct hda_codec *codec)
827 alc_auto_setup_eapd(codec, false);
830 static int alc_suspend(struct hda_codec *codec)
832 struct alc_spec *spec = codec->spec;
834 if (spec && spec->power_hook)
835 spec->power_hook(codec);
841 static int alc_resume(struct hda_codec *codec)
843 struct alc_spec *spec = codec->spec;
845 if (!spec->no_depop_delay)
846 msleep(150); /* to avoid pop noise */
847 codec->patch_ops.init(codec);
848 regcache_sync(codec->core.regmap);
849 hda_call_check_power_status(codec, 0x01);
856 static const struct hda_codec_ops alc_patch_ops = {
857 .build_controls = alc_build_controls,
858 .build_pcms = snd_hda_gen_build_pcms,
861 .unsol_event = snd_hda_jack_unsol_event,
863 .resume = alc_resume,
864 .suspend = alc_suspend,
865 .check_power_status = snd_hda_gen_check_power_status,
867 .reboot_notify = alc_reboot_notify,
871 #define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
874 * Rename codecs appropriately from COEF value or subvendor id
876 struct alc_codec_rename_table {
877 unsigned int vendor_id;
878 unsigned short coef_mask;
879 unsigned short coef_bits;
883 struct alc_codec_rename_pci_table {
884 unsigned int codec_vendor_id;
885 unsigned short pci_subvendor;
886 unsigned short pci_subdevice;
890 static struct alc_codec_rename_table rename_tbl[] = {
891 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
892 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
893 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
894 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
895 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
896 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
897 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
898 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
899 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
900 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
901 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
902 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
903 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
904 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
905 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
906 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
907 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
911 static struct alc_codec_rename_pci_table rename_pci_tbl[] = {
912 { 0x10ec0280, 0x1028, 0, "ALC3220" },
913 { 0x10ec0282, 0x1028, 0, "ALC3221" },
914 { 0x10ec0283, 0x1028, 0, "ALC3223" },
915 { 0x10ec0288, 0x1028, 0, "ALC3263" },
916 { 0x10ec0292, 0x1028, 0, "ALC3226" },
917 { 0x10ec0293, 0x1028, 0, "ALC3235" },
918 { 0x10ec0255, 0x1028, 0, "ALC3234" },
919 { 0x10ec0668, 0x1028, 0, "ALC3661" },
920 { 0x10ec0275, 0x1028, 0, "ALC3260" },
921 { 0x10ec0899, 0x1028, 0, "ALC3861" },
922 { 0x10ec0298, 0x1028, 0, "ALC3266" },
923 { 0x10ec0236, 0x1028, 0, "ALC3204" },
924 { 0x10ec0256, 0x1028, 0, "ALC3246" },
925 { 0x10ec0225, 0x1028, 0, "ALC3253" },
926 { 0x10ec0295, 0x1028, 0, "ALC3254" },
927 { 0x10ec0299, 0x1028, 0, "ALC3271" },
928 { 0x10ec0670, 0x1025, 0, "ALC669X" },
929 { 0x10ec0676, 0x1025, 0, "ALC679X" },
930 { 0x10ec0282, 0x1043, 0, "ALC3229" },
931 { 0x10ec0233, 0x1043, 0, "ALC3236" },
932 { 0x10ec0280, 0x103c, 0, "ALC3228" },
933 { 0x10ec0282, 0x103c, 0, "ALC3227" },
934 { 0x10ec0286, 0x103c, 0, "ALC3242" },
935 { 0x10ec0290, 0x103c, 0, "ALC3241" },
936 { 0x10ec0668, 0x103c, 0, "ALC3662" },
937 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
938 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
942 static int alc_codec_rename_from_preset(struct hda_codec *codec)
944 const struct alc_codec_rename_table *p;
945 const struct alc_codec_rename_pci_table *q;
947 for (p = rename_tbl; p->vendor_id; p++) {
948 if (p->vendor_id != codec->core.vendor_id)
950 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
951 return alc_codec_rename(codec, p->name);
954 if (!codec->bus->pci)
956 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
957 if (q->codec_vendor_id != codec->core.vendor_id)
959 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
961 if (!q->pci_subdevice ||
962 q->pci_subdevice == codec->bus->pci->subsystem_device)
963 return alc_codec_rename(codec, q->name);
971 * Digital-beep handlers
973 #ifdef CONFIG_SND_HDA_INPUT_BEEP
974 #define set_beep_amp(spec, nid, idx, dir) \
975 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
977 static const struct snd_pci_quirk beep_white_list[] = {
978 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
979 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
980 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
981 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
982 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
983 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
984 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
985 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
986 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
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,
1813 ALC1220_FIXUP_GB_DUAL_CODECS,
1816 static void alc889_fixup_coef(struct hda_codec *codec,
1817 const struct hda_fixup *fix, int action)
1819 if (action != HDA_FIXUP_ACT_INIT)
1821 alc_update_coef_idx(codec, 7, 0, 0x2030);
1824 /* toggle speaker-output according to the hp-jack state */
1825 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
1827 unsigned int gpiostate, gpiomask, gpiodir;
1829 gpiostate = snd_hda_codec_read(codec, codec->core.afg, 0,
1830 AC_VERB_GET_GPIO_DATA, 0);
1833 gpiostate |= (1 << pin);
1835 gpiostate &= ~(1 << pin);
1837 gpiomask = snd_hda_codec_read(codec, codec->core.afg, 0,
1838 AC_VERB_GET_GPIO_MASK, 0);
1839 gpiomask |= (1 << pin);
1841 gpiodir = snd_hda_codec_read(codec, codec->core.afg, 0,
1842 AC_VERB_GET_GPIO_DIRECTION, 0);
1843 gpiodir |= (1 << pin);
1846 snd_hda_codec_write(codec, codec->core.afg, 0,
1847 AC_VERB_SET_GPIO_MASK, gpiomask);
1848 snd_hda_codec_write(codec, codec->core.afg, 0,
1849 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
1853 snd_hda_codec_write(codec, codec->core.afg, 0,
1854 AC_VERB_SET_GPIO_DATA, gpiostate);
1857 /* set up GPIO at initialization */
1858 static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
1859 const struct hda_fixup *fix, int action)
1861 if (action != HDA_FIXUP_ACT_INIT)
1863 alc882_gpio_mute(codec, 0, 0);
1864 alc882_gpio_mute(codec, 1, 0);
1867 /* Fix the connection of some pins for ALC889:
1868 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
1869 * work correctly (bko#42740)
1871 static void alc889_fixup_dac_route(struct hda_codec *codec,
1872 const struct hda_fixup *fix, int action)
1874 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1875 /* fake the connections during parsing the tree */
1876 hda_nid_t conn1[2] = { 0x0c, 0x0d };
1877 hda_nid_t conn2[2] = { 0x0e, 0x0f };
1878 snd_hda_override_conn_list(codec, 0x14, 2, conn1);
1879 snd_hda_override_conn_list(codec, 0x15, 2, conn1);
1880 snd_hda_override_conn_list(codec, 0x18, 2, conn2);
1881 snd_hda_override_conn_list(codec, 0x1a, 2, conn2);
1882 } else if (action == HDA_FIXUP_ACT_PROBE) {
1883 /* restore the connections */
1884 hda_nid_t conn[5] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
1885 snd_hda_override_conn_list(codec, 0x14, 5, conn);
1886 snd_hda_override_conn_list(codec, 0x15, 5, conn);
1887 snd_hda_override_conn_list(codec, 0x18, 5, conn);
1888 snd_hda_override_conn_list(codec, 0x1a, 5, conn);
1892 /* Set VREF on HP pin */
1893 static void alc889_fixup_mbp_vref(struct hda_codec *codec,
1894 const struct hda_fixup *fix, int action)
1896 struct alc_spec *spec = codec->spec;
1897 static hda_nid_t nids[3] = { 0x14, 0x15, 0x19 };
1900 if (action != HDA_FIXUP_ACT_INIT)
1902 for (i = 0; i < ARRAY_SIZE(nids); i++) {
1903 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
1904 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
1906 val = snd_hda_codec_get_pin_target(codec, nids[i]);
1907 val |= AC_PINCTL_VREF_80;
1908 snd_hda_set_pin_ctl(codec, nids[i], val);
1909 spec->gen.keep_vref_in_automute = 1;
1914 static void alc889_fixup_mac_pins(struct hda_codec *codec,
1915 const hda_nid_t *nids, int num_nids)
1917 struct alc_spec *spec = codec->spec;
1920 for (i = 0; i < num_nids; i++) {
1922 val = snd_hda_codec_get_pin_target(codec, nids[i]);
1923 val |= AC_PINCTL_VREF_50;
1924 snd_hda_set_pin_ctl(codec, nids[i], val);
1926 spec->gen.keep_vref_in_automute = 1;
1929 /* Set VREF on speaker pins on imac91 */
1930 static void alc889_fixup_imac91_vref(struct hda_codec *codec,
1931 const struct hda_fixup *fix, int action)
1933 static hda_nid_t nids[2] = { 0x18, 0x1a };
1935 if (action == HDA_FIXUP_ACT_INIT)
1936 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1939 /* Set VREF on speaker pins on mba11 */
1940 static void alc889_fixup_mba11_vref(struct hda_codec *codec,
1941 const struct hda_fixup *fix, int action)
1943 static hda_nid_t nids[1] = { 0x18 };
1945 if (action == HDA_FIXUP_ACT_INIT)
1946 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1949 /* Set VREF on speaker pins on mba21 */
1950 static void alc889_fixup_mba21_vref(struct hda_codec *codec,
1951 const struct hda_fixup *fix, int action)
1953 static hda_nid_t nids[2] = { 0x18, 0x19 };
1955 if (action == HDA_FIXUP_ACT_INIT)
1956 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1959 /* Don't take HP output as primary
1960 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
1961 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
1963 static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
1964 const struct hda_fixup *fix, int action)
1966 struct alc_spec *spec = codec->spec;
1967 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1968 spec->gen.no_primary_hp = 1;
1969 spec->gen.no_multi_io = 1;
1973 static void alc_fixup_bass_chmap(struct hda_codec *codec,
1974 const struct hda_fixup *fix, int action);
1976 /* For dual-codec configuration, we need to disable some features to avoid
1977 * conflicts of kctls and PCM streams
1979 static void alc_fixup_dual_codecs(struct hda_codec *codec,
1980 const struct hda_fixup *fix, int action)
1982 struct alc_spec *spec = codec->spec;
1984 if (action != HDA_FIXUP_ACT_PRE_PROBE)
1986 /* disable vmaster */
1987 spec->gen.suppress_vmaster = 1;
1988 /* auto-mute and auto-mic switch don't work with multiple codecs */
1989 spec->gen.suppress_auto_mute = 1;
1990 spec->gen.suppress_auto_mic = 1;
1991 /* disable aamix as well */
1992 spec->gen.mixer_nid = 0;
1993 /* add location prefix to avoid conflicts */
1994 codec->force_pin_prefix = 1;
1997 static void rename_ctl(struct hda_codec *codec, const char *oldname,
1998 const char *newname)
2000 struct snd_kcontrol *kctl;
2002 kctl = snd_hda_find_mixer_ctl(codec, oldname);
2004 strcpy(kctl->id.name, newname);
2007 static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2008 const struct hda_fixup *fix,
2011 alc_fixup_dual_codecs(codec, fix, action);
2013 case HDA_FIXUP_ACT_PRE_PROBE:
2014 /* override card longname to provide a unique UCM profile */
2015 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2017 case HDA_FIXUP_ACT_BUILD:
2018 /* rename Capture controls depending on the codec */
2019 rename_ctl(codec, "Capture Volume",
2021 "Rear-Panel Capture Volume" :
2022 "Front-Panel Capture Volume");
2023 rename_ctl(codec, "Capture Switch",
2025 "Rear-Panel Capture Switch" :
2026 "Front-Panel Capture Switch");
2031 static const struct hda_fixup alc882_fixups[] = {
2032 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
2033 .type = HDA_FIXUP_PINS,
2034 .v.pins = (const struct hda_pintbl[]) {
2035 { 0x15, 0x01080104 }, /* side */
2036 { 0x16, 0x01011012 }, /* rear */
2037 { 0x17, 0x01016011 }, /* clfe */
2041 [ALC882_FIXUP_LENOVO_Y530] = {
2042 .type = HDA_FIXUP_PINS,
2043 .v.pins = (const struct hda_pintbl[]) {
2044 { 0x15, 0x99130112 }, /* rear int speakers */
2045 { 0x16, 0x99130111 }, /* subwoofer */
2049 [ALC882_FIXUP_PB_M5210] = {
2050 .type = HDA_FIXUP_PINCTLS,
2051 .v.pins = (const struct hda_pintbl[]) {
2052 { 0x19, PIN_VREF50 },
2056 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
2057 .type = HDA_FIXUP_FUNC,
2058 .v.func = alc_fixup_sku_ignore,
2060 [ALC882_FIXUP_ASUS_W90V] = {
2061 .type = HDA_FIXUP_PINS,
2062 .v.pins = (const struct hda_pintbl[]) {
2063 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
2067 [ALC889_FIXUP_CD] = {
2068 .type = HDA_FIXUP_PINS,
2069 .v.pins = (const struct hda_pintbl[]) {
2070 { 0x1c, 0x993301f0 }, /* CD */
2074 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2075 .type = HDA_FIXUP_PINS,
2076 .v.pins = (const struct hda_pintbl[]) {
2077 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2081 .chain_id = ALC889_FIXUP_CD,
2083 [ALC889_FIXUP_VAIO_TT] = {
2084 .type = HDA_FIXUP_PINS,
2085 .v.pins = (const struct hda_pintbl[]) {
2086 { 0x17, 0x90170111 }, /* hidden surround speaker */
2090 [ALC888_FIXUP_EEE1601] = {
2091 .type = HDA_FIXUP_VERBS,
2092 .v.verbs = (const struct hda_verb[]) {
2093 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2094 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
2098 [ALC882_FIXUP_EAPD] = {
2099 .type = HDA_FIXUP_VERBS,
2100 .v.verbs = (const struct hda_verb[]) {
2101 /* change to EAPD mode */
2102 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2103 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2107 [ALC883_FIXUP_EAPD] = {
2108 .type = HDA_FIXUP_VERBS,
2109 .v.verbs = (const struct hda_verb[]) {
2110 /* change to EAPD mode */
2111 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2112 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2116 [ALC883_FIXUP_ACER_EAPD] = {
2117 .type = HDA_FIXUP_VERBS,
2118 .v.verbs = (const struct hda_verb[]) {
2119 /* eanable EAPD on Acer laptops */
2120 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2121 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2125 [ALC882_FIXUP_GPIO1] = {
2126 .type = HDA_FIXUP_VERBS,
2127 .v.verbs = alc_gpio1_init_verbs,
2129 [ALC882_FIXUP_GPIO2] = {
2130 .type = HDA_FIXUP_VERBS,
2131 .v.verbs = alc_gpio2_init_verbs,
2133 [ALC882_FIXUP_GPIO3] = {
2134 .type = HDA_FIXUP_VERBS,
2135 .v.verbs = alc_gpio3_init_verbs,
2137 [ALC882_FIXUP_ASUS_W2JC] = {
2138 .type = HDA_FIXUP_VERBS,
2139 .v.verbs = alc_gpio1_init_verbs,
2141 .chain_id = ALC882_FIXUP_EAPD,
2143 [ALC889_FIXUP_COEF] = {
2144 .type = HDA_FIXUP_FUNC,
2145 .v.func = alc889_fixup_coef,
2147 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
2148 .type = HDA_FIXUP_PINS,
2149 .v.pins = (const struct hda_pintbl[]) {
2150 { 0x16, 0x99130111 }, /* CLFE speaker */
2151 { 0x17, 0x99130112 }, /* surround speaker */
2155 .chain_id = ALC882_FIXUP_GPIO1,
2157 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
2158 .type = HDA_FIXUP_PINS,
2159 .v.pins = (const struct hda_pintbl[]) {
2160 { 0x16, 0x99130111 }, /* CLFE speaker */
2161 { 0x1b, 0x99130112 }, /* surround speaker */
2165 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2167 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2168 /* additional init verbs for Acer Aspire 8930G */
2169 .type = HDA_FIXUP_VERBS,
2170 .v.verbs = (const struct hda_verb[]) {
2171 /* Enable all DACs */
2172 /* DAC DISABLE/MUTE 1? */
2173 /* setting bits 1-5 disables DAC nids 0x02-0x06
2174 * apparently. Init=0x38 */
2175 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2176 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2177 /* DAC DISABLE/MUTE 2? */
2178 /* some bit here disables the other DACs.
2180 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2181 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2183 * This laptop has a stereo digital microphone.
2184 * The mics are only 1cm apart which makes the stereo
2185 * useless. However, either the mic or the ALC889
2186 * makes the signal become a difference/sum signal
2187 * instead of standard stereo, which is annoying.
2188 * So instead we flip this bit which makes the
2189 * codec replicate the sum signal to both channels,
2190 * turning it into a normal mono mic.
2192 /* DMIC_CONTROL? Init value = 0x0001 */
2193 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2194 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2195 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2196 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2200 .chain_id = ALC882_FIXUP_GPIO1,
2202 [ALC885_FIXUP_MACPRO_GPIO] = {
2203 .type = HDA_FIXUP_FUNC,
2204 .v.func = alc885_fixup_macpro_gpio,
2206 [ALC889_FIXUP_DAC_ROUTE] = {
2207 .type = HDA_FIXUP_FUNC,
2208 .v.func = alc889_fixup_dac_route,
2210 [ALC889_FIXUP_MBP_VREF] = {
2211 .type = HDA_FIXUP_FUNC,
2212 .v.func = alc889_fixup_mbp_vref,
2214 .chain_id = ALC882_FIXUP_GPIO1,
2216 [ALC889_FIXUP_IMAC91_VREF] = {
2217 .type = HDA_FIXUP_FUNC,
2218 .v.func = alc889_fixup_imac91_vref,
2220 .chain_id = ALC882_FIXUP_GPIO1,
2222 [ALC889_FIXUP_MBA11_VREF] = {
2223 .type = HDA_FIXUP_FUNC,
2224 .v.func = alc889_fixup_mba11_vref,
2226 .chain_id = ALC889_FIXUP_MBP_VREF,
2228 [ALC889_FIXUP_MBA21_VREF] = {
2229 .type = HDA_FIXUP_FUNC,
2230 .v.func = alc889_fixup_mba21_vref,
2232 .chain_id = ALC889_FIXUP_MBP_VREF,
2234 [ALC889_FIXUP_MP11_VREF] = {
2235 .type = HDA_FIXUP_FUNC,
2236 .v.func = alc889_fixup_mba11_vref,
2238 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2240 [ALC889_FIXUP_MP41_VREF] = {
2241 .type = HDA_FIXUP_FUNC,
2242 .v.func = alc889_fixup_mbp_vref,
2244 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2246 [ALC882_FIXUP_INV_DMIC] = {
2247 .type = HDA_FIXUP_FUNC,
2248 .v.func = alc_fixup_inv_dmic,
2250 [ALC882_FIXUP_NO_PRIMARY_HP] = {
2251 .type = HDA_FIXUP_FUNC,
2252 .v.func = alc882_fixup_no_primary_hp,
2254 [ALC887_FIXUP_ASUS_BASS] = {
2255 .type = HDA_FIXUP_PINS,
2256 .v.pins = (const struct hda_pintbl[]) {
2257 {0x16, 0x99130130}, /* bass speaker */
2261 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2263 [ALC887_FIXUP_BASS_CHMAP] = {
2264 .type = HDA_FIXUP_FUNC,
2265 .v.func = alc_fixup_bass_chmap,
2267 [ALC1220_FIXUP_GB_DUAL_CODECS] = {
2268 .type = HDA_FIXUP_FUNC,
2269 .v.func = alc1220_fixup_gb_dual_codecs,
2273 static const struct snd_pci_quirk alc882_fixup_tbl[] = {
2274 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2275 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2276 SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2277 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2278 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2279 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2280 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
2281 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2282 ALC882_FIXUP_ACER_ASPIRE_4930G),
2283 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2284 ALC882_FIXUP_ACER_ASPIRE_4930G),
2285 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2286 ALC882_FIXUP_ACER_ASPIRE_8930G),
2287 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2288 ALC882_FIXUP_ACER_ASPIRE_8930G),
2289 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2290 ALC882_FIXUP_ACER_ASPIRE_4930G),
2291 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2292 ALC882_FIXUP_ACER_ASPIRE_4930G),
2293 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2294 ALC882_FIXUP_ACER_ASPIRE_4930G),
2295 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
2296 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2297 ALC882_FIXUP_ACER_ASPIRE_4930G),
2298 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
2299 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
2300 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
2301 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
2302 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
2303 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
2304 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
2305 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
2306 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
2307 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
2308 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
2309 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
2310 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2311 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
2313 /* All Apple entries are in codec SSIDs */
2314 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2315 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2316 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2317 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
2318 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2319 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
2320 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2321 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
2322 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
2323 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
2324 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
2325 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2326 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2327 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
2328 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2329 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2330 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
2331 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
2332 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
2333 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2334 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
2335 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
2337 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
2338 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
2339 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2340 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
2341 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2342 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
2343 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
2344 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2345 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
2346 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
2347 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
2351 static const struct hda_model_fixup alc882_fixup_models[] = {
2352 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2353 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2354 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
2355 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
2356 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
2357 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
2362 * BIOS auto configuration
2364 /* almost identical with ALC880 parser... */
2365 static int alc882_parse_auto_config(struct hda_codec *codec)
2367 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
2368 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2369 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
2374 static int patch_alc882(struct hda_codec *codec)
2376 struct alc_spec *spec;
2379 err = alc_alloc_spec(codec, 0x0b);
2385 switch (codec->core.vendor_id) {
2392 /* ALC883 and variants */
2393 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2397 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
2399 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2401 alc_auto_parse_customize_define(codec);
2403 if (has_cdefine_beep(codec))
2404 spec->gen.beep_nid = 0x01;
2406 /* automatic parse from the BIOS config */
2407 err = alc882_parse_auto_config(codec);
2411 if (!spec->gen.no_analog && spec->gen.beep_nid)
2412 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2414 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2427 static int alc262_parse_auto_config(struct hda_codec *codec)
2429 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
2430 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2431 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
2438 ALC262_FIXUP_FSC_H270,
2439 ALC262_FIXUP_FSC_S7110,
2440 ALC262_FIXUP_HP_Z200,
2442 ALC262_FIXUP_LENOVO_3000,
2444 ALC262_FIXUP_BENQ_T31,
2445 ALC262_FIXUP_INV_DMIC,
2446 ALC262_FIXUP_INTEL_BAYLEYBAY,
2449 static const struct hda_fixup alc262_fixups[] = {
2450 [ALC262_FIXUP_FSC_H270] = {
2451 .type = HDA_FIXUP_PINS,
2452 .v.pins = (const struct hda_pintbl[]) {
2453 { 0x14, 0x99130110 }, /* speaker */
2454 { 0x15, 0x0221142f }, /* front HP */
2455 { 0x1b, 0x0121141f }, /* rear HP */
2459 [ALC262_FIXUP_FSC_S7110] = {
2460 .type = HDA_FIXUP_PINS,
2461 .v.pins = (const struct hda_pintbl[]) {
2462 { 0x15, 0x90170110 }, /* speaker */
2466 .chain_id = ALC262_FIXUP_BENQ,
2468 [ALC262_FIXUP_HP_Z200] = {
2469 .type = HDA_FIXUP_PINS,
2470 .v.pins = (const struct hda_pintbl[]) {
2471 { 0x16, 0x99130120 }, /* internal speaker */
2475 [ALC262_FIXUP_TYAN] = {
2476 .type = HDA_FIXUP_PINS,
2477 .v.pins = (const struct hda_pintbl[]) {
2478 { 0x14, 0x1993e1f0 }, /* int AUX */
2482 [ALC262_FIXUP_LENOVO_3000] = {
2483 .type = HDA_FIXUP_PINCTLS,
2484 .v.pins = (const struct hda_pintbl[]) {
2485 { 0x19, PIN_VREF50 },
2489 .chain_id = ALC262_FIXUP_BENQ,
2491 [ALC262_FIXUP_BENQ] = {
2492 .type = HDA_FIXUP_VERBS,
2493 .v.verbs = (const struct hda_verb[]) {
2494 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2495 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2499 [ALC262_FIXUP_BENQ_T31] = {
2500 .type = HDA_FIXUP_VERBS,
2501 .v.verbs = (const struct hda_verb[]) {
2502 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2503 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2507 [ALC262_FIXUP_INV_DMIC] = {
2508 .type = HDA_FIXUP_FUNC,
2509 .v.func = alc_fixup_inv_dmic,
2511 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2512 .type = HDA_FIXUP_FUNC,
2513 .v.func = alc_fixup_no_depop_delay,
2517 static const struct snd_pci_quirk alc262_fixup_tbl[] = {
2518 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
2519 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
2520 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
2521 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
2522 SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
2523 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
2524 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
2525 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2526 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
2527 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
2531 static const struct hda_model_fixup alc262_fixup_models[] = {
2532 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
2538 static int patch_alc262(struct hda_codec *codec)
2540 struct alc_spec *spec;
2543 err = alc_alloc_spec(codec, 0x0b);
2548 spec->gen.shared_mic_vref_pin = 0x18;
2550 spec->shutup = alc_eapd_shutup;
2553 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2556 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
2558 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2560 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
2562 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2564 alc_auto_parse_customize_define(codec);
2566 if (has_cdefine_beep(codec))
2567 spec->gen.beep_nid = 0x01;
2569 /* automatic parse from the BIOS config */
2570 err = alc262_parse_auto_config(codec);
2574 if (!spec->gen.no_analog && spec->gen.beep_nid)
2575 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2577 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2589 /* bind Beep switches of both NID 0x0f and 0x10 */
2590 static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2591 struct snd_ctl_elem_value *ucontrol)
2593 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2597 mutex_lock(&codec->control_mutex);
2598 pval = kcontrol->private_value;
2599 kcontrol->private_value = (pval & ~0xff) | 0x0f;
2600 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2602 kcontrol->private_value = (pval & ~0xff) | 0x10;
2603 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2605 kcontrol->private_value = pval;
2606 mutex_unlock(&codec->control_mutex);
2610 static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2611 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
2613 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2614 .name = "Beep Playback Switch",
2615 .subdevice = HDA_SUBDEV_AMP_FLAG,
2616 .info = snd_hda_mixer_amp_switch_info,
2617 .get = snd_hda_mixer_amp_switch_get,
2618 .put = alc268_beep_switch_put,
2619 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
2624 /* set PCBEEP vol = 0, mute connections */
2625 static const struct hda_verb alc268_beep_init_verbs[] = {
2626 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2627 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2628 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2633 ALC268_FIXUP_INV_DMIC,
2634 ALC268_FIXUP_HP_EAPD,
2638 static const struct hda_fixup alc268_fixups[] = {
2639 [ALC268_FIXUP_INV_DMIC] = {
2640 .type = HDA_FIXUP_FUNC,
2641 .v.func = alc_fixup_inv_dmic,
2643 [ALC268_FIXUP_HP_EAPD] = {
2644 .type = HDA_FIXUP_VERBS,
2645 .v.verbs = (const struct hda_verb[]) {
2646 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
2650 [ALC268_FIXUP_SPDIF] = {
2651 .type = HDA_FIXUP_PINS,
2652 .v.pins = (const struct hda_pintbl[]) {
2653 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
2659 static const struct hda_model_fixup alc268_fixup_models[] = {
2660 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
2661 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
2665 static const struct snd_pci_quirk alc268_fixup_tbl[] = {
2666 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
2667 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
2668 /* below is codec SSID since multiple Toshiba laptops have the
2669 * same PCI SSID 1179:ff00
2671 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
2676 * BIOS auto configuration
2678 static int alc268_parse_auto_config(struct hda_codec *codec)
2680 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2681 return alc_parse_auto_config(codec, NULL, alc268_ssids);
2686 static int patch_alc268(struct hda_codec *codec)
2688 struct alc_spec *spec;
2691 /* ALC268 has no aa-loopback mixer */
2692 err = alc_alloc_spec(codec, 0);
2697 spec->gen.beep_nid = 0x01;
2699 spec->shutup = alc_eapd_shutup;
2701 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
2702 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2704 /* automatic parse from the BIOS config */
2705 err = alc268_parse_auto_config(codec);
2709 if (err > 0 && !spec->gen.no_analog &&
2710 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
2711 add_mixer(spec, alc268_beep_mixer);
2712 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
2713 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
2714 /* override the amp caps for beep generator */
2715 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
2716 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
2717 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
2718 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
2719 (0 << AC_AMPCAP_MUTE_SHIFT));
2722 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2735 static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
2736 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
2739 static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
2740 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
2743 /* different alc269-variants */
2745 ALC269_TYPE_ALC269VA,
2746 ALC269_TYPE_ALC269VB,
2747 ALC269_TYPE_ALC269VC,
2748 ALC269_TYPE_ALC269VD,
2767 * BIOS auto configuration
2769 static int alc269_parse_auto_config(struct hda_codec *codec)
2771 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
2772 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
2773 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2774 struct alc_spec *spec = codec->spec;
2775 const hda_nid_t *ssids;
2777 switch (spec->codec_variant) {
2778 case ALC269_TYPE_ALC269VA:
2779 case ALC269_TYPE_ALC269VC:
2780 case ALC269_TYPE_ALC280:
2781 case ALC269_TYPE_ALC284:
2782 case ALC269_TYPE_ALC293:
2783 ssids = alc269va_ssids;
2785 case ALC269_TYPE_ALC269VB:
2786 case ALC269_TYPE_ALC269VD:
2787 case ALC269_TYPE_ALC282:
2788 case ALC269_TYPE_ALC283:
2789 case ALC269_TYPE_ALC286:
2790 case ALC269_TYPE_ALC298:
2791 case ALC269_TYPE_ALC255:
2792 case ALC269_TYPE_ALC256:
2793 case ALC269_TYPE_ALC257:
2794 case ALC269_TYPE_ALC215:
2795 case ALC269_TYPE_ALC225:
2796 case ALC269_TYPE_ALC294:
2797 case ALC269_TYPE_ALC300:
2798 case ALC269_TYPE_ALC700:
2799 ssids = alc269_ssids;
2802 ssids = alc269_ssids;
2806 return alc_parse_auto_config(codec, alc269_ignore, ssids);
2809 static int find_ext_mic_pin(struct hda_codec *codec);
2811 static void alc286_shutup(struct hda_codec *codec)
2814 int mic_pin = find_ext_mic_pin(codec);
2815 /* don't shut up pins when unloading the driver; otherwise it breaks
2816 * the default pin setup at the next load of the driver
2818 if (codec->bus->shutdown)
2820 for (i = 0; i < codec->init_pins.used; i++) {
2821 struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i);
2822 /* use read here for syncing after issuing each verb */
2823 if (pin->nid != mic_pin)
2824 snd_hda_codec_read(codec, pin->nid, 0,
2825 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
2827 codec->pins_shutup = 1;
2830 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
2832 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
2835 static void alc269_shutup(struct hda_codec *codec)
2837 struct alc_spec *spec = codec->spec;
2839 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
2840 alc269vb_toggle_power_output(codec, 0);
2841 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
2842 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
2845 snd_hda_shutup_pins(codec);
2848 static struct coef_fw alc282_coefs[] = {
2849 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
2850 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
2851 WRITE_COEF(0x07, 0x0200), /* DMIC control */
2852 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
2853 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
2854 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
2855 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
2856 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
2857 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
2858 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
2859 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
2860 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
2861 WRITE_COEF(0x34, 0xa0c0), /* ANC */
2862 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
2863 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
2864 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
2865 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
2866 WRITE_COEF(0x63, 0x2902), /* PLL */
2867 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
2868 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
2869 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
2870 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
2871 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
2872 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
2873 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
2874 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
2875 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
2876 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
2877 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
2881 static void alc282_restore_default_value(struct hda_codec *codec)
2883 alc_process_coef_fw(codec, alc282_coefs);
2886 static void alc282_init(struct hda_codec *codec)
2888 struct alc_spec *spec = codec->spec;
2889 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
2893 alc282_restore_default_value(codec);
2897 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
2898 coef78 = alc_read_coef_idx(codec, 0x78);
2900 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
2901 /* Headphone capless set to high power mode */
2902 alc_write_coef_idx(codec, 0x78, 0x9004);
2907 snd_hda_codec_write(codec, hp_pin, 0,
2908 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
2913 snd_hda_codec_write(codec, hp_pin, 0,
2914 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
2919 /* Headphone capless set to normal mode */
2920 alc_write_coef_idx(codec, 0x78, coef78);
2923 static void alc282_shutup(struct hda_codec *codec)
2925 struct alc_spec *spec = codec->spec;
2926 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
2931 alc269_shutup(codec);
2935 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
2936 coef78 = alc_read_coef_idx(codec, 0x78);
2937 alc_write_coef_idx(codec, 0x78, 0x9004);
2942 snd_hda_codec_write(codec, hp_pin, 0,
2943 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
2948 snd_hda_codec_write(codec, hp_pin, 0,
2949 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
2954 alc_auto_setup_eapd(codec, false);
2955 snd_hda_shutup_pins(codec);
2956 alc_write_coef_idx(codec, 0x78, coef78);
2959 static struct coef_fw alc283_coefs[] = {
2960 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
2961 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
2962 WRITE_COEF(0x07, 0x0200), /* DMIC control */
2963 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
2964 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
2965 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
2966 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
2967 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
2968 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
2969 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
2970 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
2971 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
2972 WRITE_COEF(0x22, 0xa0c0), /* ANC */
2973 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
2974 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
2975 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
2976 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
2977 WRITE_COEF(0x2e, 0x2902), /* PLL */
2978 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
2979 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
2980 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
2981 WRITE_COEF(0x36, 0x0), /* capless control 5 */
2982 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
2983 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
2984 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
2985 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
2986 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
2987 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
2988 WRITE_COEF(0x49, 0x0), /* test mode */
2989 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
2990 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
2991 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
2992 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
2996 static void alc283_restore_default_value(struct hda_codec *codec)
2998 alc_process_coef_fw(codec, alc283_coefs);
3001 static void alc283_init(struct hda_codec *codec)
3003 struct alc_spec *spec = codec->spec;
3004 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3007 if (!spec->gen.autocfg.hp_outs) {
3008 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
3009 hp_pin = spec->gen.autocfg.line_out_pins[0];
3012 alc283_restore_default_value(codec);
3018 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3020 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3021 /* Headphone capless set to high power mode */
3022 alc_write_coef_idx(codec, 0x43, 0x9004);
3024 snd_hda_codec_write(codec, hp_pin, 0,
3025 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3030 snd_hda_codec_write(codec, hp_pin, 0,
3031 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3035 /* Index 0x46 Combo jack auto switch control 2 */
3036 /* 3k pull low control for Headset jack. */
3037 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3038 /* Headphone capless set to normal mode */
3039 alc_write_coef_idx(codec, 0x43, 0x9614);
3042 static void alc283_shutup(struct hda_codec *codec)
3044 struct alc_spec *spec = codec->spec;
3045 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3048 if (!spec->gen.autocfg.hp_outs) {
3049 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
3050 hp_pin = spec->gen.autocfg.line_out_pins[0];
3054 alc269_shutup(codec);
3058 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3060 alc_write_coef_idx(codec, 0x43, 0x9004);
3062 /*depop hp during suspend*/
3063 alc_write_coef_idx(codec, 0x06, 0x2100);
3065 snd_hda_codec_write(codec, hp_pin, 0,
3066 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3071 snd_hda_codec_write(codec, hp_pin, 0,
3072 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3074 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3078 alc_auto_setup_eapd(codec, false);
3079 snd_hda_shutup_pins(codec);
3080 alc_write_coef_idx(codec, 0x43, 0x9614);
3083 static void alc256_init(struct hda_codec *codec)
3085 struct alc_spec *spec = codec->spec;
3086 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3094 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3099 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3101 snd_hda_codec_write(codec, hp_pin, 0,
3102 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3107 snd_hda_codec_write(codec, hp_pin, 0,
3108 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3113 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3114 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3115 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3116 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
3119 static void alc256_shutup(struct hda_codec *codec)
3121 struct alc_spec *spec = codec->spec;
3122 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3126 alc269_shutup(codec);
3130 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3135 snd_hda_codec_write(codec, hp_pin, 0,
3136 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3141 /* 3k pull low control for Headset jack. */
3142 /* NOTE: call this before clearing the pin, otherwise codec stalls */
3143 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3145 snd_hda_codec_write(codec, hp_pin, 0,
3146 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3151 alc_auto_setup_eapd(codec, false);
3152 snd_hda_shutup_pins(codec);
3155 static void alc_default_init(struct hda_codec *codec)
3157 struct alc_spec *spec = codec->spec;
3158 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3166 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3171 snd_hda_codec_write(codec, hp_pin, 0,
3172 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3177 snd_hda_codec_write(codec, hp_pin, 0,
3178 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3184 static void alc_default_shutup(struct hda_codec *codec)
3186 struct alc_spec *spec = codec->spec;
3187 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3191 alc269_shutup(codec);
3195 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3200 snd_hda_codec_write(codec, hp_pin, 0,
3201 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3206 snd_hda_codec_write(codec, hp_pin, 0,
3207 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3212 alc_auto_setup_eapd(codec, false);
3213 snd_hda_shutup_pins(codec);
3216 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3219 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3220 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3221 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3224 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3228 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3229 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3231 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3236 static void alc5505_dsp_halt(struct hda_codec *codec)
3240 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3241 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3242 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3243 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3244 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3245 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3246 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3247 val = alc5505_coef_get(codec, 0x6220);
3248 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3251 static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3253 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3254 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3255 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3256 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3257 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3258 alc5505_coef_set(codec, 0x880c, 0x00000004);
3261 static void alc5505_dsp_init(struct hda_codec *codec)
3265 alc5505_dsp_halt(codec);
3266 alc5505_dsp_back_from_halt(codec);
3267 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3268 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3269 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3270 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3271 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3272 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3273 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3274 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3275 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3276 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3277 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3278 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3279 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3281 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3283 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3285 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3287 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3288 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3289 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3290 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3291 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3292 alc5505_coef_set(codec, 0x880c, 0x00000003);
3293 alc5505_coef_set(codec, 0x880c, 0x00000010);
3295 #ifdef HALT_REALTEK_ALC5505
3296 alc5505_dsp_halt(codec);
3300 #ifdef HALT_REALTEK_ALC5505
3301 #define alc5505_dsp_suspend(codec) /* NOP */
3302 #define alc5505_dsp_resume(codec) /* NOP */
3304 #define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
3305 #define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
3309 static int alc269_suspend(struct hda_codec *codec)
3311 struct alc_spec *spec = codec->spec;
3313 if (spec->has_alc5505_dsp)
3314 alc5505_dsp_suspend(codec);
3315 return alc_suspend(codec);
3318 static int alc269_resume(struct hda_codec *codec)
3320 struct alc_spec *spec = codec->spec;
3322 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3323 alc269vb_toggle_power_output(codec, 0);
3324 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3325 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
3329 codec->patch_ops.init(codec);
3331 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3332 alc269vb_toggle_power_output(codec, 1);
3333 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3334 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
3338 regcache_sync(codec->core.regmap);
3339 hda_call_check_power_status(codec, 0x01);
3341 /* on some machine, the BIOS will clear the codec gpio data when enter
3342 * suspend, and won't restore the data after resume, so we restore it
3346 snd_hda_codec_write(codec, codec->core.afg, 0, AC_VERB_SET_GPIO_DATA,
3349 if (spec->has_alc5505_dsp)
3350 alc5505_dsp_resume(codec);
3354 #endif /* CONFIG_PM */
3356 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
3357 const struct hda_fixup *fix, int action)
3359 struct alc_spec *spec = codec->spec;
3361 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3362 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
3365 static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
3366 const struct hda_fixup *fix,
3369 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
3370 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
3372 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
3373 snd_hda_codec_set_pincfg(codec, 0x19,
3374 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
3375 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
3378 static void alc269_fixup_hweq(struct hda_codec *codec,
3379 const struct hda_fixup *fix, int action)
3381 if (action == HDA_FIXUP_ACT_INIT)
3382 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
3385 static void alc269_fixup_headset_mic(struct hda_codec *codec,
3386 const struct hda_fixup *fix, int action)
3388 struct alc_spec *spec = codec->spec;
3390 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3391 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3394 static void alc271_fixup_dmic(struct hda_codec *codec,
3395 const struct hda_fixup *fix, int action)
3397 static const struct hda_verb verbs[] = {
3398 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
3399 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
3404 if (strcmp(codec->core.chip_name, "ALC271X") &&
3405 strcmp(codec->core.chip_name, "ALC269VB"))
3407 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
3408 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
3409 snd_hda_sequence_write(codec, verbs);
3412 static void alc269_fixup_pcm_44k(struct hda_codec *codec,
3413 const struct hda_fixup *fix, int action)
3415 struct alc_spec *spec = codec->spec;
3417 if (action != HDA_FIXUP_ACT_PROBE)
3420 /* Due to a hardware problem on Lenovo Ideadpad, we need to
3421 * fix the sample rate of analog I/O to 44.1kHz
3423 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
3424 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
3427 static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
3428 const struct hda_fixup *fix, int action)
3430 /* The digital-mic unit sends PDM (differential signal) instead of
3431 * the standard PCM, thus you can't record a valid mono stream as is.
3432 * Below is a workaround specific to ALC269 to control the dmic
3433 * signal source as mono.
3435 if (action == HDA_FIXUP_ACT_INIT)
3436 alc_update_coef_idx(codec, 0x07, 0, 0x80);
3439 static void alc269_quanta_automute(struct hda_codec *codec)
3441 snd_hda_gen_update_outputs(codec);
3443 alc_write_coef_idx(codec, 0x0c, 0x680);
3444 alc_write_coef_idx(codec, 0x0c, 0x480);
3447 static void alc269_fixup_quanta_mute(struct hda_codec *codec,
3448 const struct hda_fixup *fix, int action)
3450 struct alc_spec *spec = codec->spec;
3451 if (action != HDA_FIXUP_ACT_PROBE)
3453 spec->gen.automute_hook = alc269_quanta_automute;
3456 static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
3457 struct hda_jack_callback *jack)
3459 struct alc_spec *spec = codec->spec;
3462 snd_hda_gen_hp_automute(codec, jack);
3464 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
3466 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3469 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3473 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
3474 const struct hda_fixup *fix, int action)
3476 struct alc_spec *spec = codec->spec;
3477 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3478 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3479 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
3484 /* update mute-LED according to the speaker mute state via mic VREF pin */
3485 static void alc269_fixup_mic_mute_hook(void *private_data, int enabled)
3487 struct hda_codec *codec = private_data;
3488 struct alc_spec *spec = codec->spec;
3489 unsigned int pinval;
3491 if (spec->mute_led_polarity)
3493 pinval = snd_hda_codec_get_pin_target(codec, spec->mute_led_nid);
3494 pinval &= ~AC_PINCTL_VREFEN;
3495 pinval |= enabled ? AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80;
3496 if (spec->mute_led_nid) {
3497 /* temporarily power up/down for setting VREF */
3498 snd_hda_power_up_pm(codec);
3499 snd_hda_set_pin_ctl_cache(codec, spec->mute_led_nid, pinval);
3500 snd_hda_power_down_pm(codec);
3504 /* Make sure the led works even in runtime suspend */
3505 static unsigned int led_power_filter(struct hda_codec *codec,
3507 unsigned int power_state)
3509 struct alc_spec *spec = codec->spec;
3511 if (power_state != AC_PWRST_D3 || nid == 0 ||
3512 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
3515 /* Set pin ctl again, it might have just been set to 0 */
3516 snd_hda_set_pin_ctl(codec, nid,
3517 snd_hda_codec_get_pin_target(codec, nid));
3519 return snd_hda_gen_path_power_filter(codec, nid, power_state);
3522 static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
3523 const struct hda_fixup *fix, int action)
3525 struct alc_spec *spec = codec->spec;
3526 const struct dmi_device *dev = NULL;
3528 if (action != HDA_FIXUP_ACT_PRE_PROBE)
3531 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
3533 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
3535 if (pin < 0x0a || pin >= 0x10)
3537 spec->mute_led_polarity = pol;
3538 spec->mute_led_nid = pin - 0x0a + 0x18;
3539 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3540 spec->gen.vmaster_mute_enum = 1;
3541 codec->power_filter = led_power_filter;
3543 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
3544 spec->mute_led_polarity);
3549 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
3550 const struct hda_fixup *fix, int action)
3552 struct alc_spec *spec = codec->spec;
3553 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3554 spec->mute_led_polarity = 0;
3555 spec->mute_led_nid = 0x18;
3556 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3557 spec->gen.vmaster_mute_enum = 1;
3558 codec->power_filter = led_power_filter;
3562 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
3563 const struct hda_fixup *fix, int action)
3565 struct alc_spec *spec = codec->spec;
3566 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3567 spec->mute_led_polarity = 0;
3568 spec->mute_led_nid = 0x19;
3569 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3570 spec->gen.vmaster_mute_enum = 1;
3571 codec->power_filter = led_power_filter;
3575 /* update LED status via GPIO */
3576 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
3579 struct alc_spec *spec = codec->spec;
3580 unsigned int oldval = spec->gpio_led;
3582 if (spec->mute_led_polarity)
3586 spec->gpio_led &= ~mask;
3588 spec->gpio_led |= mask;
3589 if (spec->gpio_led != oldval)
3590 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
3594 /* turn on/off mute LED via GPIO per vmaster hook */
3595 static void alc_fixup_gpio_mute_hook(void *private_data, int enabled)
3597 struct hda_codec *codec = private_data;
3598 struct alc_spec *spec = codec->spec;
3600 alc_update_gpio_led(codec, spec->gpio_mute_led_mask, enabled);
3603 /* turn on/off mic-mute LED via GPIO per capture hook */
3604 static void alc_fixup_gpio_mic_mute_hook(struct hda_codec *codec,
3605 struct snd_kcontrol *kcontrol,
3606 struct snd_ctl_elem_value *ucontrol)
3608 struct alc_spec *spec = codec->spec;
3611 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
3612 ucontrol->value.integer.value[0] ||
3613 ucontrol->value.integer.value[1]);
3616 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
3617 const struct hda_fixup *fix, int action)
3619 struct alc_spec *spec = codec->spec;
3620 static const struct hda_verb gpio_init[] = {
3621 { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 },
3622 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 },
3626 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3627 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
3628 spec->gen.cap_sync_hook = alc_fixup_gpio_mic_mute_hook;
3630 spec->mute_led_polarity = 0;
3631 spec->gpio_mute_led_mask = 0x08;
3632 spec->gpio_mic_led_mask = 0x10;
3633 snd_hda_add_verbs(codec, gpio_init);
3637 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
3638 const struct hda_fixup *fix, int action)
3640 struct alc_spec *spec = codec->spec;
3641 static const struct hda_verb gpio_init[] = {
3642 { 0x01, AC_VERB_SET_GPIO_MASK, 0x22 },
3643 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x22 },
3647 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3648 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
3649 spec->gen.cap_sync_hook = alc_fixup_gpio_mic_mute_hook;
3651 spec->mute_led_polarity = 0;
3652 spec->gpio_mute_led_mask = 0x02;
3653 spec->gpio_mic_led_mask = 0x20;
3654 snd_hda_add_verbs(codec, gpio_init);
3658 /* turn on/off mic-mute LED per capture hook */
3659 static void alc269_fixup_hp_cap_mic_mute_hook(struct hda_codec *codec,
3660 struct snd_kcontrol *kcontrol,
3661 struct snd_ctl_elem_value *ucontrol)
3663 struct alc_spec *spec = codec->spec;
3664 unsigned int pinval, enable, disable;
3666 pinval = snd_hda_codec_get_pin_target(codec, spec->cap_mute_led_nid);
3667 pinval &= ~AC_PINCTL_VREFEN;
3668 enable = pinval | AC_PINCTL_VREF_80;
3669 disable = pinval | AC_PINCTL_VREF_HIZ;
3674 if (ucontrol->value.integer.value[0] ||
3675 ucontrol->value.integer.value[1])
3680 if (spec->cap_mute_led_nid)
3681 snd_hda_set_pin_ctl_cache(codec, spec->cap_mute_led_nid, pinval);
3684 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
3685 const struct hda_fixup *fix, int action)
3687 struct alc_spec *spec = codec->spec;
3688 static const struct hda_verb gpio_init[] = {
3689 { 0x01, AC_VERB_SET_GPIO_MASK, 0x08 },
3690 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x08 },
3694 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3695 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
3696 spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook;
3698 spec->mute_led_polarity = 0;
3699 spec->gpio_mute_led_mask = 0x08;
3700 spec->cap_mute_led_nid = 0x18;
3701 snd_hda_add_verbs(codec, gpio_init);
3702 codec->power_filter = led_power_filter;
3706 static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
3707 const struct hda_fixup *fix, int action)
3709 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to enable headphone amp */
3710 struct alc_spec *spec = codec->spec;
3711 static const struct hda_verb gpio_init[] = {
3712 { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 },
3713 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 },
3717 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3718 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
3719 spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook;
3721 spec->mute_led_polarity = 0;
3722 spec->gpio_mute_led_mask = 0x08;
3723 spec->cap_mute_led_nid = 0x18;
3724 snd_hda_add_verbs(codec, gpio_init);
3725 codec->power_filter = led_power_filter;
3729 #if IS_REACHABLE(CONFIG_INPUT)
3730 static void gpio2_mic_hotkey_event(struct hda_codec *codec,
3731 struct hda_jack_callback *event)
3733 struct alc_spec *spec = codec->spec;
3735 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
3736 send both key on and key off event for every interrupt. */
3737 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
3738 input_sync(spec->kb_dev);
3739 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
3740 input_sync(spec->kb_dev);
3743 static int alc_register_micmute_input_device(struct hda_codec *codec)
3745 struct alc_spec *spec = codec->spec;
3748 spec->kb_dev = input_allocate_device();
3749 if (!spec->kb_dev) {
3750 codec_err(codec, "Out of memory (input_allocate_device)\n");
3754 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
3756 spec->kb_dev->name = "Microphone Mute Button";
3757 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
3758 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
3759 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
3760 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
3761 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
3762 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
3764 if (input_register_device(spec->kb_dev)) {
3765 codec_err(codec, "input_register_device failed\n");
3766 input_free_device(spec->kb_dev);
3767 spec->kb_dev = NULL;
3774 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
3775 const struct hda_fixup *fix, int action)
3777 /* GPIO1 = set according to SKU external amp
3778 GPIO2 = mic mute hotkey
3780 GPIO4 = mic mute LED */
3781 static const struct hda_verb gpio_init[] = {
3782 { 0x01, AC_VERB_SET_GPIO_MASK, 0x1e },
3783 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x1a },
3784 { 0x01, AC_VERB_SET_GPIO_DATA, 0x02 },
3788 struct alc_spec *spec = codec->spec;
3790 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3791 if (alc_register_micmute_input_device(codec) != 0)
3794 snd_hda_add_verbs(codec, gpio_init);
3795 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
3796 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
3797 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
3798 gpio2_mic_hotkey_event);
3800 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
3801 spec->gen.cap_sync_hook = alc_fixup_gpio_mic_mute_hook;
3803 spec->mute_led_polarity = 0;
3804 spec->gpio_mute_led_mask = 0x08;
3805 spec->gpio_mic_led_mask = 0x10;
3813 case HDA_FIXUP_ACT_PROBE:
3814 spec->init_amp = ALC_INIT_DEFAULT;
3816 case HDA_FIXUP_ACT_FREE:
3817 input_unregister_device(spec->kb_dev);
3818 spec->kb_dev = NULL;
3822 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
3823 const struct hda_fixup *fix, int action)
3825 /* Line2 = mic mute hotkey
3826 GPIO2 = mic mute LED */
3827 static const struct hda_verb gpio_init[] = {
3828 { 0x01, AC_VERB_SET_GPIO_MASK, 0x04 },
3829 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04 },
3833 struct alc_spec *spec = codec->spec;
3835 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3836 if (alc_register_micmute_input_device(codec) != 0)
3839 snd_hda_add_verbs(codec, gpio_init);
3840 snd_hda_jack_detect_enable_callback(codec, 0x1b,
3841 gpio2_mic_hotkey_event);
3843 spec->gen.cap_sync_hook = alc_fixup_gpio_mic_mute_hook;
3845 spec->mute_led_polarity = 0;
3846 spec->gpio_mic_led_mask = 0x04;
3854 case HDA_FIXUP_ACT_PROBE:
3855 spec->init_amp = ALC_INIT_DEFAULT;
3857 case HDA_FIXUP_ACT_FREE:
3858 input_unregister_device(spec->kb_dev);
3859 spec->kb_dev = NULL;
3863 #define alc280_fixup_hp_gpio2_mic_hotkey NULL
3864 #define alc233_fixup_lenovo_line2_mic_hotkey NULL
3867 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
3868 const struct hda_fixup *fix, int action)
3870 struct alc_spec *spec = codec->spec;
3872 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3873 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3874 spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook;
3875 spec->mute_led_polarity = 0;
3876 spec->mute_led_nid = 0x1a;
3877 spec->cap_mute_led_nid = 0x18;
3878 spec->gen.vmaster_mute_enum = 1;
3879 codec->power_filter = led_power_filter;
3883 static struct coef_fw alc225_pre_hsmode[] = {
3884 UPDATE_COEF(0x4a, 1<<8, 0),
3885 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
3886 UPDATE_COEF(0x63, 3<<14, 3<<14),
3887 UPDATE_COEF(0x4a, 3<<4, 2<<4),
3888 UPDATE_COEF(0x4a, 3<<10, 3<<10),
3889 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
3890 UPDATE_COEF(0x4a, 3<<10, 0),
3894 static void alc_headset_mode_unplugged(struct hda_codec *codec)
3896 static struct coef_fw coef0255[] = {
3897 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
3898 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
3899 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
3900 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
3903 static struct coef_fw coef0255_1[] = {
3904 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
3907 static struct coef_fw coef0256[] = {
3908 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
3911 static struct coef_fw coef0233[] = {
3912 WRITE_COEF(0x1b, 0x0c0b),
3913 WRITE_COEF(0x45, 0xc429),
3914 UPDATE_COEF(0x35, 0x4000, 0),
3915 WRITE_COEF(0x06, 0x2104),
3916 WRITE_COEF(0x1a, 0x0001),
3917 WRITE_COEF(0x26, 0x0004),
3918 WRITE_COEF(0x32, 0x42a3),
3921 static struct coef_fw coef0288[] = {
3922 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
3923 UPDATE_COEF(0x50, 0x2000, 0x2000),
3924 UPDATE_COEF(0x56, 0x0006, 0x0006),
3925 UPDATE_COEF(0x66, 0x0008, 0),
3926 UPDATE_COEF(0x67, 0x2000, 0),
3929 static struct coef_fw coef0298[] = {
3930 UPDATE_COEF(0x19, 0x1300, 0x0300),
3933 static struct coef_fw coef0292[] = {
3934 WRITE_COEF(0x76, 0x000e),
3935 WRITE_COEF(0x6c, 0x2400),
3936 WRITE_COEF(0x18, 0x7308),
3937 WRITE_COEF(0x6b, 0xc429),
3940 static struct coef_fw coef0293[] = {
3941 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
3942 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
3943 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
3944 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
3945 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
3946 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
3949 static struct coef_fw coef0668[] = {
3950 WRITE_COEF(0x15, 0x0d40),
3951 WRITE_COEF(0xb7, 0x802b),
3954 static struct coef_fw coef0225[] = {
3955 UPDATE_COEF(0x63, 3<<14, 0),
3958 static struct coef_fw coef0274[] = {
3959 UPDATE_COEF(0x4a, 0x0100, 0),
3960 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
3961 UPDATE_COEF(0x6b, 0xf000, 0x5000),
3962 UPDATE_COEF(0x4a, 0x0010, 0),
3963 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
3964 WRITE_COEF(0x45, 0x5289),
3965 UPDATE_COEF(0x4a, 0x0c00, 0),
3969 switch (codec->core.vendor_id) {
3971 alc_process_coef_fw(codec, coef0255_1);
3972 alc_process_coef_fw(codec, coef0255);
3976 alc_process_coef_fw(codec, coef0256);
3977 alc_process_coef_fw(codec, coef0255);
3982 alc_process_coef_fw(codec, coef0274);
3986 alc_process_coef_fw(codec, coef0233);
3990 alc_process_coef_fw(codec, coef0288);
3993 alc_process_coef_fw(codec, coef0298);
3994 alc_process_coef_fw(codec, coef0288);
3997 alc_process_coef_fw(codec, coef0292);
4000 alc_process_coef_fw(codec, coef0293);
4003 alc_process_coef_fw(codec, coef0668);
4008 alc_process_coef_fw(codec, alc225_pre_hsmode);
4009 alc_process_coef_fw(codec, coef0225);
4012 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4015 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
4019 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
4022 static struct coef_fw coef0255[] = {
4023 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
4024 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4027 static struct coef_fw coef0233[] = {
4028 UPDATE_COEF(0x35, 0, 1<<14),
4029 WRITE_COEF(0x06, 0x2100),
4030 WRITE_COEF(0x1a, 0x0021),
4031 WRITE_COEF(0x26, 0x008c),
4034 static struct coef_fw coef0288[] = {
4035 UPDATE_COEF(0x4f, 0x00c0, 0),
4036 UPDATE_COEF(0x50, 0x2000, 0),
4037 UPDATE_COEF(0x56, 0x0006, 0),
4038 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4039 UPDATE_COEF(0x66, 0x0008, 0x0008),
4040 UPDATE_COEF(0x67, 0x2000, 0x2000),
4043 static struct coef_fw coef0292[] = {
4044 WRITE_COEF(0x19, 0xa208),
4045 WRITE_COEF(0x2e, 0xacf0),
4048 static struct coef_fw coef0293[] = {
4049 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
4050 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
4051 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4054 static struct coef_fw coef0688[] = {
4055 WRITE_COEF(0xb7, 0x802b),
4056 WRITE_COEF(0xb5, 0x1040),
4057 UPDATE_COEF(0xc3, 0, 1<<12),
4060 static struct coef_fw coef0225[] = {
4061 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
4062 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4063 UPDATE_COEF(0x63, 3<<14, 0),
4066 static struct coef_fw coef0274[] = {
4067 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
4068 UPDATE_COEF(0x4a, 0x0010, 0),
4069 UPDATE_COEF(0x6b, 0xf000, 0),
4073 switch (codec->core.vendor_id) {
4077 alc_write_coef_idx(codec, 0x45, 0xc489);
4078 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4079 alc_process_coef_fw(codec, coef0255);
4080 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4085 alc_write_coef_idx(codec, 0x45, 0x4689);
4086 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4087 alc_process_coef_fw(codec, coef0274);
4088 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4092 alc_write_coef_idx(codec, 0x45, 0xc429);
4093 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4094 alc_process_coef_fw(codec, coef0233);
4095 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4100 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4101 alc_process_coef_fw(codec, coef0288);
4102 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4105 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4106 alc_process_coef_fw(codec, coef0292);
4109 /* Set to TRS mode */
4110 alc_write_coef_idx(codec, 0x45, 0xc429);
4111 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4112 alc_process_coef_fw(codec, coef0293);
4113 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4116 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
4120 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4121 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4124 alc_write_coef_idx(codec, 0x11, 0x0001);
4125 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4126 alc_process_coef_fw(codec, coef0688);
4127 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4132 alc_process_coef_fw(codec, alc225_pre_hsmode);
4133 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
4134 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4135 alc_process_coef_fw(codec, coef0225);
4136 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4139 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
4142 static void alc_headset_mode_default(struct hda_codec *codec)
4144 static struct coef_fw coef0225[] = {
4145 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
4146 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
4147 UPDATE_COEF(0x49, 3<<8, 0<<8),
4148 UPDATE_COEF(0x4a, 3<<4, 3<<4),
4149 UPDATE_COEF(0x63, 3<<14, 0),
4150 UPDATE_COEF(0x67, 0xf000, 0x3000),
4153 static struct coef_fw coef0255[] = {
4154 WRITE_COEF(0x45, 0xc089),
4155 WRITE_COEF(0x45, 0xc489),
4156 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4157 WRITE_COEF(0x49, 0x0049),
4160 static struct coef_fw coef0233[] = {
4161 WRITE_COEF(0x06, 0x2100),
4162 WRITE_COEF(0x32, 0x4ea3),
4165 static struct coef_fw coef0288[] = {
4166 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
4167 UPDATE_COEF(0x50, 0x2000, 0x2000),
4168 UPDATE_COEF(0x56, 0x0006, 0x0006),
4169 UPDATE_COEF(0x66, 0x0008, 0),
4170 UPDATE_COEF(0x67, 0x2000, 0),
4173 static struct coef_fw coef0292[] = {
4174 WRITE_COEF(0x76, 0x000e),
4175 WRITE_COEF(0x6c, 0x2400),
4176 WRITE_COEF(0x6b, 0xc429),
4177 WRITE_COEF(0x18, 0x7308),
4180 static struct coef_fw coef0293[] = {
4181 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4182 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
4183 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4186 static struct coef_fw coef0688[] = {
4187 WRITE_COEF(0x11, 0x0041),
4188 WRITE_COEF(0x15, 0x0d40),
4189 WRITE_COEF(0xb7, 0x802b),
4192 static struct coef_fw coef0274[] = {
4193 WRITE_COEF(0x45, 0x4289),
4194 UPDATE_COEF(0x4a, 0x0010, 0x0010),
4195 UPDATE_COEF(0x6b, 0x0f00, 0),
4196 UPDATE_COEF(0x49, 0x0300, 0x0300),
4200 switch (codec->core.vendor_id) {
4204 alc_process_coef_fw(codec, alc225_pre_hsmode);
4205 alc_process_coef_fw(codec, coef0225);
4210 alc_process_coef_fw(codec, coef0255);
4215 alc_process_coef_fw(codec, coef0274);
4219 alc_process_coef_fw(codec, coef0233);
4224 alc_process_coef_fw(codec, coef0288);
4227 alc_process_coef_fw(codec, coef0292);
4230 alc_process_coef_fw(codec, coef0293);
4233 alc_process_coef_fw(codec, coef0688);
4236 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4239 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
4243 static void alc_headset_mode_ctia(struct hda_codec *codec)
4247 static struct coef_fw coef0255[] = {
4248 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
4249 WRITE_COEF(0x1b, 0x0c2b),
4250 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4253 static struct coef_fw coef0256[] = {
4254 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
4255 WRITE_COEF(0x1b, 0x0c6b),
4256 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4259 static struct coef_fw coef0233[] = {
4260 WRITE_COEF(0x45, 0xd429),
4261 WRITE_COEF(0x1b, 0x0c2b),
4262 WRITE_COEF(0x32, 0x4ea3),
4265 static struct coef_fw coef0288[] = {
4266 UPDATE_COEF(0x50, 0x2000, 0x2000),
4267 UPDATE_COEF(0x56, 0x0006, 0x0006),
4268 UPDATE_COEF(0x66, 0x0008, 0),
4269 UPDATE_COEF(0x67, 0x2000, 0),
4272 static struct coef_fw coef0292[] = {
4273 WRITE_COEF(0x6b, 0xd429),
4274 WRITE_COEF(0x76, 0x0008),
4275 WRITE_COEF(0x18, 0x7388),
4278 static struct coef_fw coef0293[] = {
4279 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
4280 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
4283 static struct coef_fw coef0688[] = {
4284 WRITE_COEF(0x11, 0x0001),
4285 WRITE_COEF(0x15, 0x0d60),
4286 WRITE_COEF(0xc3, 0x0000),
4289 static struct coef_fw coef0225_1[] = {
4290 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
4291 UPDATE_COEF(0x63, 3<<14, 2<<14),
4294 static struct coef_fw coef0225_2[] = {
4295 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
4296 UPDATE_COEF(0x63, 3<<14, 1<<14),
4300 switch (codec->core.vendor_id) {
4302 alc_process_coef_fw(codec, coef0255);
4306 alc_process_coef_fw(codec, coef0256);
4311 alc_write_coef_idx(codec, 0x45, 0xd689);
4315 alc_process_coef_fw(codec, coef0233);
4318 val = alc_read_coef_idx(codec, 0x50);
4319 if (val & (1 << 12)) {
4320 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
4321 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4324 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
4325 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4331 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4333 alc_process_coef_fw(codec, coef0288);
4336 alc_process_coef_fw(codec, coef0292);
4339 alc_process_coef_fw(codec, coef0293);
4342 alc_process_coef_fw(codec, coef0688);
4347 val = alc_read_coef_idx(codec, 0x45);
4349 alc_process_coef_fw(codec, coef0225_2);
4351 alc_process_coef_fw(codec, coef0225_1);
4354 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4357 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
4361 static void alc_headset_mode_omtp(struct hda_codec *codec)
4363 static struct coef_fw coef0255[] = {
4364 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
4365 WRITE_COEF(0x1b, 0x0c2b),
4366 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4369 static struct coef_fw coef0256[] = {
4370 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
4371 WRITE_COEF(0x1b, 0x0c6b),
4372 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4375 static struct coef_fw coef0233[] = {
4376 WRITE_COEF(0x45, 0xe429),
4377 WRITE_COEF(0x1b, 0x0c2b),
4378 WRITE_COEF(0x32, 0x4ea3),
4381 static struct coef_fw coef0288[] = {
4382 UPDATE_COEF(0x50, 0x2000, 0x2000),
4383 UPDATE_COEF(0x56, 0x0006, 0x0006),
4384 UPDATE_COEF(0x66, 0x0008, 0),
4385 UPDATE_COEF(0x67, 0x2000, 0),
4388 static struct coef_fw coef0292[] = {
4389 WRITE_COEF(0x6b, 0xe429),
4390 WRITE_COEF(0x76, 0x0008),
4391 WRITE_COEF(0x18, 0x7388),
4394 static struct coef_fw coef0293[] = {
4395 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
4396 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
4399 static struct coef_fw coef0688[] = {
4400 WRITE_COEF(0x11, 0x0001),
4401 WRITE_COEF(0x15, 0x0d50),
4402 WRITE_COEF(0xc3, 0x0000),
4405 static struct coef_fw coef0225[] = {
4406 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
4407 UPDATE_COEF(0x63, 3<<14, 2<<14),
4411 switch (codec->core.vendor_id) {
4413 alc_process_coef_fw(codec, coef0255);
4417 alc_process_coef_fw(codec, coef0256);
4422 alc_write_coef_idx(codec, 0x45, 0xe689);
4426 alc_process_coef_fw(codec, coef0233);
4429 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
4430 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
4435 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
4437 alc_process_coef_fw(codec, coef0288);
4440 alc_process_coef_fw(codec, coef0292);
4443 alc_process_coef_fw(codec, coef0293);
4446 alc_process_coef_fw(codec, coef0688);
4451 alc_process_coef_fw(codec, coef0225);
4454 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
4457 static void alc_determine_headset_type(struct hda_codec *codec)
4460 bool is_ctia = false;
4461 struct alc_spec *spec = codec->spec;
4462 static struct coef_fw coef0255[] = {
4463 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
4464 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
4468 static struct coef_fw coef0288[] = {
4469 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
4472 static struct coef_fw coef0298[] = {
4473 UPDATE_COEF(0x50, 0x2000, 0x2000),
4474 UPDATE_COEF(0x56, 0x0006, 0x0006),
4475 UPDATE_COEF(0x66, 0x0008, 0),
4476 UPDATE_COEF(0x67, 0x2000, 0),
4477 UPDATE_COEF(0x19, 0x1300, 0x1300),
4480 static struct coef_fw coef0293[] = {
4481 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
4482 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
4485 static struct coef_fw coef0688[] = {
4486 WRITE_COEF(0x11, 0x0001),
4487 WRITE_COEF(0xb7, 0x802b),
4488 WRITE_COEF(0x15, 0x0d60),
4489 WRITE_COEF(0xc3, 0x0c00),
4492 static struct coef_fw coef0274[] = {
4493 UPDATE_COEF(0x4a, 0x0010, 0),
4494 UPDATE_COEF(0x4a, 0x8000, 0),
4495 WRITE_COEF(0x45, 0xd289),
4496 UPDATE_COEF(0x49, 0x0300, 0x0300),
4500 switch (codec->core.vendor_id) {
4504 alc_process_coef_fw(codec, coef0255);
4506 val = alc_read_coef_idx(codec, 0x46);
4507 is_ctia = (val & 0x0070) == 0x0070;
4512 alc_process_coef_fw(codec, coef0274);
4514 val = alc_read_coef_idx(codec, 0x46);
4515 is_ctia = (val & 0x00f0) == 0x00f0;
4519 alc_write_coef_idx(codec, 0x45, 0xd029);
4521 val = alc_read_coef_idx(codec, 0x46);
4522 is_ctia = (val & 0x0070) == 0x0070;
4525 snd_hda_codec_write(codec, 0x21, 0,
4526 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
4528 snd_hda_codec_write(codec, 0x21, 0,
4529 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4532 val = alc_read_coef_idx(codec, 0x50);
4533 if (val & (1 << 12)) {
4534 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
4535 alc_process_coef_fw(codec, coef0288);
4537 val = alc_read_coef_idx(codec, 0x50);
4538 is_ctia = (val & 0x0070) == 0x0070;
4540 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
4541 alc_process_coef_fw(codec, coef0288);
4543 val = alc_read_coef_idx(codec, 0x50);
4544 is_ctia = (val & 0x0070) == 0x0070;
4546 alc_process_coef_fw(codec, coef0298);
4547 snd_hda_codec_write(codec, 0x21, 0,
4548 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
4550 snd_hda_codec_write(codec, 0x21, 0,
4551 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
4555 alc_process_coef_fw(codec, coef0288);
4557 val = alc_read_coef_idx(codec, 0x50);
4558 is_ctia = (val & 0x0070) == 0x0070;
4561 alc_write_coef_idx(codec, 0x6b, 0xd429);
4563 val = alc_read_coef_idx(codec, 0x6c);
4564 is_ctia = (val & 0x001c) == 0x001c;
4567 alc_process_coef_fw(codec, coef0293);
4569 val = alc_read_coef_idx(codec, 0x46);
4570 is_ctia = (val & 0x0070) == 0x0070;
4573 alc_process_coef_fw(codec, coef0688);
4575 val = alc_read_coef_idx(codec, 0xbe);
4576 is_ctia = (val & 0x1c02) == 0x1c02;
4581 alc_process_coef_fw(codec, alc225_pre_hsmode);
4582 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
4583 val = alc_read_coef_idx(codec, 0x45);
4584 if (val & (1 << 9)) {
4585 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
4586 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
4588 val = alc_read_coef_idx(codec, 0x46);
4589 is_ctia = (val & 0x00f0) == 0x00f0;
4591 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
4592 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
4594 val = alc_read_coef_idx(codec, 0x46);
4595 is_ctia = (val & 0x00f0) == 0x00f0;
4597 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
4598 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
4599 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
4606 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
4607 is_ctia ? "yes" : "no");
4608 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
4611 static void alc_update_headset_mode(struct hda_codec *codec)
4613 struct alc_spec *spec = codec->spec;
4615 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
4616 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
4618 int new_headset_mode;
4620 if (!snd_hda_jack_detect(codec, hp_pin))
4621 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
4622 else if (mux_pin == spec->headset_mic_pin)
4623 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
4624 else if (mux_pin == spec->headphone_mic_pin)
4625 new_headset_mode = ALC_HEADSET_MODE_MIC;
4627 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
4629 if (new_headset_mode == spec->current_headset_mode) {
4630 snd_hda_gen_update_outputs(codec);
4634 switch (new_headset_mode) {
4635 case ALC_HEADSET_MODE_UNPLUGGED:
4636 alc_headset_mode_unplugged(codec);
4637 spec->gen.hp_jack_present = false;
4639 case ALC_HEADSET_MODE_HEADSET:
4640 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
4641 alc_determine_headset_type(codec);
4642 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
4643 alc_headset_mode_ctia(codec);
4644 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
4645 alc_headset_mode_omtp(codec);
4646 spec->gen.hp_jack_present = true;
4648 case ALC_HEADSET_MODE_MIC:
4649 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
4650 spec->gen.hp_jack_present = false;
4652 case ALC_HEADSET_MODE_HEADPHONE:
4653 alc_headset_mode_default(codec);
4654 spec->gen.hp_jack_present = true;
4657 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
4658 snd_hda_set_pin_ctl_cache(codec, hp_pin,
4659 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
4660 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
4661 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
4664 spec->current_headset_mode = new_headset_mode;
4666 snd_hda_gen_update_outputs(codec);
4669 static void alc_update_headset_mode_hook(struct hda_codec *codec,
4670 struct snd_kcontrol *kcontrol,
4671 struct snd_ctl_elem_value *ucontrol)
4673 alc_update_headset_mode(codec);
4676 static void alc_update_headset_jack_cb(struct hda_codec *codec,
4677 struct hda_jack_callback *jack)
4679 struct alc_spec *spec = codec->spec;
4680 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
4681 snd_hda_gen_hp_automute(codec, jack);
4684 static void alc_probe_headset_mode(struct hda_codec *codec)
4687 struct alc_spec *spec = codec->spec;
4688 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
4691 for (i = 0; i < cfg->num_inputs; i++) {
4692 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
4693 spec->headset_mic_pin = cfg->inputs[i].pin;
4694 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
4695 spec->headphone_mic_pin = cfg->inputs[i].pin;
4698 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
4699 spec->gen.automute_hook = alc_update_headset_mode;
4700 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
4703 static void alc_fixup_headset_mode(struct hda_codec *codec,
4704 const struct hda_fixup *fix, int action)
4706 struct alc_spec *spec = codec->spec;
4709 case HDA_FIXUP_ACT_PRE_PROBE:
4710 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
4712 case HDA_FIXUP_ACT_PROBE:
4713 alc_probe_headset_mode(codec);
4715 case HDA_FIXUP_ACT_INIT:
4716 spec->current_headset_mode = 0;
4717 alc_update_headset_mode(codec);
4722 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
4723 const struct hda_fixup *fix, int action)
4725 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4726 struct alc_spec *spec = codec->spec;
4727 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4730 alc_fixup_headset_mode(codec, fix, action);
4733 static void alc255_set_default_jack_type(struct hda_codec *codec)
4735 /* Set to iphone type */
4736 static struct coef_fw alc255fw[] = {
4737 WRITE_COEF(0x1b, 0x880b),
4738 WRITE_COEF(0x45, 0xd089),
4739 WRITE_COEF(0x1b, 0x080b),
4740 WRITE_COEF(0x46, 0x0004),
4741 WRITE_COEF(0x1b, 0x0c0b),
4744 static struct coef_fw alc256fw[] = {
4745 WRITE_COEF(0x1b, 0x884b),
4746 WRITE_COEF(0x45, 0xd089),
4747 WRITE_COEF(0x1b, 0x084b),
4748 WRITE_COEF(0x46, 0x0004),
4749 WRITE_COEF(0x1b, 0x0c4b),
4752 switch (codec->core.vendor_id) {
4754 alc_process_coef_fw(codec, alc255fw);
4758 alc_process_coef_fw(codec, alc256fw);
4764 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
4765 const struct hda_fixup *fix, int action)
4767 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4768 alc255_set_default_jack_type(codec);
4770 alc_fixup_headset_mode(codec, fix, action);
4773 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
4774 const struct hda_fixup *fix, int action)
4776 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4777 struct alc_spec *spec = codec->spec;
4778 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4779 alc255_set_default_jack_type(codec);
4782 alc_fixup_headset_mode(codec, fix, action);
4785 static void alc288_update_headset_jack_cb(struct hda_codec *codec,
4786 struct hda_jack_callback *jack)
4788 struct alc_spec *spec = codec->spec;
4791 alc_update_headset_jack_cb(codec, jack);
4792 /* Headset Mic enable or disable, only for Dell Dino */
4793 present = spec->gen.hp_jack_present ? 0x40 : 0;
4794 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
4798 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
4799 const struct hda_fixup *fix, int action)
4801 alc_fixup_headset_mode(codec, fix, action);
4802 if (action == HDA_FIXUP_ACT_PROBE) {
4803 struct alc_spec *spec = codec->spec;
4804 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
4808 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
4809 const struct hda_fixup *fix, int action)
4811 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4812 struct alc_spec *spec = codec->spec;
4813 spec->gen.auto_mute_via_amp = 1;
4817 static void alc_no_shutup(struct hda_codec *codec)
4821 static void alc_fixup_no_shutup(struct hda_codec *codec,
4822 const struct hda_fixup *fix, int action)
4824 if (action == HDA_FIXUP_ACT_PROBE) {
4825 struct alc_spec *spec = codec->spec;
4826 spec->shutup = alc_no_shutup;
4830 static void alc_fixup_disable_aamix(struct hda_codec *codec,
4831 const struct hda_fixup *fix, int action)
4833 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4834 struct alc_spec *spec = codec->spec;
4835 /* Disable AA-loopback as it causes white noise */
4836 spec->gen.mixer_nid = 0;
4840 /* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
4841 static void alc_fixup_tpt440_dock(struct hda_codec *codec,
4842 const struct hda_fixup *fix, int action)
4844 static const struct hda_pintbl pincfgs[] = {
4845 { 0x16, 0x21211010 }, /* dock headphone */
4846 { 0x19, 0x21a11010 }, /* dock mic */
4849 struct alc_spec *spec = codec->spec;
4851 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4852 spec->reboot_notify = alc_d3_at_reboot; /* reduce noise */
4853 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
4854 codec->power_save_node = 0; /* avoid click noises */
4855 snd_hda_apply_pincfgs(codec, pincfgs);
4859 static void alc_fixup_tpt470_dock(struct hda_codec *codec,
4860 const struct hda_fixup *fix, int action)
4862 static const struct hda_pintbl pincfgs[] = {
4863 { 0x17, 0x21211010 }, /* dock headphone */
4864 { 0x19, 0x21a11010 }, /* dock mic */
4867 /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
4868 * the speaker output becomes too low by some reason on Thinkpads with
4871 static hda_nid_t preferred_pairs[] = {
4872 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
4875 struct alc_spec *spec = codec->spec;
4877 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4878 spec->gen.preferred_dacs = preferred_pairs;
4879 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
4880 snd_hda_apply_pincfgs(codec, pincfgs);
4881 } else if (action == HDA_FIXUP_ACT_INIT) {
4882 /* Enable DOCK device */
4883 snd_hda_codec_write(codec, 0x17, 0,
4884 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
4885 /* Enable DOCK device */
4886 snd_hda_codec_write(codec, 0x19, 0,
4887 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
4891 static void alc_shutup_dell_xps13(struct hda_codec *codec)
4893 struct alc_spec *spec = codec->spec;
4894 int hp_pin = spec->gen.autocfg.hp_pins[0];
4896 /* Prevent pop noises when headphones are plugged in */
4897 snd_hda_codec_write(codec, hp_pin, 0,
4898 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
4902 static void alc_fixup_dell_xps13(struct hda_codec *codec,
4903 const struct hda_fixup *fix, int action)
4905 struct alc_spec *spec = codec->spec;
4906 struct hda_input_mux *imux = &spec->gen.input_mux;
4910 case HDA_FIXUP_ACT_PRE_PROBE:
4911 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
4912 * it causes a click noise at start up
4914 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
4916 case HDA_FIXUP_ACT_PROBE:
4917 spec->shutup = alc_shutup_dell_xps13;
4919 /* Make the internal mic the default input source. */
4920 for (i = 0; i < imux->num_items; i++) {
4921 if (spec->gen.imux_pins[i] == 0x12) {
4922 spec->gen.cur_mux[0] = i;
4930 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
4931 const struct hda_fixup *fix, int action)
4933 struct alc_spec *spec = codec->spec;
4935 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4936 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4937 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
4939 /* Disable boost for mic-in permanently. (This code is only called
4940 from quirks that guarantee that the headphone is at NID 0x1b.) */
4941 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
4942 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
4944 alc_fixup_headset_mode(codec, fix, action);
4947 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
4948 const struct hda_fixup *fix, int action)
4950 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4951 alc_write_coef_idx(codec, 0xc4, 0x8000);
4952 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
4953 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
4955 alc_fixup_headset_mode(codec, fix, action);
4958 /* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
4959 static int find_ext_mic_pin(struct hda_codec *codec)
4961 struct alc_spec *spec = codec->spec;
4962 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
4964 unsigned int defcfg;
4967 for (i = 0; i < cfg->num_inputs; i++) {
4968 if (cfg->inputs[i].type != AUTO_PIN_MIC)
4970 nid = cfg->inputs[i].pin;
4971 defcfg = snd_hda_codec_get_pincfg(codec, nid);
4972 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
4980 static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
4981 const struct hda_fixup *fix,
4984 struct alc_spec *spec = codec->spec;
4986 if (action == HDA_FIXUP_ACT_PROBE) {
4987 int mic_pin = find_ext_mic_pin(codec);
4988 int hp_pin = spec->gen.autocfg.hp_pins[0];
4990 if (snd_BUG_ON(!mic_pin || !hp_pin))
4992 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
4996 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
4997 const struct hda_fixup *fix,
5000 struct alc_spec *spec = codec->spec;
5001 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5004 /* The mic boosts on level 2 and 3 are too noisy
5005 on the internal mic input.
5006 Therefore limit the boost to 0 or 1. */
5008 if (action != HDA_FIXUP_ACT_PROBE)
5011 for (i = 0; i < cfg->num_inputs; i++) {
5012 hda_nid_t nid = cfg->inputs[i].pin;
5013 unsigned int defcfg;
5014 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5016 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5017 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
5020 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
5021 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
5022 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
5023 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
5024 (0 << AC_AMPCAP_MUTE_SHIFT));
5028 static void alc283_hp_automute_hook(struct hda_codec *codec,
5029 struct hda_jack_callback *jack)
5031 struct alc_spec *spec = codec->spec;
5035 snd_hda_gen_hp_automute(codec, jack);
5037 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
5040 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5044 static void alc283_fixup_chromebook(struct hda_codec *codec,
5045 const struct hda_fixup *fix, int action)
5047 struct alc_spec *spec = codec->spec;
5050 case HDA_FIXUP_ACT_PRE_PROBE:
5051 snd_hda_override_wcaps(codec, 0x03, 0);
5052 /* Disable AA-loopback as it causes white noise */
5053 spec->gen.mixer_nid = 0;
5055 case HDA_FIXUP_ACT_INIT:
5056 /* MIC2-VREF control */
5057 /* Set to manual mode */
5058 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
5059 /* Enable Line1 input control by verb */
5060 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
5065 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
5066 const struct hda_fixup *fix, int action)
5068 struct alc_spec *spec = codec->spec;
5071 case HDA_FIXUP_ACT_PRE_PROBE:
5072 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
5074 case HDA_FIXUP_ACT_INIT:
5075 /* MIC2-VREF control */
5076 /* Set to manual mode */
5077 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
5082 /* mute tablet speaker pin (0x14) via dock plugging in addition */
5083 static void asus_tx300_automute(struct hda_codec *codec)
5085 struct alc_spec *spec = codec->spec;
5086 snd_hda_gen_update_outputs(codec);
5087 if (snd_hda_jack_detect(codec, 0x1b))
5088 spec->gen.mute_bits |= (1ULL << 0x14);
5091 static void alc282_fixup_asus_tx300(struct hda_codec *codec,
5092 const struct hda_fixup *fix, int action)
5094 struct alc_spec *spec = codec->spec;
5095 /* TX300 needs to set up GPIO2 for the speaker amp */
5096 static const struct hda_verb gpio2_verbs[] = {
5097 { 0x01, AC_VERB_SET_GPIO_MASK, 0x04 },
5098 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04 },
5099 { 0x01, AC_VERB_SET_GPIO_DATA, 0x04 },
5102 static const struct hda_pintbl dock_pins[] = {
5103 { 0x1b, 0x21114000 }, /* dock speaker pin */
5108 case HDA_FIXUP_ACT_PRE_PROBE:
5109 snd_hda_add_verbs(codec, gpio2_verbs);
5110 snd_hda_apply_pincfgs(codec, dock_pins);
5111 spec->gen.auto_mute_via_amp = 1;
5112 spec->gen.automute_hook = asus_tx300_automute;
5113 snd_hda_jack_detect_enable_callback(codec, 0x1b,
5114 snd_hda_gen_hp_automute);
5116 case HDA_FIXUP_ACT_BUILD:
5117 /* this is a bit tricky; give more sane names for the main
5118 * (tablet) speaker and the dock speaker, respectively
5120 rename_ctl(codec, "Speaker Playback Switch",
5121 "Dock Speaker Playback Switch");
5122 rename_ctl(codec, "Bass Speaker Playback Switch",
5123 "Speaker Playback Switch");
5128 static void alc290_fixup_mono_speakers(struct hda_codec *codec,
5129 const struct hda_fixup *fix, int action)
5131 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5132 /* DAC node 0x03 is giving mono output. We therefore want to
5133 make sure 0x14 (front speaker) and 0x15 (headphones) use the
5134 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
5135 hda_nid_t conn1[2] = { 0x0c };
5136 snd_hda_override_conn_list(codec, 0x14, 1, conn1);
5137 snd_hda_override_conn_list(codec, 0x15, 1, conn1);
5141 static void alc298_fixup_speaker_volume(struct hda_codec *codec,
5142 const struct hda_fixup *fix, int action)
5144 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5145 /* The speaker is routed to the Node 0x06 by a mistake, as a result
5146 we can't adjust the speaker's volume since this node does not has
5147 Amp-out capability. we change the speaker's route to:
5148 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
5149 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
5150 speaker's volume now. */
5152 hda_nid_t conn1[1] = { 0x0c };
5153 snd_hda_override_conn_list(codec, 0x17, 1, conn1);
5157 /* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
5158 static void alc295_fixup_disable_dac3(struct hda_codec *codec,
5159 const struct hda_fixup *fix, int action)
5161 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5162 hda_nid_t conn[2] = { 0x02, 0x03 };
5163 snd_hda_override_conn_list(codec, 0x17, 2, conn);
5167 /* Hook to update amp GPIO4 for automute */
5168 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
5169 struct hda_jack_callback *jack)
5171 struct alc_spec *spec = codec->spec;
5173 snd_hda_gen_hp_automute(codec, jack);
5174 /* mute_led_polarity is set to 0, so we pass inverted value here */
5175 alc_update_gpio_led(codec, 0x10, !spec->gen.hp_jack_present);
5178 /* Manage GPIOs for HP EliteBook Folio 9480m.
5180 * GPIO4 is the headphone amplifier power control
5181 * GPIO3 is the audio output mute indicator LED
5184 static void alc280_fixup_hp_9480m(struct hda_codec *codec,
5185 const struct hda_fixup *fix,
5188 struct alc_spec *spec = codec->spec;
5189 static const struct hda_verb gpio_init[] = {
5190 { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 },
5191 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 },
5195 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5196 /* Set the hooks to turn the headphone amp on/off
5199 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
5200 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
5202 /* The GPIOs are currently off */
5205 /* GPIO3 is connected to the output mute LED,
5206 * high is on, low is off
5208 spec->mute_led_polarity = 0;
5209 spec->gpio_mute_led_mask = 0x08;
5211 /* Initialize GPIO configuration */
5212 snd_hda_add_verbs(codec, gpio_init);
5216 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
5217 const struct hda_fixup *fix,
5220 alc_fixup_dual_codecs(codec, fix, action);
5222 case HDA_FIXUP_ACT_PRE_PROBE:
5223 /* override card longname to provide a unique UCM profile */
5224 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
5226 case HDA_FIXUP_ACT_BUILD:
5227 /* rename Capture controls depending on the codec */
5228 rename_ctl(codec, "Capture Volume",
5230 "Rear-Panel Capture Volume" :
5231 "Front-Panel Capture Volume");
5232 rename_ctl(codec, "Capture Switch",
5234 "Rear-Panel Capture Switch" :
5235 "Front-Panel Capture Switch");
5240 /* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
5241 static void alc274_fixup_bind_dacs(struct hda_codec *codec,
5242 const struct hda_fixup *fix, int action)
5244 struct alc_spec *spec = codec->spec;
5245 static hda_nid_t preferred_pairs[] = {
5246 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
5250 if (action != HDA_FIXUP_ACT_PRE_PROBE)
5253 spec->gen.preferred_dacs = preferred_pairs;
5256 /* for hda_fixup_thinkpad_acpi() */
5257 #include "thinkpad_helper.c"
5259 static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
5260 const struct hda_fixup *fix, int action)
5262 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
5263 hda_fixup_thinkpad_acpi(codec, fix, action);
5266 /* for dell wmi mic mute led */
5267 #include "dell_wmi_helper.c"
5270 ALC269_FIXUP_SONY_VAIO,
5271 ALC275_FIXUP_SONY_VAIO_GPIO2,
5272 ALC269_FIXUP_DELL_M101Z,
5273 ALC269_FIXUP_SKU_IGNORE,
5274 ALC269_FIXUP_ASUS_G73JW,
5275 ALC269_FIXUP_LENOVO_EAPD,
5276 ALC275_FIXUP_SONY_HWEQ,
5277 ALC275_FIXUP_SONY_DISABLE_AAMIX,
5279 ALC269_FIXUP_PCM_44K,
5280 ALC269_FIXUP_STEREO_DMIC,
5281 ALC269_FIXUP_HEADSET_MIC,
5282 ALC269_FIXUP_QUANTA_MUTE,
5283 ALC269_FIXUP_LIFEBOOK,
5284 ALC269_FIXUP_LIFEBOOK_EXTMIC,
5285 ALC269_FIXUP_LIFEBOOK_HP_PIN,
5286 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
5287 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
5290 ALC269VB_FIXUP_AMIC,
5291 ALC269VB_FIXUP_DMIC,
5292 ALC269_FIXUP_HP_MUTE_LED,
5293 ALC269_FIXUP_HP_MUTE_LED_MIC1,
5294 ALC269_FIXUP_HP_MUTE_LED_MIC2,
5295 ALC269_FIXUP_HP_GPIO_LED,
5296 ALC269_FIXUP_HP_GPIO_MIC1_LED,
5297 ALC269_FIXUP_HP_LINE1_MIC1_LED,
5298 ALC269_FIXUP_INV_DMIC,
5299 ALC269_FIXUP_LENOVO_DOCK,
5300 ALC269_FIXUP_NO_SHUTUP,
5301 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
5302 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
5303 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
5304 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
5305 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
5306 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
5307 ALC269_FIXUP_HEADSET_MODE,
5308 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
5309 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
5310 ALC269_FIXUP_ASUS_X101_FUNC,
5311 ALC269_FIXUP_ASUS_X101_VERB,
5312 ALC269_FIXUP_ASUS_X101,
5313 ALC271_FIXUP_AMIC_MIC2,
5314 ALC271_FIXUP_HP_GATE_MIC_JACK,
5315 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
5316 ALC269_FIXUP_ACER_AC700,
5317 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
5318 ALC269VB_FIXUP_ASUS_ZENBOOK,
5319 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
5320 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
5321 ALC269VB_FIXUP_ORDISSIMO_EVE2,
5322 ALC283_FIXUP_CHROME_BOOK,
5323 ALC283_FIXUP_SENSE_COMBO_JACK,
5324 ALC282_FIXUP_ASUS_TX300,
5325 ALC283_FIXUP_INT_MIC,
5326 ALC290_FIXUP_MONO_SPEAKERS,
5327 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
5328 ALC290_FIXUP_SUBWOOFER,
5329 ALC290_FIXUP_SUBWOOFER_HSJACK,
5330 ALC269_FIXUP_THINKPAD_ACPI,
5331 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
5332 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
5333 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
5334 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5335 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
5336 ALC255_FIXUP_HEADSET_MODE,
5337 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
5338 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
5339 ALC292_FIXUP_TPT440_DOCK,
5340 ALC292_FIXUP_TPT440,
5341 ALC283_FIXUP_HEADSET_MIC,
5342 ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED,
5343 ALC282_FIXUP_ASPIRE_V5_PINS,
5344 ALC280_FIXUP_HP_GPIO4,
5345 ALC286_FIXUP_HP_GPIO_LED,
5346 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
5347 ALC280_FIXUP_HP_DOCK_PINS,
5348 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
5349 ALC280_FIXUP_HP_9480M,
5350 ALC288_FIXUP_DELL_HEADSET_MODE,
5351 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
5352 ALC288_FIXUP_DELL_XPS_13_GPIO6,
5353 ALC288_FIXUP_DELL_XPS_13,
5354 ALC288_FIXUP_DISABLE_AAMIX,
5355 ALC292_FIXUP_DELL_E7X,
5356 ALC292_FIXUP_DISABLE_AAMIX,
5357 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
5358 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
5359 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
5360 ALC275_FIXUP_DELL_XPS,
5361 ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE,
5362 ALC293_FIXUP_LENOVO_SPK_NOISE,
5363 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
5364 ALC255_FIXUP_DELL_SPK_NOISE,
5365 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
5366 ALC295_FIXUP_DISABLE_DAC3,
5367 ALC280_FIXUP_HP_HEADSET_MIC,
5368 ALC221_FIXUP_HP_FRONT_MIC,
5369 ALC292_FIXUP_TPT460,
5370 ALC298_FIXUP_SPK_VOLUME,
5371 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
5372 ALC269_FIXUP_ATIV_BOOK_8,
5373 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
5374 ALC256_FIXUP_ASUS_HEADSET_MODE,
5375 ALC256_FIXUP_ASUS_MIC,
5376 ALC256_FIXUP_ASUS_AIO_GPIO2,
5377 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
5378 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
5379 ALC233_FIXUP_LENOVO_MULTI_CODECS,
5380 ALC294_FIXUP_LENOVO_MIC_LOCATION,
5381 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
5382 ALC700_FIXUP_INTEL_REFERENCE,
5383 ALC274_FIXUP_DELL_BIND_DACS,
5384 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
5385 ALC298_FIXUP_TPT470_DOCK,
5386 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
5387 ALC255_FIXUP_DELL_HEADSET_MIC,
5390 static const struct hda_fixup alc269_fixups[] = {
5391 [ALC269_FIXUP_SONY_VAIO] = {
5392 .type = HDA_FIXUP_PINCTLS,
5393 .v.pins = (const struct hda_pintbl[]) {
5394 {0x19, PIN_VREFGRD},
5398 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
5399 .type = HDA_FIXUP_VERBS,
5400 .v.verbs = (const struct hda_verb[]) {
5401 {0x01, AC_VERB_SET_GPIO_MASK, 0x04},
5402 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04},
5403 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5407 .chain_id = ALC269_FIXUP_SONY_VAIO
5409 [ALC269_FIXUP_DELL_M101Z] = {
5410 .type = HDA_FIXUP_VERBS,
5411 .v.verbs = (const struct hda_verb[]) {
5412 /* Enables internal speaker */
5413 {0x20, AC_VERB_SET_COEF_INDEX, 13},
5414 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
5418 [ALC269_FIXUP_SKU_IGNORE] = {
5419 .type = HDA_FIXUP_FUNC,
5420 .v.func = alc_fixup_sku_ignore,
5422 [ALC269_FIXUP_ASUS_G73JW] = {
5423 .type = HDA_FIXUP_PINS,
5424 .v.pins = (const struct hda_pintbl[]) {
5425 { 0x17, 0x99130111 }, /* subwoofer */
5429 [ALC269_FIXUP_LENOVO_EAPD] = {
5430 .type = HDA_FIXUP_VERBS,
5431 .v.verbs = (const struct hda_verb[]) {
5432 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
5436 [ALC275_FIXUP_SONY_HWEQ] = {
5437 .type = HDA_FIXUP_FUNC,
5438 .v.func = alc269_fixup_hweq,
5440 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
5442 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
5443 .type = HDA_FIXUP_FUNC,
5444 .v.func = alc_fixup_disable_aamix,
5446 .chain_id = ALC269_FIXUP_SONY_VAIO
5448 [ALC271_FIXUP_DMIC] = {
5449 .type = HDA_FIXUP_FUNC,
5450 .v.func = alc271_fixup_dmic,
5452 [ALC269_FIXUP_PCM_44K] = {
5453 .type = HDA_FIXUP_FUNC,
5454 .v.func = alc269_fixup_pcm_44k,
5456 .chain_id = ALC269_FIXUP_QUANTA_MUTE
5458 [ALC269_FIXUP_STEREO_DMIC] = {
5459 .type = HDA_FIXUP_FUNC,
5460 .v.func = alc269_fixup_stereo_dmic,
5462 [ALC269_FIXUP_HEADSET_MIC] = {
5463 .type = HDA_FIXUP_FUNC,
5464 .v.func = alc269_fixup_headset_mic,
5466 [ALC269_FIXUP_QUANTA_MUTE] = {
5467 .type = HDA_FIXUP_FUNC,
5468 .v.func = alc269_fixup_quanta_mute,
5470 [ALC269_FIXUP_LIFEBOOK] = {
5471 .type = HDA_FIXUP_PINS,
5472 .v.pins = (const struct hda_pintbl[]) {
5473 { 0x1a, 0x2101103f }, /* dock line-out */
5474 { 0x1b, 0x23a11040 }, /* dock mic-in */
5478 .chain_id = ALC269_FIXUP_QUANTA_MUTE
5480 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
5481 .type = HDA_FIXUP_PINS,
5482 .v.pins = (const struct hda_pintbl[]) {
5483 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
5487 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
5488 .type = HDA_FIXUP_PINS,
5489 .v.pins = (const struct hda_pintbl[]) {
5490 { 0x21, 0x0221102f }, /* HP out */
5494 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
5495 .type = HDA_FIXUP_FUNC,
5496 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
5498 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
5499 .type = HDA_FIXUP_FUNC,
5500 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
5502 [ALC269_FIXUP_AMIC] = {
5503 .type = HDA_FIXUP_PINS,
5504 .v.pins = (const struct hda_pintbl[]) {
5505 { 0x14, 0x99130110 }, /* speaker */
5506 { 0x15, 0x0121401f }, /* HP out */
5507 { 0x18, 0x01a19c20 }, /* mic */
5508 { 0x19, 0x99a3092f }, /* int-mic */
5512 [ALC269_FIXUP_DMIC] = {
5513 .type = HDA_FIXUP_PINS,
5514 .v.pins = (const struct hda_pintbl[]) {
5515 { 0x12, 0x99a3092f }, /* int-mic */
5516 { 0x14, 0x99130110 }, /* speaker */
5517 { 0x15, 0x0121401f }, /* HP out */
5518 { 0x18, 0x01a19c20 }, /* mic */
5522 [ALC269VB_FIXUP_AMIC] = {
5523 .type = HDA_FIXUP_PINS,
5524 .v.pins = (const struct hda_pintbl[]) {
5525 { 0x14, 0x99130110 }, /* speaker */
5526 { 0x18, 0x01a19c20 }, /* mic */
5527 { 0x19, 0x99a3092f }, /* int-mic */
5528 { 0x21, 0x0121401f }, /* HP out */
5532 [ALC269VB_FIXUP_DMIC] = {
5533 .type = HDA_FIXUP_PINS,
5534 .v.pins = (const struct hda_pintbl[]) {
5535 { 0x12, 0x99a3092f }, /* int-mic */
5536 { 0x14, 0x99130110 }, /* speaker */
5537 { 0x18, 0x01a19c20 }, /* mic */
5538 { 0x21, 0x0121401f }, /* HP out */
5542 [ALC269_FIXUP_HP_MUTE_LED] = {
5543 .type = HDA_FIXUP_FUNC,
5544 .v.func = alc269_fixup_hp_mute_led,
5546 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
5547 .type = HDA_FIXUP_FUNC,
5548 .v.func = alc269_fixup_hp_mute_led_mic1,
5550 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
5551 .type = HDA_FIXUP_FUNC,
5552 .v.func = alc269_fixup_hp_mute_led_mic2,
5554 [ALC269_FIXUP_HP_GPIO_LED] = {
5555 .type = HDA_FIXUP_FUNC,
5556 .v.func = alc269_fixup_hp_gpio_led,
5558 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
5559 .type = HDA_FIXUP_FUNC,
5560 .v.func = alc269_fixup_hp_gpio_mic1_led,
5562 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
5563 .type = HDA_FIXUP_FUNC,
5564 .v.func = alc269_fixup_hp_line1_mic1_led,
5566 [ALC269_FIXUP_INV_DMIC] = {
5567 .type = HDA_FIXUP_FUNC,
5568 .v.func = alc_fixup_inv_dmic,
5570 [ALC269_FIXUP_NO_SHUTUP] = {
5571 .type = HDA_FIXUP_FUNC,
5572 .v.func = alc_fixup_no_shutup,
5574 [ALC269_FIXUP_LENOVO_DOCK] = {
5575 .type = HDA_FIXUP_PINS,
5576 .v.pins = (const struct hda_pintbl[]) {
5577 { 0x19, 0x23a11040 }, /* dock mic */
5578 { 0x1b, 0x2121103f }, /* dock headphone */
5582 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
5584 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
5585 .type = HDA_FIXUP_FUNC,
5586 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
5588 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
5590 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
5591 .type = HDA_FIXUP_PINS,
5592 .v.pins = (const struct hda_pintbl[]) {
5593 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5594 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5598 .chain_id = ALC269_FIXUP_HEADSET_MODE
5600 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
5601 .type = HDA_FIXUP_PINS,
5602 .v.pins = (const struct hda_pintbl[]) {
5603 { 0x16, 0x21014020 }, /* dock line out */
5604 { 0x19, 0x21a19030 }, /* dock mic */
5605 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5609 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
5611 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
5612 .type = HDA_FIXUP_PINS,
5613 .v.pins = (const struct hda_pintbl[]) {
5614 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5618 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
5620 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
5621 .type = HDA_FIXUP_PINS,
5622 .v.pins = (const struct hda_pintbl[]) {
5623 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5624 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5628 .chain_id = ALC269_FIXUP_HEADSET_MODE
5630 [ALC269_FIXUP_HEADSET_MODE] = {
5631 .type = HDA_FIXUP_FUNC,
5632 .v.func = alc_fixup_headset_mode,
5634 .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
5636 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
5637 .type = HDA_FIXUP_FUNC,
5638 .v.func = alc_fixup_headset_mode_no_hp_mic,
5640 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
5641 .type = HDA_FIXUP_PINS,
5642 .v.pins = (const struct hda_pintbl[]) {
5643 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
5647 .chain_id = ALC269_FIXUP_HEADSET_MODE,
5649 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
5650 .type = HDA_FIXUP_PINS,
5651 .v.pins = (const struct hda_pintbl[]) {
5652 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5656 .chain_id = ALC269_FIXUP_HEADSET_MIC
5658 [ALC269_FIXUP_ASUS_X101_FUNC] = {
5659 .type = HDA_FIXUP_FUNC,
5660 .v.func = alc269_fixup_x101_headset_mic,
5662 [ALC269_FIXUP_ASUS_X101_VERB] = {
5663 .type = HDA_FIXUP_VERBS,
5664 .v.verbs = (const struct hda_verb[]) {
5665 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5666 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
5667 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
5671 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
5673 [ALC269_FIXUP_ASUS_X101] = {
5674 .type = HDA_FIXUP_PINS,
5675 .v.pins = (const struct hda_pintbl[]) {
5676 { 0x18, 0x04a1182c }, /* Headset mic */
5680 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
5682 [ALC271_FIXUP_AMIC_MIC2] = {
5683 .type = HDA_FIXUP_PINS,
5684 .v.pins = (const struct hda_pintbl[]) {
5685 { 0x14, 0x99130110 }, /* speaker */
5686 { 0x19, 0x01a19c20 }, /* mic */
5687 { 0x1b, 0x99a7012f }, /* int-mic */
5688 { 0x21, 0x0121401f }, /* HP out */
5692 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
5693 .type = HDA_FIXUP_FUNC,
5694 .v.func = alc271_hp_gate_mic_jack,
5696 .chain_id = ALC271_FIXUP_AMIC_MIC2,
5698 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
5699 .type = HDA_FIXUP_FUNC,
5700 .v.func = alc269_fixup_limit_int_mic_boost,
5702 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
5704 [ALC269_FIXUP_ACER_AC700] = {
5705 .type = HDA_FIXUP_PINS,
5706 .v.pins = (const struct hda_pintbl[]) {
5707 { 0x12, 0x99a3092f }, /* int-mic */
5708 { 0x14, 0x99130110 }, /* speaker */
5709 { 0x18, 0x03a11c20 }, /* mic */
5710 { 0x1e, 0x0346101e }, /* SPDIF1 */
5711 { 0x21, 0x0321101f }, /* HP out */
5715 .chain_id = ALC271_FIXUP_DMIC,
5717 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
5718 .type = HDA_FIXUP_FUNC,
5719 .v.func = alc269_fixup_limit_int_mic_boost,
5721 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
5723 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
5724 .type = HDA_FIXUP_FUNC,
5725 .v.func = alc269_fixup_limit_int_mic_boost,
5727 .chain_id = ALC269VB_FIXUP_DMIC,
5729 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
5730 .type = HDA_FIXUP_VERBS,
5731 .v.verbs = (const struct hda_verb[]) {
5732 /* class-D output amp +5dB */
5733 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
5734 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
5738 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
5740 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
5741 .type = HDA_FIXUP_FUNC,
5742 .v.func = alc269_fixup_limit_int_mic_boost,
5744 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
5746 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
5747 .type = HDA_FIXUP_PINS,
5748 .v.pins = (const struct hda_pintbl[]) {
5749 { 0x12, 0x99a3092f }, /* int-mic */
5750 { 0x18, 0x03a11d20 }, /* mic */
5751 { 0x19, 0x411111f0 }, /* Unused bogus pin */
5755 [ALC283_FIXUP_CHROME_BOOK] = {
5756 .type = HDA_FIXUP_FUNC,
5757 .v.func = alc283_fixup_chromebook,
5759 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
5760 .type = HDA_FIXUP_FUNC,
5761 .v.func = alc283_fixup_sense_combo_jack,
5763 .chain_id = ALC283_FIXUP_CHROME_BOOK,
5765 [ALC282_FIXUP_ASUS_TX300] = {
5766 .type = HDA_FIXUP_FUNC,
5767 .v.func = alc282_fixup_asus_tx300,
5769 [ALC283_FIXUP_INT_MIC] = {
5770 .type = HDA_FIXUP_VERBS,
5771 .v.verbs = (const struct hda_verb[]) {
5772 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
5773 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
5777 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
5779 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
5780 .type = HDA_FIXUP_PINS,
5781 .v.pins = (const struct hda_pintbl[]) {
5782 { 0x17, 0x90170112 }, /* subwoofer */
5786 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
5788 [ALC290_FIXUP_SUBWOOFER] = {
5789 .type = HDA_FIXUP_PINS,
5790 .v.pins = (const struct hda_pintbl[]) {
5791 { 0x17, 0x90170112 }, /* subwoofer */
5795 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
5797 [ALC290_FIXUP_MONO_SPEAKERS] = {
5798 .type = HDA_FIXUP_FUNC,
5799 .v.func = alc290_fixup_mono_speakers,
5801 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
5802 .type = HDA_FIXUP_FUNC,
5803 .v.func = alc290_fixup_mono_speakers,
5805 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
5807 [ALC269_FIXUP_THINKPAD_ACPI] = {
5808 .type = HDA_FIXUP_FUNC,
5809 .v.func = alc_fixup_thinkpad_acpi,
5811 .chain_id = ALC269_FIXUP_SKU_IGNORE,
5813 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
5814 .type = HDA_FIXUP_FUNC,
5815 .v.func = alc_fixup_inv_dmic,
5817 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
5819 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
5820 .type = HDA_FIXUP_PINS,
5821 .v.pins = (const struct hda_pintbl[]) {
5822 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5826 .chain_id = ALC255_FIXUP_HEADSET_MODE
5828 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
5829 .type = HDA_FIXUP_PINS,
5830 .v.pins = (const struct hda_pintbl[]) {
5831 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5835 .chain_id = ALC255_FIXUP_HEADSET_MODE
5837 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
5838 .type = HDA_FIXUP_PINS,
5839 .v.pins = (const struct hda_pintbl[]) {
5840 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5841 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5845 .chain_id = ALC255_FIXUP_HEADSET_MODE
5847 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
5848 .type = HDA_FIXUP_PINS,
5849 .v.pins = (const struct hda_pintbl[]) {
5850 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5854 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
5856 [ALC255_FIXUP_HEADSET_MODE] = {
5857 .type = HDA_FIXUP_FUNC,
5858 .v.func = alc_fixup_headset_mode_alc255,
5860 .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
5862 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
5863 .type = HDA_FIXUP_FUNC,
5864 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
5866 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
5867 .type = HDA_FIXUP_PINS,
5868 .v.pins = (const struct hda_pintbl[]) {
5869 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5870 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5874 .chain_id = ALC269_FIXUP_HEADSET_MODE
5876 [ALC292_FIXUP_TPT440_DOCK] = {
5877 .type = HDA_FIXUP_FUNC,
5878 .v.func = alc_fixup_tpt440_dock,
5880 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
5882 [ALC292_FIXUP_TPT440] = {
5883 .type = HDA_FIXUP_FUNC,
5884 .v.func = alc_fixup_disable_aamix,
5886 .chain_id = ALC292_FIXUP_TPT440_DOCK,
5888 [ALC283_FIXUP_HEADSET_MIC] = {
5889 .type = HDA_FIXUP_PINS,
5890 .v.pins = (const struct hda_pintbl[]) {
5891 { 0x19, 0x04a110f0 },
5895 [ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED] = {
5896 .type = HDA_FIXUP_FUNC,
5897 .v.func = alc_fixup_dell_wmi,
5899 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
5900 .type = HDA_FIXUP_PINS,
5901 .v.pins = (const struct hda_pintbl[]) {
5902 { 0x12, 0x90a60130 },
5903 { 0x14, 0x90170110 },
5904 { 0x17, 0x40000008 },
5905 { 0x18, 0x411111f0 },
5906 { 0x19, 0x01a1913c },
5907 { 0x1a, 0x411111f0 },
5908 { 0x1b, 0x411111f0 },
5909 { 0x1d, 0x40f89b2d },
5910 { 0x1e, 0x411111f0 },
5911 { 0x21, 0x0321101f },
5915 [ALC280_FIXUP_HP_GPIO4] = {
5916 .type = HDA_FIXUP_FUNC,
5917 .v.func = alc280_fixup_hp_gpio4,
5919 [ALC286_FIXUP_HP_GPIO_LED] = {
5920 .type = HDA_FIXUP_FUNC,
5921 .v.func = alc286_fixup_hp_gpio_led,
5923 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
5924 .type = HDA_FIXUP_FUNC,
5925 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
5927 [ALC280_FIXUP_HP_DOCK_PINS] = {
5928 .type = HDA_FIXUP_PINS,
5929 .v.pins = (const struct hda_pintbl[]) {
5930 { 0x1b, 0x21011020 }, /* line-out */
5931 { 0x1a, 0x01a1903c }, /* headset mic */
5932 { 0x18, 0x2181103f }, /* line-in */
5936 .chain_id = ALC280_FIXUP_HP_GPIO4
5938 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
5939 .type = HDA_FIXUP_PINS,
5940 .v.pins = (const struct hda_pintbl[]) {
5941 { 0x1b, 0x21011020 }, /* line-out */
5942 { 0x18, 0x2181103f }, /* line-in */
5946 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
5948 [ALC280_FIXUP_HP_9480M] = {
5949 .type = HDA_FIXUP_FUNC,
5950 .v.func = alc280_fixup_hp_9480m,
5952 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
5953 .type = HDA_FIXUP_FUNC,
5954 .v.func = alc_fixup_headset_mode_dell_alc288,
5956 .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
5958 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
5959 .type = HDA_FIXUP_PINS,
5960 .v.pins = (const struct hda_pintbl[]) {
5961 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5962 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5966 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
5968 [ALC288_FIXUP_DELL_XPS_13_GPIO6] = {
5969 .type = HDA_FIXUP_VERBS,
5970 .v.verbs = (const struct hda_verb[]) {
5971 {0x01, AC_VERB_SET_GPIO_MASK, 0x40},
5972 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x40},
5973 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5977 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
5979 [ALC288_FIXUP_DISABLE_AAMIX] = {
5980 .type = HDA_FIXUP_FUNC,
5981 .v.func = alc_fixup_disable_aamix,
5983 .chain_id = ALC288_FIXUP_DELL_XPS_13_GPIO6
5985 [ALC288_FIXUP_DELL_XPS_13] = {
5986 .type = HDA_FIXUP_FUNC,
5987 .v.func = alc_fixup_dell_xps13,
5989 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
5991 [ALC292_FIXUP_DISABLE_AAMIX] = {
5992 .type = HDA_FIXUP_FUNC,
5993 .v.func = alc_fixup_disable_aamix,
5995 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
5997 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
5998 .type = HDA_FIXUP_FUNC,
5999 .v.func = alc_fixup_disable_aamix,
6001 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
6003 [ALC292_FIXUP_DELL_E7X] = {
6004 .type = HDA_FIXUP_FUNC,
6005 .v.func = alc_fixup_dell_xps13,
6007 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
6009 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6010 .type = HDA_FIXUP_PINS,
6011 .v.pins = (const struct hda_pintbl[]) {
6012 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6013 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6017 .chain_id = ALC269_FIXUP_HEADSET_MODE
6019 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
6020 .type = HDA_FIXUP_PINS,
6021 .v.pins = (const struct hda_pintbl[]) {
6022 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6026 .chain_id = ALC269_FIXUP_HEADSET_MODE
6028 [ALC275_FIXUP_DELL_XPS] = {
6029 .type = HDA_FIXUP_VERBS,
6030 .v.verbs = (const struct hda_verb[]) {
6031 /* Enables internal speaker */
6032 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
6033 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
6034 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
6035 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
6039 [ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE] = {
6040 .type = HDA_FIXUP_VERBS,
6041 .v.verbs = (const struct hda_verb[]) {
6042 /* Disable pass-through path for FRONT 14h */
6043 {0x20, AC_VERB_SET_COEF_INDEX, 0x36},
6044 {0x20, AC_VERB_SET_PROC_COEF, 0x1737},
6048 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6050 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
6051 .type = HDA_FIXUP_FUNC,
6052 .v.func = alc_fixup_disable_aamix,
6054 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
6056 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
6057 .type = HDA_FIXUP_FUNC,
6058 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
6060 [ALC255_FIXUP_DELL_SPK_NOISE] = {
6061 .type = HDA_FIXUP_FUNC,
6062 .v.func = alc_fixup_disable_aamix,
6064 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6066 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6067 .type = HDA_FIXUP_VERBS,
6068 .v.verbs = (const struct hda_verb[]) {
6069 /* Disable pass-through path for FRONT 14h */
6070 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
6071 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
6075 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
6077 [ALC280_FIXUP_HP_HEADSET_MIC] = {
6078 .type = HDA_FIXUP_FUNC,
6079 .v.func = alc_fixup_disable_aamix,
6081 .chain_id = ALC269_FIXUP_HEADSET_MIC,
6083 [ALC221_FIXUP_HP_FRONT_MIC] = {
6084 .type = HDA_FIXUP_PINS,
6085 .v.pins = (const struct hda_pintbl[]) {
6086 { 0x19, 0x02a19020 }, /* Front Mic */
6090 [ALC292_FIXUP_TPT460] = {
6091 .type = HDA_FIXUP_FUNC,
6092 .v.func = alc_fixup_tpt440_dock,
6094 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
6096 [ALC298_FIXUP_SPK_VOLUME] = {
6097 .type = HDA_FIXUP_FUNC,
6098 .v.func = alc298_fixup_speaker_volume,
6100 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
6102 [ALC295_FIXUP_DISABLE_DAC3] = {
6103 .type = HDA_FIXUP_FUNC,
6104 .v.func = alc295_fixup_disable_dac3,
6106 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
6107 .type = HDA_FIXUP_PINS,
6108 .v.pins = (const struct hda_pintbl[]) {
6109 { 0x1b, 0x90170151 },
6113 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6115 [ALC269_FIXUP_ATIV_BOOK_8] = {
6116 .type = HDA_FIXUP_FUNC,
6117 .v.func = alc_fixup_auto_mute_via_amp,
6119 .chain_id = ALC269_FIXUP_NO_SHUTUP
6121 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
6122 .type = HDA_FIXUP_PINS,
6123 .v.pins = (const struct hda_pintbl[]) {
6124 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6125 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6129 .chain_id = ALC269_FIXUP_HEADSET_MODE
6131 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
6132 .type = HDA_FIXUP_FUNC,
6133 .v.func = alc_fixup_headset_mode,
6135 [ALC256_FIXUP_ASUS_MIC] = {
6136 .type = HDA_FIXUP_PINS,
6137 .v.pins = (const struct hda_pintbl[]) {
6138 { 0x13, 0x90a60160 }, /* use as internal mic */
6139 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
6143 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
6145 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
6146 .type = HDA_FIXUP_VERBS,
6147 .v.verbs = (const struct hda_verb[]) {
6148 /* Set up GPIO2 for the speaker amp */
6149 { 0x01, AC_VERB_SET_GPIO_MASK, 0x04 },
6150 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04 },
6151 { 0x01, AC_VERB_SET_GPIO_DATA, 0x04 },
6155 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
6156 .type = HDA_FIXUP_PINS,
6157 .v.pins = (const struct hda_pintbl[]) {
6158 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6162 .chain_id = ALC269_FIXUP_HEADSET_MIC
6164 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
6165 .type = HDA_FIXUP_VERBS,
6166 .v.verbs = (const struct hda_verb[]) {
6167 /* Enables internal speaker */
6168 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
6169 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
6173 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
6175 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
6176 .type = HDA_FIXUP_FUNC,
6177 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
6179 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
6180 .type = HDA_FIXUP_PINS,
6181 .v.pins = (const struct hda_pintbl[]) {
6182 /* Change the mic location from front to right, otherwise there are
6183 two front mics with the same name, pulseaudio can't handle them.
6184 This is just a temporary workaround, after applying this fixup,
6185 there will be one "Front Mic" and one "Mic" in this machine.
6187 { 0x1a, 0x04a19040 },
6191 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
6192 .type = HDA_FIXUP_PINS,
6193 .v.pins = (const struct hda_pintbl[]) {
6194 { 0x16, 0x0101102f }, /* Rear Headset HP */
6195 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
6196 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
6197 { 0x1b, 0x02011020 },
6201 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6203 [ALC700_FIXUP_INTEL_REFERENCE] = {
6204 .type = HDA_FIXUP_VERBS,
6205 .v.verbs = (const struct hda_verb[]) {
6206 /* Enables internal speaker */
6207 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
6208 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
6209 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
6210 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
6211 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
6212 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
6213 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
6214 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
6218 [ALC274_FIXUP_DELL_BIND_DACS] = {
6219 .type = HDA_FIXUP_FUNC,
6220 .v.func = alc274_fixup_bind_dacs,
6222 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
6224 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
6225 .type = HDA_FIXUP_PINS,
6226 .v.pins = (const struct hda_pintbl[]) {
6227 { 0x1b, 0x0401102f },
6231 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
6233 [ALC298_FIXUP_TPT470_DOCK] = {
6234 .type = HDA_FIXUP_FUNC,
6235 .v.func = alc_fixup_tpt470_dock,
6237 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
6239 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
6240 .type = HDA_FIXUP_PINS,
6241 .v.pins = (const struct hda_pintbl[]) {
6242 { 0x14, 0x0201101f },
6246 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6248 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
6249 .type = HDA_FIXUP_PINS,
6250 .v.pins = (const struct hda_pintbl[]) {
6251 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6255 .chain_id = ALC269_FIXUP_HEADSET_MIC
6259 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
6260 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
6261 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
6262 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
6263 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
6264 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
6265 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
6266 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
6267 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
6268 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
6269 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
6270 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
6271 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
6272 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
6273 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
6274 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
6275 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
6276 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
6277 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
6278 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
6279 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
6280 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
6281 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
6282 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
6283 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
6284 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
6285 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
6286 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
6287 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6288 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6289 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
6290 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
6291 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
6292 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
6293 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6294 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6295 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6296 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6297 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6298 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6299 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6300 SND_PCI_QUIRK(0x1028, 0x0704, "Dell XPS 13 9350", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
6301 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
6302 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
6303 SND_PCI_QUIRK(0x1028, 0x075b, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
6304 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
6305 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
6306 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
6307 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
6308 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
6309 SND_PCI_QUIRK(0x1028, 0x082a, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
6310 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
6311 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
6312 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
6313 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
6314 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
6315 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
6316 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6317 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6318 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
6319 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
6320 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
6321 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
6323 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6324 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6325 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6326 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6327 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6328 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6329 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6330 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6331 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6332 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6333 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6334 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6335 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
6336 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
6337 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
6338 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6339 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6340 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6341 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6342 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6343 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
6344 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6345 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6347 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6348 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6349 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6350 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6351 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6352 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6353 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6354 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6355 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6356 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
6357 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6358 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6359 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6360 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6361 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6362 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6363 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6364 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6365 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6366 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6367 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6368 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6369 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6370 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6371 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6372 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6373 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6374 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6375 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6376 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
6377 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
6378 SND_PCI_QUIRK(0x103c, 0x82bf, "HP", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
6379 SND_PCI_QUIRK(0x103c, 0x82c0, "HP", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
6380 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
6381 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
6382 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
6383 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
6384 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
6385 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
6386 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
6387 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
6388 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
6389 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
6390 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
6391 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
6392 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
6393 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
6394 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
6395 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
6396 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
6397 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
6398 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
6399 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
6400 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
6401 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
6402 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
6403 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
6404 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
6405 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
6406 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
6407 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
6408 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
6409 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
6410 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
6411 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
6412 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
6413 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
6414 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
6415 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
6416 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
6417 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
6418 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
6419 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
6420 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
6421 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
6422 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
6423 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
6424 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
6425 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
6426 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
6427 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
6428 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
6429 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
6430 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
6431 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
6432 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK),
6433 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
6434 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
6435 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
6436 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
6437 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
6438 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
6439 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
6440 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
6441 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
6442 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
6443 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
6444 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
6445 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
6446 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
6447 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
6448 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6449 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6450 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
6451 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
6452 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
6453 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6454 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6455 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
6456 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6457 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6458 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6459 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
6460 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
6461 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
6462 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
6463 SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
6464 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
6465 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
6466 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
6467 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
6468 SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP),
6469 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
6470 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
6471 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
6472 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
6473 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
6474 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
6475 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
6476 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
6477 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
6478 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
6479 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
6480 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
6481 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6482 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6483 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6484 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
6485 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6486 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6487 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
6488 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
6489 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
6492 /* Below is a quirk table taken from the old code.
6493 * Basically the device should work as is without the fixup table.
6494 * If BIOS doesn't give a proper info, enable the corresponding
6497 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
6499 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
6500 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
6501 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
6502 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
6503 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
6504 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
6505 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
6506 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
6507 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
6508 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
6509 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
6510 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
6511 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
6512 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
6513 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
6514 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
6515 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
6516 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
6517 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
6518 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
6519 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
6520 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
6521 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
6522 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
6523 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
6524 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
6525 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
6526 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
6527 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
6528 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
6529 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
6530 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
6531 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
6532 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
6533 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
6534 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
6535 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
6536 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
6537 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
6542 static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
6543 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
6544 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
6545 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
6546 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
6550 static const struct hda_model_fixup alc269_fixup_models[] = {
6551 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
6552 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
6553 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
6554 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
6555 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
6556 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
6557 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
6558 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
6559 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
6560 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
6561 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
6562 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
6563 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
6564 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
6565 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
6566 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
6567 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
6568 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
6569 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
6572 #define ALC225_STANDARD_PINS \
6575 #define ALC256_STANDARD_PINS \
6576 {0x12, 0x90a60140}, \
6577 {0x14, 0x90170110}, \
6580 #define ALC282_STANDARD_PINS \
6583 #define ALC290_STANDARD_PINS \
6586 #define ALC292_STANDARD_PINS \
6587 {0x14, 0x90170110}, \
6590 #define ALC295_STANDARD_PINS \
6591 {0x12, 0xb7a60130}, \
6592 {0x14, 0x90170110}, \
6595 #define ALC298_STANDARD_PINS \
6596 {0x12, 0x90a60130}, \
6599 static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
6600 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
6603 {0x21, 0x02211030}),
6604 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
6607 {0x21, 0x03211020}),
6608 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
6611 {0x21, 0x03211020}),
6612 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
6613 ALC225_STANDARD_PINS,
6615 {0x14, 0x901701a0}),
6616 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
6617 ALC225_STANDARD_PINS,
6619 {0x14, 0x901701b0}),
6620 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
6621 ALC225_STANDARD_PINS,
6623 {0x14, 0x901701a0}),
6624 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
6625 ALC225_STANDARD_PINS,
6627 {0x14, 0x901701b0}),
6628 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
6629 ALC225_STANDARD_PINS,
6631 {0x1b, 0x90170110}),
6632 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6635 {0x21, 0x02211020}),
6636 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
6640 {0x21, 0x02211020}),
6641 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
6646 {0x21, 0x0221101f}),
6647 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
6652 {0x21, 0x0221101f}),
6653 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
6657 {0x21, 0x0221101f}),
6658 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6661 {0x21, 0x02211020}),
6662 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
6664 {0x21, 0x02211020}),
6665 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6667 {0x21, 0x02211040}),
6668 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6671 {0x21, 0x02211020}),
6672 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6675 {0x21, 0x02211030}),
6676 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6679 {0x21, 0x0221101f}),
6680 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6683 {0x21, 0x0221101f}),
6684 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6687 {0x21, 0x0221103f}),
6688 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6691 {0x21, 0x0221103f}),
6692 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6695 {0x21, 0x0221103f}),
6696 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6699 {0x21, 0x0221105f}),
6700 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6703 {0x21, 0x0221101f}),
6704 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6708 {0x21, 0x0321102f}),
6709 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6712 {0x21, 0x02211040}),
6713 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6716 {0x21, 0x02211050}),
6717 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6720 {0x21, 0x02211030}),
6721 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6724 {0x21, 0x02211040}),
6725 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6728 {0x21, 0x02211040}),
6729 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6732 {0x21, 0x02211050}),
6733 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6736 {0x21, 0x02211040}),
6737 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6740 {0x21, 0x02211030}),
6741 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6743 {0x21, 0x02211010}),
6744 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6748 {0x21, 0x0221101f}),
6749 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6752 {0x21, 0x02211030}),
6753 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6756 {0x21, 0x02211030}),
6757 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell Inspiron 5468", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6760 {0x21, 0x02211030}),
6761 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6764 {0x21, 0x02211020}),
6765 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6769 {0x21, 0x0221101f}),
6770 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6771 ALC256_STANDARD_PINS),
6772 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
6775 {0x21, 0x04211020}),
6776 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
6779 {0x21, 0x03211020}),
6780 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
6784 {0x21, 0x04211020}),
6785 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
6789 {0x1a, 0x04a11020}),
6790 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
6796 {0x1b, 0x02011020}),
6797 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
6798 ALC282_STANDARD_PINS,
6801 {0x21, 0x0321101f}),
6802 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
6803 ALC282_STANDARD_PINS,
6806 {0x21, 0x03211040}),
6807 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
6808 ALC282_STANDARD_PINS,
6811 {0x21, 0x03211020}),
6812 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
6813 ALC282_STANDARD_PINS,
6816 {0x21, 0x0421101f}),
6817 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
6818 ALC282_STANDARD_PINS,
6821 {0x21, 0x04211020}),
6822 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6823 ALC282_STANDARD_PINS,
6825 {0x21, 0x0321101f}),
6826 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6829 {0x21, 0x02211030}),
6830 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6831 ALC282_STANDARD_PINS,
6834 {0x21, 0x0321101f}),
6835 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL_XPS_13_GPIO6,
6838 {0x21, 0x0321101f}),
6839 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
6842 {0x21, 0x04211020}),
6843 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
6844 ALC290_STANDARD_PINS,
6847 {0x1a, 0x04a11020}),
6848 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
6849 ALC290_STANDARD_PINS,
6852 {0x1a, 0x04a11020}),
6853 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
6854 ALC290_STANDARD_PINS,
6856 {0x1a, 0x04a11020}),
6857 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
6858 ALC290_STANDARD_PINS,
6860 {0x1a, 0x04a11040}),
6861 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
6862 ALC290_STANDARD_PINS,
6865 {0x1a, 0x04a11040}),
6866 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
6867 ALC290_STANDARD_PINS,
6870 {0x1a, 0x04a11020}),
6871 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
6872 ALC290_STANDARD_PINS,
6875 {0x1a, 0x04a11020}),
6876 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
6877 ALC292_STANDARD_PINS,
6880 {0x19, 0x01a19030}),
6881 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
6882 ALC292_STANDARD_PINS,
6886 {0x19, 0x01a1903e}),
6887 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
6888 ALC292_STANDARD_PINS,
6889 {0x12, 0x90a60140}),
6890 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
6891 ALC292_STANDARD_PINS,
6894 {0x19, 0x21a19030}),
6895 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
6896 ALC292_STANDARD_PINS,
6897 {0x13, 0x90a60140}),
6898 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6899 ALC295_STANDARD_PINS,
6901 {0x18, 0x21a19030}),
6902 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6903 ALC295_STANDARD_PINS,
6905 {0x18, 0x21a19050}),
6906 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6907 ALC295_STANDARD_PINS),
6908 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
6909 ALC298_STANDARD_PINS,
6910 {0x17, 0x90170110}),
6911 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
6912 ALC298_STANDARD_PINS,
6913 {0x17, 0x90170140}),
6914 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
6915 ALC298_STANDARD_PINS,
6916 {0x17, 0x90170150}),
6917 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
6922 {0x21, 0x03211030}),
6923 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
6924 ALC225_STANDARD_PINS,
6926 {0x17, 0x90170110}),
6930 static void alc269_fill_coef(struct hda_codec *codec)
6932 struct alc_spec *spec = codec->spec;
6935 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
6938 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
6939 alc_write_coef_idx(codec, 0xf, 0x960b);
6940 alc_write_coef_idx(codec, 0xe, 0x8817);
6943 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
6944 alc_write_coef_idx(codec, 0xf, 0x960b);
6945 alc_write_coef_idx(codec, 0xe, 0x8814);
6948 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
6949 /* Power up output pin */
6950 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
6953 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
6954 val = alc_read_coef_idx(codec, 0xd);
6955 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
6956 /* Capless ramp up clock control */
6957 alc_write_coef_idx(codec, 0xd, val | (1<<10));
6959 val = alc_read_coef_idx(codec, 0x17);
6960 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
6961 /* Class D power on reset */
6962 alc_write_coef_idx(codec, 0x17, val | (1<<7));
6967 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
6970 static void alc294_hp_init(struct hda_codec *codec)
6972 struct alc_spec *spec = codec->spec;
6973 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
6979 snd_hda_codec_write(codec, hp_pin, 0,
6980 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
6984 snd_hda_codec_write(codec, hp_pin, 0,
6985 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
6987 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
6988 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
6990 /* Wait for depop procedure finish */
6991 val = alc_read_coefex_idx(codec, 0x58, 0x01);
6992 for (i = 0; i < 20 && val & 0x0080; i++) {
6994 val = alc_read_coefex_idx(codec, 0x58, 0x01);
6996 /* Set HP depop to auto mode */
6997 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
7003 static int patch_alc269(struct hda_codec *codec)
7005 struct alc_spec *spec;
7008 err = alc_alloc_spec(codec, 0x0b);
7013 spec->gen.shared_mic_vref_pin = 0x18;
7014 codec->power_save_node = 1;
7017 codec->patch_ops.suspend = alc269_suspend;
7018 codec->patch_ops.resume = alc269_resume;
7020 spec->shutup = alc_default_shutup;
7021 spec->init_hook = alc_default_init;
7023 snd_hda_pick_fixup(codec, alc269_fixup_models,
7024 alc269_fixup_tbl, alc269_fixups);
7025 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups);
7026 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
7028 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
7030 alc_auto_parse_customize_define(codec);
7032 if (has_cdefine_beep(codec))
7033 spec->gen.beep_nid = 0x01;
7035 switch (codec->core.vendor_id) {
7037 spec->codec_variant = ALC269_TYPE_ALC269VA;
7038 switch (alc_get_coef0(codec) & 0x00f0) {
7040 if (codec->bus->pci &&
7041 codec->bus->pci->subsystem_vendor == 0x1025 &&
7042 spec->cdefine.platform_type == 1)
7043 err = alc_codec_rename(codec, "ALC271X");
7044 spec->codec_variant = ALC269_TYPE_ALC269VB;
7047 if (codec->bus->pci &&
7048 codec->bus->pci->subsystem_vendor == 0x17aa &&
7049 codec->bus->pci->subsystem_device == 0x21f3)
7050 err = alc_codec_rename(codec, "ALC3202");
7051 spec->codec_variant = ALC269_TYPE_ALC269VC;
7054 spec->codec_variant = ALC269_TYPE_ALC269VD;
7057 alc_fix_pll_init(codec, 0x20, 0x04, 15);
7061 spec->shutup = alc269_shutup;
7062 spec->init_hook = alc269_fill_coef;
7063 alc269_fill_coef(codec);
7068 spec->codec_variant = ALC269_TYPE_ALC280;
7071 spec->codec_variant = ALC269_TYPE_ALC282;
7072 spec->shutup = alc282_shutup;
7073 spec->init_hook = alc282_init;
7077 spec->codec_variant = ALC269_TYPE_ALC283;
7078 spec->shutup = alc283_shutup;
7079 spec->init_hook = alc283_init;
7083 spec->codec_variant = ALC269_TYPE_ALC284;
7086 spec->codec_variant = ALC269_TYPE_ALC293;
7090 spec->codec_variant = ALC269_TYPE_ALC286;
7091 spec->shutup = alc286_shutup;
7094 spec->codec_variant = ALC269_TYPE_ALC298;
7098 spec->codec_variant = ALC269_TYPE_ALC255;
7099 spec->shutup = alc256_shutup;
7100 spec->init_hook = alc256_init;
7104 spec->codec_variant = ALC269_TYPE_ALC256;
7105 spec->shutup = alc256_shutup;
7106 spec->init_hook = alc256_init;
7107 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
7108 alc_update_coef_idx(codec, 0x36, 1 << 13, 1 << 5); /* Switch pcbeep path to Line in path*/
7111 spec->codec_variant = ALC269_TYPE_ALC257;
7112 spec->shutup = alc256_shutup;
7113 spec->init_hook = alc256_init;
7114 spec->gen.mixer_nid = 0;
7119 spec->codec_variant = ALC269_TYPE_ALC215;
7120 spec->gen.mixer_nid = 0;
7124 spec->codec_variant = ALC269_TYPE_ALC225;
7125 spec->gen.mixer_nid = 0; /* no loopback on ALC225 ALC295 */
7128 spec->codec_variant = ALC269_TYPE_ALC225;
7129 spec->gen.mixer_nid = 0; /* no loopback on ALC299 */
7134 spec->codec_variant = ALC269_TYPE_ALC294;
7135 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
7136 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
7137 alc294_hp_init(codec);
7140 spec->codec_variant = ALC269_TYPE_ALC300;
7141 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
7146 spec->codec_variant = ALC269_TYPE_ALC700;
7147 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
7148 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
7149 alc294_hp_init(codec);
7154 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
7155 spec->has_alc5505_dsp = 1;
7156 spec->init_hook = alc5505_dsp_init;
7159 /* automatic parse from the BIOS config */
7160 err = alc269_parse_auto_config(codec);
7164 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid)
7165 set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
7167 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
7180 static int alc861_parse_auto_config(struct hda_codec *codec)
7182 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
7183 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
7184 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
7187 /* Pin config fixes */
7189 ALC861_FIXUP_FSC_AMILO_PI1505,
7190 ALC861_FIXUP_AMP_VREF_0F,
7191 ALC861_FIXUP_NO_JACK_DETECT,
7192 ALC861_FIXUP_ASUS_A6RP,
7193 ALC660_FIXUP_ASUS_W7J,
7196 /* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
7197 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
7198 const struct hda_fixup *fix, int action)
7200 struct alc_spec *spec = codec->spec;
7203 if (action != HDA_FIXUP_ACT_INIT)
7205 val = snd_hda_codec_get_pin_target(codec, 0x0f);
7206 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
7207 val |= AC_PINCTL_IN_EN;
7208 val |= AC_PINCTL_VREF_50;
7209 snd_hda_set_pin_ctl(codec, 0x0f, val);
7210 spec->gen.keep_vref_in_automute = 1;
7213 /* suppress the jack-detection */
7214 static void alc_fixup_no_jack_detect(struct hda_codec *codec,
7215 const struct hda_fixup *fix, int action)
7217 if (action == HDA_FIXUP_ACT_PRE_PROBE)
7218 codec->no_jack_detect = 1;
7221 static const struct hda_fixup alc861_fixups[] = {
7222 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
7223 .type = HDA_FIXUP_PINS,
7224 .v.pins = (const struct hda_pintbl[]) {
7225 { 0x0b, 0x0221101f }, /* HP */
7226 { 0x0f, 0x90170310 }, /* speaker */
7230 [ALC861_FIXUP_AMP_VREF_0F] = {
7231 .type = HDA_FIXUP_FUNC,
7232 .v.func = alc861_fixup_asus_amp_vref_0f,
7234 [ALC861_FIXUP_NO_JACK_DETECT] = {
7235 .type = HDA_FIXUP_FUNC,
7236 .v.func = alc_fixup_no_jack_detect,
7238 [ALC861_FIXUP_ASUS_A6RP] = {
7239 .type = HDA_FIXUP_FUNC,
7240 .v.func = alc861_fixup_asus_amp_vref_0f,
7242 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
7244 [ALC660_FIXUP_ASUS_W7J] = {
7245 .type = HDA_FIXUP_VERBS,
7246 .v.verbs = (const struct hda_verb[]) {
7247 /* ASUS W7J needs a magic pin setup on unused NID 0x10
7248 * for enabling outputs
7250 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
7256 static const struct snd_pci_quirk alc861_fixup_tbl[] = {
7257 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
7258 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
7259 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
7260 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
7261 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
7262 SND_PCI_QUIRK(0x1584, 0x2b01, "Haier W18", ALC861_FIXUP_AMP_VREF_0F),
7263 SND_PCI_QUIRK(0x1584, 0x0000, "Uniwill ECS M31EI", ALC861_FIXUP_AMP_VREF_0F),
7264 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
7270 static int patch_alc861(struct hda_codec *codec)
7272 struct alc_spec *spec;
7275 err = alc_alloc_spec(codec, 0x15);
7280 spec->gen.beep_nid = 0x23;
7283 spec->power_hook = alc_power_eapd;
7286 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
7287 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
7289 /* automatic parse from the BIOS config */
7290 err = alc861_parse_auto_config(codec);
7294 if (!spec->gen.no_analog)
7295 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
7297 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
7311 * In addition, an independent DAC
7313 static int alc861vd_parse_auto_config(struct hda_codec *codec)
7315 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
7316 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
7317 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
7321 ALC660VD_FIX_ASUS_GPIO1,
7322 ALC861VD_FIX_DALLAS,
7325 /* exclude VREF80 */
7326 static void alc861vd_fixup_dallas(struct hda_codec *codec,
7327 const struct hda_fixup *fix, int action)
7329 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
7330 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
7331 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
7335 static const struct hda_fixup alc861vd_fixups[] = {
7336 [ALC660VD_FIX_ASUS_GPIO1] = {
7337 .type = HDA_FIXUP_VERBS,
7338 .v.verbs = (const struct hda_verb[]) {
7340 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
7341 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
7342 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
7346 [ALC861VD_FIX_DALLAS] = {
7347 .type = HDA_FIXUP_FUNC,
7348 .v.func = alc861vd_fixup_dallas,
7352 static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
7353 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
7354 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
7355 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
7361 static int patch_alc861vd(struct hda_codec *codec)
7363 struct alc_spec *spec;
7366 err = alc_alloc_spec(codec, 0x0b);
7371 spec->gen.beep_nid = 0x23;
7373 spec->shutup = alc_eapd_shutup;
7375 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
7376 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
7378 /* automatic parse from the BIOS config */
7379 err = alc861vd_parse_auto_config(codec);
7383 if (!spec->gen.no_analog)
7384 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
7386 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
7398 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
7399 * configuration. Each pin widget can choose any input DACs and a mixer.
7400 * Each ADC is connected from a mixer of all inputs. This makes possible
7401 * 6-channel independent captures.
7403 * In addition, an independent DAC for the multi-playback (not used in this
7408 * BIOS auto configuration
7411 static int alc662_parse_auto_config(struct hda_codec *codec)
7413 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
7414 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
7415 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
7416 const hda_nid_t *ssids;
7418 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
7419 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
7420 codec->core.vendor_id == 0x10ec0671)
7421 ssids = alc663_ssids;
7423 ssids = alc662_ssids;
7424 return alc_parse_auto_config(codec, alc662_ignore, ssids);
7427 static void alc272_fixup_mario(struct hda_codec *codec,
7428 const struct hda_fixup *fix, int action)
7430 if (action != HDA_FIXUP_ACT_PRE_PROBE)
7432 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
7433 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
7434 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
7435 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
7436 (0 << AC_AMPCAP_MUTE_SHIFT)))
7437 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
7440 static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
7442 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
7444 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
7445 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
7449 /* override the 2.1 chmap */
7450 static void alc_fixup_bass_chmap(struct hda_codec *codec,
7451 const struct hda_fixup *fix, int action)
7453 if (action == HDA_FIXUP_ACT_BUILD) {
7454 struct alc_spec *spec = codec->spec;
7455 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
7459 /* avoid D3 for keeping GPIO up */
7460 static unsigned int gpio_led_power_filter(struct hda_codec *codec,
7462 unsigned int power_state)
7464 struct alc_spec *spec = codec->spec;
7465 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_led)
7470 static void alc662_fixup_led_gpio1(struct hda_codec *codec,
7471 const struct hda_fixup *fix, int action)
7473 struct alc_spec *spec = codec->spec;
7474 static const struct hda_verb gpio_init[] = {
7475 { 0x01, AC_VERB_SET_GPIO_MASK, 0x01 },
7476 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01 },
7480 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
7481 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
7483 spec->mute_led_polarity = 1;
7484 spec->gpio_mute_led_mask = 0x01;
7485 snd_hda_add_verbs(codec, gpio_init);
7486 codec->power_filter = gpio_led_power_filter;
7490 static void alc662_usi_automute_hook(struct hda_codec *codec,
7491 struct hda_jack_callback *jack)
7493 struct alc_spec *spec = codec->spec;
7496 snd_hda_gen_hp_automute(codec, jack);
7498 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
7500 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
7504 static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
7505 const struct hda_fixup *fix, int action)
7507 struct alc_spec *spec = codec->spec;
7508 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
7509 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
7510 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
7514 static struct coef_fw alc668_coefs[] = {
7515 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
7516 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
7517 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
7518 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
7519 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
7520 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
7521 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
7522 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
7523 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
7524 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
7525 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
7526 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
7527 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
7528 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
7529 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
7530 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
7531 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
7532 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
7533 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
7534 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
7538 static void alc668_restore_default_value(struct hda_codec *codec)
7540 alc_process_coef_fw(codec, alc668_coefs);
7544 ALC662_FIXUP_ASPIRE,
7545 ALC662_FIXUP_LED_GPIO1,
7546 ALC662_FIXUP_IDEAPAD,
7548 ALC662_FIXUP_CZC_P10T,
7549 ALC662_FIXUP_SKU_IGNORE,
7550 ALC662_FIXUP_HP_RP5800,
7551 ALC662_FIXUP_ASUS_MODE1,
7552 ALC662_FIXUP_ASUS_MODE2,
7553 ALC662_FIXUP_ASUS_MODE3,
7554 ALC662_FIXUP_ASUS_MODE4,
7555 ALC662_FIXUP_ASUS_MODE5,
7556 ALC662_FIXUP_ASUS_MODE6,
7557 ALC662_FIXUP_ASUS_MODE7,
7558 ALC662_FIXUP_ASUS_MODE8,
7559 ALC662_FIXUP_NO_JACK_DETECT,
7560 ALC662_FIXUP_ZOTAC_Z68,
7561 ALC662_FIXUP_INV_DMIC,
7562 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
7563 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
7564 ALC662_FIXUP_HEADSET_MODE,
7565 ALC668_FIXUP_HEADSET_MODE,
7566 ALC662_FIXUP_BASS_MODE4_CHMAP,
7567 ALC662_FIXUP_BASS_16,
7568 ALC662_FIXUP_BASS_1A,
7569 ALC662_FIXUP_BASS_CHMAP,
7570 ALC668_FIXUP_AUTO_MUTE,
7571 ALC668_FIXUP_DELL_DISABLE_AAMIX,
7572 ALC668_FIXUP_DELL_XPS13,
7573 ALC662_FIXUP_ASUS_Nx50,
7574 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
7575 ALC668_FIXUP_ASUS_Nx51,
7576 ALC668_FIXUP_MIC_COEF,
7577 ALC668_FIXUP_ASUS_G751,
7578 ALC891_FIXUP_HEADSET_MODE,
7579 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
7580 ALC662_FIXUP_ACER_VERITON,
7581 ALC892_FIXUP_ASROCK_MOBO,
7582 ALC662_FIXUP_USI_FUNC,
7583 ALC662_FIXUP_USI_HEADSET_MODE,
7584 ALC662_FIXUP_LENOVO_MULTI_CODECS,
7587 static const struct hda_fixup alc662_fixups[] = {
7588 [ALC662_FIXUP_ASPIRE] = {
7589 .type = HDA_FIXUP_PINS,
7590 .v.pins = (const struct hda_pintbl[]) {
7591 { 0x15, 0x99130112 }, /* subwoofer */
7595 [ALC662_FIXUP_LED_GPIO1] = {
7596 .type = HDA_FIXUP_FUNC,
7597 .v.func = alc662_fixup_led_gpio1,
7599 [ALC662_FIXUP_IDEAPAD] = {
7600 .type = HDA_FIXUP_PINS,
7601 .v.pins = (const struct hda_pintbl[]) {
7602 { 0x17, 0x99130112 }, /* subwoofer */
7606 .chain_id = ALC662_FIXUP_LED_GPIO1,
7608 [ALC272_FIXUP_MARIO] = {
7609 .type = HDA_FIXUP_FUNC,
7610 .v.func = alc272_fixup_mario,
7612 [ALC662_FIXUP_CZC_P10T] = {
7613 .type = HDA_FIXUP_VERBS,
7614 .v.verbs = (const struct hda_verb[]) {
7615 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
7619 [ALC662_FIXUP_SKU_IGNORE] = {
7620 .type = HDA_FIXUP_FUNC,
7621 .v.func = alc_fixup_sku_ignore,
7623 [ALC662_FIXUP_HP_RP5800] = {
7624 .type = HDA_FIXUP_PINS,
7625 .v.pins = (const struct hda_pintbl[]) {
7626 { 0x14, 0x0221201f }, /* HP out */
7630 .chain_id = ALC662_FIXUP_SKU_IGNORE
7632 [ALC662_FIXUP_ASUS_MODE1] = {
7633 .type = HDA_FIXUP_PINS,
7634 .v.pins = (const struct hda_pintbl[]) {
7635 { 0x14, 0x99130110 }, /* speaker */
7636 { 0x18, 0x01a19c20 }, /* mic */
7637 { 0x19, 0x99a3092f }, /* int-mic */
7638 { 0x21, 0x0121401f }, /* HP out */
7642 .chain_id = ALC662_FIXUP_SKU_IGNORE
7644 [ALC662_FIXUP_ASUS_MODE2] = {
7645 .type = HDA_FIXUP_PINS,
7646 .v.pins = (const struct hda_pintbl[]) {
7647 { 0x14, 0x99130110 }, /* speaker */
7648 { 0x18, 0x01a19820 }, /* mic */
7649 { 0x19, 0x99a3092f }, /* int-mic */
7650 { 0x1b, 0x0121401f }, /* HP out */
7654 .chain_id = ALC662_FIXUP_SKU_IGNORE
7656 [ALC662_FIXUP_ASUS_MODE3] = {
7657 .type = HDA_FIXUP_PINS,
7658 .v.pins = (const struct hda_pintbl[]) {
7659 { 0x14, 0x99130110 }, /* speaker */
7660 { 0x15, 0x0121441f }, /* HP */
7661 { 0x18, 0x01a19840 }, /* mic */
7662 { 0x19, 0x99a3094f }, /* int-mic */
7663 { 0x21, 0x01211420 }, /* HP2 */
7667 .chain_id = ALC662_FIXUP_SKU_IGNORE
7669 [ALC662_FIXUP_ASUS_MODE4] = {
7670 .type = HDA_FIXUP_PINS,
7671 .v.pins = (const struct hda_pintbl[]) {
7672 { 0x14, 0x99130110 }, /* speaker */
7673 { 0x16, 0x99130111 }, /* speaker */
7674 { 0x18, 0x01a19840 }, /* mic */
7675 { 0x19, 0x99a3094f }, /* int-mic */
7676 { 0x21, 0x0121441f }, /* HP */
7680 .chain_id = ALC662_FIXUP_SKU_IGNORE
7682 [ALC662_FIXUP_ASUS_MODE5] = {
7683 .type = HDA_FIXUP_PINS,
7684 .v.pins = (const struct hda_pintbl[]) {
7685 { 0x14, 0x99130110 }, /* speaker */
7686 { 0x15, 0x0121441f }, /* HP */
7687 { 0x16, 0x99130111 }, /* speaker */
7688 { 0x18, 0x01a19840 }, /* mic */
7689 { 0x19, 0x99a3094f }, /* int-mic */
7693 .chain_id = ALC662_FIXUP_SKU_IGNORE
7695 [ALC662_FIXUP_ASUS_MODE6] = {
7696 .type = HDA_FIXUP_PINS,
7697 .v.pins = (const struct hda_pintbl[]) {
7698 { 0x14, 0x99130110 }, /* speaker */
7699 { 0x15, 0x01211420 }, /* HP2 */
7700 { 0x18, 0x01a19840 }, /* mic */
7701 { 0x19, 0x99a3094f }, /* int-mic */
7702 { 0x1b, 0x0121441f }, /* HP */
7706 .chain_id = ALC662_FIXUP_SKU_IGNORE
7708 [ALC662_FIXUP_ASUS_MODE7] = {
7709 .type = HDA_FIXUP_PINS,
7710 .v.pins = (const struct hda_pintbl[]) {
7711 { 0x14, 0x99130110 }, /* speaker */
7712 { 0x17, 0x99130111 }, /* speaker */
7713 { 0x18, 0x01a19840 }, /* mic */
7714 { 0x19, 0x99a3094f }, /* int-mic */
7715 { 0x1b, 0x01214020 }, /* HP */
7716 { 0x21, 0x0121401f }, /* HP */
7720 .chain_id = ALC662_FIXUP_SKU_IGNORE
7722 [ALC662_FIXUP_ASUS_MODE8] = {
7723 .type = HDA_FIXUP_PINS,
7724 .v.pins = (const struct hda_pintbl[]) {
7725 { 0x14, 0x99130110 }, /* speaker */
7726 { 0x12, 0x99a30970 }, /* int-mic */
7727 { 0x15, 0x01214020 }, /* HP */
7728 { 0x17, 0x99130111 }, /* speaker */
7729 { 0x18, 0x01a19840 }, /* mic */
7730 { 0x21, 0x0121401f }, /* HP */
7734 .chain_id = ALC662_FIXUP_SKU_IGNORE
7736 [ALC662_FIXUP_NO_JACK_DETECT] = {
7737 .type = HDA_FIXUP_FUNC,
7738 .v.func = alc_fixup_no_jack_detect,
7740 [ALC662_FIXUP_ZOTAC_Z68] = {
7741 .type = HDA_FIXUP_PINS,
7742 .v.pins = (const struct hda_pintbl[]) {
7743 { 0x1b, 0x02214020 }, /* Front HP */
7747 [ALC662_FIXUP_INV_DMIC] = {
7748 .type = HDA_FIXUP_FUNC,
7749 .v.func = alc_fixup_inv_dmic,
7751 [ALC668_FIXUP_DELL_XPS13] = {
7752 .type = HDA_FIXUP_FUNC,
7753 .v.func = alc_fixup_dell_xps13,
7755 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
7757 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
7758 .type = HDA_FIXUP_FUNC,
7759 .v.func = alc_fixup_disable_aamix,
7761 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
7763 [ALC668_FIXUP_AUTO_MUTE] = {
7764 .type = HDA_FIXUP_FUNC,
7765 .v.func = alc_fixup_auto_mute_via_amp,
7767 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
7769 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
7770 .type = HDA_FIXUP_PINS,
7771 .v.pins = (const struct hda_pintbl[]) {
7772 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
7773 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
7777 .chain_id = ALC662_FIXUP_HEADSET_MODE
7779 [ALC662_FIXUP_HEADSET_MODE] = {
7780 .type = HDA_FIXUP_FUNC,
7781 .v.func = alc_fixup_headset_mode_alc662,
7783 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
7784 .type = HDA_FIXUP_PINS,
7785 .v.pins = (const struct hda_pintbl[]) {
7786 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
7787 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
7791 .chain_id = ALC668_FIXUP_HEADSET_MODE
7793 [ALC668_FIXUP_HEADSET_MODE] = {
7794 .type = HDA_FIXUP_FUNC,
7795 .v.func = alc_fixup_headset_mode_alc668,
7797 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
7798 .type = HDA_FIXUP_FUNC,
7799 .v.func = alc_fixup_bass_chmap,
7801 .chain_id = ALC662_FIXUP_ASUS_MODE4
7803 [ALC662_FIXUP_BASS_16] = {
7804 .type = HDA_FIXUP_PINS,
7805 .v.pins = (const struct hda_pintbl[]) {
7806 {0x16, 0x80106111}, /* bass speaker */
7810 .chain_id = ALC662_FIXUP_BASS_CHMAP,
7812 [ALC662_FIXUP_BASS_1A] = {
7813 .type = HDA_FIXUP_PINS,
7814 .v.pins = (const struct hda_pintbl[]) {
7815 {0x1a, 0x80106111}, /* bass speaker */
7819 .chain_id = ALC662_FIXUP_BASS_CHMAP,
7821 [ALC662_FIXUP_BASS_CHMAP] = {
7822 .type = HDA_FIXUP_FUNC,
7823 .v.func = alc_fixup_bass_chmap,
7825 [ALC662_FIXUP_ASUS_Nx50] = {
7826 .type = HDA_FIXUP_FUNC,
7827 .v.func = alc_fixup_auto_mute_via_amp,
7829 .chain_id = ALC662_FIXUP_BASS_1A
7831 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
7832 .type = HDA_FIXUP_FUNC,
7833 .v.func = alc_fixup_headset_mode_alc668,
7834 .chain_id = ALC662_FIXUP_BASS_CHMAP
7836 [ALC668_FIXUP_ASUS_Nx51] = {
7837 .type = HDA_FIXUP_PINS,
7838 .v.pins = (const struct hda_pintbl[]) {
7839 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
7840 { 0x1a, 0x90170151 }, /* bass speaker */
7841 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
7845 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
7847 [ALC668_FIXUP_MIC_COEF] = {
7848 .type = HDA_FIXUP_VERBS,
7849 .v.verbs = (const struct hda_verb[]) {
7850 { 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
7851 { 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
7855 [ALC668_FIXUP_ASUS_G751] = {
7856 .type = HDA_FIXUP_PINS,
7857 .v.pins = (const struct hda_pintbl[]) {
7858 { 0x16, 0x0421101f }, /* HP */
7862 .chain_id = ALC668_FIXUP_MIC_COEF
7864 [ALC891_FIXUP_HEADSET_MODE] = {
7865 .type = HDA_FIXUP_FUNC,
7866 .v.func = alc_fixup_headset_mode,
7868 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
7869 .type = HDA_FIXUP_PINS,
7870 .v.pins = (const struct hda_pintbl[]) {
7871 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
7872 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
7876 .chain_id = ALC891_FIXUP_HEADSET_MODE
7878 [ALC662_FIXUP_ACER_VERITON] = {
7879 .type = HDA_FIXUP_PINS,
7880 .v.pins = (const struct hda_pintbl[]) {
7881 { 0x15, 0x50170120 }, /* no internal speaker */
7885 [ALC892_FIXUP_ASROCK_MOBO] = {
7886 .type = HDA_FIXUP_PINS,
7887 .v.pins = (const struct hda_pintbl[]) {
7888 { 0x15, 0x40f000f0 }, /* disabled */
7889 { 0x16, 0x40f000f0 }, /* disabled */
7893 [ALC662_FIXUP_USI_FUNC] = {
7894 .type = HDA_FIXUP_FUNC,
7895 .v.func = alc662_fixup_usi_headset_mic,
7897 [ALC662_FIXUP_USI_HEADSET_MODE] = {
7898 .type = HDA_FIXUP_PINS,
7899 .v.pins = (const struct hda_pintbl[]) {
7900 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
7901 { 0x18, 0x01a1903d },
7905 .chain_id = ALC662_FIXUP_USI_FUNC
7907 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
7908 .type = HDA_FIXUP_FUNC,
7909 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
7913 static const struct snd_pci_quirk alc662_fixup_tbl[] = {
7914 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
7915 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
7916 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
7917 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
7918 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
7919 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
7920 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
7921 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
7922 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
7923 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
7924 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
7925 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
7926 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
7927 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
7928 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
7929 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
7930 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
7931 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
7932 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
7933 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
7934 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
7935 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
7936 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
7937 SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
7938 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
7939 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
7940 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
7941 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
7942 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
7943 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
7944 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
7945 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
7946 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
7947 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
7948 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
7949 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
7950 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
7951 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
7952 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
7953 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
7954 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
7955 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
7958 /* Below is a quirk table taken from the old code.
7959 * Basically the device should work as is without the fixup table.
7960 * If BIOS doesn't give a proper info, enable the corresponding
7963 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
7964 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
7965 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
7966 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
7967 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
7968 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
7969 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
7970 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
7971 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
7972 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
7973 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
7974 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
7975 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
7976 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
7977 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
7978 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
7979 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
7980 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
7981 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
7982 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
7983 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
7984 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
7985 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
7986 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
7987 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
7988 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
7989 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
7990 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
7991 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
7992 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
7993 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
7994 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
7995 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
7996 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
7997 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
7998 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
7999 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
8000 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
8001 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
8002 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8003 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
8004 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
8005 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8006 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
8007 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
8008 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
8009 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
8010 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
8011 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8012 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
8017 static const struct hda_model_fixup alc662_fixup_models[] = {
8018 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
8019 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
8020 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
8021 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
8022 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
8023 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
8024 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
8025 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
8026 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
8027 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
8028 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
8029 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
8033 static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
8034 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
8038 {0x21, 0x01014020}),
8039 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
8043 {0x1b, 0x0221401f}),
8044 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8048 {0x16, 0x03011020}),
8049 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8053 {0x16, 0x03011020}),
8054 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8058 {0x16, 0x03011020}),
8059 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8062 {0x16, 0x03011020}),
8063 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
8066 {0x15, 0x0321101f}),
8072 static int patch_alc662(struct hda_codec *codec)
8074 struct alc_spec *spec;
8077 err = alc_alloc_spec(codec, 0x0b);
8083 spec->shutup = alc_eapd_shutup;
8085 /* handle multiple HPs as is */
8086 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
8088 alc_fix_pll_init(codec, 0x20, 0x04, 15);
8090 switch (codec->core.vendor_id) {
8092 spec->init_hook = alc668_restore_default_value;
8096 snd_hda_pick_fixup(codec, alc662_fixup_models,
8097 alc662_fixup_tbl, alc662_fixups);
8098 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups);
8099 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
8101 alc_auto_parse_customize_define(codec);
8103 if (has_cdefine_beep(codec))
8104 spec->gen.beep_nid = 0x01;
8106 if ((alc_get_coef0(codec) & (1 << 14)) &&
8107 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
8108 spec->cdefine.platform_type == 1) {
8109 err = alc_codec_rename(codec, "ALC272X");
8114 /* automatic parse from the BIOS config */
8115 err = alc662_parse_auto_config(codec);
8119 if (!spec->gen.no_analog && spec->gen.beep_nid) {
8120 switch (codec->core.vendor_id) {
8122 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
8128 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
8131 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
8136 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
8149 static int alc680_parse_auto_config(struct hda_codec *codec)
8151 return alc_parse_auto_config(codec, NULL, NULL);
8156 static int patch_alc680(struct hda_codec *codec)
8160 /* ALC680 has no aa-loopback mixer */
8161 err = alc_alloc_spec(codec, 0);
8165 /* automatic parse from the BIOS config */
8166 err = alc680_parse_auto_config(codec);
8178 static const struct hda_device_id snd_hda_id_realtek[] = {
8179 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
8180 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
8181 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
8182 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
8183 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
8184 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
8185 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
8186 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
8187 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
8188 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
8189 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
8190 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
8191 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
8192 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
8193 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
8194 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
8195 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
8196 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
8197 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
8198 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
8199 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
8200 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
8201 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
8202 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
8203 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
8204 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
8205 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
8206 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
8207 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
8208 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
8209 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
8210 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
8211 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
8212 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
8213 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
8214 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
8215 HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
8216 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
8217 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
8218 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
8219 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
8220 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
8221 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
8222 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
8223 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
8224 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
8225 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
8226 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
8227 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
8228 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
8229 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
8230 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
8231 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
8232 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
8233 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
8234 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
8235 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
8236 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
8237 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
8238 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
8239 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
8240 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
8241 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
8242 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
8243 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
8244 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
8245 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
8246 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
8247 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
8248 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
8251 MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
8253 MODULE_LICENSE("GPL");
8254 MODULE_DESCRIPTION("Realtek HD-audio codec");
8256 static struct hda_codec_driver realtek_driver = {
8257 .id = snd_hda_id_realtek,
8260 module_hda_codec_driver(realtek_driver);