2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for Realtek ALC codecs
6 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
8 * Takashi Iwai <tiwai@suse.de>
9 * Jonathan Woithe <jwoithe@just42.net>
11 * This driver is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <linux/dmi.h>
31 #include <linux/module.h>
32 #include <linux/input.h>
33 #include <sound/core.h>
34 #include <sound/jack.h>
35 #include "hda_codec.h"
36 #include "hda_local.h"
37 #include "hda_auto_parser.h"
39 #include "hda_generic.h"
41 /* keep halting ALC5505 DSP, for power saving */
42 #define HALT_REALTEK_ALC5505
45 #define GPIO_MASK 0x03
47 /* extra amp-initialization sequence types */
57 ALC_HEADSET_MODE_UNKNOWN,
58 ALC_HEADSET_MODE_UNPLUGGED,
59 ALC_HEADSET_MODE_HEADSET,
61 ALC_HEADSET_MODE_HEADPHONE,
65 ALC_HEADSET_TYPE_UNKNOWN,
66 ALC_HEADSET_TYPE_CTIA,
67 ALC_HEADSET_TYPE_OMTP,
71 ALC_KEY_MICMUTE_INDEX,
74 struct alc_customize_define {
76 unsigned char port_connectivity;
77 unsigned char check_sum;
78 unsigned char customization;
79 unsigned char external_amp;
80 unsigned int enable_pcbeep:1;
81 unsigned int platform_type:1;
83 unsigned int override:1;
84 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
88 struct hda_gen_spec gen; /* must be at head */
90 /* codec parameterization */
91 const struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
92 unsigned int num_mixers;
93 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
95 struct alc_customize_define cdefine;
96 unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
98 /* mute LED for HP laptops, see alc269_fixup_mic_mute_hook() */
99 int mute_led_polarity;
100 hda_nid_t mute_led_nid;
101 hda_nid_t cap_mute_led_nid;
103 unsigned int gpio_led; /* used for alc269_fixup_hp_gpio_led() */
104 unsigned int gpio_mute_led_mask;
105 unsigned int gpio_mic_led_mask;
107 hda_nid_t headset_mic_pin;
108 hda_nid_t headphone_mic_pin;
109 int current_headset_mode;
110 int current_headset_type;
113 void (*init_hook)(struct hda_codec *codec);
115 void (*power_hook)(struct hda_codec *codec);
117 void (*shutup)(struct hda_codec *codec);
118 void (*reboot_notify)(struct hda_codec *codec);
121 int codec_variant; /* flag for other variants */
122 unsigned int has_alc5505_dsp:1;
123 unsigned int no_depop_delay:1;
127 unsigned int pll_coef_idx, pll_coef_bit;
129 struct input_dev *kb_dev;
130 u8 alc_mute_keycode_map[1];
134 * COEF access helper functions
137 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
138 unsigned int coef_idx)
142 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
143 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
147 #define alc_read_coef_idx(codec, coef_idx) \
148 alc_read_coefex_idx(codec, 0x20, coef_idx)
150 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
151 unsigned int coef_idx, unsigned int coef_val)
153 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
154 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
157 #define alc_write_coef_idx(codec, coef_idx, coef_val) \
158 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
160 static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
161 unsigned int coef_idx, unsigned int mask,
162 unsigned int bits_set)
164 unsigned int val = alc_read_coefex_idx(codec, nid, coef_idx);
167 alc_write_coefex_idx(codec, nid, coef_idx,
168 (val & ~mask) | bits_set);
171 #define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
172 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
174 /* a special bypass for COEF 0; read the cached value at the second time */
175 static unsigned int alc_get_coef0(struct hda_codec *codec)
177 struct alc_spec *spec = codec->spec;
180 spec->coef0 = alc_read_coef_idx(codec, 0);
184 /* coef writes/updates batch */
192 #define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
193 { .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
194 #define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
195 #define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
196 #define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
198 static void alc_process_coef_fw(struct hda_codec *codec,
199 const struct coef_fw *fw)
201 for (; fw->nid; fw++) {
202 if (fw->mask == (unsigned short)-1)
203 alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
205 alc_update_coefex_idx(codec, fw->nid, fw->idx,
211 * Append the given mixer and verb elements for the later use
212 * The mixer array is referred in build_controls(), and init_verbs are
215 static void add_mixer(struct alc_spec *spec, const struct snd_kcontrol_new *mix)
217 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
219 spec->mixers[spec->num_mixers++] = mix;
223 * GPIO setup tables, used in initialization
225 /* Enable GPIO mask and set output */
226 static const struct hda_verb alc_gpio1_init_verbs[] = {
227 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
228 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
229 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
233 static const struct hda_verb alc_gpio2_init_verbs[] = {
234 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
235 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
236 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
240 static const struct hda_verb alc_gpio3_init_verbs[] = {
241 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
242 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
243 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
248 * Fix hardware PLL issue
249 * On some codecs, the analog PLL gating control must be off while
250 * the default value is 1.
252 static void alc_fix_pll(struct hda_codec *codec)
254 struct alc_spec *spec = codec->spec;
257 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
258 1 << spec->pll_coef_bit, 0);
261 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
262 unsigned int coef_idx, unsigned int coef_bit)
264 struct alc_spec *spec = codec->spec;
266 spec->pll_coef_idx = coef_idx;
267 spec->pll_coef_bit = coef_bit;
271 /* update the master volume per volume-knob's unsol event */
272 static void alc_update_knob_master(struct hda_codec *codec,
273 struct hda_jack_callback *jack)
276 struct snd_kcontrol *kctl;
277 struct snd_ctl_elem_value *uctl;
279 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
282 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
285 val = snd_hda_codec_read(codec, jack->nid, 0,
286 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
287 val &= HDA_AMP_VOLMASK;
288 uctl->value.integer.value[0] = val;
289 uctl->value.integer.value[1] = val;
290 kctl->put(kctl, uctl);
294 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
296 /* For some reason, the res given from ALC880 is broken.
297 Here we adjust it properly. */
298 snd_hda_jack_unsol_event(codec, res >> 2);
301 /* Change EAPD to verb control */
302 static void alc_fill_eapd_coef(struct hda_codec *codec)
306 coef = alc_get_coef0(codec);
308 switch (codec->core.vendor_id) {
310 alc_update_coef_idx(codec, 0x7, 0, 1<<5);
314 alc_update_coef_idx(codec, 0x7, 0, 1<<13);
317 if ((coef & 0x00f0) == 0x0010)
318 alc_update_coef_idx(codec, 0xd, 0, 1<<14);
319 if ((coef & 0x00f0) == 0x0020)
320 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
321 if ((coef & 0x00f0) == 0x0030)
322 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
328 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
344 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
348 alc_update_coef_idx(codec, 0xa, 1<<13, 0);
356 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
359 if ((coef & 0x00f0) == 0x0030)
360 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
369 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
372 alc_update_coef_idx(codec, 0x7, 3<<13, 0);
375 alc_update_coef_idx(codec, 0x4, 1<<10, 0);
378 if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
379 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
382 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
386 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
391 /* additional initialization for ALC888 variants */
392 static void alc888_coef_init(struct hda_codec *codec)
394 switch (alc_get_coef0(codec) & 0x00f0) {
399 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
404 /* turn on/off EAPD control (only if available) */
405 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
407 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
409 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
410 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
414 /* turn on/off EAPD controls of the codec */
415 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
417 /* We currently only handle front, HP */
418 static hda_nid_t pins[] = {
419 0x0f, 0x10, 0x14, 0x15, 0x17, 0
422 for (p = pins; *p; p++)
423 set_eapd(codec, *p, on);
426 /* generic shutup callback;
427 * just turning off EPAD and a little pause for avoiding pop-noise
429 static void alc_eapd_shutup(struct hda_codec *codec)
431 struct alc_spec *spec = codec->spec;
433 alc_auto_setup_eapd(codec, false);
434 if (!spec->no_depop_delay)
436 snd_hda_shutup_pins(codec);
439 /* generic EAPD initialization */
440 static void alc_auto_init_amp(struct hda_codec *codec, int type)
442 alc_fill_eapd_coef(codec);
443 alc_auto_setup_eapd(codec, true);
446 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
449 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
452 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
454 case ALC_INIT_DEFAULT:
455 switch (codec->core.vendor_id) {
457 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
463 alc_update_coef_idx(codec, 7, 0, 0x2030);
466 alc888_coef_init(codec);
475 * Realtek SSID verification
478 /* Could be any non-zero and even value. When used as fixup, tells
479 * the driver to ignore any present sku defines.
481 #define ALC_FIXUP_SKU_IGNORE (2)
483 static void alc_fixup_sku_ignore(struct hda_codec *codec,
484 const struct hda_fixup *fix, int action)
486 struct alc_spec *spec = codec->spec;
487 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
488 spec->cdefine.fixup = 1;
489 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
493 static void alc_fixup_no_depop_delay(struct hda_codec *codec,
494 const struct hda_fixup *fix, int action)
496 struct alc_spec *spec = codec->spec;
498 if (action == HDA_FIXUP_ACT_PROBE) {
499 spec->no_depop_delay = 1;
500 codec->depop_delay = 0;
504 static int alc_auto_parse_customize_define(struct hda_codec *codec)
506 unsigned int ass, tmp, i;
508 struct alc_spec *spec = codec->spec;
510 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
512 if (spec->cdefine.fixup) {
513 ass = spec->cdefine.sku_cfg;
514 if (ass == ALC_FIXUP_SKU_IGNORE)
519 if (!codec->bus->pci)
521 ass = codec->core.subsystem_id & 0xffff;
522 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
526 if (codec->core.vendor_id == 0x10ec0260)
528 ass = snd_hda_codec_get_pincfg(codec, nid);
531 codec_info(codec, "%s: SKU not ready 0x%08x\n",
532 codec->core.chip_name, ass);
538 for (i = 1; i < 16; i++) {
542 if (((ass >> 16) & 0xf) != tmp)
545 spec->cdefine.port_connectivity = ass >> 30;
546 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
547 spec->cdefine.check_sum = (ass >> 16) & 0xf;
548 spec->cdefine.customization = ass >> 8;
550 spec->cdefine.sku_cfg = ass;
551 spec->cdefine.external_amp = (ass & 0x38) >> 3;
552 spec->cdefine.platform_type = (ass & 0x4) >> 2;
553 spec->cdefine.swap = (ass & 0x2) >> 1;
554 spec->cdefine.override = ass & 0x1;
556 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
557 nid, spec->cdefine.sku_cfg);
558 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
559 spec->cdefine.port_connectivity);
560 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
561 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
562 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
563 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
564 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
565 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
566 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
571 /* return the position of NID in the list, or -1 if not found */
572 static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
575 for (i = 0; i < nums; i++)
580 /* return true if the given NID is found in the list */
581 static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
583 return find_idx_in_nid_list(nid, list, nums) >= 0;
586 /* check subsystem ID and set up device-specific initialization;
587 * return 1 if initialized, 0 if invalid SSID
589 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
590 * 31 ~ 16 : Manufacture ID
592 * 7 ~ 0 : Assembly ID
593 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
595 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
597 unsigned int ass, tmp, i;
599 struct alc_spec *spec = codec->spec;
601 if (spec->cdefine.fixup) {
602 ass = spec->cdefine.sku_cfg;
603 if (ass == ALC_FIXUP_SKU_IGNORE)
608 ass = codec->core.subsystem_id & 0xffff;
609 if (codec->bus->pci &&
610 ass != codec->bus->pci->subsystem_device && (ass & 1))
613 /* invalid SSID, check the special NID pin defcfg instead */
615 * 31~30 : port connectivity
618 * 19~16 : Check sum (15:1)
623 if (codec->core.vendor_id == 0x10ec0260)
625 ass = snd_hda_codec_get_pincfg(codec, nid);
627 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
631 if ((ass >> 30) != 1) /* no physical connection */
636 for (i = 1; i < 16; i++) {
640 if (((ass >> 16) & 0xf) != tmp)
643 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
644 ass & 0xffff, codec->core.vendor_id);
648 * 2 : 0 --> Desktop, 1 --> Laptop
649 * 3~5 : External Amplifier control
652 tmp = (ass & 0x38) >> 3; /* external Amp control */
655 spec->init_amp = ALC_INIT_GPIO1;
658 spec->init_amp = ALC_INIT_GPIO2;
661 spec->init_amp = ALC_INIT_GPIO3;
665 spec->init_amp = ALC_INIT_DEFAULT;
669 /* is laptop or Desktop and enable the function "Mute internal speaker
670 * when the external headphone out jack is plugged"
675 * 10~8 : Jack location
676 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
678 * 15 : 1 --> enable the function "Mute internal speaker
679 * when the external headphone out jack is plugged"
681 if (!spec->gen.autocfg.hp_pins[0] &&
682 !(spec->gen.autocfg.line_out_pins[0] &&
683 spec->gen.autocfg.line_out_type == AUTO_PIN_HP_OUT)) {
685 tmp = (ass >> 11) & 0x3; /* HP to chassis */
687 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
688 spec->gen.autocfg.line_outs))
690 spec->gen.autocfg.hp_pins[0] = nid;
695 /* Check the validity of ALC subsystem-id
696 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
697 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
699 if (!alc_subsystem_id(codec, ports)) {
700 struct alc_spec *spec = codec->spec;
702 "realtek: Enable default setup for auto mode as fallback\n");
703 spec->init_amp = ALC_INIT_DEFAULT;
710 static void alc_fixup_inv_dmic(struct hda_codec *codec,
711 const struct hda_fixup *fix, int action)
713 struct alc_spec *spec = codec->spec;
715 spec->gen.inv_dmic_split = 1;
719 #ifdef CONFIG_SND_HDA_INPUT_BEEP
720 /* additional beep mixers; the actual parameters are overwritten at build */
721 static const struct snd_kcontrol_new alc_beep_mixer[] = {
722 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
723 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
728 static int alc_build_controls(struct hda_codec *codec)
730 struct alc_spec *spec = codec->spec;
733 err = snd_hda_gen_build_controls(codec);
737 for (i = 0; i < spec->num_mixers; i++) {
738 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
743 #ifdef CONFIG_SND_HDA_INPUT_BEEP
744 /* create beep controls if needed */
745 if (spec->beep_amp) {
746 const struct snd_kcontrol_new *knew;
747 for (knew = alc_beep_mixer; knew->name; knew++) {
748 struct snd_kcontrol *kctl;
749 kctl = snd_ctl_new1(knew, codec);
752 kctl->private_value = spec->beep_amp;
753 err = snd_hda_ctl_add(codec, 0, kctl);
760 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
769 static int alc_init(struct hda_codec *codec)
771 struct alc_spec *spec = codec->spec;
774 spec->init_hook(codec);
776 snd_hda_gen_init(codec);
778 alc_auto_init_amp(codec, spec->init_amp);
780 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
785 static inline void alc_shutup(struct hda_codec *codec)
787 struct alc_spec *spec = codec->spec;
789 if (spec && spec->shutup)
792 snd_hda_shutup_pins(codec);
795 static void alc_reboot_notify(struct hda_codec *codec)
797 struct alc_spec *spec = codec->spec;
799 if (spec && spec->reboot_notify)
800 spec->reboot_notify(codec);
805 /* power down codec to D3 at reboot/shutdown; set as reboot_notify ops */
806 static void alc_d3_at_reboot(struct hda_codec *codec)
808 snd_hda_codec_set_power_to_all(codec, codec->core.afg, AC_PWRST_D3);
809 snd_hda_codec_write(codec, codec->core.afg, 0,
810 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
814 #define alc_free snd_hda_gen_free
817 static void alc_power_eapd(struct hda_codec *codec)
819 alc_auto_setup_eapd(codec, false);
822 static int alc_suspend(struct hda_codec *codec)
824 struct alc_spec *spec = codec->spec;
826 if (spec && spec->power_hook)
827 spec->power_hook(codec);
833 static int alc_resume(struct hda_codec *codec)
835 struct alc_spec *spec = codec->spec;
837 if (!spec->no_depop_delay)
838 msleep(150); /* to avoid pop noise */
839 codec->patch_ops.init(codec);
840 regcache_sync(codec->core.regmap);
841 hda_call_check_power_status(codec, 0x01);
848 static const struct hda_codec_ops alc_patch_ops = {
849 .build_controls = alc_build_controls,
850 .build_pcms = snd_hda_gen_build_pcms,
853 .unsol_event = snd_hda_jack_unsol_event,
855 .resume = alc_resume,
856 .suspend = alc_suspend,
857 .check_power_status = snd_hda_gen_check_power_status,
859 .reboot_notify = alc_reboot_notify,
863 #define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
866 * Rename codecs appropriately from COEF value or subvendor id
868 struct alc_codec_rename_table {
869 unsigned int vendor_id;
870 unsigned short coef_mask;
871 unsigned short coef_bits;
875 struct alc_codec_rename_pci_table {
876 unsigned int codec_vendor_id;
877 unsigned short pci_subvendor;
878 unsigned short pci_subdevice;
882 static struct alc_codec_rename_table rename_tbl[] = {
883 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
884 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
885 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
886 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
887 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
888 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
889 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
890 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
891 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
892 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
893 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
894 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
895 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
896 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
897 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
898 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
899 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
903 static struct alc_codec_rename_pci_table rename_pci_tbl[] = {
904 { 0x10ec0280, 0x1028, 0, "ALC3220" },
905 { 0x10ec0282, 0x1028, 0, "ALC3221" },
906 { 0x10ec0283, 0x1028, 0, "ALC3223" },
907 { 0x10ec0288, 0x1028, 0, "ALC3263" },
908 { 0x10ec0292, 0x1028, 0, "ALC3226" },
909 { 0x10ec0293, 0x1028, 0, "ALC3235" },
910 { 0x10ec0255, 0x1028, 0, "ALC3234" },
911 { 0x10ec0668, 0x1028, 0, "ALC3661" },
912 { 0x10ec0275, 0x1028, 0, "ALC3260" },
913 { 0x10ec0899, 0x1028, 0, "ALC3861" },
914 { 0x10ec0298, 0x1028, 0, "ALC3266" },
915 { 0x10ec0236, 0x1028, 0, "ALC3204" },
916 { 0x10ec0256, 0x1028, 0, "ALC3246" },
917 { 0x10ec0225, 0x1028, 0, "ALC3253" },
918 { 0x10ec0295, 0x1028, 0, "ALC3254" },
919 { 0x10ec0299, 0x1028, 0, "ALC3271" },
920 { 0x10ec0670, 0x1025, 0, "ALC669X" },
921 { 0x10ec0676, 0x1025, 0, "ALC679X" },
922 { 0x10ec0282, 0x1043, 0, "ALC3229" },
923 { 0x10ec0233, 0x1043, 0, "ALC3236" },
924 { 0x10ec0280, 0x103c, 0, "ALC3228" },
925 { 0x10ec0282, 0x103c, 0, "ALC3227" },
926 { 0x10ec0286, 0x103c, 0, "ALC3242" },
927 { 0x10ec0290, 0x103c, 0, "ALC3241" },
928 { 0x10ec0668, 0x103c, 0, "ALC3662" },
929 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
930 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
934 static int alc_codec_rename_from_preset(struct hda_codec *codec)
936 const struct alc_codec_rename_table *p;
937 const struct alc_codec_rename_pci_table *q;
939 for (p = rename_tbl; p->vendor_id; p++) {
940 if (p->vendor_id != codec->core.vendor_id)
942 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
943 return alc_codec_rename(codec, p->name);
946 if (!codec->bus->pci)
948 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
949 if (q->codec_vendor_id != codec->core.vendor_id)
951 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
953 if (!q->pci_subdevice ||
954 q->pci_subdevice == codec->bus->pci->subsystem_device)
955 return alc_codec_rename(codec, q->name);
963 * Digital-beep handlers
965 #ifdef CONFIG_SND_HDA_INPUT_BEEP
966 #define set_beep_amp(spec, nid, idx, dir) \
967 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
969 static const struct snd_pci_quirk beep_white_list[] = {
970 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
971 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
972 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
973 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
974 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
975 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
976 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
977 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
978 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
982 static inline int has_cdefine_beep(struct hda_codec *codec)
984 struct alc_spec *spec = codec->spec;
985 const struct snd_pci_quirk *q;
986 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list);
989 return spec->cdefine.enable_pcbeep;
992 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
993 #define has_cdefine_beep(codec) 0
996 /* parse the BIOS configuration and set up the alc_spec */
997 /* return 1 if successful, 0 if the proper config is not found,
998 * or a negative error code
1000 static int alc_parse_auto_config(struct hda_codec *codec,
1001 const hda_nid_t *ignore_nids,
1002 const hda_nid_t *ssid_nids)
1004 struct alc_spec *spec = codec->spec;
1005 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
1008 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1014 alc_ssid_check(codec, ssid_nids);
1016 err = snd_hda_gen_parse_auto_config(codec, cfg);
1023 /* common preparation job for alc_spec */
1024 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1026 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1032 snd_hda_gen_spec_init(&spec->gen);
1033 spec->gen.mixer_nid = mixer_nid;
1034 spec->gen.own_eapd_ctl = 1;
1035 codec->single_adc_amp = 1;
1036 /* FIXME: do we need this for all Realtek codec models? */
1037 codec->spdif_status_reset = 1;
1038 codec->patch_ops = alc_patch_ops;
1040 err = alc_codec_rename_from_preset(codec);
1048 static int alc880_parse_auto_config(struct hda_codec *codec)
1050 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
1051 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
1052 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1061 ALC880_FIXUP_MEDION_RIM,
1063 ALC880_FIXUP_LG_LW25,
1065 ALC880_FIXUP_EAPD_COEF,
1066 ALC880_FIXUP_TCL_S700,
1067 ALC880_FIXUP_VOL_KNOB,
1068 ALC880_FIXUP_FUJITSU,
1070 ALC880_FIXUP_UNIWILL,
1071 ALC880_FIXUP_UNIWILL_DIG,
1073 ALC880_FIXUP_ASUS_W5A,
1074 ALC880_FIXUP_3ST_BASE,
1076 ALC880_FIXUP_3ST_DIG,
1077 ALC880_FIXUP_5ST_BASE,
1079 ALC880_FIXUP_5ST_DIG,
1080 ALC880_FIXUP_6ST_BASE,
1082 ALC880_FIXUP_6ST_DIG,
1083 ALC880_FIXUP_6ST_AUTOMUTE,
1086 /* enable the volume-knob widget support on NID 0x21 */
1087 static void alc880_fixup_vol_knob(struct hda_codec *codec,
1088 const struct hda_fixup *fix, int action)
1090 if (action == HDA_FIXUP_ACT_PROBE)
1091 snd_hda_jack_detect_enable_callback(codec, 0x21,
1092 alc_update_knob_master);
1095 static const struct hda_fixup alc880_fixups[] = {
1096 [ALC880_FIXUP_GPIO1] = {
1097 .type = HDA_FIXUP_VERBS,
1098 .v.verbs = alc_gpio1_init_verbs,
1100 [ALC880_FIXUP_GPIO2] = {
1101 .type = HDA_FIXUP_VERBS,
1102 .v.verbs = alc_gpio2_init_verbs,
1104 [ALC880_FIXUP_MEDION_RIM] = {
1105 .type = HDA_FIXUP_VERBS,
1106 .v.verbs = (const struct hda_verb[]) {
1107 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1108 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1112 .chain_id = ALC880_FIXUP_GPIO2,
1114 [ALC880_FIXUP_LG] = {
1115 .type = HDA_FIXUP_PINS,
1116 .v.pins = (const struct hda_pintbl[]) {
1117 /* disable bogus unused pins */
1118 { 0x16, 0x411111f0 },
1119 { 0x18, 0x411111f0 },
1120 { 0x1a, 0x411111f0 },
1124 [ALC880_FIXUP_LG_LW25] = {
1125 .type = HDA_FIXUP_PINS,
1126 .v.pins = (const struct hda_pintbl[]) {
1127 { 0x1a, 0x0181344f }, /* line-in */
1128 { 0x1b, 0x0321403f }, /* headphone */
1132 [ALC880_FIXUP_W810] = {
1133 .type = HDA_FIXUP_PINS,
1134 .v.pins = (const struct hda_pintbl[]) {
1135 /* disable bogus unused pins */
1136 { 0x17, 0x411111f0 },
1140 .chain_id = ALC880_FIXUP_GPIO2,
1142 [ALC880_FIXUP_EAPD_COEF] = {
1143 .type = HDA_FIXUP_VERBS,
1144 .v.verbs = (const struct hda_verb[]) {
1145 /* change to EAPD mode */
1146 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1147 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1151 [ALC880_FIXUP_TCL_S700] = {
1152 .type = HDA_FIXUP_VERBS,
1153 .v.verbs = (const struct hda_verb[]) {
1154 /* change to EAPD mode */
1155 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1156 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1160 .chain_id = ALC880_FIXUP_GPIO2,
1162 [ALC880_FIXUP_VOL_KNOB] = {
1163 .type = HDA_FIXUP_FUNC,
1164 .v.func = alc880_fixup_vol_knob,
1166 [ALC880_FIXUP_FUJITSU] = {
1167 /* override all pins as BIOS on old Amilo is broken */
1168 .type = HDA_FIXUP_PINS,
1169 .v.pins = (const struct hda_pintbl[]) {
1170 { 0x14, 0x0121401f }, /* HP */
1171 { 0x15, 0x99030120 }, /* speaker */
1172 { 0x16, 0x99030130 }, /* bass speaker */
1173 { 0x17, 0x411111f0 }, /* N/A */
1174 { 0x18, 0x411111f0 }, /* N/A */
1175 { 0x19, 0x01a19950 }, /* mic-in */
1176 { 0x1a, 0x411111f0 }, /* N/A */
1177 { 0x1b, 0x411111f0 }, /* N/A */
1178 { 0x1c, 0x411111f0 }, /* N/A */
1179 { 0x1d, 0x411111f0 }, /* N/A */
1180 { 0x1e, 0x01454140 }, /* SPDIF out */
1184 .chain_id = ALC880_FIXUP_VOL_KNOB,
1186 [ALC880_FIXUP_F1734] = {
1187 /* almost compatible with FUJITSU, but no bass and SPDIF */
1188 .type = HDA_FIXUP_PINS,
1189 .v.pins = (const struct hda_pintbl[]) {
1190 { 0x14, 0x0121401f }, /* HP */
1191 { 0x15, 0x99030120 }, /* speaker */
1192 { 0x16, 0x411111f0 }, /* N/A */
1193 { 0x17, 0x411111f0 }, /* N/A */
1194 { 0x18, 0x411111f0 }, /* N/A */
1195 { 0x19, 0x01a19950 }, /* mic-in */
1196 { 0x1a, 0x411111f0 }, /* N/A */
1197 { 0x1b, 0x411111f0 }, /* N/A */
1198 { 0x1c, 0x411111f0 }, /* N/A */
1199 { 0x1d, 0x411111f0 }, /* N/A */
1200 { 0x1e, 0x411111f0 }, /* N/A */
1204 .chain_id = ALC880_FIXUP_VOL_KNOB,
1206 [ALC880_FIXUP_UNIWILL] = {
1207 /* need to fix HP and speaker pins to be parsed correctly */
1208 .type = HDA_FIXUP_PINS,
1209 .v.pins = (const struct hda_pintbl[]) {
1210 { 0x14, 0x0121411f }, /* HP */
1211 { 0x15, 0x99030120 }, /* speaker */
1212 { 0x16, 0x99030130 }, /* bass speaker */
1216 [ALC880_FIXUP_UNIWILL_DIG] = {
1217 .type = HDA_FIXUP_PINS,
1218 .v.pins = (const struct hda_pintbl[]) {
1219 /* disable bogus unused pins */
1220 { 0x17, 0x411111f0 },
1221 { 0x19, 0x411111f0 },
1222 { 0x1b, 0x411111f0 },
1223 { 0x1f, 0x411111f0 },
1227 [ALC880_FIXUP_Z71V] = {
1228 .type = HDA_FIXUP_PINS,
1229 .v.pins = (const struct hda_pintbl[]) {
1230 /* set up the whole pins as BIOS is utterly broken */
1231 { 0x14, 0x99030120 }, /* speaker */
1232 { 0x15, 0x0121411f }, /* HP */
1233 { 0x16, 0x411111f0 }, /* N/A */
1234 { 0x17, 0x411111f0 }, /* N/A */
1235 { 0x18, 0x01a19950 }, /* mic-in */
1236 { 0x19, 0x411111f0 }, /* N/A */
1237 { 0x1a, 0x01813031 }, /* line-in */
1238 { 0x1b, 0x411111f0 }, /* N/A */
1239 { 0x1c, 0x411111f0 }, /* N/A */
1240 { 0x1d, 0x411111f0 }, /* N/A */
1241 { 0x1e, 0x0144111e }, /* SPDIF */
1245 [ALC880_FIXUP_ASUS_W5A] = {
1246 .type = HDA_FIXUP_PINS,
1247 .v.pins = (const struct hda_pintbl[]) {
1248 /* set up the whole pins as BIOS is utterly broken */
1249 { 0x14, 0x0121411f }, /* HP */
1250 { 0x15, 0x411111f0 }, /* N/A */
1251 { 0x16, 0x411111f0 }, /* N/A */
1252 { 0x17, 0x411111f0 }, /* N/A */
1253 { 0x18, 0x90a60160 }, /* mic */
1254 { 0x19, 0x411111f0 }, /* N/A */
1255 { 0x1a, 0x411111f0 }, /* N/A */
1256 { 0x1b, 0x411111f0 }, /* N/A */
1257 { 0x1c, 0x411111f0 }, /* N/A */
1258 { 0x1d, 0x411111f0 }, /* N/A */
1259 { 0x1e, 0xb743111e }, /* SPDIF out */
1263 .chain_id = ALC880_FIXUP_GPIO1,
1265 [ALC880_FIXUP_3ST_BASE] = {
1266 .type = HDA_FIXUP_PINS,
1267 .v.pins = (const struct hda_pintbl[]) {
1268 { 0x14, 0x01014010 }, /* line-out */
1269 { 0x15, 0x411111f0 }, /* N/A */
1270 { 0x16, 0x411111f0 }, /* N/A */
1271 { 0x17, 0x411111f0 }, /* N/A */
1272 { 0x18, 0x01a19c30 }, /* mic-in */
1273 { 0x19, 0x0121411f }, /* HP */
1274 { 0x1a, 0x01813031 }, /* line-in */
1275 { 0x1b, 0x02a19c40 }, /* front-mic */
1276 { 0x1c, 0x411111f0 }, /* N/A */
1277 { 0x1d, 0x411111f0 }, /* N/A */
1278 /* 0x1e is filled in below */
1279 { 0x1f, 0x411111f0 }, /* N/A */
1283 [ALC880_FIXUP_3ST] = {
1284 .type = HDA_FIXUP_PINS,
1285 .v.pins = (const struct hda_pintbl[]) {
1286 { 0x1e, 0x411111f0 }, /* N/A */
1290 .chain_id = ALC880_FIXUP_3ST_BASE,
1292 [ALC880_FIXUP_3ST_DIG] = {
1293 .type = HDA_FIXUP_PINS,
1294 .v.pins = (const struct hda_pintbl[]) {
1295 { 0x1e, 0x0144111e }, /* SPDIF */
1299 .chain_id = ALC880_FIXUP_3ST_BASE,
1301 [ALC880_FIXUP_5ST_BASE] = {
1302 .type = HDA_FIXUP_PINS,
1303 .v.pins = (const struct hda_pintbl[]) {
1304 { 0x14, 0x01014010 }, /* front */
1305 { 0x15, 0x411111f0 }, /* N/A */
1306 { 0x16, 0x01011411 }, /* CLFE */
1307 { 0x17, 0x01016412 }, /* surr */
1308 { 0x18, 0x01a19c30 }, /* mic-in */
1309 { 0x19, 0x0121411f }, /* HP */
1310 { 0x1a, 0x01813031 }, /* line-in */
1311 { 0x1b, 0x02a19c40 }, /* front-mic */
1312 { 0x1c, 0x411111f0 }, /* N/A */
1313 { 0x1d, 0x411111f0 }, /* N/A */
1314 /* 0x1e is filled in below */
1315 { 0x1f, 0x411111f0 }, /* N/A */
1319 [ALC880_FIXUP_5ST] = {
1320 .type = HDA_FIXUP_PINS,
1321 .v.pins = (const struct hda_pintbl[]) {
1322 { 0x1e, 0x411111f0 }, /* N/A */
1326 .chain_id = ALC880_FIXUP_5ST_BASE,
1328 [ALC880_FIXUP_5ST_DIG] = {
1329 .type = HDA_FIXUP_PINS,
1330 .v.pins = (const struct hda_pintbl[]) {
1331 { 0x1e, 0x0144111e }, /* SPDIF */
1335 .chain_id = ALC880_FIXUP_5ST_BASE,
1337 [ALC880_FIXUP_6ST_BASE] = {
1338 .type = HDA_FIXUP_PINS,
1339 .v.pins = (const struct hda_pintbl[]) {
1340 { 0x14, 0x01014010 }, /* front */
1341 { 0x15, 0x01016412 }, /* surr */
1342 { 0x16, 0x01011411 }, /* CLFE */
1343 { 0x17, 0x01012414 }, /* side */
1344 { 0x18, 0x01a19c30 }, /* mic-in */
1345 { 0x19, 0x02a19c40 }, /* front-mic */
1346 { 0x1a, 0x01813031 }, /* line-in */
1347 { 0x1b, 0x0121411f }, /* HP */
1348 { 0x1c, 0x411111f0 }, /* N/A */
1349 { 0x1d, 0x411111f0 }, /* N/A */
1350 /* 0x1e is filled in below */
1351 { 0x1f, 0x411111f0 }, /* N/A */
1355 [ALC880_FIXUP_6ST] = {
1356 .type = HDA_FIXUP_PINS,
1357 .v.pins = (const struct hda_pintbl[]) {
1358 { 0x1e, 0x411111f0 }, /* N/A */
1362 .chain_id = ALC880_FIXUP_6ST_BASE,
1364 [ALC880_FIXUP_6ST_DIG] = {
1365 .type = HDA_FIXUP_PINS,
1366 .v.pins = (const struct hda_pintbl[]) {
1367 { 0x1e, 0x0144111e }, /* SPDIF */
1371 .chain_id = ALC880_FIXUP_6ST_BASE,
1373 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1374 .type = HDA_FIXUP_PINS,
1375 .v.pins = (const struct hda_pintbl[]) {
1376 { 0x1b, 0x0121401f }, /* HP with jack detect */
1379 .chained_before = true,
1380 .chain_id = ALC880_FIXUP_6ST_BASE,
1384 static const struct snd_pci_quirk alc880_fixup_tbl[] = {
1385 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
1386 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
1387 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
1388 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
1389 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
1390 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
1391 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
1392 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
1393 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
1394 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
1395 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
1396 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
1397 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
1398 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
1399 SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
1400 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
1401 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
1402 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
1403 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1404 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1405 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
1406 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
1407 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
1409 /* Below is the copied entries from alc880_quirks.c.
1410 * It's not quite sure whether BIOS sets the correct pin-config table
1411 * on these machines, thus they are kept to be compatible with
1412 * the old static quirks. Once when it's confirmed to work without
1413 * these overrides, it'd be better to remove.
1415 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1416 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1417 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1418 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1419 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1420 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1421 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1422 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1423 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1424 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1425 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1426 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1427 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1428 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1429 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1430 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1431 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1432 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1433 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1434 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1435 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1436 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1437 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1438 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1439 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1440 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1441 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1442 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1443 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1444 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1445 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1446 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1447 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1449 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1450 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1451 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1455 static const struct hda_model_fixup alc880_fixup_models[] = {
1456 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1457 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1458 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1459 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1460 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1461 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
1462 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
1468 * OK, here we have finally the patch for ALC880
1470 static int patch_alc880(struct hda_codec *codec)
1472 struct alc_spec *spec;
1475 err = alc_alloc_spec(codec, 0x0b);
1480 spec->gen.need_dac_fix = 1;
1481 spec->gen.beep_nid = 0x01;
1483 codec->patch_ops.unsol_event = alc880_unsol_event;
1485 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
1487 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1489 /* automatic parse from the BIOS config */
1490 err = alc880_parse_auto_config(codec);
1494 if (!spec->gen.no_analog)
1495 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1497 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1510 static int alc260_parse_auto_config(struct hda_codec *codec)
1512 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
1513 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1514 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
1521 ALC260_FIXUP_HP_DC5750,
1522 ALC260_FIXUP_HP_PIN_0F,
1525 ALC260_FIXUP_GPIO1_TOGGLE,
1526 ALC260_FIXUP_REPLACER,
1527 ALC260_FIXUP_HP_B1900,
1529 ALC260_FIXUP_FSC_S7020,
1530 ALC260_FIXUP_FSC_S7020_JWSE,
1531 ALC260_FIXUP_VAIO_PINS,
1534 static void alc260_gpio1_automute(struct hda_codec *codec)
1536 struct alc_spec *spec = codec->spec;
1537 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
1538 spec->gen.hp_jack_present);
1541 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1542 const struct hda_fixup *fix, int action)
1544 struct alc_spec *spec = codec->spec;
1545 if (action == HDA_FIXUP_ACT_PROBE) {
1546 /* although the machine has only one output pin, we need to
1547 * toggle GPIO1 according to the jack state
1549 spec->gen.automute_hook = alc260_gpio1_automute;
1550 spec->gen.detect_hp = 1;
1551 spec->gen.automute_speaker = 1;
1552 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
1553 snd_hda_jack_detect_enable_callback(codec, 0x0f,
1554 snd_hda_gen_hp_automute);
1555 snd_hda_add_verbs(codec, alc_gpio1_init_verbs);
1559 static void alc260_fixup_kn1(struct hda_codec *codec,
1560 const struct hda_fixup *fix, int action)
1562 struct alc_spec *spec = codec->spec;
1563 static const struct hda_pintbl pincfgs[] = {
1564 { 0x0f, 0x02214000 }, /* HP/speaker */
1565 { 0x12, 0x90a60160 }, /* int mic */
1566 { 0x13, 0x02a19000 }, /* ext mic */
1567 { 0x18, 0x01446000 }, /* SPDIF out */
1568 /* disable bogus I/O pins */
1569 { 0x10, 0x411111f0 },
1570 { 0x11, 0x411111f0 },
1571 { 0x14, 0x411111f0 },
1572 { 0x15, 0x411111f0 },
1573 { 0x16, 0x411111f0 },
1574 { 0x17, 0x411111f0 },
1575 { 0x19, 0x411111f0 },
1580 case HDA_FIXUP_ACT_PRE_PROBE:
1581 snd_hda_apply_pincfgs(codec, pincfgs);
1583 case HDA_FIXUP_ACT_PROBE:
1584 spec->init_amp = ALC_INIT_NONE;
1589 static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1590 const struct hda_fixup *fix, int action)
1592 struct alc_spec *spec = codec->spec;
1593 if (action == HDA_FIXUP_ACT_PROBE)
1594 spec->init_amp = ALC_INIT_NONE;
1597 static void alc260_fixup_fsc_s7020_jwse(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_PRE_PROBE) {
1602 spec->gen.add_jack_modes = 1;
1603 spec->gen.hp_mic = 1;
1607 static const struct hda_fixup alc260_fixups[] = {
1608 [ALC260_FIXUP_HP_DC5750] = {
1609 .type = HDA_FIXUP_PINS,
1610 .v.pins = (const struct hda_pintbl[]) {
1611 { 0x11, 0x90130110 }, /* speaker */
1615 [ALC260_FIXUP_HP_PIN_0F] = {
1616 .type = HDA_FIXUP_PINS,
1617 .v.pins = (const struct hda_pintbl[]) {
1618 { 0x0f, 0x01214000 }, /* HP */
1622 [ALC260_FIXUP_COEF] = {
1623 .type = HDA_FIXUP_VERBS,
1624 .v.verbs = (const struct hda_verb[]) {
1625 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1626 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
1630 [ALC260_FIXUP_GPIO1] = {
1631 .type = HDA_FIXUP_VERBS,
1632 .v.verbs = alc_gpio1_init_verbs,
1634 [ALC260_FIXUP_GPIO1_TOGGLE] = {
1635 .type = HDA_FIXUP_FUNC,
1636 .v.func = alc260_fixup_gpio1_toggle,
1638 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1640 [ALC260_FIXUP_REPLACER] = {
1641 .type = HDA_FIXUP_VERBS,
1642 .v.verbs = (const struct hda_verb[]) {
1643 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1644 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
1648 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1650 [ALC260_FIXUP_HP_B1900] = {
1651 .type = HDA_FIXUP_FUNC,
1652 .v.func = alc260_fixup_gpio1_toggle,
1654 .chain_id = ALC260_FIXUP_COEF,
1656 [ALC260_FIXUP_KN1] = {
1657 .type = HDA_FIXUP_FUNC,
1658 .v.func = alc260_fixup_kn1,
1660 [ALC260_FIXUP_FSC_S7020] = {
1661 .type = HDA_FIXUP_FUNC,
1662 .v.func = alc260_fixup_fsc_s7020,
1664 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1665 .type = HDA_FIXUP_FUNC,
1666 .v.func = alc260_fixup_fsc_s7020_jwse,
1668 .chain_id = ALC260_FIXUP_FSC_S7020,
1670 [ALC260_FIXUP_VAIO_PINS] = {
1671 .type = HDA_FIXUP_PINS,
1672 .v.pins = (const struct hda_pintbl[]) {
1673 /* Pin configs are missing completely on some VAIOs */
1674 { 0x0f, 0x01211020 },
1675 { 0x10, 0x0001003f },
1676 { 0x11, 0x411111f0 },
1677 { 0x12, 0x01a15930 },
1678 { 0x13, 0x411111f0 },
1679 { 0x14, 0x411111f0 },
1680 { 0x15, 0x411111f0 },
1681 { 0x16, 0x411111f0 },
1682 { 0x17, 0x411111f0 },
1683 { 0x18, 0x411111f0 },
1684 { 0x19, 0x411111f0 },
1690 static const struct snd_pci_quirk alc260_fixup_tbl[] = {
1691 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
1692 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
1693 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
1694 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
1695 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
1696 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
1697 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
1698 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
1699 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
1700 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
1701 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
1702 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
1706 static const struct hda_model_fixup alc260_fixup_models[] = {
1707 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1708 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1709 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1710 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1716 static int patch_alc260(struct hda_codec *codec)
1718 struct alc_spec *spec;
1721 err = alc_alloc_spec(codec, 0x07);
1726 /* as quite a few machines require HP amp for speaker outputs,
1727 * it's easier to enable it unconditionally; even if it's unneeded,
1728 * it's almost harmless.
1730 spec->gen.prefer_hp_amp = 1;
1731 spec->gen.beep_nid = 0x01;
1733 spec->shutup = alc_eapd_shutup;
1735 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1737 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1739 /* automatic parse from the BIOS config */
1740 err = alc260_parse_auto_config(codec);
1744 if (!spec->gen.no_analog)
1745 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1747 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1758 * ALC882/883/885/888/889 support
1760 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1761 * configuration. Each pin widget can choose any input DACs and a mixer.
1762 * Each ADC is connected from a mixer of all inputs. This makes possible
1763 * 6-channel independent captures.
1765 * In addition, an independent DAC for the multi-playback (not used in this
1773 ALC882_FIXUP_ABIT_AW9D_MAX,
1774 ALC882_FIXUP_LENOVO_Y530,
1775 ALC882_FIXUP_PB_M5210,
1776 ALC882_FIXUP_ACER_ASPIRE_7736,
1777 ALC882_FIXUP_ASUS_W90V,
1779 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
1780 ALC889_FIXUP_VAIO_TT,
1781 ALC888_FIXUP_EEE1601,
1784 ALC883_FIXUP_ACER_EAPD,
1789 ALC882_FIXUP_ASUS_W2JC,
1790 ALC882_FIXUP_ACER_ASPIRE_4930G,
1791 ALC882_FIXUP_ACER_ASPIRE_8930G,
1792 ALC882_FIXUP_ASPIRE_8930G_VERBS,
1793 ALC885_FIXUP_MACPRO_GPIO,
1794 ALC889_FIXUP_DAC_ROUTE,
1795 ALC889_FIXUP_MBP_VREF,
1796 ALC889_FIXUP_IMAC91_VREF,
1797 ALC889_FIXUP_MBA11_VREF,
1798 ALC889_FIXUP_MBA21_VREF,
1799 ALC889_FIXUP_MP11_VREF,
1800 ALC889_FIXUP_MP41_VREF,
1801 ALC882_FIXUP_INV_DMIC,
1802 ALC882_FIXUP_NO_PRIMARY_HP,
1803 ALC887_FIXUP_ASUS_BASS,
1804 ALC887_FIXUP_BASS_CHMAP,
1807 static void alc889_fixup_coef(struct hda_codec *codec,
1808 const struct hda_fixup *fix, int action)
1810 if (action != HDA_FIXUP_ACT_INIT)
1812 alc_update_coef_idx(codec, 7, 0, 0x2030);
1815 /* toggle speaker-output according to the hp-jack state */
1816 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
1818 unsigned int gpiostate, gpiomask, gpiodir;
1820 gpiostate = snd_hda_codec_read(codec, codec->core.afg, 0,
1821 AC_VERB_GET_GPIO_DATA, 0);
1824 gpiostate |= (1 << pin);
1826 gpiostate &= ~(1 << pin);
1828 gpiomask = snd_hda_codec_read(codec, codec->core.afg, 0,
1829 AC_VERB_GET_GPIO_MASK, 0);
1830 gpiomask |= (1 << pin);
1832 gpiodir = snd_hda_codec_read(codec, codec->core.afg, 0,
1833 AC_VERB_GET_GPIO_DIRECTION, 0);
1834 gpiodir |= (1 << pin);
1837 snd_hda_codec_write(codec, codec->core.afg, 0,
1838 AC_VERB_SET_GPIO_MASK, gpiomask);
1839 snd_hda_codec_write(codec, codec->core.afg, 0,
1840 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
1844 snd_hda_codec_write(codec, codec->core.afg, 0,
1845 AC_VERB_SET_GPIO_DATA, gpiostate);
1848 /* set up GPIO at initialization */
1849 static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
1850 const struct hda_fixup *fix, int action)
1852 if (action != HDA_FIXUP_ACT_INIT)
1854 alc882_gpio_mute(codec, 0, 0);
1855 alc882_gpio_mute(codec, 1, 0);
1858 /* Fix the connection of some pins for ALC889:
1859 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
1860 * work correctly (bko#42740)
1862 static void alc889_fixup_dac_route(struct hda_codec *codec,
1863 const struct hda_fixup *fix, int action)
1865 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1866 /* fake the connections during parsing the tree */
1867 hda_nid_t conn1[2] = { 0x0c, 0x0d };
1868 hda_nid_t conn2[2] = { 0x0e, 0x0f };
1869 snd_hda_override_conn_list(codec, 0x14, 2, conn1);
1870 snd_hda_override_conn_list(codec, 0x15, 2, conn1);
1871 snd_hda_override_conn_list(codec, 0x18, 2, conn2);
1872 snd_hda_override_conn_list(codec, 0x1a, 2, conn2);
1873 } else if (action == HDA_FIXUP_ACT_PROBE) {
1874 /* restore the connections */
1875 hda_nid_t conn[5] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
1876 snd_hda_override_conn_list(codec, 0x14, 5, conn);
1877 snd_hda_override_conn_list(codec, 0x15, 5, conn);
1878 snd_hda_override_conn_list(codec, 0x18, 5, conn);
1879 snd_hda_override_conn_list(codec, 0x1a, 5, conn);
1883 /* Set VREF on HP pin */
1884 static void alc889_fixup_mbp_vref(struct hda_codec *codec,
1885 const struct hda_fixup *fix, int action)
1887 struct alc_spec *spec = codec->spec;
1888 static hda_nid_t nids[3] = { 0x14, 0x15, 0x19 };
1891 if (action != HDA_FIXUP_ACT_INIT)
1893 for (i = 0; i < ARRAY_SIZE(nids); i++) {
1894 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
1895 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
1897 val = snd_hda_codec_get_pin_target(codec, nids[i]);
1898 val |= AC_PINCTL_VREF_80;
1899 snd_hda_set_pin_ctl(codec, nids[i], val);
1900 spec->gen.keep_vref_in_automute = 1;
1905 static void alc889_fixup_mac_pins(struct hda_codec *codec,
1906 const hda_nid_t *nids, int num_nids)
1908 struct alc_spec *spec = codec->spec;
1911 for (i = 0; i < num_nids; i++) {
1913 val = snd_hda_codec_get_pin_target(codec, nids[i]);
1914 val |= AC_PINCTL_VREF_50;
1915 snd_hda_set_pin_ctl(codec, nids[i], val);
1917 spec->gen.keep_vref_in_automute = 1;
1920 /* Set VREF on speaker pins on imac91 */
1921 static void alc889_fixup_imac91_vref(struct hda_codec *codec,
1922 const struct hda_fixup *fix, int action)
1924 static hda_nid_t nids[2] = { 0x18, 0x1a };
1926 if (action == HDA_FIXUP_ACT_INIT)
1927 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1930 /* Set VREF on speaker pins on mba11 */
1931 static void alc889_fixup_mba11_vref(struct hda_codec *codec,
1932 const struct hda_fixup *fix, int action)
1934 static hda_nid_t nids[1] = { 0x18 };
1936 if (action == HDA_FIXUP_ACT_INIT)
1937 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1940 /* Set VREF on speaker pins on mba21 */
1941 static void alc889_fixup_mba21_vref(struct hda_codec *codec,
1942 const struct hda_fixup *fix, int action)
1944 static hda_nid_t nids[2] = { 0x18, 0x19 };
1946 if (action == HDA_FIXUP_ACT_INIT)
1947 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1950 /* Don't take HP output as primary
1951 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
1952 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
1954 static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
1955 const struct hda_fixup *fix, int action)
1957 struct alc_spec *spec = codec->spec;
1958 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1959 spec->gen.no_primary_hp = 1;
1960 spec->gen.no_multi_io = 1;
1964 static void alc_fixup_bass_chmap(struct hda_codec *codec,
1965 const struct hda_fixup *fix, int action);
1967 static const struct hda_fixup alc882_fixups[] = {
1968 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
1969 .type = HDA_FIXUP_PINS,
1970 .v.pins = (const struct hda_pintbl[]) {
1971 { 0x15, 0x01080104 }, /* side */
1972 { 0x16, 0x01011012 }, /* rear */
1973 { 0x17, 0x01016011 }, /* clfe */
1977 [ALC882_FIXUP_LENOVO_Y530] = {
1978 .type = HDA_FIXUP_PINS,
1979 .v.pins = (const struct hda_pintbl[]) {
1980 { 0x15, 0x99130112 }, /* rear int speakers */
1981 { 0x16, 0x99130111 }, /* subwoofer */
1985 [ALC882_FIXUP_PB_M5210] = {
1986 .type = HDA_FIXUP_PINCTLS,
1987 .v.pins = (const struct hda_pintbl[]) {
1988 { 0x19, PIN_VREF50 },
1992 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
1993 .type = HDA_FIXUP_FUNC,
1994 .v.func = alc_fixup_sku_ignore,
1996 [ALC882_FIXUP_ASUS_W90V] = {
1997 .type = HDA_FIXUP_PINS,
1998 .v.pins = (const struct hda_pintbl[]) {
1999 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
2003 [ALC889_FIXUP_CD] = {
2004 .type = HDA_FIXUP_PINS,
2005 .v.pins = (const struct hda_pintbl[]) {
2006 { 0x1c, 0x993301f0 }, /* CD */
2010 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2011 .type = HDA_FIXUP_PINS,
2012 .v.pins = (const struct hda_pintbl[]) {
2013 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2017 .chain_id = ALC889_FIXUP_CD,
2019 [ALC889_FIXUP_VAIO_TT] = {
2020 .type = HDA_FIXUP_PINS,
2021 .v.pins = (const struct hda_pintbl[]) {
2022 { 0x17, 0x90170111 }, /* hidden surround speaker */
2026 [ALC888_FIXUP_EEE1601] = {
2027 .type = HDA_FIXUP_VERBS,
2028 .v.verbs = (const struct hda_verb[]) {
2029 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2030 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
2034 [ALC882_FIXUP_EAPD] = {
2035 .type = HDA_FIXUP_VERBS,
2036 .v.verbs = (const struct hda_verb[]) {
2037 /* change to EAPD mode */
2038 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2039 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2043 [ALC883_FIXUP_EAPD] = {
2044 .type = HDA_FIXUP_VERBS,
2045 .v.verbs = (const struct hda_verb[]) {
2046 /* change to EAPD mode */
2047 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2048 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2052 [ALC883_FIXUP_ACER_EAPD] = {
2053 .type = HDA_FIXUP_VERBS,
2054 .v.verbs = (const struct hda_verb[]) {
2055 /* eanable EAPD on Acer laptops */
2056 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2057 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2061 [ALC882_FIXUP_GPIO1] = {
2062 .type = HDA_FIXUP_VERBS,
2063 .v.verbs = alc_gpio1_init_verbs,
2065 [ALC882_FIXUP_GPIO2] = {
2066 .type = HDA_FIXUP_VERBS,
2067 .v.verbs = alc_gpio2_init_verbs,
2069 [ALC882_FIXUP_GPIO3] = {
2070 .type = HDA_FIXUP_VERBS,
2071 .v.verbs = alc_gpio3_init_verbs,
2073 [ALC882_FIXUP_ASUS_W2JC] = {
2074 .type = HDA_FIXUP_VERBS,
2075 .v.verbs = alc_gpio1_init_verbs,
2077 .chain_id = ALC882_FIXUP_EAPD,
2079 [ALC889_FIXUP_COEF] = {
2080 .type = HDA_FIXUP_FUNC,
2081 .v.func = alc889_fixup_coef,
2083 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
2084 .type = HDA_FIXUP_PINS,
2085 .v.pins = (const struct hda_pintbl[]) {
2086 { 0x16, 0x99130111 }, /* CLFE speaker */
2087 { 0x17, 0x99130112 }, /* surround speaker */
2091 .chain_id = ALC882_FIXUP_GPIO1,
2093 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
2094 .type = HDA_FIXUP_PINS,
2095 .v.pins = (const struct hda_pintbl[]) {
2096 { 0x16, 0x99130111 }, /* CLFE speaker */
2097 { 0x1b, 0x99130112 }, /* surround speaker */
2101 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2103 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2104 /* additional init verbs for Acer Aspire 8930G */
2105 .type = HDA_FIXUP_VERBS,
2106 .v.verbs = (const struct hda_verb[]) {
2107 /* Enable all DACs */
2108 /* DAC DISABLE/MUTE 1? */
2109 /* setting bits 1-5 disables DAC nids 0x02-0x06
2110 * apparently. Init=0x38 */
2111 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2112 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2113 /* DAC DISABLE/MUTE 2? */
2114 /* some bit here disables the other DACs.
2116 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2117 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2119 * This laptop has a stereo digital microphone.
2120 * The mics are only 1cm apart which makes the stereo
2121 * useless. However, either the mic or the ALC889
2122 * makes the signal become a difference/sum signal
2123 * instead of standard stereo, which is annoying.
2124 * So instead we flip this bit which makes the
2125 * codec replicate the sum signal to both channels,
2126 * turning it into a normal mono mic.
2128 /* DMIC_CONTROL? Init value = 0x0001 */
2129 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2130 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2131 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2132 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2136 .chain_id = ALC882_FIXUP_GPIO1,
2138 [ALC885_FIXUP_MACPRO_GPIO] = {
2139 .type = HDA_FIXUP_FUNC,
2140 .v.func = alc885_fixup_macpro_gpio,
2142 [ALC889_FIXUP_DAC_ROUTE] = {
2143 .type = HDA_FIXUP_FUNC,
2144 .v.func = alc889_fixup_dac_route,
2146 [ALC889_FIXUP_MBP_VREF] = {
2147 .type = HDA_FIXUP_FUNC,
2148 .v.func = alc889_fixup_mbp_vref,
2150 .chain_id = ALC882_FIXUP_GPIO1,
2152 [ALC889_FIXUP_IMAC91_VREF] = {
2153 .type = HDA_FIXUP_FUNC,
2154 .v.func = alc889_fixup_imac91_vref,
2156 .chain_id = ALC882_FIXUP_GPIO1,
2158 [ALC889_FIXUP_MBA11_VREF] = {
2159 .type = HDA_FIXUP_FUNC,
2160 .v.func = alc889_fixup_mba11_vref,
2162 .chain_id = ALC889_FIXUP_MBP_VREF,
2164 [ALC889_FIXUP_MBA21_VREF] = {
2165 .type = HDA_FIXUP_FUNC,
2166 .v.func = alc889_fixup_mba21_vref,
2168 .chain_id = ALC889_FIXUP_MBP_VREF,
2170 [ALC889_FIXUP_MP11_VREF] = {
2171 .type = HDA_FIXUP_FUNC,
2172 .v.func = alc889_fixup_mba11_vref,
2174 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2176 [ALC889_FIXUP_MP41_VREF] = {
2177 .type = HDA_FIXUP_FUNC,
2178 .v.func = alc889_fixup_mbp_vref,
2180 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2182 [ALC882_FIXUP_INV_DMIC] = {
2183 .type = HDA_FIXUP_FUNC,
2184 .v.func = alc_fixup_inv_dmic,
2186 [ALC882_FIXUP_NO_PRIMARY_HP] = {
2187 .type = HDA_FIXUP_FUNC,
2188 .v.func = alc882_fixup_no_primary_hp,
2190 [ALC887_FIXUP_ASUS_BASS] = {
2191 .type = HDA_FIXUP_PINS,
2192 .v.pins = (const struct hda_pintbl[]) {
2193 {0x16, 0x99130130}, /* bass speaker */
2197 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2199 [ALC887_FIXUP_BASS_CHMAP] = {
2200 .type = HDA_FIXUP_FUNC,
2201 .v.func = alc_fixup_bass_chmap,
2205 static const struct snd_pci_quirk alc882_fixup_tbl[] = {
2206 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2207 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2208 SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2209 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2210 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2211 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2212 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
2213 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2214 ALC882_FIXUP_ACER_ASPIRE_4930G),
2215 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2216 ALC882_FIXUP_ACER_ASPIRE_4930G),
2217 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2218 ALC882_FIXUP_ACER_ASPIRE_8930G),
2219 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2220 ALC882_FIXUP_ACER_ASPIRE_8930G),
2221 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2222 ALC882_FIXUP_ACER_ASPIRE_4930G),
2223 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2224 ALC882_FIXUP_ACER_ASPIRE_4930G),
2225 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2226 ALC882_FIXUP_ACER_ASPIRE_4930G),
2227 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
2228 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2229 ALC882_FIXUP_ACER_ASPIRE_4930G),
2230 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
2231 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
2232 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
2233 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
2234 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
2235 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
2236 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
2237 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
2238 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
2239 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
2240 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
2241 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
2242 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2243 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
2245 /* All Apple entries are in codec SSIDs */
2246 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2247 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2248 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2249 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
2250 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2251 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
2252 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2253 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
2254 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
2255 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
2256 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
2257 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2258 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2259 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
2260 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2261 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2262 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
2263 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
2264 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
2265 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2266 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
2267 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
2269 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
2270 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
2271 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
2272 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
2273 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
2274 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2275 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
2276 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
2277 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
2281 static const struct hda_model_fixup alc882_fixup_models[] = {
2282 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2283 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2284 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
2285 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
2286 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
2291 * BIOS auto configuration
2293 /* almost identical with ALC880 parser... */
2294 static int alc882_parse_auto_config(struct hda_codec *codec)
2296 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
2297 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2298 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
2303 static int patch_alc882(struct hda_codec *codec)
2305 struct alc_spec *spec;
2308 err = alc_alloc_spec(codec, 0x0b);
2314 switch (codec->core.vendor_id) {
2320 /* ALC883 and variants */
2321 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2325 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
2327 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2329 alc_auto_parse_customize_define(codec);
2331 if (has_cdefine_beep(codec))
2332 spec->gen.beep_nid = 0x01;
2334 /* automatic parse from the BIOS config */
2335 err = alc882_parse_auto_config(codec);
2339 if (!spec->gen.no_analog && spec->gen.beep_nid)
2340 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2342 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2355 static int alc262_parse_auto_config(struct hda_codec *codec)
2357 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
2358 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2359 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
2366 ALC262_FIXUP_FSC_H270,
2367 ALC262_FIXUP_FSC_S7110,
2368 ALC262_FIXUP_HP_Z200,
2370 ALC262_FIXUP_LENOVO_3000,
2372 ALC262_FIXUP_BENQ_T31,
2373 ALC262_FIXUP_INV_DMIC,
2374 ALC262_FIXUP_INTEL_BAYLEYBAY,
2377 static const struct hda_fixup alc262_fixups[] = {
2378 [ALC262_FIXUP_FSC_H270] = {
2379 .type = HDA_FIXUP_PINS,
2380 .v.pins = (const struct hda_pintbl[]) {
2381 { 0x14, 0x99130110 }, /* speaker */
2382 { 0x15, 0x0221142f }, /* front HP */
2383 { 0x1b, 0x0121141f }, /* rear HP */
2387 [ALC262_FIXUP_FSC_S7110] = {
2388 .type = HDA_FIXUP_PINS,
2389 .v.pins = (const struct hda_pintbl[]) {
2390 { 0x15, 0x90170110 }, /* speaker */
2394 .chain_id = ALC262_FIXUP_BENQ,
2396 [ALC262_FIXUP_HP_Z200] = {
2397 .type = HDA_FIXUP_PINS,
2398 .v.pins = (const struct hda_pintbl[]) {
2399 { 0x16, 0x99130120 }, /* internal speaker */
2403 [ALC262_FIXUP_TYAN] = {
2404 .type = HDA_FIXUP_PINS,
2405 .v.pins = (const struct hda_pintbl[]) {
2406 { 0x14, 0x1993e1f0 }, /* int AUX */
2410 [ALC262_FIXUP_LENOVO_3000] = {
2411 .type = HDA_FIXUP_PINCTLS,
2412 .v.pins = (const struct hda_pintbl[]) {
2413 { 0x19, PIN_VREF50 },
2417 .chain_id = ALC262_FIXUP_BENQ,
2419 [ALC262_FIXUP_BENQ] = {
2420 .type = HDA_FIXUP_VERBS,
2421 .v.verbs = (const struct hda_verb[]) {
2422 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2423 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2427 [ALC262_FIXUP_BENQ_T31] = {
2428 .type = HDA_FIXUP_VERBS,
2429 .v.verbs = (const struct hda_verb[]) {
2430 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2431 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2435 [ALC262_FIXUP_INV_DMIC] = {
2436 .type = HDA_FIXUP_FUNC,
2437 .v.func = alc_fixup_inv_dmic,
2439 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2440 .type = HDA_FIXUP_FUNC,
2441 .v.func = alc_fixup_no_depop_delay,
2445 static const struct snd_pci_quirk alc262_fixup_tbl[] = {
2446 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
2447 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
2448 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
2449 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
2450 SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
2451 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
2452 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
2453 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2454 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
2455 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
2459 static const struct hda_model_fixup alc262_fixup_models[] = {
2460 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
2466 static int patch_alc262(struct hda_codec *codec)
2468 struct alc_spec *spec;
2471 err = alc_alloc_spec(codec, 0x0b);
2476 spec->gen.shared_mic_vref_pin = 0x18;
2478 spec->shutup = alc_eapd_shutup;
2481 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2484 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
2486 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2488 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
2490 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2492 alc_auto_parse_customize_define(codec);
2494 if (has_cdefine_beep(codec))
2495 spec->gen.beep_nid = 0x01;
2497 /* automatic parse from the BIOS config */
2498 err = alc262_parse_auto_config(codec);
2502 if (!spec->gen.no_analog && spec->gen.beep_nid)
2503 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2505 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2517 /* bind Beep switches of both NID 0x0f and 0x10 */
2518 static const struct hda_bind_ctls alc268_bind_beep_sw = {
2519 .ops = &snd_hda_bind_sw,
2521 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
2522 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
2527 static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2528 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
2529 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
2533 /* set PCBEEP vol = 0, mute connections */
2534 static const struct hda_verb alc268_beep_init_verbs[] = {
2535 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2536 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2537 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2542 ALC268_FIXUP_INV_DMIC,
2543 ALC268_FIXUP_HP_EAPD,
2547 static const struct hda_fixup alc268_fixups[] = {
2548 [ALC268_FIXUP_INV_DMIC] = {
2549 .type = HDA_FIXUP_FUNC,
2550 .v.func = alc_fixup_inv_dmic,
2552 [ALC268_FIXUP_HP_EAPD] = {
2553 .type = HDA_FIXUP_VERBS,
2554 .v.verbs = (const struct hda_verb[]) {
2555 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
2559 [ALC268_FIXUP_SPDIF] = {
2560 .type = HDA_FIXUP_PINS,
2561 .v.pins = (const struct hda_pintbl[]) {
2562 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
2568 static const struct hda_model_fixup alc268_fixup_models[] = {
2569 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
2570 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
2574 static const struct snd_pci_quirk alc268_fixup_tbl[] = {
2575 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
2576 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
2577 /* below is codec SSID since multiple Toshiba laptops have the
2578 * same PCI SSID 1179:ff00
2580 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
2585 * BIOS auto configuration
2587 static int alc268_parse_auto_config(struct hda_codec *codec)
2589 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2590 return alc_parse_auto_config(codec, NULL, alc268_ssids);
2595 static int patch_alc268(struct hda_codec *codec)
2597 struct alc_spec *spec;
2600 /* ALC268 has no aa-loopback mixer */
2601 err = alc_alloc_spec(codec, 0);
2606 spec->gen.beep_nid = 0x01;
2608 spec->shutup = alc_eapd_shutup;
2610 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
2611 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2613 /* automatic parse from the BIOS config */
2614 err = alc268_parse_auto_config(codec);
2618 if (err > 0 && !spec->gen.no_analog &&
2619 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
2620 add_mixer(spec, alc268_beep_mixer);
2621 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
2622 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
2623 /* override the amp caps for beep generator */
2624 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
2625 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
2626 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
2627 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
2628 (0 << AC_AMPCAP_MUTE_SHIFT));
2631 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2644 static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
2645 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
2648 static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
2649 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
2652 /* different alc269-variants */
2654 ALC269_TYPE_ALC269VA,
2655 ALC269_TYPE_ALC269VB,
2656 ALC269_TYPE_ALC269VC,
2657 ALC269_TYPE_ALC269VD,
2674 * BIOS auto configuration
2676 static int alc269_parse_auto_config(struct hda_codec *codec)
2678 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
2679 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
2680 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2681 struct alc_spec *spec = codec->spec;
2682 const hda_nid_t *ssids;
2684 switch (spec->codec_variant) {
2685 case ALC269_TYPE_ALC269VA:
2686 case ALC269_TYPE_ALC269VC:
2687 case ALC269_TYPE_ALC280:
2688 case ALC269_TYPE_ALC284:
2689 case ALC269_TYPE_ALC285:
2690 ssids = alc269va_ssids;
2692 case ALC269_TYPE_ALC269VB:
2693 case ALC269_TYPE_ALC269VD:
2694 case ALC269_TYPE_ALC282:
2695 case ALC269_TYPE_ALC283:
2696 case ALC269_TYPE_ALC286:
2697 case ALC269_TYPE_ALC298:
2698 case ALC269_TYPE_ALC255:
2699 case ALC269_TYPE_ALC256:
2700 case ALC269_TYPE_ALC257:
2701 case ALC269_TYPE_ALC225:
2702 case ALC269_TYPE_ALC294:
2703 case ALC269_TYPE_ALC700:
2704 ssids = alc269_ssids;
2707 ssids = alc269_ssids;
2711 return alc_parse_auto_config(codec, alc269_ignore, ssids);
2714 static int find_ext_mic_pin(struct hda_codec *codec);
2716 static void alc286_shutup(struct hda_codec *codec)
2719 int mic_pin = find_ext_mic_pin(codec);
2720 /* don't shut up pins when unloading the driver; otherwise it breaks
2721 * the default pin setup at the next load of the driver
2723 if (codec->bus->shutdown)
2725 for (i = 0; i < codec->init_pins.used; i++) {
2726 struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i);
2727 /* use read here for syncing after issuing each verb */
2728 if (pin->nid != mic_pin)
2729 snd_hda_codec_read(codec, pin->nid, 0,
2730 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
2732 codec->pins_shutup = 1;
2735 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
2737 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
2740 static void alc269_shutup(struct hda_codec *codec)
2742 struct alc_spec *spec = codec->spec;
2744 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
2745 alc269vb_toggle_power_output(codec, 0);
2746 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
2747 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
2750 snd_hda_shutup_pins(codec);
2753 static struct coef_fw alc282_coefs[] = {
2754 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
2755 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
2756 WRITE_COEF(0x07, 0x0200), /* DMIC control */
2757 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
2758 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
2759 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
2760 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
2761 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
2762 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
2763 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
2764 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
2765 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
2766 WRITE_COEF(0x34, 0xa0c0), /* ANC */
2767 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
2768 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
2769 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
2770 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
2771 WRITE_COEF(0x63, 0x2902), /* PLL */
2772 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
2773 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
2774 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
2775 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
2776 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
2777 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
2778 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
2779 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
2780 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
2781 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
2782 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
2786 static void alc282_restore_default_value(struct hda_codec *codec)
2788 alc_process_coef_fw(codec, alc282_coefs);
2791 static void alc282_init(struct hda_codec *codec)
2793 struct alc_spec *spec = codec->spec;
2794 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
2798 alc282_restore_default_value(codec);
2802 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
2803 coef78 = alc_read_coef_idx(codec, 0x78);
2805 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
2806 /* Headphone capless set to high power mode */
2807 alc_write_coef_idx(codec, 0x78, 0x9004);
2812 snd_hda_codec_write(codec, hp_pin, 0,
2813 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
2818 snd_hda_codec_write(codec, hp_pin, 0,
2819 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
2824 /* Headphone capless set to normal mode */
2825 alc_write_coef_idx(codec, 0x78, coef78);
2828 static void alc282_shutup(struct hda_codec *codec)
2830 struct alc_spec *spec = codec->spec;
2831 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
2836 alc269_shutup(codec);
2840 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
2841 coef78 = alc_read_coef_idx(codec, 0x78);
2842 alc_write_coef_idx(codec, 0x78, 0x9004);
2847 snd_hda_codec_write(codec, hp_pin, 0,
2848 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
2853 snd_hda_codec_write(codec, hp_pin, 0,
2854 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
2859 alc_auto_setup_eapd(codec, false);
2860 snd_hda_shutup_pins(codec);
2861 alc_write_coef_idx(codec, 0x78, coef78);
2864 static struct coef_fw alc283_coefs[] = {
2865 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
2866 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
2867 WRITE_COEF(0x07, 0x0200), /* DMIC control */
2868 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
2869 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
2870 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
2871 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
2872 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
2873 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
2874 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
2875 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
2876 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
2877 WRITE_COEF(0x22, 0xa0c0), /* ANC */
2878 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
2879 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
2880 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
2881 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
2882 WRITE_COEF(0x2e, 0x2902), /* PLL */
2883 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
2884 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
2885 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
2886 WRITE_COEF(0x36, 0x0), /* capless control 5 */
2887 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
2888 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
2889 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
2890 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
2891 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
2892 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
2893 WRITE_COEF(0x49, 0x0), /* test mode */
2894 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
2895 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
2896 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
2897 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
2901 static void alc283_restore_default_value(struct hda_codec *codec)
2903 alc_process_coef_fw(codec, alc283_coefs);
2906 static void alc283_init(struct hda_codec *codec)
2908 struct alc_spec *spec = codec->spec;
2909 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
2912 if (!spec->gen.autocfg.hp_outs) {
2913 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
2914 hp_pin = spec->gen.autocfg.line_out_pins[0];
2917 alc283_restore_default_value(codec);
2923 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
2925 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
2926 /* Headphone capless set to high power mode */
2927 alc_write_coef_idx(codec, 0x43, 0x9004);
2929 snd_hda_codec_write(codec, hp_pin, 0,
2930 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
2935 snd_hda_codec_write(codec, hp_pin, 0,
2936 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
2940 /* Index 0x46 Combo jack auto switch control 2 */
2941 /* 3k pull low control for Headset jack. */
2942 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
2943 /* Headphone capless set to normal mode */
2944 alc_write_coef_idx(codec, 0x43, 0x9614);
2947 static void alc283_shutup(struct hda_codec *codec)
2949 struct alc_spec *spec = codec->spec;
2950 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
2953 if (!spec->gen.autocfg.hp_outs) {
2954 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
2955 hp_pin = spec->gen.autocfg.line_out_pins[0];
2959 alc269_shutup(codec);
2963 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
2965 alc_write_coef_idx(codec, 0x43, 0x9004);
2967 /*depop hp during suspend*/
2968 alc_write_coef_idx(codec, 0x06, 0x2100);
2970 snd_hda_codec_write(codec, hp_pin, 0,
2971 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
2976 snd_hda_codec_write(codec, hp_pin, 0,
2977 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
2979 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
2983 alc_auto_setup_eapd(codec, false);
2984 snd_hda_shutup_pins(codec);
2985 alc_write_coef_idx(codec, 0x43, 0x9614);
2988 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
2991 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
2992 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
2993 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
2996 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3000 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3001 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3003 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3008 static void alc5505_dsp_halt(struct hda_codec *codec)
3012 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3013 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3014 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3015 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3016 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3017 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3018 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3019 val = alc5505_coef_get(codec, 0x6220);
3020 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3023 static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3025 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3026 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3027 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3028 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3029 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3030 alc5505_coef_set(codec, 0x880c, 0x00000004);
3033 static void alc5505_dsp_init(struct hda_codec *codec)
3037 alc5505_dsp_halt(codec);
3038 alc5505_dsp_back_from_halt(codec);
3039 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3040 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3041 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3042 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3043 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3044 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3045 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3046 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3047 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3048 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3049 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3050 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3051 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3053 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3055 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3057 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3059 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3060 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3061 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3062 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3063 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3064 alc5505_coef_set(codec, 0x880c, 0x00000003);
3065 alc5505_coef_set(codec, 0x880c, 0x00000010);
3067 #ifdef HALT_REALTEK_ALC5505
3068 alc5505_dsp_halt(codec);
3072 #ifdef HALT_REALTEK_ALC5505
3073 #define alc5505_dsp_suspend(codec) /* NOP */
3074 #define alc5505_dsp_resume(codec) /* NOP */
3076 #define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
3077 #define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
3081 static int alc269_suspend(struct hda_codec *codec)
3083 struct alc_spec *spec = codec->spec;
3085 if (spec->has_alc5505_dsp)
3086 alc5505_dsp_suspend(codec);
3087 return alc_suspend(codec);
3090 static int alc269_resume(struct hda_codec *codec)
3092 struct alc_spec *spec = codec->spec;
3094 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3095 alc269vb_toggle_power_output(codec, 0);
3096 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3097 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
3101 codec->patch_ops.init(codec);
3103 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3104 alc269vb_toggle_power_output(codec, 1);
3105 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3106 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
3110 regcache_sync(codec->core.regmap);
3111 hda_call_check_power_status(codec, 0x01);
3113 /* on some machine, the BIOS will clear the codec gpio data when enter
3114 * suspend, and won't restore the data after resume, so we restore it
3118 snd_hda_codec_write(codec, codec->core.afg, 0, AC_VERB_SET_GPIO_DATA,
3121 if (spec->has_alc5505_dsp)
3122 alc5505_dsp_resume(codec);
3126 #endif /* CONFIG_PM */
3128 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
3129 const struct hda_fixup *fix, int action)
3131 struct alc_spec *spec = codec->spec;
3133 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3134 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
3137 static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
3138 const struct hda_fixup *fix,
3141 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
3142 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
3144 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
3145 snd_hda_codec_set_pincfg(codec, 0x19,
3146 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
3147 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
3150 static void alc269_fixup_hweq(struct hda_codec *codec,
3151 const struct hda_fixup *fix, int action)
3153 if (action == HDA_FIXUP_ACT_INIT)
3154 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
3157 static void alc269_fixup_headset_mic(struct hda_codec *codec,
3158 const struct hda_fixup *fix, int action)
3160 struct alc_spec *spec = codec->spec;
3162 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3163 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3166 static void alc271_fixup_dmic(struct hda_codec *codec,
3167 const struct hda_fixup *fix, int action)
3169 static const struct hda_verb verbs[] = {
3170 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
3171 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
3176 if (strcmp(codec->core.chip_name, "ALC271X") &&
3177 strcmp(codec->core.chip_name, "ALC269VB"))
3179 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
3180 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
3181 snd_hda_sequence_write(codec, verbs);
3184 static void alc269_fixup_pcm_44k(struct hda_codec *codec,
3185 const struct hda_fixup *fix, int action)
3187 struct alc_spec *spec = codec->spec;
3189 if (action != HDA_FIXUP_ACT_PROBE)
3192 /* Due to a hardware problem on Lenovo Ideadpad, we need to
3193 * fix the sample rate of analog I/O to 44.1kHz
3195 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
3196 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
3199 static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
3200 const struct hda_fixup *fix, int action)
3202 /* The digital-mic unit sends PDM (differential signal) instead of
3203 * the standard PCM, thus you can't record a valid mono stream as is.
3204 * Below is a workaround specific to ALC269 to control the dmic
3205 * signal source as mono.
3207 if (action == HDA_FIXUP_ACT_INIT)
3208 alc_update_coef_idx(codec, 0x07, 0, 0x80);
3211 static void alc269_quanta_automute(struct hda_codec *codec)
3213 snd_hda_gen_update_outputs(codec);
3215 alc_write_coef_idx(codec, 0x0c, 0x680);
3216 alc_write_coef_idx(codec, 0x0c, 0x480);
3219 static void alc269_fixup_quanta_mute(struct hda_codec *codec,
3220 const struct hda_fixup *fix, int action)
3222 struct alc_spec *spec = codec->spec;
3223 if (action != HDA_FIXUP_ACT_PROBE)
3225 spec->gen.automute_hook = alc269_quanta_automute;
3228 static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
3229 struct hda_jack_callback *jack)
3231 struct alc_spec *spec = codec->spec;
3234 snd_hda_gen_hp_automute(codec, jack);
3236 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
3238 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3241 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3245 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
3246 const struct hda_fixup *fix, int action)
3248 struct alc_spec *spec = codec->spec;
3249 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3250 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3251 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
3256 /* update mute-LED according to the speaker mute state via mic VREF pin */
3257 static void alc269_fixup_mic_mute_hook(void *private_data, int enabled)
3259 struct hda_codec *codec = private_data;
3260 struct alc_spec *spec = codec->spec;
3261 unsigned int pinval;
3263 if (spec->mute_led_polarity)
3265 pinval = snd_hda_codec_get_pin_target(codec, spec->mute_led_nid);
3266 pinval &= ~AC_PINCTL_VREFEN;
3267 pinval |= enabled ? AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80;
3268 if (spec->mute_led_nid) {
3269 /* temporarily power up/down for setting VREF */
3270 snd_hda_power_up_pm(codec);
3271 snd_hda_set_pin_ctl_cache(codec, spec->mute_led_nid, pinval);
3272 snd_hda_power_down_pm(codec);
3276 /* Make sure the led works even in runtime suspend */
3277 static unsigned int led_power_filter(struct hda_codec *codec,
3279 unsigned int power_state)
3281 struct alc_spec *spec = codec->spec;
3283 if (power_state != AC_PWRST_D3 || nid == 0 ||
3284 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
3287 /* Set pin ctl again, it might have just been set to 0 */
3288 snd_hda_set_pin_ctl(codec, nid,
3289 snd_hda_codec_get_pin_target(codec, nid));
3291 return snd_hda_gen_path_power_filter(codec, nid, power_state);
3294 static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
3295 const struct hda_fixup *fix, int action)
3297 struct alc_spec *spec = codec->spec;
3298 const struct dmi_device *dev = NULL;
3300 if (action != HDA_FIXUP_ACT_PRE_PROBE)
3303 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
3305 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
3307 if (pin < 0x0a || pin >= 0x10)
3309 spec->mute_led_polarity = pol;
3310 spec->mute_led_nid = pin - 0x0a + 0x18;
3311 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3312 spec->gen.vmaster_mute_enum = 1;
3313 codec->power_filter = led_power_filter;
3315 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
3316 spec->mute_led_polarity);
3321 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
3322 const struct hda_fixup *fix, int action)
3324 struct alc_spec *spec = codec->spec;
3325 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3326 spec->mute_led_polarity = 0;
3327 spec->mute_led_nid = 0x18;
3328 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3329 spec->gen.vmaster_mute_enum = 1;
3330 codec->power_filter = led_power_filter;
3334 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
3335 const struct hda_fixup *fix, int action)
3337 struct alc_spec *spec = codec->spec;
3338 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3339 spec->mute_led_polarity = 0;
3340 spec->mute_led_nid = 0x19;
3341 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3342 spec->gen.vmaster_mute_enum = 1;
3343 codec->power_filter = led_power_filter;
3347 /* update LED status via GPIO */
3348 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
3351 struct alc_spec *spec = codec->spec;
3352 unsigned int oldval = spec->gpio_led;
3354 if (spec->mute_led_polarity)
3358 spec->gpio_led &= ~mask;
3360 spec->gpio_led |= mask;
3361 if (spec->gpio_led != oldval)
3362 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
3366 /* turn on/off mute LED via GPIO per vmaster hook */
3367 static void alc_fixup_gpio_mute_hook(void *private_data, int enabled)
3369 struct hda_codec *codec = private_data;
3370 struct alc_spec *spec = codec->spec;
3372 alc_update_gpio_led(codec, spec->gpio_mute_led_mask, enabled);
3375 /* turn on/off mic-mute LED via GPIO per capture hook */
3376 static void alc_fixup_gpio_mic_mute_hook(struct hda_codec *codec,
3377 struct snd_kcontrol *kcontrol,
3378 struct snd_ctl_elem_value *ucontrol)
3380 struct alc_spec *spec = codec->spec;
3383 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
3384 ucontrol->value.integer.value[0] ||
3385 ucontrol->value.integer.value[1]);
3388 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
3389 const struct hda_fixup *fix, int action)
3391 struct alc_spec *spec = codec->spec;
3392 static const struct hda_verb gpio_init[] = {
3393 { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 },
3394 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 },
3398 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3399 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
3400 spec->gen.cap_sync_hook = alc_fixup_gpio_mic_mute_hook;
3402 spec->mute_led_polarity = 0;
3403 spec->gpio_mute_led_mask = 0x08;
3404 spec->gpio_mic_led_mask = 0x10;
3405 snd_hda_add_verbs(codec, gpio_init);
3409 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
3410 const struct hda_fixup *fix, int action)
3412 struct alc_spec *spec = codec->spec;
3413 static const struct hda_verb gpio_init[] = {
3414 { 0x01, AC_VERB_SET_GPIO_MASK, 0x22 },
3415 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x22 },
3419 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3420 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
3421 spec->gen.cap_sync_hook = alc_fixup_gpio_mic_mute_hook;
3423 spec->mute_led_polarity = 0;
3424 spec->gpio_mute_led_mask = 0x02;
3425 spec->gpio_mic_led_mask = 0x20;
3426 snd_hda_add_verbs(codec, gpio_init);
3430 /* turn on/off mic-mute LED per capture hook */
3431 static void alc269_fixup_hp_cap_mic_mute_hook(struct hda_codec *codec,
3432 struct snd_kcontrol *kcontrol,
3433 struct snd_ctl_elem_value *ucontrol)
3435 struct alc_spec *spec = codec->spec;
3436 unsigned int pinval, enable, disable;
3438 pinval = snd_hda_codec_get_pin_target(codec, spec->cap_mute_led_nid);
3439 pinval &= ~AC_PINCTL_VREFEN;
3440 enable = pinval | AC_PINCTL_VREF_80;
3441 disable = pinval | AC_PINCTL_VREF_HIZ;
3446 if (ucontrol->value.integer.value[0] ||
3447 ucontrol->value.integer.value[1])
3452 if (spec->cap_mute_led_nid)
3453 snd_hda_set_pin_ctl_cache(codec, spec->cap_mute_led_nid, pinval);
3456 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
3457 const struct hda_fixup *fix, int action)
3459 struct alc_spec *spec = codec->spec;
3460 static const struct hda_verb gpio_init[] = {
3461 { 0x01, AC_VERB_SET_GPIO_MASK, 0x08 },
3462 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x08 },
3466 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3467 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
3468 spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook;
3470 spec->mute_led_polarity = 0;
3471 spec->gpio_mute_led_mask = 0x08;
3472 spec->cap_mute_led_nid = 0x18;
3473 snd_hda_add_verbs(codec, gpio_init);
3474 codec->power_filter = led_power_filter;
3478 static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
3479 const struct hda_fixup *fix, int action)
3481 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to enable headphone amp */
3482 struct alc_spec *spec = codec->spec;
3483 static const struct hda_verb gpio_init[] = {
3484 { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 },
3485 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 },
3489 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3490 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
3491 spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook;
3493 spec->mute_led_polarity = 0;
3494 spec->gpio_mute_led_mask = 0x08;
3495 spec->cap_mute_led_nid = 0x18;
3496 snd_hda_add_verbs(codec, gpio_init);
3497 codec->power_filter = led_power_filter;
3501 #if IS_REACHABLE(CONFIG_INPUT)
3502 static void gpio2_mic_hotkey_event(struct hda_codec *codec,
3503 struct hda_jack_callback *event)
3505 struct alc_spec *spec = codec->spec;
3507 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
3508 send both key on and key off event for every interrupt. */
3509 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
3510 input_sync(spec->kb_dev);
3511 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
3512 input_sync(spec->kb_dev);
3515 static int alc_register_micmute_input_device(struct hda_codec *codec)
3517 struct alc_spec *spec = codec->spec;
3520 spec->kb_dev = input_allocate_device();
3521 if (!spec->kb_dev) {
3522 codec_err(codec, "Out of memory (input_allocate_device)\n");
3526 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
3528 spec->kb_dev->name = "Microphone Mute Button";
3529 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
3530 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
3531 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
3532 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
3533 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
3534 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
3536 if (input_register_device(spec->kb_dev)) {
3537 codec_err(codec, "input_register_device failed\n");
3538 input_free_device(spec->kb_dev);
3539 spec->kb_dev = NULL;
3546 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
3547 const struct hda_fixup *fix, int action)
3549 /* GPIO1 = set according to SKU external amp
3550 GPIO2 = mic mute hotkey
3552 GPIO4 = mic mute LED */
3553 static const struct hda_verb gpio_init[] = {
3554 { 0x01, AC_VERB_SET_GPIO_MASK, 0x1e },
3555 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x1a },
3556 { 0x01, AC_VERB_SET_GPIO_DATA, 0x02 },
3560 struct alc_spec *spec = codec->spec;
3562 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3563 if (alc_register_micmute_input_device(codec) != 0)
3566 snd_hda_add_verbs(codec, gpio_init);
3567 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
3568 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
3569 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
3570 gpio2_mic_hotkey_event);
3572 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
3573 spec->gen.cap_sync_hook = alc_fixup_gpio_mic_mute_hook;
3575 spec->mute_led_polarity = 0;
3576 spec->gpio_mute_led_mask = 0x08;
3577 spec->gpio_mic_led_mask = 0x10;
3585 case HDA_FIXUP_ACT_PROBE:
3586 spec->init_amp = ALC_INIT_DEFAULT;
3588 case HDA_FIXUP_ACT_FREE:
3589 input_unregister_device(spec->kb_dev);
3590 spec->kb_dev = NULL;
3594 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
3595 const struct hda_fixup *fix, int action)
3597 /* Line2 = mic mute hotkey
3598 GPIO2 = mic mute LED */
3599 static const struct hda_verb gpio_init[] = {
3600 { 0x01, AC_VERB_SET_GPIO_MASK, 0x04 },
3601 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04 },
3605 struct alc_spec *spec = codec->spec;
3607 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3608 if (alc_register_micmute_input_device(codec) != 0)
3611 snd_hda_add_verbs(codec, gpio_init);
3612 snd_hda_jack_detect_enable_callback(codec, 0x1b,
3613 gpio2_mic_hotkey_event);
3615 spec->gen.cap_sync_hook = alc_fixup_gpio_mic_mute_hook;
3617 spec->mute_led_polarity = 0;
3618 spec->gpio_mic_led_mask = 0x04;
3626 case HDA_FIXUP_ACT_PROBE:
3627 spec->init_amp = ALC_INIT_DEFAULT;
3629 case HDA_FIXUP_ACT_FREE:
3630 input_unregister_device(spec->kb_dev);
3631 spec->kb_dev = NULL;
3635 #define alc280_fixup_hp_gpio2_mic_hotkey NULL
3636 #define alc233_fixup_lenovo_line2_mic_hotkey NULL
3639 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
3640 const struct hda_fixup *fix, int action)
3642 struct alc_spec *spec = codec->spec;
3644 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3645 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3646 spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook;
3647 spec->mute_led_polarity = 0;
3648 spec->mute_led_nid = 0x1a;
3649 spec->cap_mute_led_nid = 0x18;
3650 spec->gen.vmaster_mute_enum = 1;
3651 codec->power_filter = led_power_filter;
3655 static void alc_headset_mode_unplugged(struct hda_codec *codec)
3657 static struct coef_fw coef0255[] = {
3658 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
3659 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
3660 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
3661 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
3664 static struct coef_fw coef0255_1[] = {
3665 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
3668 static struct coef_fw coef0256[] = {
3669 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
3672 static struct coef_fw coef0233[] = {
3673 WRITE_COEF(0x1b, 0x0c0b),
3674 WRITE_COEF(0x45, 0xc429),
3675 UPDATE_COEF(0x35, 0x4000, 0),
3676 WRITE_COEF(0x06, 0x2104),
3677 WRITE_COEF(0x1a, 0x0001),
3678 WRITE_COEF(0x26, 0x0004),
3679 WRITE_COEF(0x32, 0x42a3),
3682 static struct coef_fw coef0288[] = {
3683 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
3684 UPDATE_COEF(0x50, 0x2000, 0x2000),
3685 UPDATE_COEF(0x56, 0x0006, 0x0006),
3686 UPDATE_COEF(0x66, 0x0008, 0),
3687 UPDATE_COEF(0x67, 0x2000, 0),
3690 static struct coef_fw coef0292[] = {
3691 WRITE_COEF(0x76, 0x000e),
3692 WRITE_COEF(0x6c, 0x2400),
3693 WRITE_COEF(0x18, 0x7308),
3694 WRITE_COEF(0x6b, 0xc429),
3697 static struct coef_fw coef0293[] = {
3698 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
3699 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
3700 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
3701 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
3702 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
3703 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
3706 static struct coef_fw coef0668[] = {
3707 WRITE_COEF(0x15, 0x0d40),
3708 WRITE_COEF(0xb7, 0x802b),
3711 static struct coef_fw coef0225[] = {
3712 UPDATE_COEF(0x4a, 1<<8, 0),
3713 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
3714 UPDATE_COEF(0x63, 3<<14, 3<<14),
3715 UPDATE_COEF(0x4a, 3<<4, 2<<4),
3716 UPDATE_COEF(0x4a, 3<<10, 3<<10),
3717 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
3718 UPDATE_COEF(0x4a, 3<<10, 0),
3722 switch (codec->core.vendor_id) {
3724 alc_process_coef_fw(codec, coef0255_1);
3725 alc_process_coef_fw(codec, coef0255);
3729 alc_process_coef_fw(codec, coef0256);
3730 alc_process_coef_fw(codec, coef0255);
3734 alc_process_coef_fw(codec, coef0233);
3739 alc_process_coef_fw(codec, coef0288);
3742 alc_process_coef_fw(codec, coef0292);
3745 alc_process_coef_fw(codec, coef0293);
3748 alc_process_coef_fw(codec, coef0668);
3753 alc_process_coef_fw(codec, coef0225);
3756 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
3759 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
3763 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
3766 static struct coef_fw coef0255[] = {
3767 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
3768 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
3771 static struct coef_fw coef0233[] = {
3772 UPDATE_COEF(0x35, 0, 1<<14),
3773 WRITE_COEF(0x06, 0x2100),
3774 WRITE_COEF(0x1a, 0x0021),
3775 WRITE_COEF(0x26, 0x008c),
3778 static struct coef_fw coef0288[] = {
3779 UPDATE_COEF(0x50, 0x2000, 0),
3780 UPDATE_COEF(0x56, 0x0006, 0),
3781 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
3782 UPDATE_COEF(0x66, 0x0008, 0x0008),
3783 UPDATE_COEF(0x67, 0x2000, 0x2000),
3786 static struct coef_fw coef0292[] = {
3787 WRITE_COEF(0x19, 0xa208),
3788 WRITE_COEF(0x2e, 0xacf0),
3791 static struct coef_fw coef0293[] = {
3792 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
3793 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
3794 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
3797 static struct coef_fw coef0688[] = {
3798 WRITE_COEF(0xb7, 0x802b),
3799 WRITE_COEF(0xb5, 0x1040),
3800 UPDATE_COEF(0xc3, 0, 1<<12),
3803 static struct coef_fw coef0225[] = {
3804 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
3805 UPDATE_COEF(0x4a, 3<<4, 2<<4),
3806 UPDATE_COEF(0x63, 3<<14, 0),
3811 switch (codec->core.vendor_id) {
3815 alc_write_coef_idx(codec, 0x45, 0xc489);
3816 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
3817 alc_process_coef_fw(codec, coef0255);
3818 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
3822 alc_write_coef_idx(codec, 0x45, 0xc429);
3823 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
3824 alc_process_coef_fw(codec, coef0233);
3825 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
3830 alc_update_coef_idx(codec, 0x4f, 0x000c, 0);
3831 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
3832 alc_process_coef_fw(codec, coef0288);
3833 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
3836 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
3837 alc_process_coef_fw(codec, coef0292);
3840 /* Set to TRS mode */
3841 alc_write_coef_idx(codec, 0x45, 0xc429);
3842 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
3843 alc_process_coef_fw(codec, coef0293);
3844 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
3847 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
3850 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
3851 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
3854 alc_write_coef_idx(codec, 0x11, 0x0001);
3855 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
3856 alc_process_coef_fw(codec, coef0688);
3857 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
3862 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
3863 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
3864 alc_process_coef_fw(codec, coef0225);
3865 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
3868 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
3871 static void alc_headset_mode_default(struct hda_codec *codec)
3873 static struct coef_fw coef0225[] = {
3874 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
3877 static struct coef_fw coef0255[] = {
3878 WRITE_COEF(0x45, 0xc089),
3879 WRITE_COEF(0x45, 0xc489),
3880 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
3881 WRITE_COEF(0x49, 0x0049),
3884 static struct coef_fw coef0233[] = {
3885 WRITE_COEF(0x06, 0x2100),
3886 WRITE_COEF(0x32, 0x4ea3),
3889 static struct coef_fw coef0288[] = {
3890 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
3891 UPDATE_COEF(0x50, 0x2000, 0x2000),
3892 UPDATE_COEF(0x56, 0x0006, 0x0006),
3893 UPDATE_COEF(0x66, 0x0008, 0),
3894 UPDATE_COEF(0x67, 0x2000, 0),
3897 static struct coef_fw coef0292[] = {
3898 WRITE_COEF(0x76, 0x000e),
3899 WRITE_COEF(0x6c, 0x2400),
3900 WRITE_COEF(0x6b, 0xc429),
3901 WRITE_COEF(0x18, 0x7308),
3904 static struct coef_fw coef0293[] = {
3905 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
3906 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
3907 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
3910 static struct coef_fw coef0688[] = {
3911 WRITE_COEF(0x11, 0x0041),
3912 WRITE_COEF(0x15, 0x0d40),
3913 WRITE_COEF(0xb7, 0x802b),
3917 switch (codec->core.vendor_id) {
3921 alc_process_coef_fw(codec, coef0225);
3926 alc_process_coef_fw(codec, coef0255);
3930 alc_process_coef_fw(codec, coef0233);
3935 alc_process_coef_fw(codec, coef0288);
3938 alc_process_coef_fw(codec, coef0292);
3941 alc_process_coef_fw(codec, coef0293);
3944 alc_process_coef_fw(codec, coef0688);
3947 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
3950 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
3954 static void alc_headset_mode_ctia(struct hda_codec *codec)
3956 static struct coef_fw coef0255[] = {
3957 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
3958 WRITE_COEF(0x1b, 0x0c2b),
3959 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
3962 static struct coef_fw coef0256[] = {
3963 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
3964 WRITE_COEF(0x1b, 0x0c6b),
3965 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
3968 static struct coef_fw coef0233[] = {
3969 WRITE_COEF(0x45, 0xd429),
3970 WRITE_COEF(0x1b, 0x0c2b),
3971 WRITE_COEF(0x32, 0x4ea3),
3974 static struct coef_fw coef0288[] = {
3975 UPDATE_COEF(0x50, 0x2000, 0x2000),
3976 UPDATE_COEF(0x56, 0x0006, 0x0006),
3977 UPDATE_COEF(0x66, 0x0008, 0),
3978 UPDATE_COEF(0x67, 0x2000, 0),
3981 static struct coef_fw coef0292[] = {
3982 WRITE_COEF(0x6b, 0xd429),
3983 WRITE_COEF(0x76, 0x0008),
3984 WRITE_COEF(0x18, 0x7388),
3987 static struct coef_fw coef0293[] = {
3988 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
3989 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
3992 static struct coef_fw coef0688[] = {
3993 WRITE_COEF(0x11, 0x0001),
3994 WRITE_COEF(0x15, 0x0d60),
3995 WRITE_COEF(0xc3, 0x0000),
3998 static struct coef_fw coef0225[] = {
3999 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
4000 UPDATE_COEF(0x49, 1<<8, 1<<8),
4001 UPDATE_COEF(0x4a, 7<<6, 7<<6),
4002 UPDATE_COEF(0x4a, 3<<4, 3<<4),
4006 switch (codec->core.vendor_id) {
4008 alc_process_coef_fw(codec, coef0255);
4012 alc_process_coef_fw(codec, coef0256);
4016 alc_process_coef_fw(codec, coef0233);
4019 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);/* Headset output enable */
4020 /* ALC298 jack type setting is the same with ALC286/ALC288 */
4023 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4025 alc_process_coef_fw(codec, coef0288);
4028 alc_process_coef_fw(codec, coef0292);
4031 alc_process_coef_fw(codec, coef0293);
4034 alc_process_coef_fw(codec, coef0688);
4039 alc_process_coef_fw(codec, coef0225);
4042 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4045 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
4049 static void alc_headset_mode_omtp(struct hda_codec *codec)
4051 static struct coef_fw coef0255[] = {
4052 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
4053 WRITE_COEF(0x1b, 0x0c2b),
4054 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4057 static struct coef_fw coef0256[] = {
4058 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
4059 WRITE_COEF(0x1b, 0x0c6b),
4060 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4063 static struct coef_fw coef0233[] = {
4064 WRITE_COEF(0x45, 0xe429),
4065 WRITE_COEF(0x1b, 0x0c2b),
4066 WRITE_COEF(0x32, 0x4ea3),
4069 static struct coef_fw coef0288[] = {
4070 UPDATE_COEF(0x50, 0x2000, 0x2000),
4071 UPDATE_COEF(0x56, 0x0006, 0x0006),
4072 UPDATE_COEF(0x66, 0x0008, 0),
4073 UPDATE_COEF(0x67, 0x2000, 0),
4076 static struct coef_fw coef0292[] = {
4077 WRITE_COEF(0x6b, 0xe429),
4078 WRITE_COEF(0x76, 0x0008),
4079 WRITE_COEF(0x18, 0x7388),
4082 static struct coef_fw coef0293[] = {
4083 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
4084 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
4087 static struct coef_fw coef0688[] = {
4088 WRITE_COEF(0x11, 0x0001),
4089 WRITE_COEF(0x15, 0x0d50),
4090 WRITE_COEF(0xc3, 0x0000),
4093 static struct coef_fw coef0225[] = {
4094 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
4095 UPDATE_COEF(0x49, 1<<8, 1<<8),
4096 UPDATE_COEF(0x4a, 7<<6, 7<<6),
4097 UPDATE_COEF(0x4a, 3<<4, 3<<4),
4101 switch (codec->core.vendor_id) {
4103 alc_process_coef_fw(codec, coef0255);
4107 alc_process_coef_fw(codec, coef0256);
4111 alc_process_coef_fw(codec, coef0233);
4114 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
4115 /* ALC298 jack type setting is the same with ALC286/ALC288 */
4118 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
4120 alc_process_coef_fw(codec, coef0288);
4123 alc_process_coef_fw(codec, coef0292);
4126 alc_process_coef_fw(codec, coef0293);
4129 alc_process_coef_fw(codec, coef0688);
4134 alc_process_coef_fw(codec, coef0225);
4137 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
4140 static void alc_determine_headset_type(struct hda_codec *codec)
4143 bool is_ctia = false;
4144 struct alc_spec *spec = codec->spec;
4145 static struct coef_fw coef0255[] = {
4146 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
4147 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
4151 static struct coef_fw coef0288[] = {
4152 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
4155 static struct coef_fw coef0293[] = {
4156 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
4157 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
4160 static struct coef_fw coef0688[] = {
4161 WRITE_COEF(0x11, 0x0001),
4162 WRITE_COEF(0xb7, 0x802b),
4163 WRITE_COEF(0x15, 0x0d60),
4164 WRITE_COEF(0xc3, 0x0c00),
4167 static struct coef_fw coef0225[] = {
4168 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4169 UPDATE_COEF(0x49, 1<<8, 1<<8),
4173 switch (codec->core.vendor_id) {
4177 alc_process_coef_fw(codec, coef0255);
4179 val = alc_read_coef_idx(codec, 0x46);
4180 is_ctia = (val & 0x0070) == 0x0070;
4184 alc_write_coef_idx(codec, 0x45, 0xd029);
4186 val = alc_read_coef_idx(codec, 0x46);
4187 is_ctia = (val & 0x0070) == 0x0070;
4190 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020); /* Headset output enable */
4191 /* ALC298 check jack type is the same with ALC286/ALC288 */
4194 alc_process_coef_fw(codec, coef0288);
4196 val = alc_read_coef_idx(codec, 0x50);
4197 is_ctia = (val & 0x0070) == 0x0070;
4200 alc_write_coef_idx(codec, 0x6b, 0xd429);
4202 val = alc_read_coef_idx(codec, 0x6c);
4203 is_ctia = (val & 0x001c) == 0x001c;
4206 alc_process_coef_fw(codec, coef0293);
4208 val = alc_read_coef_idx(codec, 0x46);
4209 is_ctia = (val & 0x0070) == 0x0070;
4212 alc_process_coef_fw(codec, coef0688);
4214 val = alc_read_coef_idx(codec, 0xbe);
4215 is_ctia = (val & 0x1c02) == 0x1c02;
4220 alc_process_coef_fw(codec, coef0225);
4222 val = alc_read_coef_idx(codec, 0x46);
4223 is_ctia = (val & 0x00f0) == 0x00f0;
4230 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
4231 is_ctia ? "yes" : "no");
4232 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
4235 static void alc_update_headset_mode(struct hda_codec *codec)
4237 struct alc_spec *spec = codec->spec;
4239 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
4240 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
4242 int new_headset_mode;
4244 if (!snd_hda_jack_detect(codec, hp_pin))
4245 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
4246 else if (mux_pin == spec->headset_mic_pin)
4247 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
4248 else if (mux_pin == spec->headphone_mic_pin)
4249 new_headset_mode = ALC_HEADSET_MODE_MIC;
4251 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
4253 if (new_headset_mode == spec->current_headset_mode) {
4254 snd_hda_gen_update_outputs(codec);
4258 switch (new_headset_mode) {
4259 case ALC_HEADSET_MODE_UNPLUGGED:
4260 alc_headset_mode_unplugged(codec);
4261 spec->gen.hp_jack_present = false;
4263 case ALC_HEADSET_MODE_HEADSET:
4264 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
4265 alc_determine_headset_type(codec);
4266 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
4267 alc_headset_mode_ctia(codec);
4268 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
4269 alc_headset_mode_omtp(codec);
4270 spec->gen.hp_jack_present = true;
4272 case ALC_HEADSET_MODE_MIC:
4273 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
4274 spec->gen.hp_jack_present = false;
4276 case ALC_HEADSET_MODE_HEADPHONE:
4277 alc_headset_mode_default(codec);
4278 spec->gen.hp_jack_present = true;
4281 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
4282 snd_hda_set_pin_ctl_cache(codec, hp_pin,
4283 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
4284 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
4285 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
4288 spec->current_headset_mode = new_headset_mode;
4290 snd_hda_gen_update_outputs(codec);
4293 static void alc_update_headset_mode_hook(struct hda_codec *codec,
4294 struct snd_kcontrol *kcontrol,
4295 struct snd_ctl_elem_value *ucontrol)
4297 alc_update_headset_mode(codec);
4300 static void alc_update_headset_jack_cb(struct hda_codec *codec,
4301 struct hda_jack_callback *jack)
4303 struct alc_spec *spec = codec->spec;
4304 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
4305 snd_hda_gen_hp_automute(codec, jack);
4308 static void alc_probe_headset_mode(struct hda_codec *codec)
4311 struct alc_spec *spec = codec->spec;
4312 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
4315 for (i = 0; i < cfg->num_inputs; i++) {
4316 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
4317 spec->headset_mic_pin = cfg->inputs[i].pin;
4318 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
4319 spec->headphone_mic_pin = cfg->inputs[i].pin;
4322 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
4323 spec->gen.automute_hook = alc_update_headset_mode;
4324 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
4327 static void alc_fixup_headset_mode(struct hda_codec *codec,
4328 const struct hda_fixup *fix, int action)
4330 struct alc_spec *spec = codec->spec;
4333 case HDA_FIXUP_ACT_PRE_PROBE:
4334 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
4336 case HDA_FIXUP_ACT_PROBE:
4337 alc_probe_headset_mode(codec);
4339 case HDA_FIXUP_ACT_INIT:
4340 spec->current_headset_mode = 0;
4341 alc_update_headset_mode(codec);
4346 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
4347 const struct hda_fixup *fix, int action)
4349 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4350 struct alc_spec *spec = codec->spec;
4351 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4354 alc_fixup_headset_mode(codec, fix, action);
4357 static void alc255_set_default_jack_type(struct hda_codec *codec)
4359 /* Set to iphone type */
4360 static struct coef_fw alc255fw[] = {
4361 WRITE_COEF(0x1b, 0x880b),
4362 WRITE_COEF(0x45, 0xd089),
4363 WRITE_COEF(0x1b, 0x080b),
4364 WRITE_COEF(0x46, 0x0004),
4365 WRITE_COEF(0x1b, 0x0c0b),
4368 static struct coef_fw alc256fw[] = {
4369 WRITE_COEF(0x1b, 0x884b),
4370 WRITE_COEF(0x45, 0xd089),
4371 WRITE_COEF(0x1b, 0x084b),
4372 WRITE_COEF(0x46, 0x0004),
4373 WRITE_COEF(0x1b, 0x0c4b),
4376 switch (codec->core.vendor_id) {
4378 alc_process_coef_fw(codec, alc255fw);
4382 alc_process_coef_fw(codec, alc256fw);
4388 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
4389 const struct hda_fixup *fix, int action)
4391 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4392 alc255_set_default_jack_type(codec);
4394 alc_fixup_headset_mode(codec, fix, action);
4397 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
4398 const struct hda_fixup *fix, int action)
4400 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4401 struct alc_spec *spec = codec->spec;
4402 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4403 alc255_set_default_jack_type(codec);
4406 alc_fixup_headset_mode(codec, fix, action);
4409 static void alc288_update_headset_jack_cb(struct hda_codec *codec,
4410 struct hda_jack_callback *jack)
4412 struct alc_spec *spec = codec->spec;
4415 alc_update_headset_jack_cb(codec, jack);
4416 /* Headset Mic enable or disable, only for Dell Dino */
4417 present = spec->gen.hp_jack_present ? 0x40 : 0;
4418 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
4422 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
4423 const struct hda_fixup *fix, int action)
4425 alc_fixup_headset_mode(codec, fix, action);
4426 if (action == HDA_FIXUP_ACT_PROBE) {
4427 struct alc_spec *spec = codec->spec;
4428 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
4432 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
4433 const struct hda_fixup *fix, int action)
4435 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4436 struct alc_spec *spec = codec->spec;
4437 spec->gen.auto_mute_via_amp = 1;
4441 static void alc_no_shutup(struct hda_codec *codec)
4445 static void alc_fixup_no_shutup(struct hda_codec *codec,
4446 const struct hda_fixup *fix, int action)
4448 if (action == HDA_FIXUP_ACT_PROBE) {
4449 struct alc_spec *spec = codec->spec;
4450 spec->shutup = alc_no_shutup;
4454 static void alc_fixup_disable_aamix(struct hda_codec *codec,
4455 const struct hda_fixup *fix, int action)
4457 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4458 struct alc_spec *spec = codec->spec;
4459 /* Disable AA-loopback as it causes white noise */
4460 spec->gen.mixer_nid = 0;
4464 /* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
4465 static void alc_fixup_tpt440_dock(struct hda_codec *codec,
4466 const struct hda_fixup *fix, int action)
4468 static const struct hda_pintbl pincfgs[] = {
4469 { 0x16, 0x21211010 }, /* dock headphone */
4470 { 0x19, 0x21a11010 }, /* dock mic */
4473 struct alc_spec *spec = codec->spec;
4475 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4476 spec->reboot_notify = alc_d3_at_reboot; /* reduce noise */
4477 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
4478 codec->power_save_node = 0; /* avoid click noises */
4479 snd_hda_apply_pincfgs(codec, pincfgs);
4483 static void alc_fixup_tpt470_dock(struct hda_codec *codec,
4484 const struct hda_fixup *fix, int action)
4486 static const struct hda_pintbl pincfgs[] = {
4487 { 0x17, 0x21211010 }, /* dock headphone */
4488 { 0x19, 0x21a11010 }, /* dock mic */
4491 /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
4492 * the speaker output becomes too low by some reason on Thinkpads with
4495 static hda_nid_t preferred_pairs[] = {
4496 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
4499 struct alc_spec *spec = codec->spec;
4501 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4502 spec->gen.preferred_dacs = preferred_pairs;
4503 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
4504 snd_hda_apply_pincfgs(codec, pincfgs);
4505 } else if (action == HDA_FIXUP_ACT_INIT) {
4506 /* Enable DOCK device */
4507 snd_hda_codec_write(codec, 0x17, 0,
4508 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
4509 /* Enable DOCK device */
4510 snd_hda_codec_write(codec, 0x19, 0,
4511 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
4515 static void alc_shutup_dell_xps13(struct hda_codec *codec)
4517 struct alc_spec *spec = codec->spec;
4518 int hp_pin = spec->gen.autocfg.hp_pins[0];
4520 /* Prevent pop noises when headphones are plugged in */
4521 snd_hda_codec_write(codec, hp_pin, 0,
4522 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
4526 static void alc_fixup_dell_xps13(struct hda_codec *codec,
4527 const struct hda_fixup *fix, int action)
4529 struct alc_spec *spec = codec->spec;
4530 struct hda_input_mux *imux = &spec->gen.input_mux;
4534 case HDA_FIXUP_ACT_PRE_PROBE:
4535 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
4536 * it causes a click noise at start up
4538 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
4540 case HDA_FIXUP_ACT_PROBE:
4541 spec->shutup = alc_shutup_dell_xps13;
4543 /* Make the internal mic the default input source. */
4544 for (i = 0; i < imux->num_items; i++) {
4545 if (spec->gen.imux_pins[i] == 0x12) {
4546 spec->gen.cur_mux[0] = i;
4554 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
4555 const struct hda_fixup *fix, int action)
4557 struct alc_spec *spec = codec->spec;
4559 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4560 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4561 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
4563 /* Disable boost for mic-in permanently. (This code is only called
4564 from quirks that guarantee that the headphone is at NID 0x1b.) */
4565 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
4566 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
4568 alc_fixup_headset_mode(codec, fix, action);
4571 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
4572 const struct hda_fixup *fix, int action)
4574 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4575 alc_write_coef_idx(codec, 0xc4, 0x8000);
4576 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
4577 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
4579 alc_fixup_headset_mode(codec, fix, action);
4582 /* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
4583 static int find_ext_mic_pin(struct hda_codec *codec)
4585 struct alc_spec *spec = codec->spec;
4586 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
4588 unsigned int defcfg;
4591 for (i = 0; i < cfg->num_inputs; i++) {
4592 if (cfg->inputs[i].type != AUTO_PIN_MIC)
4594 nid = cfg->inputs[i].pin;
4595 defcfg = snd_hda_codec_get_pincfg(codec, nid);
4596 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
4604 static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
4605 const struct hda_fixup *fix,
4608 struct alc_spec *spec = codec->spec;
4610 if (action == HDA_FIXUP_ACT_PROBE) {
4611 int mic_pin = find_ext_mic_pin(codec);
4612 int hp_pin = spec->gen.autocfg.hp_pins[0];
4614 if (snd_BUG_ON(!mic_pin || !hp_pin))
4616 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
4620 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
4621 const struct hda_fixup *fix,
4624 struct alc_spec *spec = codec->spec;
4625 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
4628 /* The mic boosts on level 2 and 3 are too noisy
4629 on the internal mic input.
4630 Therefore limit the boost to 0 or 1. */
4632 if (action != HDA_FIXUP_ACT_PROBE)
4635 for (i = 0; i < cfg->num_inputs; i++) {
4636 hda_nid_t nid = cfg->inputs[i].pin;
4637 unsigned int defcfg;
4638 if (cfg->inputs[i].type != AUTO_PIN_MIC)
4640 defcfg = snd_hda_codec_get_pincfg(codec, nid);
4641 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
4644 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
4645 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
4646 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
4647 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
4648 (0 << AC_AMPCAP_MUTE_SHIFT));
4652 static void alc283_hp_automute_hook(struct hda_codec *codec,
4653 struct hda_jack_callback *jack)
4655 struct alc_spec *spec = codec->spec;
4659 snd_hda_gen_hp_automute(codec, jack);
4661 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4664 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4668 static void alc283_fixup_chromebook(struct hda_codec *codec,
4669 const struct hda_fixup *fix, int action)
4671 struct alc_spec *spec = codec->spec;
4674 case HDA_FIXUP_ACT_PRE_PROBE:
4675 snd_hda_override_wcaps(codec, 0x03, 0);
4676 /* Disable AA-loopback as it causes white noise */
4677 spec->gen.mixer_nid = 0;
4679 case HDA_FIXUP_ACT_INIT:
4680 /* MIC2-VREF control */
4681 /* Set to manual mode */
4682 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
4683 /* Enable Line1 input control by verb */
4684 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
4689 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
4690 const struct hda_fixup *fix, int action)
4692 struct alc_spec *spec = codec->spec;
4695 case HDA_FIXUP_ACT_PRE_PROBE:
4696 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
4698 case HDA_FIXUP_ACT_INIT:
4699 /* MIC2-VREF control */
4700 /* Set to manual mode */
4701 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
4706 /* mute tablet speaker pin (0x14) via dock plugging in addition */
4707 static void asus_tx300_automute(struct hda_codec *codec)
4709 struct alc_spec *spec = codec->spec;
4710 snd_hda_gen_update_outputs(codec);
4711 if (snd_hda_jack_detect(codec, 0x1b))
4712 spec->gen.mute_bits |= (1ULL << 0x14);
4715 static void alc282_fixup_asus_tx300(struct hda_codec *codec,
4716 const struct hda_fixup *fix, int action)
4718 struct alc_spec *spec = codec->spec;
4719 /* TX300 needs to set up GPIO2 for the speaker amp */
4720 static const struct hda_verb gpio2_verbs[] = {
4721 { 0x01, AC_VERB_SET_GPIO_MASK, 0x04 },
4722 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04 },
4723 { 0x01, AC_VERB_SET_GPIO_DATA, 0x04 },
4726 static const struct hda_pintbl dock_pins[] = {
4727 { 0x1b, 0x21114000 }, /* dock speaker pin */
4730 struct snd_kcontrol *kctl;
4733 case HDA_FIXUP_ACT_PRE_PROBE:
4734 snd_hda_add_verbs(codec, gpio2_verbs);
4735 snd_hda_apply_pincfgs(codec, dock_pins);
4736 spec->gen.auto_mute_via_amp = 1;
4737 spec->gen.automute_hook = asus_tx300_automute;
4738 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4739 snd_hda_gen_hp_automute);
4741 case HDA_FIXUP_ACT_BUILD:
4742 /* this is a bit tricky; give more sane names for the main
4743 * (tablet) speaker and the dock speaker, respectively
4745 kctl = snd_hda_find_mixer_ctl(codec, "Speaker Playback Switch");
4747 strcpy(kctl->id.name, "Dock Speaker Playback Switch");
4748 kctl = snd_hda_find_mixer_ctl(codec, "Bass Speaker Playback Switch");
4750 strcpy(kctl->id.name, "Speaker Playback Switch");
4755 static void alc290_fixup_mono_speakers(struct hda_codec *codec,
4756 const struct hda_fixup *fix, int action)
4758 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4759 /* DAC node 0x03 is giving mono output. We therefore want to
4760 make sure 0x14 (front speaker) and 0x15 (headphones) use the
4761 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
4762 hda_nid_t conn1[2] = { 0x0c };
4763 snd_hda_override_conn_list(codec, 0x14, 1, conn1);
4764 snd_hda_override_conn_list(codec, 0x15, 1, conn1);
4768 static void alc298_fixup_speaker_volume(struct hda_codec *codec,
4769 const struct hda_fixup *fix, int action)
4771 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4772 /* The speaker is routed to the Node 0x06 by a mistake, as a result
4773 we can't adjust the speaker's volume since this node does not has
4774 Amp-out capability. we change the speaker's route to:
4775 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
4776 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
4777 speaker's volume now. */
4779 hda_nid_t conn1[1] = { 0x0c };
4780 snd_hda_override_conn_list(codec, 0x17, 1, conn1);
4784 /* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
4785 static void alc295_fixup_disable_dac3(struct hda_codec *codec,
4786 const struct hda_fixup *fix, int action)
4788 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4789 hda_nid_t conn[2] = { 0x02, 0x03 };
4790 snd_hda_override_conn_list(codec, 0x17, 2, conn);
4794 /* Hook to update amp GPIO4 for automute */
4795 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
4796 struct hda_jack_callback *jack)
4798 struct alc_spec *spec = codec->spec;
4800 snd_hda_gen_hp_automute(codec, jack);
4801 /* mute_led_polarity is set to 0, so we pass inverted value here */
4802 alc_update_gpio_led(codec, 0x10, !spec->gen.hp_jack_present);
4805 /* Manage GPIOs for HP EliteBook Folio 9480m.
4807 * GPIO4 is the headphone amplifier power control
4808 * GPIO3 is the audio output mute indicator LED
4811 static void alc280_fixup_hp_9480m(struct hda_codec *codec,
4812 const struct hda_fixup *fix,
4815 struct alc_spec *spec = codec->spec;
4816 static const struct hda_verb gpio_init[] = {
4817 { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 },
4818 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 },
4822 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4823 /* Set the hooks to turn the headphone amp on/off
4826 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
4827 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
4829 /* The GPIOs are currently off */
4832 /* GPIO3 is connected to the output mute LED,
4833 * high is on, low is off
4835 spec->mute_led_polarity = 0;
4836 spec->gpio_mute_led_mask = 0x08;
4838 /* Initialize GPIO configuration */
4839 snd_hda_add_verbs(codec, gpio_init);
4843 static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
4844 const struct hda_fixup *fix, int action)
4846 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4847 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
4850 /* for hda_fixup_thinkpad_acpi() */
4851 #include "thinkpad_helper.c"
4853 static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
4854 const struct hda_fixup *fix, int action)
4856 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
4857 hda_fixup_thinkpad_acpi(codec, fix, action);
4860 /* for dell wmi mic mute led */
4861 #include "dell_wmi_helper.c"
4864 ALC269_FIXUP_SONY_VAIO,
4865 ALC275_FIXUP_SONY_VAIO_GPIO2,
4866 ALC269_FIXUP_DELL_M101Z,
4867 ALC269_FIXUP_SKU_IGNORE,
4868 ALC269_FIXUP_ASUS_G73JW,
4869 ALC269_FIXUP_LENOVO_EAPD,
4870 ALC275_FIXUP_SONY_HWEQ,
4871 ALC275_FIXUP_SONY_DISABLE_AAMIX,
4873 ALC269_FIXUP_PCM_44K,
4874 ALC269_FIXUP_STEREO_DMIC,
4875 ALC269_FIXUP_HEADSET_MIC,
4876 ALC269_FIXUP_QUANTA_MUTE,
4877 ALC269_FIXUP_LIFEBOOK,
4878 ALC269_FIXUP_LIFEBOOK_EXTMIC,
4879 ALC269_FIXUP_LIFEBOOK_HP_PIN,
4880 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
4881 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
4884 ALC269VB_FIXUP_AMIC,
4885 ALC269VB_FIXUP_DMIC,
4886 ALC269_FIXUP_HP_MUTE_LED,
4887 ALC269_FIXUP_HP_MUTE_LED_MIC1,
4888 ALC269_FIXUP_HP_MUTE_LED_MIC2,
4889 ALC269_FIXUP_HP_GPIO_LED,
4890 ALC269_FIXUP_HP_GPIO_MIC1_LED,
4891 ALC269_FIXUP_HP_LINE1_MIC1_LED,
4892 ALC269_FIXUP_INV_DMIC,
4893 ALC269_FIXUP_LENOVO_DOCK,
4894 ALC269_FIXUP_NO_SHUTUP,
4895 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
4896 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
4897 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
4898 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
4899 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
4900 ALC269_FIXUP_HEADSET_MODE,
4901 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
4902 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
4903 ALC269_FIXUP_ASUS_X101_FUNC,
4904 ALC269_FIXUP_ASUS_X101_VERB,
4905 ALC269_FIXUP_ASUS_X101,
4906 ALC271_FIXUP_AMIC_MIC2,
4907 ALC271_FIXUP_HP_GATE_MIC_JACK,
4908 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
4909 ALC269_FIXUP_ACER_AC700,
4910 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
4911 ALC269VB_FIXUP_ASUS_ZENBOOK,
4912 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
4913 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
4914 ALC269VB_FIXUP_ORDISSIMO_EVE2,
4915 ALC283_FIXUP_CHROME_BOOK,
4916 ALC283_FIXUP_SENSE_COMBO_JACK,
4917 ALC282_FIXUP_ASUS_TX300,
4918 ALC283_FIXUP_INT_MIC,
4919 ALC290_FIXUP_MONO_SPEAKERS,
4920 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
4921 ALC290_FIXUP_SUBWOOFER,
4922 ALC290_FIXUP_SUBWOOFER_HSJACK,
4923 ALC269_FIXUP_THINKPAD_ACPI,
4924 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
4925 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
4926 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
4927 ALC255_FIXUP_HEADSET_MODE,
4928 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
4929 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
4930 ALC292_FIXUP_TPT440_DOCK,
4931 ALC292_FIXUP_TPT440,
4932 ALC283_FIXUP_HEADSET_MIC,
4933 ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED,
4934 ALC282_FIXUP_ASPIRE_V5_PINS,
4935 ALC280_FIXUP_HP_GPIO4,
4936 ALC286_FIXUP_HP_GPIO_LED,
4937 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
4938 ALC280_FIXUP_HP_DOCK_PINS,
4939 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
4940 ALC280_FIXUP_HP_9480M,
4941 ALC288_FIXUP_DELL_HEADSET_MODE,
4942 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
4943 ALC288_FIXUP_DELL_XPS_13_GPIO6,
4944 ALC288_FIXUP_DELL_XPS_13,
4945 ALC288_FIXUP_DISABLE_AAMIX,
4946 ALC292_FIXUP_DELL_E7X,
4947 ALC292_FIXUP_DISABLE_AAMIX,
4948 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
4949 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
4950 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
4951 ALC275_FIXUP_DELL_XPS,
4952 ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE,
4953 ALC293_FIXUP_LENOVO_SPK_NOISE,
4954 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
4955 ALC255_FIXUP_DELL_SPK_NOISE,
4956 ALC225_FIXUP_DISABLE_MIC_VREF,
4957 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
4958 ALC295_FIXUP_DISABLE_DAC3,
4959 ALC280_FIXUP_HP_HEADSET_MIC,
4960 ALC221_FIXUP_HP_FRONT_MIC,
4961 ALC292_FIXUP_TPT460,
4962 ALC298_FIXUP_SPK_VOLUME,
4963 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
4964 ALC298_FIXUP_TPT470_DOCK,
4967 static const struct hda_fixup alc269_fixups[] = {
4968 [ALC269_FIXUP_SONY_VAIO] = {
4969 .type = HDA_FIXUP_PINCTLS,
4970 .v.pins = (const struct hda_pintbl[]) {
4971 {0x19, PIN_VREFGRD},
4975 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
4976 .type = HDA_FIXUP_VERBS,
4977 .v.verbs = (const struct hda_verb[]) {
4978 {0x01, AC_VERB_SET_GPIO_MASK, 0x04},
4979 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04},
4980 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4984 .chain_id = ALC269_FIXUP_SONY_VAIO
4986 [ALC269_FIXUP_DELL_M101Z] = {
4987 .type = HDA_FIXUP_VERBS,
4988 .v.verbs = (const struct hda_verb[]) {
4989 /* Enables internal speaker */
4990 {0x20, AC_VERB_SET_COEF_INDEX, 13},
4991 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
4995 [ALC269_FIXUP_SKU_IGNORE] = {
4996 .type = HDA_FIXUP_FUNC,
4997 .v.func = alc_fixup_sku_ignore,
4999 [ALC269_FIXUP_ASUS_G73JW] = {
5000 .type = HDA_FIXUP_PINS,
5001 .v.pins = (const struct hda_pintbl[]) {
5002 { 0x17, 0x99130111 }, /* subwoofer */
5006 [ALC269_FIXUP_LENOVO_EAPD] = {
5007 .type = HDA_FIXUP_VERBS,
5008 .v.verbs = (const struct hda_verb[]) {
5009 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
5013 [ALC275_FIXUP_SONY_HWEQ] = {
5014 .type = HDA_FIXUP_FUNC,
5015 .v.func = alc269_fixup_hweq,
5017 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
5019 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
5020 .type = HDA_FIXUP_FUNC,
5021 .v.func = alc_fixup_disable_aamix,
5023 .chain_id = ALC269_FIXUP_SONY_VAIO
5025 [ALC271_FIXUP_DMIC] = {
5026 .type = HDA_FIXUP_FUNC,
5027 .v.func = alc271_fixup_dmic,
5029 [ALC269_FIXUP_PCM_44K] = {
5030 .type = HDA_FIXUP_FUNC,
5031 .v.func = alc269_fixup_pcm_44k,
5033 .chain_id = ALC269_FIXUP_QUANTA_MUTE
5035 [ALC269_FIXUP_STEREO_DMIC] = {
5036 .type = HDA_FIXUP_FUNC,
5037 .v.func = alc269_fixup_stereo_dmic,
5039 [ALC269_FIXUP_HEADSET_MIC] = {
5040 .type = HDA_FIXUP_FUNC,
5041 .v.func = alc269_fixup_headset_mic,
5043 [ALC269_FIXUP_QUANTA_MUTE] = {
5044 .type = HDA_FIXUP_FUNC,
5045 .v.func = alc269_fixup_quanta_mute,
5047 [ALC269_FIXUP_LIFEBOOK] = {
5048 .type = HDA_FIXUP_PINS,
5049 .v.pins = (const struct hda_pintbl[]) {
5050 { 0x1a, 0x2101103f }, /* dock line-out */
5051 { 0x1b, 0x23a11040 }, /* dock mic-in */
5055 .chain_id = ALC269_FIXUP_QUANTA_MUTE
5057 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
5058 .type = HDA_FIXUP_PINS,
5059 .v.pins = (const struct hda_pintbl[]) {
5060 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
5064 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
5065 .type = HDA_FIXUP_PINS,
5066 .v.pins = (const struct hda_pintbl[]) {
5067 { 0x21, 0x0221102f }, /* HP out */
5071 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
5072 .type = HDA_FIXUP_FUNC,
5073 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
5075 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
5076 .type = HDA_FIXUP_FUNC,
5077 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
5079 [ALC269_FIXUP_AMIC] = {
5080 .type = HDA_FIXUP_PINS,
5081 .v.pins = (const struct hda_pintbl[]) {
5082 { 0x14, 0x99130110 }, /* speaker */
5083 { 0x15, 0x0121401f }, /* HP out */
5084 { 0x18, 0x01a19c20 }, /* mic */
5085 { 0x19, 0x99a3092f }, /* int-mic */
5089 [ALC269_FIXUP_DMIC] = {
5090 .type = HDA_FIXUP_PINS,
5091 .v.pins = (const struct hda_pintbl[]) {
5092 { 0x12, 0x99a3092f }, /* int-mic */
5093 { 0x14, 0x99130110 }, /* speaker */
5094 { 0x15, 0x0121401f }, /* HP out */
5095 { 0x18, 0x01a19c20 }, /* mic */
5099 [ALC269VB_FIXUP_AMIC] = {
5100 .type = HDA_FIXUP_PINS,
5101 .v.pins = (const struct hda_pintbl[]) {
5102 { 0x14, 0x99130110 }, /* speaker */
5103 { 0x18, 0x01a19c20 }, /* mic */
5104 { 0x19, 0x99a3092f }, /* int-mic */
5105 { 0x21, 0x0121401f }, /* HP out */
5109 [ALC269VB_FIXUP_DMIC] = {
5110 .type = HDA_FIXUP_PINS,
5111 .v.pins = (const struct hda_pintbl[]) {
5112 { 0x12, 0x99a3092f }, /* int-mic */
5113 { 0x14, 0x99130110 }, /* speaker */
5114 { 0x18, 0x01a19c20 }, /* mic */
5115 { 0x21, 0x0121401f }, /* HP out */
5119 [ALC269_FIXUP_HP_MUTE_LED] = {
5120 .type = HDA_FIXUP_FUNC,
5121 .v.func = alc269_fixup_hp_mute_led,
5123 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
5124 .type = HDA_FIXUP_FUNC,
5125 .v.func = alc269_fixup_hp_mute_led_mic1,
5127 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
5128 .type = HDA_FIXUP_FUNC,
5129 .v.func = alc269_fixup_hp_mute_led_mic2,
5131 [ALC269_FIXUP_HP_GPIO_LED] = {
5132 .type = HDA_FIXUP_FUNC,
5133 .v.func = alc269_fixup_hp_gpio_led,
5135 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
5136 .type = HDA_FIXUP_FUNC,
5137 .v.func = alc269_fixup_hp_gpio_mic1_led,
5139 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
5140 .type = HDA_FIXUP_FUNC,
5141 .v.func = alc269_fixup_hp_line1_mic1_led,
5143 [ALC269_FIXUP_INV_DMIC] = {
5144 .type = HDA_FIXUP_FUNC,
5145 .v.func = alc_fixup_inv_dmic,
5147 [ALC269_FIXUP_NO_SHUTUP] = {
5148 .type = HDA_FIXUP_FUNC,
5149 .v.func = alc_fixup_no_shutup,
5151 [ALC269_FIXUP_LENOVO_DOCK] = {
5152 .type = HDA_FIXUP_PINS,
5153 .v.pins = (const struct hda_pintbl[]) {
5154 { 0x19, 0x23a11040 }, /* dock mic */
5155 { 0x1b, 0x2121103f }, /* dock headphone */
5159 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
5161 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
5162 .type = HDA_FIXUP_FUNC,
5163 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
5165 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
5167 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
5168 .type = HDA_FIXUP_PINS,
5169 .v.pins = (const struct hda_pintbl[]) {
5170 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5171 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5175 .chain_id = ALC269_FIXUP_HEADSET_MODE
5177 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
5178 .type = HDA_FIXUP_PINS,
5179 .v.pins = (const struct hda_pintbl[]) {
5180 { 0x16, 0x21014020 }, /* dock line out */
5181 { 0x19, 0x21a19030 }, /* dock mic */
5182 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5186 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
5188 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
5189 .type = HDA_FIXUP_PINS,
5190 .v.pins = (const struct hda_pintbl[]) {
5191 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5195 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
5197 [ALC269_FIXUP_HEADSET_MODE] = {
5198 .type = HDA_FIXUP_FUNC,
5199 .v.func = alc_fixup_headset_mode,
5201 .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
5203 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
5204 .type = HDA_FIXUP_FUNC,
5205 .v.func = alc_fixup_headset_mode_no_hp_mic,
5207 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
5208 .type = HDA_FIXUP_PINS,
5209 .v.pins = (const struct hda_pintbl[]) {
5210 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
5214 .chain_id = ALC269_FIXUP_HEADSET_MODE,
5216 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
5217 .type = HDA_FIXUP_PINS,
5218 .v.pins = (const struct hda_pintbl[]) {
5219 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5223 .chain_id = ALC269_FIXUP_HEADSET_MIC
5225 [ALC269_FIXUP_ASUS_X101_FUNC] = {
5226 .type = HDA_FIXUP_FUNC,
5227 .v.func = alc269_fixup_x101_headset_mic,
5229 [ALC269_FIXUP_ASUS_X101_VERB] = {
5230 .type = HDA_FIXUP_VERBS,
5231 .v.verbs = (const struct hda_verb[]) {
5232 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5233 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
5234 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
5238 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
5240 [ALC269_FIXUP_ASUS_X101] = {
5241 .type = HDA_FIXUP_PINS,
5242 .v.pins = (const struct hda_pintbl[]) {
5243 { 0x18, 0x04a1182c }, /* Headset mic */
5247 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
5249 [ALC271_FIXUP_AMIC_MIC2] = {
5250 .type = HDA_FIXUP_PINS,
5251 .v.pins = (const struct hda_pintbl[]) {
5252 { 0x14, 0x99130110 }, /* speaker */
5253 { 0x19, 0x01a19c20 }, /* mic */
5254 { 0x1b, 0x99a7012f }, /* int-mic */
5255 { 0x21, 0x0121401f }, /* HP out */
5259 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
5260 .type = HDA_FIXUP_FUNC,
5261 .v.func = alc271_hp_gate_mic_jack,
5263 .chain_id = ALC271_FIXUP_AMIC_MIC2,
5265 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
5266 .type = HDA_FIXUP_FUNC,
5267 .v.func = alc269_fixup_limit_int_mic_boost,
5269 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
5271 [ALC269_FIXUP_ACER_AC700] = {
5272 .type = HDA_FIXUP_PINS,
5273 .v.pins = (const struct hda_pintbl[]) {
5274 { 0x12, 0x99a3092f }, /* int-mic */
5275 { 0x14, 0x99130110 }, /* speaker */
5276 { 0x18, 0x03a11c20 }, /* mic */
5277 { 0x1e, 0x0346101e }, /* SPDIF1 */
5278 { 0x21, 0x0321101f }, /* HP out */
5282 .chain_id = ALC271_FIXUP_DMIC,
5284 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
5285 .type = HDA_FIXUP_FUNC,
5286 .v.func = alc269_fixup_limit_int_mic_boost,
5288 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
5290 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
5291 .type = HDA_FIXUP_FUNC,
5292 .v.func = alc269_fixup_limit_int_mic_boost,
5294 .chain_id = ALC269VB_FIXUP_DMIC,
5296 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
5297 .type = HDA_FIXUP_VERBS,
5298 .v.verbs = (const struct hda_verb[]) {
5299 /* class-D output amp +5dB */
5300 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
5301 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
5305 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
5307 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
5308 .type = HDA_FIXUP_FUNC,
5309 .v.func = alc269_fixup_limit_int_mic_boost,
5311 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
5313 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
5314 .type = HDA_FIXUP_PINS,
5315 .v.pins = (const struct hda_pintbl[]) {
5316 { 0x12, 0x99a3092f }, /* int-mic */
5317 { 0x18, 0x03a11d20 }, /* mic */
5318 { 0x19, 0x411111f0 }, /* Unused bogus pin */
5322 [ALC283_FIXUP_CHROME_BOOK] = {
5323 .type = HDA_FIXUP_FUNC,
5324 .v.func = alc283_fixup_chromebook,
5326 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
5327 .type = HDA_FIXUP_FUNC,
5328 .v.func = alc283_fixup_sense_combo_jack,
5330 .chain_id = ALC283_FIXUP_CHROME_BOOK,
5332 [ALC282_FIXUP_ASUS_TX300] = {
5333 .type = HDA_FIXUP_FUNC,
5334 .v.func = alc282_fixup_asus_tx300,
5336 [ALC283_FIXUP_INT_MIC] = {
5337 .type = HDA_FIXUP_VERBS,
5338 .v.verbs = (const struct hda_verb[]) {
5339 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
5340 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
5344 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
5346 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
5347 .type = HDA_FIXUP_PINS,
5348 .v.pins = (const struct hda_pintbl[]) {
5349 { 0x17, 0x90170112 }, /* subwoofer */
5353 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
5355 [ALC290_FIXUP_SUBWOOFER] = {
5356 .type = HDA_FIXUP_PINS,
5357 .v.pins = (const struct hda_pintbl[]) {
5358 { 0x17, 0x90170112 }, /* subwoofer */
5362 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
5364 [ALC290_FIXUP_MONO_SPEAKERS] = {
5365 .type = HDA_FIXUP_FUNC,
5366 .v.func = alc290_fixup_mono_speakers,
5368 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
5369 .type = HDA_FIXUP_FUNC,
5370 .v.func = alc290_fixup_mono_speakers,
5372 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
5374 [ALC269_FIXUP_THINKPAD_ACPI] = {
5375 .type = HDA_FIXUP_FUNC,
5376 .v.func = alc_fixup_thinkpad_acpi,
5378 .chain_id = ALC269_FIXUP_SKU_IGNORE,
5380 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
5381 .type = HDA_FIXUP_FUNC,
5382 .v.func = alc_fixup_inv_dmic,
5384 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
5386 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
5387 .type = HDA_FIXUP_PINS,
5388 .v.pins = (const struct hda_pintbl[]) {
5389 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5390 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5394 .chain_id = ALC255_FIXUP_HEADSET_MODE
5396 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
5397 .type = HDA_FIXUP_PINS,
5398 .v.pins = (const struct hda_pintbl[]) {
5399 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5403 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
5405 [ALC255_FIXUP_HEADSET_MODE] = {
5406 .type = HDA_FIXUP_FUNC,
5407 .v.func = alc_fixup_headset_mode_alc255,
5409 .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
5411 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
5412 .type = HDA_FIXUP_FUNC,
5413 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
5415 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
5416 .type = HDA_FIXUP_PINS,
5417 .v.pins = (const struct hda_pintbl[]) {
5418 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5419 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5423 .chain_id = ALC269_FIXUP_HEADSET_MODE
5425 [ALC292_FIXUP_TPT440_DOCK] = {
5426 .type = HDA_FIXUP_FUNC,
5427 .v.func = alc_fixup_tpt440_dock,
5429 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
5431 [ALC292_FIXUP_TPT440] = {
5432 .type = HDA_FIXUP_FUNC,
5433 .v.func = alc_fixup_disable_aamix,
5435 .chain_id = ALC292_FIXUP_TPT440_DOCK,
5437 [ALC283_FIXUP_HEADSET_MIC] = {
5438 .type = HDA_FIXUP_PINS,
5439 .v.pins = (const struct hda_pintbl[]) {
5440 { 0x19, 0x04a110f0 },
5444 [ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED] = {
5445 .type = HDA_FIXUP_FUNC,
5446 .v.func = alc_fixup_dell_wmi,
5448 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
5449 .type = HDA_FIXUP_PINS,
5450 .v.pins = (const struct hda_pintbl[]) {
5451 { 0x12, 0x90a60130 },
5452 { 0x14, 0x90170110 },
5453 { 0x17, 0x40000008 },
5454 { 0x18, 0x411111f0 },
5455 { 0x19, 0x01a1913c },
5456 { 0x1a, 0x411111f0 },
5457 { 0x1b, 0x411111f0 },
5458 { 0x1d, 0x40f89b2d },
5459 { 0x1e, 0x411111f0 },
5460 { 0x21, 0x0321101f },
5464 [ALC280_FIXUP_HP_GPIO4] = {
5465 .type = HDA_FIXUP_FUNC,
5466 .v.func = alc280_fixup_hp_gpio4,
5468 [ALC286_FIXUP_HP_GPIO_LED] = {
5469 .type = HDA_FIXUP_FUNC,
5470 .v.func = alc286_fixup_hp_gpio_led,
5472 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
5473 .type = HDA_FIXUP_FUNC,
5474 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
5476 [ALC280_FIXUP_HP_DOCK_PINS] = {
5477 .type = HDA_FIXUP_PINS,
5478 .v.pins = (const struct hda_pintbl[]) {
5479 { 0x1b, 0x21011020 }, /* line-out */
5480 { 0x1a, 0x01a1903c }, /* headset mic */
5481 { 0x18, 0x2181103f }, /* line-in */
5485 .chain_id = ALC280_FIXUP_HP_GPIO4
5487 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
5488 .type = HDA_FIXUP_PINS,
5489 .v.pins = (const struct hda_pintbl[]) {
5490 { 0x1b, 0x21011020 }, /* line-out */
5491 { 0x18, 0x2181103f }, /* line-in */
5495 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
5497 [ALC280_FIXUP_HP_9480M] = {
5498 .type = HDA_FIXUP_FUNC,
5499 .v.func = alc280_fixup_hp_9480m,
5501 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
5502 .type = HDA_FIXUP_FUNC,
5503 .v.func = alc_fixup_headset_mode_dell_alc288,
5505 .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
5507 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
5508 .type = HDA_FIXUP_PINS,
5509 .v.pins = (const struct hda_pintbl[]) {
5510 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5511 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5515 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
5517 [ALC288_FIXUP_DELL_XPS_13_GPIO6] = {
5518 .type = HDA_FIXUP_VERBS,
5519 .v.verbs = (const struct hda_verb[]) {
5520 {0x01, AC_VERB_SET_GPIO_MASK, 0x40},
5521 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x40},
5522 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5526 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
5528 [ALC288_FIXUP_DISABLE_AAMIX] = {
5529 .type = HDA_FIXUP_FUNC,
5530 .v.func = alc_fixup_disable_aamix,
5532 .chain_id = ALC288_FIXUP_DELL_XPS_13_GPIO6
5534 [ALC288_FIXUP_DELL_XPS_13] = {
5535 .type = HDA_FIXUP_FUNC,
5536 .v.func = alc_fixup_dell_xps13,
5538 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
5540 [ALC292_FIXUP_DISABLE_AAMIX] = {
5541 .type = HDA_FIXUP_FUNC,
5542 .v.func = alc_fixup_disable_aamix,
5544 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
5546 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
5547 .type = HDA_FIXUP_FUNC,
5548 .v.func = alc_fixup_disable_aamix,
5550 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
5552 [ALC292_FIXUP_DELL_E7X] = {
5553 .type = HDA_FIXUP_FUNC,
5554 .v.func = alc_fixup_dell_xps13,
5556 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
5558 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
5559 .type = HDA_FIXUP_PINS,
5560 .v.pins = (const struct hda_pintbl[]) {
5561 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5562 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5566 .chain_id = ALC269_FIXUP_HEADSET_MODE
5568 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
5569 .type = HDA_FIXUP_PINS,
5570 .v.pins = (const struct hda_pintbl[]) {
5571 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5575 .chain_id = ALC269_FIXUP_HEADSET_MODE
5577 [ALC275_FIXUP_DELL_XPS] = {
5578 .type = HDA_FIXUP_VERBS,
5579 .v.verbs = (const struct hda_verb[]) {
5580 /* Enables internal speaker */
5581 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
5582 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
5583 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
5584 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
5588 [ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE] = {
5589 .type = HDA_FIXUP_VERBS,
5590 .v.verbs = (const struct hda_verb[]) {
5591 /* Disable pass-through path for FRONT 14h */
5592 {0x20, AC_VERB_SET_COEF_INDEX, 0x36},
5593 {0x20, AC_VERB_SET_PROC_COEF, 0x1737},
5597 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
5599 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
5600 .type = HDA_FIXUP_FUNC,
5601 .v.func = alc_fixup_disable_aamix,
5603 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
5605 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
5606 .type = HDA_FIXUP_FUNC,
5607 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
5609 [ALC255_FIXUP_DELL_SPK_NOISE] = {
5610 .type = HDA_FIXUP_FUNC,
5611 .v.func = alc_fixup_disable_aamix,
5613 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
5615 [ALC225_FIXUP_DISABLE_MIC_VREF] = {
5616 .type = HDA_FIXUP_FUNC,
5617 .v.func = alc_fixup_disable_mic_vref,
5619 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
5621 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
5622 .type = HDA_FIXUP_VERBS,
5623 .v.verbs = (const struct hda_verb[]) {
5624 /* Disable pass-through path for FRONT 14h */
5625 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
5626 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
5630 .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
5632 [ALC280_FIXUP_HP_HEADSET_MIC] = {
5633 .type = HDA_FIXUP_FUNC,
5634 .v.func = alc_fixup_disable_aamix,
5636 .chain_id = ALC269_FIXUP_HEADSET_MIC,
5638 [ALC221_FIXUP_HP_FRONT_MIC] = {
5639 .type = HDA_FIXUP_PINS,
5640 .v.pins = (const struct hda_pintbl[]) {
5641 { 0x19, 0x02a19020 }, /* Front Mic */
5645 [ALC292_FIXUP_TPT460] = {
5646 .type = HDA_FIXUP_FUNC,
5647 .v.func = alc_fixup_tpt440_dock,
5649 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
5651 [ALC298_FIXUP_SPK_VOLUME] = {
5652 .type = HDA_FIXUP_FUNC,
5653 .v.func = alc298_fixup_speaker_volume,
5655 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
5657 [ALC295_FIXUP_DISABLE_DAC3] = {
5658 .type = HDA_FIXUP_FUNC,
5659 .v.func = alc295_fixup_disable_dac3,
5661 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
5662 .type = HDA_FIXUP_PINS,
5663 .v.pins = (const struct hda_pintbl[]) {
5664 { 0x1b, 0x90170151 },
5668 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
5670 [ALC298_FIXUP_TPT470_DOCK] = {
5671 .type = HDA_FIXUP_FUNC,
5672 .v.func = alc_fixup_tpt470_dock,
5674 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
5678 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
5679 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
5680 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
5681 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
5682 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
5683 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
5684 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
5685 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
5686 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
5687 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
5688 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
5689 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
5690 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
5691 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
5692 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
5693 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
5694 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
5695 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
5696 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
5697 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
5698 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
5699 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
5700 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
5701 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
5702 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
5703 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
5704 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
5705 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
5706 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
5707 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
5708 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
5709 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
5710 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
5711 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
5712 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
5713 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
5714 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
5715 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
5716 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
5717 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
5718 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
5719 SND_PCI_QUIRK(0x1028, 0x0704, "Dell XPS 13 9350", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
5720 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
5721 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
5722 SND_PCI_QUIRK(0x1028, 0x075b, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
5723 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
5724 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
5725 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
5726 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
5727 SND_PCI_QUIRK(0x1028, 0x082a, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
5728 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
5729 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
5730 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
5731 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
5732 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
5733 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
5735 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5736 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5737 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5738 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
5739 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
5740 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
5741 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
5742 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
5743 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5744 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5745 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5746 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5747 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
5748 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
5749 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
5750 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5751 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5752 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5753 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5754 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5755 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
5756 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5757 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5759 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5760 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5761 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5762 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5763 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5764 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5765 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5766 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5767 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5768 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
5769 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5770 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5771 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5772 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5773 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5774 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5775 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5776 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5777 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5778 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5779 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5780 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5781 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5782 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5783 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5784 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5785 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5786 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5787 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5788 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
5789 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
5790 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
5791 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
5792 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
5793 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
5794 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
5795 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
5796 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
5797 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
5798 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
5799 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
5800 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
5801 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
5802 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
5803 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
5804 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
5805 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
5806 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
5807 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
5808 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
5809 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
5810 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
5811 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
5812 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
5813 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
5814 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
5815 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
5816 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
5817 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
5818 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
5819 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
5820 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
5821 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
5822 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
5823 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
5824 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK),
5825 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
5826 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
5827 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
5828 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
5829 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
5830 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
5831 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
5832 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
5833 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
5834 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
5835 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
5836 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
5837 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
5838 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
5839 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
5840 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
5841 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
5842 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
5843 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
5844 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
5845 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
5846 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
5847 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
5848 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
5849 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
5850 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
5851 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
5852 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
5853 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
5854 SND_PCI_QUIRK(0x17aa, 0x3112, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
5855 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
5856 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
5857 SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP),
5858 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
5859 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
5860 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
5861 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
5862 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
5863 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
5864 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
5865 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
5866 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
5867 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
5868 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
5869 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
5870 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
5871 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
5872 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
5873 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
5874 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
5875 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
5876 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
5877 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
5878 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
5881 /* Below is a quirk table taken from the old code.
5882 * Basically the device should work as is without the fixup table.
5883 * If BIOS doesn't give a proper info, enable the corresponding
5886 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
5888 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
5889 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
5890 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
5891 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
5892 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
5893 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
5894 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
5895 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
5896 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
5897 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
5898 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
5899 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
5900 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
5901 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
5902 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
5903 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
5904 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
5905 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
5906 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
5907 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
5908 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
5909 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
5910 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
5911 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
5912 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
5913 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
5914 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
5915 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
5916 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
5917 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
5918 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
5919 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
5920 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
5921 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
5922 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
5923 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
5924 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
5925 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
5926 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
5931 static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
5932 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
5933 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
5934 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
5935 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
5939 static const struct hda_model_fixup alc269_fixup_models[] = {
5940 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
5941 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
5942 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
5943 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
5944 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
5945 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
5946 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
5947 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
5948 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
5949 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
5950 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
5951 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
5952 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
5953 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
5954 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
5955 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
5956 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
5957 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
5960 #define ALC225_STANDARD_PINS \
5963 #define ALC256_STANDARD_PINS \
5964 {0x12, 0x90a60140}, \
5965 {0x14, 0x90170110}, \
5968 #define ALC282_STANDARD_PINS \
5971 #define ALC290_STANDARD_PINS \
5974 #define ALC292_STANDARD_PINS \
5975 {0x14, 0x90170110}, \
5978 #define ALC295_STANDARD_PINS \
5979 {0x12, 0xb7a60130}, \
5980 {0x14, 0x90170110}, \
5983 #define ALC298_STANDARD_PINS \
5984 {0x12, 0x90a60130}, \
5987 static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
5988 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
5989 ALC225_STANDARD_PINS,
5991 {0x14, 0x901701a0}),
5992 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
5993 ALC225_STANDARD_PINS,
5995 {0x14, 0x901701b0}),
5996 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
5997 ALC225_STANDARD_PINS,
5999 {0x14, 0x901701a0}),
6000 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
6001 ALC225_STANDARD_PINS,
6003 {0x14, 0x901701b0}),
6004 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
6005 ALC225_STANDARD_PINS,
6007 {0x1b, 0x90170110}),
6008 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6011 {0x21, 0x02211020}),
6012 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6015 {0x21, 0x02211020}),
6016 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
6018 {0x21, 0x02211020}),
6019 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6021 {0x21, 0x02211040}),
6022 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6025 {0x21, 0x02211020}),
6026 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6029 {0x21, 0x02211030}),
6030 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6033 {0x21, 0x0221101f}),
6034 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6037 {0x21, 0x0221101f}),
6038 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6041 {0x21, 0x0221103f}),
6042 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6045 {0x21, 0x0221103f}),
6046 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6049 {0x21, 0x0221103f}),
6050 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6053 {0x21, 0x0221105f}),
6054 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6057 {0x21, 0x0221101f}),
6058 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6062 {0x21, 0x0321102f}),
6063 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6066 {0x21, 0x02211040}),
6067 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6070 {0x21, 0x02211050}),
6071 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6074 {0x21, 0x02211030}),
6075 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6078 {0x21, 0x02211040}),
6079 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6082 {0x21, 0x02211040}),
6083 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6086 {0x21, 0x02211050}),
6087 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6090 {0x21, 0x02211040}),
6091 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6094 {0x21, 0x02211030}),
6095 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6097 {0x21, 0x02211010}),
6098 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6102 {0x21, 0x0221101f}),
6103 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6106 {0x21, 0x02211030}),
6107 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6110 {0x21, 0x02211030}),
6111 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell Inspiron 5468", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6114 {0x21, 0x02211030}),
6115 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6118 {0x21, 0x02211020}),
6119 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6123 {0x21, 0x0221101f}),
6124 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6125 ALC256_STANDARD_PINS),
6126 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
6130 {0x1a, 0x04a11020}),
6131 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
6137 {0x1b, 0x02011020}),
6138 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
6139 ALC282_STANDARD_PINS,
6142 {0x21, 0x0321101f}),
6143 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
6144 ALC282_STANDARD_PINS,
6147 {0x21, 0x03211040}),
6148 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
6149 ALC282_STANDARD_PINS,
6152 {0x21, 0x03211020}),
6153 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
6154 ALC282_STANDARD_PINS,
6157 {0x21, 0x0421101f}),
6158 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
6159 ALC282_STANDARD_PINS,
6162 {0x21, 0x04211020}),
6163 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6164 ALC282_STANDARD_PINS,
6166 {0x21, 0x0321101f}),
6167 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6170 {0x21, 0x02211030}),
6171 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6172 ALC282_STANDARD_PINS,
6175 {0x21, 0x0321101f}),
6176 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL_XPS_13_GPIO6,
6179 {0x21, 0x0321101f}),
6180 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
6183 {0x21, 0x04211020}),
6184 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
6185 ALC290_STANDARD_PINS,
6188 {0x1a, 0x04a11020}),
6189 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
6190 ALC290_STANDARD_PINS,
6193 {0x1a, 0x04a11020}),
6194 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
6195 ALC290_STANDARD_PINS,
6197 {0x1a, 0x04a11020}),
6198 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
6199 ALC290_STANDARD_PINS,
6201 {0x1a, 0x04a11040}),
6202 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
6203 ALC290_STANDARD_PINS,
6206 {0x1a, 0x04a11040}),
6207 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
6208 ALC290_STANDARD_PINS,
6211 {0x1a, 0x04a11020}),
6212 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
6213 ALC290_STANDARD_PINS,
6216 {0x1a, 0x04a11020}),
6217 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
6218 ALC292_STANDARD_PINS,
6221 {0x19, 0x01a19030}),
6222 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
6223 ALC292_STANDARD_PINS,
6227 {0x19, 0x01a1903e}),
6228 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
6229 ALC292_STANDARD_PINS,
6230 {0x12, 0x90a60140}),
6231 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
6232 ALC292_STANDARD_PINS,
6235 {0x19, 0x21a19030}),
6236 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
6237 ALC292_STANDARD_PINS,
6238 {0x13, 0x90a60140}),
6239 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6240 ALC295_STANDARD_PINS,
6242 {0x18, 0x21a19030}),
6243 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6244 ALC295_STANDARD_PINS,
6246 {0x18, 0x21a19050}),
6247 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6248 ALC295_STANDARD_PINS),
6249 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
6250 ALC298_STANDARD_PINS,
6251 {0x17, 0x90170110}),
6252 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
6253 ALC298_STANDARD_PINS,
6254 {0x17, 0x90170140}),
6255 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
6256 ALC298_STANDARD_PINS,
6257 {0x17, 0x90170150}),
6258 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
6263 {0x21, 0x03211030}),
6267 static void alc269_fill_coef(struct hda_codec *codec)
6269 struct alc_spec *spec = codec->spec;
6272 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
6275 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
6276 alc_write_coef_idx(codec, 0xf, 0x960b);
6277 alc_write_coef_idx(codec, 0xe, 0x8817);
6280 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
6281 alc_write_coef_idx(codec, 0xf, 0x960b);
6282 alc_write_coef_idx(codec, 0xe, 0x8814);
6285 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
6286 /* Power up output pin */
6287 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
6290 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
6291 val = alc_read_coef_idx(codec, 0xd);
6292 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
6293 /* Capless ramp up clock control */
6294 alc_write_coef_idx(codec, 0xd, val | (1<<10));
6296 val = alc_read_coef_idx(codec, 0x17);
6297 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
6298 /* Class D power on reset */
6299 alc_write_coef_idx(codec, 0x17, val | (1<<7));
6304 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
6309 static int patch_alc269(struct hda_codec *codec)
6311 struct alc_spec *spec;
6314 err = alc_alloc_spec(codec, 0x0b);
6319 spec->gen.shared_mic_vref_pin = 0x18;
6320 codec->power_save_node = 1;
6323 codec->patch_ops.suspend = alc269_suspend;
6324 codec->patch_ops.resume = alc269_resume;
6326 spec->shutup = alc269_shutup;
6328 snd_hda_pick_fixup(codec, alc269_fixup_models,
6329 alc269_fixup_tbl, alc269_fixups);
6330 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups);
6331 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
6333 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
6335 alc_auto_parse_customize_define(codec);
6337 if (has_cdefine_beep(codec))
6338 spec->gen.beep_nid = 0x01;
6340 switch (codec->core.vendor_id) {
6342 spec->codec_variant = ALC269_TYPE_ALC269VA;
6343 switch (alc_get_coef0(codec) & 0x00f0) {
6345 if (codec->bus->pci &&
6346 codec->bus->pci->subsystem_vendor == 0x1025 &&
6347 spec->cdefine.platform_type == 1)
6348 err = alc_codec_rename(codec, "ALC271X");
6349 spec->codec_variant = ALC269_TYPE_ALC269VB;
6352 if (codec->bus->pci &&
6353 codec->bus->pci->subsystem_vendor == 0x17aa &&
6354 codec->bus->pci->subsystem_device == 0x21f3)
6355 err = alc_codec_rename(codec, "ALC3202");
6356 spec->codec_variant = ALC269_TYPE_ALC269VC;
6359 spec->codec_variant = ALC269_TYPE_ALC269VD;
6362 alc_fix_pll_init(codec, 0x20, 0x04, 15);
6366 spec->init_hook = alc269_fill_coef;
6367 alc269_fill_coef(codec);
6372 spec->codec_variant = ALC269_TYPE_ALC280;
6375 spec->codec_variant = ALC269_TYPE_ALC282;
6376 spec->shutup = alc282_shutup;
6377 spec->init_hook = alc282_init;
6381 spec->codec_variant = ALC269_TYPE_ALC283;
6382 spec->shutup = alc283_shutup;
6383 spec->init_hook = alc283_init;
6387 spec->codec_variant = ALC269_TYPE_ALC284;
6391 spec->codec_variant = ALC269_TYPE_ALC285;
6395 spec->codec_variant = ALC269_TYPE_ALC286;
6396 spec->shutup = alc286_shutup;
6399 spec->codec_variant = ALC269_TYPE_ALC298;
6403 spec->codec_variant = ALC269_TYPE_ALC255;
6407 spec->codec_variant = ALC269_TYPE_ALC256;
6408 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
6409 alc_update_coef_idx(codec, 0x36, 1 << 13, 1 << 5); /* Switch pcbeep path to Line in path*/
6412 spec->codec_variant = ALC269_TYPE_ALC257;
6413 spec->gen.mixer_nid = 0;
6417 spec->codec_variant = ALC269_TYPE_ALC225;
6420 spec->codec_variant = ALC269_TYPE_ALC225;
6421 spec->gen.mixer_nid = 0; /* no loopback on ALC299 */
6426 spec->codec_variant = ALC269_TYPE_ALC294;
6431 spec->codec_variant = ALC269_TYPE_ALC700;
6432 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
6433 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
6438 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
6439 spec->has_alc5505_dsp = 1;
6440 spec->init_hook = alc5505_dsp_init;
6443 /* automatic parse from the BIOS config */
6444 err = alc269_parse_auto_config(codec);
6448 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid)
6449 set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
6451 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
6464 static int alc861_parse_auto_config(struct hda_codec *codec)
6466 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
6467 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
6468 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
6471 /* Pin config fixes */
6473 ALC861_FIXUP_FSC_AMILO_PI1505,
6474 ALC861_FIXUP_AMP_VREF_0F,
6475 ALC861_FIXUP_NO_JACK_DETECT,
6476 ALC861_FIXUP_ASUS_A6RP,
6477 ALC660_FIXUP_ASUS_W7J,
6480 /* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
6481 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
6482 const struct hda_fixup *fix, int action)
6484 struct alc_spec *spec = codec->spec;
6487 if (action != HDA_FIXUP_ACT_INIT)
6489 val = snd_hda_codec_get_pin_target(codec, 0x0f);
6490 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
6491 val |= AC_PINCTL_IN_EN;
6492 val |= AC_PINCTL_VREF_50;
6493 snd_hda_set_pin_ctl(codec, 0x0f, val);
6494 spec->gen.keep_vref_in_automute = 1;
6497 /* suppress the jack-detection */
6498 static void alc_fixup_no_jack_detect(struct hda_codec *codec,
6499 const struct hda_fixup *fix, int action)
6501 if (action == HDA_FIXUP_ACT_PRE_PROBE)
6502 codec->no_jack_detect = 1;
6505 static const struct hda_fixup alc861_fixups[] = {
6506 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
6507 .type = HDA_FIXUP_PINS,
6508 .v.pins = (const struct hda_pintbl[]) {
6509 { 0x0b, 0x0221101f }, /* HP */
6510 { 0x0f, 0x90170310 }, /* speaker */
6514 [ALC861_FIXUP_AMP_VREF_0F] = {
6515 .type = HDA_FIXUP_FUNC,
6516 .v.func = alc861_fixup_asus_amp_vref_0f,
6518 [ALC861_FIXUP_NO_JACK_DETECT] = {
6519 .type = HDA_FIXUP_FUNC,
6520 .v.func = alc_fixup_no_jack_detect,
6522 [ALC861_FIXUP_ASUS_A6RP] = {
6523 .type = HDA_FIXUP_FUNC,
6524 .v.func = alc861_fixup_asus_amp_vref_0f,
6526 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
6528 [ALC660_FIXUP_ASUS_W7J] = {
6529 .type = HDA_FIXUP_VERBS,
6530 .v.verbs = (const struct hda_verb[]) {
6531 /* ASUS W7J needs a magic pin setup on unused NID 0x10
6532 * for enabling outputs
6534 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6540 static const struct snd_pci_quirk alc861_fixup_tbl[] = {
6541 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
6542 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
6543 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
6544 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
6545 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
6546 SND_PCI_QUIRK(0x1584, 0x2b01, "Haier W18", ALC861_FIXUP_AMP_VREF_0F),
6547 SND_PCI_QUIRK(0x1584, 0x0000, "Uniwill ECS M31EI", ALC861_FIXUP_AMP_VREF_0F),
6548 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
6554 static int patch_alc861(struct hda_codec *codec)
6556 struct alc_spec *spec;
6559 err = alc_alloc_spec(codec, 0x15);
6564 spec->gen.beep_nid = 0x23;
6567 spec->power_hook = alc_power_eapd;
6570 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
6571 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
6573 /* automatic parse from the BIOS config */
6574 err = alc861_parse_auto_config(codec);
6578 if (!spec->gen.no_analog)
6579 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
6581 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
6595 * In addition, an independent DAC
6597 static int alc861vd_parse_auto_config(struct hda_codec *codec)
6599 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
6600 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
6601 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
6605 ALC660VD_FIX_ASUS_GPIO1,
6606 ALC861VD_FIX_DALLAS,
6609 /* exclude VREF80 */
6610 static void alc861vd_fixup_dallas(struct hda_codec *codec,
6611 const struct hda_fixup *fix, int action)
6613 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6614 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
6615 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
6619 static const struct hda_fixup alc861vd_fixups[] = {
6620 [ALC660VD_FIX_ASUS_GPIO1] = {
6621 .type = HDA_FIXUP_VERBS,
6622 .v.verbs = (const struct hda_verb[]) {
6624 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
6625 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6626 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6630 [ALC861VD_FIX_DALLAS] = {
6631 .type = HDA_FIXUP_FUNC,
6632 .v.func = alc861vd_fixup_dallas,
6636 static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
6637 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
6638 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
6639 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
6645 static int patch_alc861vd(struct hda_codec *codec)
6647 struct alc_spec *spec;
6650 err = alc_alloc_spec(codec, 0x0b);
6655 spec->gen.beep_nid = 0x23;
6657 spec->shutup = alc_eapd_shutup;
6659 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
6660 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
6662 /* automatic parse from the BIOS config */
6663 err = alc861vd_parse_auto_config(codec);
6667 if (!spec->gen.no_analog)
6668 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
6670 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
6682 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
6683 * configuration. Each pin widget can choose any input DACs and a mixer.
6684 * Each ADC is connected from a mixer of all inputs. This makes possible
6685 * 6-channel independent captures.
6687 * In addition, an independent DAC for the multi-playback (not used in this
6692 * BIOS auto configuration
6695 static int alc662_parse_auto_config(struct hda_codec *codec)
6697 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
6698 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
6699 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
6700 const hda_nid_t *ssids;
6702 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
6703 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
6704 codec->core.vendor_id == 0x10ec0671)
6705 ssids = alc663_ssids;
6707 ssids = alc662_ssids;
6708 return alc_parse_auto_config(codec, alc662_ignore, ssids);
6711 static void alc272_fixup_mario(struct hda_codec *codec,
6712 const struct hda_fixup *fix, int action)
6714 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6716 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
6717 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
6718 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
6719 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
6720 (0 << AC_AMPCAP_MUTE_SHIFT)))
6721 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
6724 static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
6726 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
6728 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
6729 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
6733 /* override the 2.1 chmap */
6734 static void alc_fixup_bass_chmap(struct hda_codec *codec,
6735 const struct hda_fixup *fix, int action)
6737 if (action == HDA_FIXUP_ACT_BUILD) {
6738 struct alc_spec *spec = codec->spec;
6739 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
6743 /* avoid D3 for keeping GPIO up */
6744 static unsigned int gpio_led_power_filter(struct hda_codec *codec,
6746 unsigned int power_state)
6748 struct alc_spec *spec = codec->spec;
6749 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_led)
6754 static void alc662_fixup_led_gpio1(struct hda_codec *codec,
6755 const struct hda_fixup *fix, int action)
6757 struct alc_spec *spec = codec->spec;
6758 static const struct hda_verb gpio_init[] = {
6759 { 0x01, AC_VERB_SET_GPIO_MASK, 0x01 },
6760 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01 },
6764 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6765 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
6767 spec->mute_led_polarity = 1;
6768 spec->gpio_mute_led_mask = 0x01;
6769 snd_hda_add_verbs(codec, gpio_init);
6770 codec->power_filter = gpio_led_power_filter;
6774 static struct coef_fw alc668_coefs[] = {
6775 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
6776 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
6777 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
6778 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
6779 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
6780 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
6781 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
6782 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
6783 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
6784 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
6785 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
6786 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
6787 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
6788 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
6789 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
6790 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
6791 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
6792 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
6793 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
6794 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
6798 static void alc668_restore_default_value(struct hda_codec *codec)
6800 alc_process_coef_fw(codec, alc668_coefs);
6804 ALC662_FIXUP_ASPIRE,
6805 ALC662_FIXUP_LED_GPIO1,
6806 ALC662_FIXUP_IDEAPAD,
6808 ALC662_FIXUP_CZC_P10T,
6809 ALC662_FIXUP_SKU_IGNORE,
6810 ALC662_FIXUP_HP_RP5800,
6811 ALC662_FIXUP_ASUS_MODE1,
6812 ALC662_FIXUP_ASUS_MODE2,
6813 ALC662_FIXUP_ASUS_MODE3,
6814 ALC662_FIXUP_ASUS_MODE4,
6815 ALC662_FIXUP_ASUS_MODE5,
6816 ALC662_FIXUP_ASUS_MODE6,
6817 ALC662_FIXUP_ASUS_MODE7,
6818 ALC662_FIXUP_ASUS_MODE8,
6819 ALC662_FIXUP_NO_JACK_DETECT,
6820 ALC662_FIXUP_ZOTAC_Z68,
6821 ALC662_FIXUP_INV_DMIC,
6822 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
6823 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
6824 ALC662_FIXUP_HEADSET_MODE,
6825 ALC668_FIXUP_HEADSET_MODE,
6826 ALC662_FIXUP_BASS_MODE4_CHMAP,
6827 ALC662_FIXUP_BASS_16,
6828 ALC662_FIXUP_BASS_1A,
6829 ALC662_FIXUP_BASS_CHMAP,
6830 ALC668_FIXUP_AUTO_MUTE,
6831 ALC668_FIXUP_DELL_DISABLE_AAMIX,
6832 ALC668_FIXUP_DELL_XPS13,
6833 ALC662_FIXUP_ASUS_Nx50,
6834 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
6835 ALC668_FIXUP_ASUS_Nx51,
6836 ALC668_FIXUP_MIC_COEF,
6837 ALC668_FIXUP_ASUS_G751,
6838 ALC891_FIXUP_HEADSET_MODE,
6839 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
6840 ALC662_FIXUP_ACER_VERITON,
6841 ALC892_FIXUP_ASROCK_MOBO,
6844 static const struct hda_fixup alc662_fixups[] = {
6845 [ALC662_FIXUP_ASPIRE] = {
6846 .type = HDA_FIXUP_PINS,
6847 .v.pins = (const struct hda_pintbl[]) {
6848 { 0x15, 0x99130112 }, /* subwoofer */
6852 [ALC662_FIXUP_LED_GPIO1] = {
6853 .type = HDA_FIXUP_FUNC,
6854 .v.func = alc662_fixup_led_gpio1,
6856 [ALC662_FIXUP_IDEAPAD] = {
6857 .type = HDA_FIXUP_PINS,
6858 .v.pins = (const struct hda_pintbl[]) {
6859 { 0x17, 0x99130112 }, /* subwoofer */
6863 .chain_id = ALC662_FIXUP_LED_GPIO1,
6865 [ALC272_FIXUP_MARIO] = {
6866 .type = HDA_FIXUP_FUNC,
6867 .v.func = alc272_fixup_mario,
6869 [ALC662_FIXUP_CZC_P10T] = {
6870 .type = HDA_FIXUP_VERBS,
6871 .v.verbs = (const struct hda_verb[]) {
6872 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
6876 [ALC662_FIXUP_SKU_IGNORE] = {
6877 .type = HDA_FIXUP_FUNC,
6878 .v.func = alc_fixup_sku_ignore,
6880 [ALC662_FIXUP_HP_RP5800] = {
6881 .type = HDA_FIXUP_PINS,
6882 .v.pins = (const struct hda_pintbl[]) {
6883 { 0x14, 0x0221201f }, /* HP out */
6887 .chain_id = ALC662_FIXUP_SKU_IGNORE
6889 [ALC662_FIXUP_ASUS_MODE1] = {
6890 .type = HDA_FIXUP_PINS,
6891 .v.pins = (const struct hda_pintbl[]) {
6892 { 0x14, 0x99130110 }, /* speaker */
6893 { 0x18, 0x01a19c20 }, /* mic */
6894 { 0x19, 0x99a3092f }, /* int-mic */
6895 { 0x21, 0x0121401f }, /* HP out */
6899 .chain_id = ALC662_FIXUP_SKU_IGNORE
6901 [ALC662_FIXUP_ASUS_MODE2] = {
6902 .type = HDA_FIXUP_PINS,
6903 .v.pins = (const struct hda_pintbl[]) {
6904 { 0x14, 0x99130110 }, /* speaker */
6905 { 0x18, 0x01a19820 }, /* mic */
6906 { 0x19, 0x99a3092f }, /* int-mic */
6907 { 0x1b, 0x0121401f }, /* HP out */
6911 .chain_id = ALC662_FIXUP_SKU_IGNORE
6913 [ALC662_FIXUP_ASUS_MODE3] = {
6914 .type = HDA_FIXUP_PINS,
6915 .v.pins = (const struct hda_pintbl[]) {
6916 { 0x14, 0x99130110 }, /* speaker */
6917 { 0x15, 0x0121441f }, /* HP */
6918 { 0x18, 0x01a19840 }, /* mic */
6919 { 0x19, 0x99a3094f }, /* int-mic */
6920 { 0x21, 0x01211420 }, /* HP2 */
6924 .chain_id = ALC662_FIXUP_SKU_IGNORE
6926 [ALC662_FIXUP_ASUS_MODE4] = {
6927 .type = HDA_FIXUP_PINS,
6928 .v.pins = (const struct hda_pintbl[]) {
6929 { 0x14, 0x99130110 }, /* speaker */
6930 { 0x16, 0x99130111 }, /* speaker */
6931 { 0x18, 0x01a19840 }, /* mic */
6932 { 0x19, 0x99a3094f }, /* int-mic */
6933 { 0x21, 0x0121441f }, /* HP */
6937 .chain_id = ALC662_FIXUP_SKU_IGNORE
6939 [ALC662_FIXUP_ASUS_MODE5] = {
6940 .type = HDA_FIXUP_PINS,
6941 .v.pins = (const struct hda_pintbl[]) {
6942 { 0x14, 0x99130110 }, /* speaker */
6943 { 0x15, 0x0121441f }, /* HP */
6944 { 0x16, 0x99130111 }, /* speaker */
6945 { 0x18, 0x01a19840 }, /* mic */
6946 { 0x19, 0x99a3094f }, /* int-mic */
6950 .chain_id = ALC662_FIXUP_SKU_IGNORE
6952 [ALC662_FIXUP_ASUS_MODE6] = {
6953 .type = HDA_FIXUP_PINS,
6954 .v.pins = (const struct hda_pintbl[]) {
6955 { 0x14, 0x99130110 }, /* speaker */
6956 { 0x15, 0x01211420 }, /* HP2 */
6957 { 0x18, 0x01a19840 }, /* mic */
6958 { 0x19, 0x99a3094f }, /* int-mic */
6959 { 0x1b, 0x0121441f }, /* HP */
6963 .chain_id = ALC662_FIXUP_SKU_IGNORE
6965 [ALC662_FIXUP_ASUS_MODE7] = {
6966 .type = HDA_FIXUP_PINS,
6967 .v.pins = (const struct hda_pintbl[]) {
6968 { 0x14, 0x99130110 }, /* speaker */
6969 { 0x17, 0x99130111 }, /* speaker */
6970 { 0x18, 0x01a19840 }, /* mic */
6971 { 0x19, 0x99a3094f }, /* int-mic */
6972 { 0x1b, 0x01214020 }, /* HP */
6973 { 0x21, 0x0121401f }, /* HP */
6977 .chain_id = ALC662_FIXUP_SKU_IGNORE
6979 [ALC662_FIXUP_ASUS_MODE8] = {
6980 .type = HDA_FIXUP_PINS,
6981 .v.pins = (const struct hda_pintbl[]) {
6982 { 0x14, 0x99130110 }, /* speaker */
6983 { 0x12, 0x99a30970 }, /* int-mic */
6984 { 0x15, 0x01214020 }, /* HP */
6985 { 0x17, 0x99130111 }, /* speaker */
6986 { 0x18, 0x01a19840 }, /* mic */
6987 { 0x21, 0x0121401f }, /* HP */
6991 .chain_id = ALC662_FIXUP_SKU_IGNORE
6993 [ALC662_FIXUP_NO_JACK_DETECT] = {
6994 .type = HDA_FIXUP_FUNC,
6995 .v.func = alc_fixup_no_jack_detect,
6997 [ALC662_FIXUP_ZOTAC_Z68] = {
6998 .type = HDA_FIXUP_PINS,
6999 .v.pins = (const struct hda_pintbl[]) {
7000 { 0x1b, 0x02214020 }, /* Front HP */
7004 [ALC662_FIXUP_INV_DMIC] = {
7005 .type = HDA_FIXUP_FUNC,
7006 .v.func = alc_fixup_inv_dmic,
7008 [ALC668_FIXUP_DELL_XPS13] = {
7009 .type = HDA_FIXUP_FUNC,
7010 .v.func = alc_fixup_dell_xps13,
7012 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
7014 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
7015 .type = HDA_FIXUP_FUNC,
7016 .v.func = alc_fixup_disable_aamix,
7018 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
7020 [ALC668_FIXUP_AUTO_MUTE] = {
7021 .type = HDA_FIXUP_FUNC,
7022 .v.func = alc_fixup_auto_mute_via_amp,
7024 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
7026 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
7027 .type = HDA_FIXUP_PINS,
7028 .v.pins = (const struct hda_pintbl[]) {
7029 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
7030 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
7034 .chain_id = ALC662_FIXUP_HEADSET_MODE
7036 [ALC662_FIXUP_HEADSET_MODE] = {
7037 .type = HDA_FIXUP_FUNC,
7038 .v.func = alc_fixup_headset_mode_alc662,
7040 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
7041 .type = HDA_FIXUP_PINS,
7042 .v.pins = (const struct hda_pintbl[]) {
7043 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
7044 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
7048 .chain_id = ALC668_FIXUP_HEADSET_MODE
7050 [ALC668_FIXUP_HEADSET_MODE] = {
7051 .type = HDA_FIXUP_FUNC,
7052 .v.func = alc_fixup_headset_mode_alc668,
7054 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
7055 .type = HDA_FIXUP_FUNC,
7056 .v.func = alc_fixup_bass_chmap,
7058 .chain_id = ALC662_FIXUP_ASUS_MODE4
7060 [ALC662_FIXUP_BASS_16] = {
7061 .type = HDA_FIXUP_PINS,
7062 .v.pins = (const struct hda_pintbl[]) {
7063 {0x16, 0x80106111}, /* bass speaker */
7067 .chain_id = ALC662_FIXUP_BASS_CHMAP,
7069 [ALC662_FIXUP_BASS_1A] = {
7070 .type = HDA_FIXUP_PINS,
7071 .v.pins = (const struct hda_pintbl[]) {
7072 {0x1a, 0x80106111}, /* bass speaker */
7076 .chain_id = ALC662_FIXUP_BASS_CHMAP,
7078 [ALC662_FIXUP_BASS_CHMAP] = {
7079 .type = HDA_FIXUP_FUNC,
7080 .v.func = alc_fixup_bass_chmap,
7082 [ALC662_FIXUP_ASUS_Nx50] = {
7083 .type = HDA_FIXUP_FUNC,
7084 .v.func = alc_fixup_auto_mute_via_amp,
7086 .chain_id = ALC662_FIXUP_BASS_1A
7088 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
7089 .type = HDA_FIXUP_FUNC,
7090 .v.func = alc_fixup_headset_mode_alc668,
7091 .chain_id = ALC662_FIXUP_BASS_CHMAP
7093 [ALC668_FIXUP_ASUS_Nx51] = {
7094 .type = HDA_FIXUP_PINS,
7095 .v.pins = (const struct hda_pintbl[]) {
7096 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
7097 { 0x1a, 0x90170151 }, /* bass speaker */
7098 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
7102 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
7104 [ALC668_FIXUP_MIC_COEF] = {
7105 .type = HDA_FIXUP_VERBS,
7106 .v.verbs = (const struct hda_verb[]) {
7107 { 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
7108 { 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
7112 [ALC668_FIXUP_ASUS_G751] = {
7113 .type = HDA_FIXUP_PINS,
7114 .v.pins = (const struct hda_pintbl[]) {
7115 { 0x16, 0x0421101f }, /* HP */
7119 .chain_id = ALC668_FIXUP_MIC_COEF
7121 [ALC891_FIXUP_HEADSET_MODE] = {
7122 .type = HDA_FIXUP_FUNC,
7123 .v.func = alc_fixup_headset_mode,
7125 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
7126 .type = HDA_FIXUP_PINS,
7127 .v.pins = (const struct hda_pintbl[]) {
7128 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
7129 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
7133 .chain_id = ALC891_FIXUP_HEADSET_MODE
7135 [ALC662_FIXUP_ACER_VERITON] = {
7136 .type = HDA_FIXUP_PINS,
7137 .v.pins = (const struct hda_pintbl[]) {
7138 { 0x15, 0x50170120 }, /* no internal speaker */
7142 [ALC892_FIXUP_ASROCK_MOBO] = {
7143 .type = HDA_FIXUP_PINS,
7144 .v.pins = (const struct hda_pintbl[]) {
7145 { 0x15, 0x40f000f0 }, /* disabled */
7146 { 0x16, 0x40f000f0 }, /* disabled */
7152 static const struct snd_pci_quirk alc662_fixup_tbl[] = {
7153 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
7154 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
7155 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
7156 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
7157 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
7158 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
7159 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
7160 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
7161 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
7162 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
7163 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
7164 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
7165 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
7166 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
7167 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
7168 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
7169 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
7170 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
7171 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
7172 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
7173 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
7174 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
7175 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
7176 SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
7177 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
7178 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
7179 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
7180 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
7181 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
7182 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
7183 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
7184 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
7185 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
7186 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
7187 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
7188 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
7189 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
7190 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
7191 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
7192 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
7195 /* Below is a quirk table taken from the old code.
7196 * Basically the device should work as is without the fixup table.
7197 * If BIOS doesn't give a proper info, enable the corresponding
7200 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
7201 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
7202 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
7203 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
7204 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
7205 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
7206 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
7207 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
7208 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
7209 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
7210 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
7211 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
7212 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
7213 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
7214 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
7215 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
7216 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
7217 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
7218 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
7219 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
7220 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
7221 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
7222 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
7223 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
7224 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
7225 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
7226 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
7227 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
7228 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
7229 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
7230 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
7231 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
7232 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
7233 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
7234 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
7235 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
7236 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
7237 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
7238 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
7239 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
7240 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
7241 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
7242 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
7243 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
7244 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
7245 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
7246 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
7247 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
7248 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
7249 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
7254 static const struct hda_model_fixup alc662_fixup_models[] = {
7255 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
7256 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
7257 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
7258 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
7259 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
7260 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
7261 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
7262 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
7263 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
7264 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
7265 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
7269 static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
7270 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
7274 {0x21, 0x01014020}),
7275 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
7279 {0x1b, 0x0221401f}),
7280 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
7284 {0x16, 0x03011020}),
7285 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
7289 {0x16, 0x03011020}),
7290 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
7294 {0x16, 0x03011020}),
7295 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
7298 {0x16, 0x03011020}),
7299 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
7302 {0x15, 0x0321101f}),
7308 static int patch_alc662(struct hda_codec *codec)
7310 struct alc_spec *spec;
7313 err = alc_alloc_spec(codec, 0x0b);
7319 spec->shutup = alc_eapd_shutup;
7321 /* handle multiple HPs as is */
7322 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
7324 alc_fix_pll_init(codec, 0x20, 0x04, 15);
7326 switch (codec->core.vendor_id) {
7328 spec->init_hook = alc668_restore_default_value;
7332 snd_hda_pick_fixup(codec, alc662_fixup_models,
7333 alc662_fixup_tbl, alc662_fixups);
7334 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups);
7335 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
7337 alc_auto_parse_customize_define(codec);
7339 if (has_cdefine_beep(codec))
7340 spec->gen.beep_nid = 0x01;
7342 if ((alc_get_coef0(codec) & (1 << 14)) &&
7343 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
7344 spec->cdefine.platform_type == 1) {
7345 err = alc_codec_rename(codec, "ALC272X");
7350 /* automatic parse from the BIOS config */
7351 err = alc662_parse_auto_config(codec);
7355 if (!spec->gen.no_analog && spec->gen.beep_nid) {
7356 switch (codec->core.vendor_id) {
7358 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
7364 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
7367 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
7372 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
7385 static int alc680_parse_auto_config(struct hda_codec *codec)
7387 return alc_parse_auto_config(codec, NULL, NULL);
7392 static int patch_alc680(struct hda_codec *codec)
7396 /* ALC680 has no aa-loopback mixer */
7397 err = alc_alloc_spec(codec, 0);
7401 /* automatic parse from the BIOS config */
7402 err = alc680_parse_auto_config(codec);
7414 static const struct hda_device_id snd_hda_id_realtek[] = {
7415 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
7416 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
7417 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
7418 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
7419 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
7420 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
7421 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
7422 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
7423 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
7424 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
7425 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
7426 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
7427 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
7428 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
7429 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
7430 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
7431 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
7432 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
7433 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
7434 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
7435 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
7436 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
7437 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
7438 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
7439 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
7440 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
7441 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
7442 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
7443 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
7444 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
7445 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
7446 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
7447 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
7448 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
7449 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
7450 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
7451 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
7452 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
7453 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
7454 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
7455 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
7456 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
7457 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
7458 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
7459 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
7460 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
7461 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
7462 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
7463 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
7464 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
7465 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
7466 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
7467 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
7468 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
7469 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
7470 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
7471 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
7472 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
7473 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
7474 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
7475 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
7476 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
7477 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
7478 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
7479 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
7482 MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
7484 MODULE_LICENSE("GPL");
7485 MODULE_DESCRIPTION("Realtek HD-audio codec");
7487 static struct hda_codec_driver realtek_driver = {
7488 .id = snd_hda_id_realtek,
7491 module_hda_codec_driver(realtek_driver);