2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for Realtek ALC codecs
6 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
8 * Takashi Iwai <tiwai@suse.de>
9 * Jonathan Woithe <jwoithe@just42.net>
11 * This driver is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <linux/dmi.h>
31 #include <linux/module.h>
32 #include <sound/core.h>
33 #include <sound/jack.h>
34 #include "hda_codec.h"
35 #include "hda_local.h"
36 #include "hda_auto_parser.h"
38 #include "hda_generic.h"
40 /* keep halting ALC5505 DSP, for power saving */
41 #define HALT_REALTEK_ALC5505
43 /* unsol event tags */
44 #define ALC_DCVOL_EVENT 0x08
47 #define GPIO_MASK 0x03
49 /* extra amp-initialization sequence types */
59 ALC_HEADSET_MODE_UNKNOWN,
60 ALC_HEADSET_MODE_UNPLUGGED,
61 ALC_HEADSET_MODE_HEADSET,
63 ALC_HEADSET_MODE_HEADPHONE,
67 ALC_HEADSET_TYPE_UNKNOWN,
68 ALC_HEADSET_TYPE_CTIA,
69 ALC_HEADSET_TYPE_OMTP,
72 struct alc_customize_define {
74 unsigned char port_connectivity;
75 unsigned char check_sum;
76 unsigned char customization;
77 unsigned char external_amp;
78 unsigned int enable_pcbeep:1;
79 unsigned int platform_type:1;
81 unsigned int override:1;
82 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
86 struct hda_gen_spec gen; /* must be at head */
88 /* codec parameterization */
89 const struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
90 unsigned int num_mixers;
91 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
93 struct alc_customize_define cdefine;
94 unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
96 /* inverted dmic fix */
97 unsigned int inv_dmic_fixup:1; /* has inverted digital-mic workaround */
98 unsigned int inv_dmic_muted:1; /* R-ch of inv d-mic is muted? */
99 hda_nid_t inv_dmic_pin;
101 /* mute LED for HP laptops, see alc269_fixup_mic_mute_hook() */
102 int mute_led_polarity;
103 hda_nid_t mute_led_nid;
104 hda_nid_t cap_mute_led_nid;
106 unsigned int gpio_led; /* used for alc269_fixup_hp_gpio_led() */
108 hda_nid_t headset_mic_pin;
109 hda_nid_t headphone_mic_pin;
110 int current_headset_mode;
111 int current_headset_type;
114 void (*init_hook)(struct hda_codec *codec);
116 void (*power_hook)(struct hda_codec *codec);
118 void (*shutup)(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;
132 * Append the given mixer and verb elements for the later use
133 * The mixer array is referred in build_controls(), and init_verbs are
136 static void add_mixer(struct alc_spec *spec, const struct snd_kcontrol_new *mix)
138 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
140 spec->mixers[spec->num_mixers++] = mix;
144 * GPIO setup tables, used in initialization
146 /* Enable GPIO mask and set output */
147 static const struct hda_verb alc_gpio1_init_verbs[] = {
148 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
149 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
150 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
154 static const struct hda_verb alc_gpio2_init_verbs[] = {
155 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
156 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
157 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
161 static const struct hda_verb alc_gpio3_init_verbs[] = {
162 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
163 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
164 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
169 * Fix hardware PLL issue
170 * On some codecs, the analog PLL gating control must be off while
171 * the default value is 1.
173 static void alc_fix_pll(struct hda_codec *codec)
175 struct alc_spec *spec = codec->spec;
180 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
182 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
183 AC_VERB_GET_PROC_COEF, 0);
186 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
188 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
189 val & ~(1 << spec->pll_coef_bit));
192 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
193 unsigned int coef_idx, unsigned int coef_bit)
195 struct alc_spec *spec = codec->spec;
197 spec->pll_coef_idx = coef_idx;
198 spec->pll_coef_bit = coef_bit;
202 /* update the master volume per volume-knob's unsol event */
203 static void alc_update_knob_master(struct hda_codec *codec, struct hda_jack_tbl *jack)
206 struct snd_kcontrol *kctl;
207 struct snd_ctl_elem_value *uctl;
209 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
212 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
215 val = snd_hda_codec_read(codec, jack->nid, 0,
216 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
217 val &= HDA_AMP_VOLMASK;
218 uctl->value.integer.value[0] = val;
219 uctl->value.integer.value[1] = val;
220 kctl->put(kctl, uctl);
224 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
226 /* For some reason, the res given from ALC880 is broken.
227 Here we adjust it properly. */
228 snd_hda_jack_unsol_event(codec, res >> 2);
231 /* additional initialization for ALC888 variants */
232 static void alc888_coef_init(struct hda_codec *codec)
236 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
237 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
238 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
239 if ((tmp & 0xf0) == 0x20)
241 snd_hda_codec_read(codec, 0x20, 0,
242 AC_VERB_SET_PROC_COEF, 0x830);
245 snd_hda_codec_read(codec, 0x20, 0,
246 AC_VERB_SET_PROC_COEF, 0x3030);
249 /* additional initialization for ALC889 variants */
250 static void alc889_coef_init(struct hda_codec *codec)
254 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
255 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
256 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
257 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
260 /* turn on/off EAPD control (only if available) */
261 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
263 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
265 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
266 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
270 /* turn on/off EAPD controls of the codec */
271 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
273 /* We currently only handle front, HP */
274 static hda_nid_t pins[] = {
275 0x0f, 0x10, 0x14, 0x15, 0
278 for (p = pins; *p; p++)
279 set_eapd(codec, *p, on);
282 /* generic shutup callback;
283 * just turning off EPAD and a little pause for avoiding pop-noise
285 static void alc_eapd_shutup(struct hda_codec *codec)
287 struct alc_spec *spec = codec->spec;
289 alc_auto_setup_eapd(codec, false);
290 if (!spec->no_depop_delay)
292 snd_hda_shutup_pins(codec);
295 /* generic EAPD initialization */
296 static void alc_auto_init_amp(struct hda_codec *codec, int type)
300 alc_auto_setup_eapd(codec, true);
303 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
306 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
309 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
311 case ALC_INIT_DEFAULT:
312 switch (codec->vendor_id) {
314 snd_hda_codec_write(codec, 0x1a, 0,
315 AC_VERB_SET_COEF_INDEX, 7);
316 tmp = snd_hda_codec_read(codec, 0x1a, 0,
317 AC_VERB_GET_PROC_COEF, 0);
318 snd_hda_codec_write(codec, 0x1a, 0,
319 AC_VERB_SET_COEF_INDEX, 7);
320 snd_hda_codec_write(codec, 0x1a, 0,
321 AC_VERB_SET_PROC_COEF,
330 /*case 0x10ec0889:*/ /* this causes an SPDIF problem */
331 alc889_coef_init(codec);
334 alc888_coef_init(codec);
336 #if 0 /* XXX: This may cause the silent output on speaker on some machines */
339 snd_hda_codec_write(codec, 0x20, 0,
340 AC_VERB_SET_COEF_INDEX, 7);
341 tmp = snd_hda_codec_read(codec, 0x20, 0,
342 AC_VERB_GET_PROC_COEF, 0);
343 snd_hda_codec_write(codec, 0x20, 0,
344 AC_VERB_SET_COEF_INDEX, 7);
345 snd_hda_codec_write(codec, 0x20, 0,
346 AC_VERB_SET_PROC_COEF,
357 * Realtek SSID verification
360 /* Could be any non-zero and even value. When used as fixup, tells
361 * the driver to ignore any present sku defines.
363 #define ALC_FIXUP_SKU_IGNORE (2)
365 static void alc_fixup_sku_ignore(struct hda_codec *codec,
366 const struct hda_fixup *fix, int action)
368 struct alc_spec *spec = codec->spec;
369 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
370 spec->cdefine.fixup = 1;
371 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
375 static void alc_fixup_no_depop_delay(struct hda_codec *codec,
376 const struct hda_fixup *fix, int action)
378 struct alc_spec *spec = codec->spec;
380 if (action == HDA_FIXUP_ACT_PROBE) {
381 spec->no_depop_delay = 1;
382 codec->depop_delay = 0;
386 static int alc_auto_parse_customize_define(struct hda_codec *codec)
388 unsigned int ass, tmp, i;
390 struct alc_spec *spec = codec->spec;
392 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
394 if (spec->cdefine.fixup) {
395 ass = spec->cdefine.sku_cfg;
396 if (ass == ALC_FIXUP_SKU_IGNORE)
401 if (!codec->bus->pci)
403 ass = codec->subsystem_id & 0xffff;
404 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
408 if (codec->vendor_id == 0x10ec0260)
410 ass = snd_hda_codec_get_pincfg(codec, nid);
413 codec_info(codec, "%s: SKU not ready 0x%08x\n",
414 codec->chip_name, ass);
420 for (i = 1; i < 16; i++) {
424 if (((ass >> 16) & 0xf) != tmp)
427 spec->cdefine.port_connectivity = ass >> 30;
428 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
429 spec->cdefine.check_sum = (ass >> 16) & 0xf;
430 spec->cdefine.customization = ass >> 8;
432 spec->cdefine.sku_cfg = ass;
433 spec->cdefine.external_amp = (ass & 0x38) >> 3;
434 spec->cdefine.platform_type = (ass & 0x4) >> 2;
435 spec->cdefine.swap = (ass & 0x2) >> 1;
436 spec->cdefine.override = ass & 0x1;
438 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
439 nid, spec->cdefine.sku_cfg);
440 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
441 spec->cdefine.port_connectivity);
442 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
443 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
444 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
445 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
446 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
447 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
448 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
453 /* return the position of NID in the list, or -1 if not found */
454 static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
457 for (i = 0; i < nums; i++)
462 /* return true if the given NID is found in the list */
463 static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
465 return find_idx_in_nid_list(nid, list, nums) >= 0;
468 /* check subsystem ID and set up device-specific initialization;
469 * return 1 if initialized, 0 if invalid SSID
471 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
472 * 31 ~ 16 : Manufacture ID
474 * 7 ~ 0 : Assembly ID
475 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
477 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
479 unsigned int ass, tmp, i;
481 struct alc_spec *spec = codec->spec;
483 if (spec->cdefine.fixup) {
484 ass = spec->cdefine.sku_cfg;
485 if (ass == ALC_FIXUP_SKU_IGNORE)
490 ass = codec->subsystem_id & 0xffff;
491 if (codec->bus->pci &&
492 ass != codec->bus->pci->subsystem_device && (ass & 1))
495 /* invalid SSID, check the special NID pin defcfg instead */
497 * 31~30 : port connectivity
500 * 19~16 : Check sum (15:1)
505 if (codec->vendor_id == 0x10ec0260)
507 ass = snd_hda_codec_get_pincfg(codec, nid);
509 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
513 if ((ass >> 30) != 1) /* no physical connection */
518 for (i = 1; i < 16; i++) {
522 if (((ass >> 16) & 0xf) != tmp)
525 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
526 ass & 0xffff, codec->vendor_id);
530 * 2 : 0 --> Desktop, 1 --> Laptop
531 * 3~5 : External Amplifier control
534 tmp = (ass & 0x38) >> 3; /* external Amp control */
537 spec->init_amp = ALC_INIT_GPIO1;
540 spec->init_amp = ALC_INIT_GPIO2;
543 spec->init_amp = ALC_INIT_GPIO3;
547 spec->init_amp = ALC_INIT_DEFAULT;
551 /* is laptop or Desktop and enable the function "Mute internal speaker
552 * when the external headphone out jack is plugged"
557 * 10~8 : Jack location
558 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
560 * 15 : 1 --> enable the function "Mute internal speaker
561 * when the external headphone out jack is plugged"
563 if (!spec->gen.autocfg.hp_pins[0] &&
564 !(spec->gen.autocfg.line_out_pins[0] &&
565 spec->gen.autocfg.line_out_type == AUTO_PIN_HP_OUT)) {
567 tmp = (ass >> 11) & 0x3; /* HP to chassis */
569 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
570 spec->gen.autocfg.line_outs))
572 spec->gen.autocfg.hp_pins[0] = nid;
577 /* Check the validity of ALC subsystem-id
578 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
579 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
581 if (!alc_subsystem_id(codec, ports)) {
582 struct alc_spec *spec = codec->spec;
584 "realtek: Enable default setup for auto mode as fallback\n");
585 spec->init_amp = ALC_INIT_DEFAULT;
590 * COEF access helper functions
593 static int alc_read_coefex_idx(struct hda_codec *codec,
595 unsigned int coef_idx)
598 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX,
600 val = snd_hda_codec_read(codec, nid, 0,
601 AC_VERB_GET_PROC_COEF, 0);
605 #define alc_read_coef_idx(codec, coef_idx) \
606 alc_read_coefex_idx(codec, 0x20, coef_idx)
608 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
609 unsigned int coef_idx,
610 unsigned int coef_val)
612 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX,
614 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF,
618 #define alc_write_coef_idx(codec, coef_idx, coef_val) \
619 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
621 /* a special bypass for COEF 0; read the cached value at the second time */
622 static unsigned int alc_get_coef0(struct hda_codec *codec)
624 struct alc_spec *spec = codec->spec;
626 spec->coef0 = alc_read_coef_idx(codec, 0);
633 static hda_nid_t get_adc_nid(struct hda_codec *codec, int adc_idx, int imux_idx)
635 struct hda_gen_spec *spec = codec->spec;
636 if (spec->dyn_adc_switch)
637 adc_idx = spec->dyn_adc_idx[imux_idx];
638 return spec->adc_nids[adc_idx];
641 static void alc_inv_dmic_sync_adc(struct hda_codec *codec, int adc_idx)
643 struct alc_spec *spec = codec->spec;
644 struct hda_input_mux *imux = &spec->gen.input_mux;
645 struct nid_path *path;
650 for (i = 0; i < imux->num_items; i++) {
651 if (spec->gen.imux_pins[i] == spec->inv_dmic_pin)
654 if (i >= imux->num_items)
657 path = snd_hda_get_nid_path(codec, spec->inv_dmic_pin,
658 get_adc_nid(codec, adc_idx, i));
659 val = path->ctls[NID_PATH_MUTE_CTL];
662 nid = get_amp_nid_(val);
663 dir = get_amp_direction_(val);
664 parm = AC_AMP_SET_RIGHT |
665 (dir == HDA_OUTPUT ? AC_AMP_SET_OUTPUT : AC_AMP_SET_INPUT);
667 /* flush all cached amps at first */
668 snd_hda_codec_flush_cache(codec);
670 /* we care only right channel */
671 val = snd_hda_codec_amp_read(codec, nid, 1, dir, 0);
672 if (val & 0x80) /* if already muted, we don't need to touch */
675 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
680 * Inverted digital-mic handling
682 * First off, it's a bit tricky. The "Inverted Internal Mic Capture Switch"
683 * gives the additional mute only to the right channel of the digital mic
684 * capture stream. This is a workaround for avoiding the almost silence
685 * by summing the stereo stream from some (known to be ForteMedia)
688 * The logic is to call alc_inv_dmic_sync() after each action (possibly)
689 * modifying ADC amp. When the mute flag is set, it mutes the R-channel
690 * without caching so that the cache can still keep the original value.
691 * The cached value is then restored when the flag is set off or any other
692 * than d-mic is used as the current input source.
694 static void alc_inv_dmic_sync(struct hda_codec *codec, bool force)
696 struct alc_spec *spec = codec->spec;
699 if (!spec->inv_dmic_fixup)
701 if (!spec->inv_dmic_muted && !force)
703 nums = spec->gen.dyn_adc_switch ? 1 : spec->gen.num_adc_nids;
704 for (src = 0; src < nums; src++) {
705 bool dmic_fixup = false;
707 if (spec->inv_dmic_muted &&
708 spec->gen.imux_pins[spec->gen.cur_mux[src]] == spec->inv_dmic_pin)
710 if (!dmic_fixup && !force)
712 alc_inv_dmic_sync_adc(codec, src);
716 static void alc_inv_dmic_hook(struct hda_codec *codec,
717 struct snd_kcontrol *kcontrol,
718 struct snd_ctl_elem_value *ucontrol)
720 alc_inv_dmic_sync(codec, false);
723 static int alc_inv_dmic_sw_get(struct snd_kcontrol *kcontrol,
724 struct snd_ctl_elem_value *ucontrol)
726 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
727 struct alc_spec *spec = codec->spec;
729 ucontrol->value.integer.value[0] = !spec->inv_dmic_muted;
733 static int alc_inv_dmic_sw_put(struct snd_kcontrol *kcontrol,
734 struct snd_ctl_elem_value *ucontrol)
736 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
737 struct alc_spec *spec = codec->spec;
738 unsigned int val = !ucontrol->value.integer.value[0];
740 if (val == spec->inv_dmic_muted)
742 spec->inv_dmic_muted = val;
743 alc_inv_dmic_sync(codec, true);
747 static const struct snd_kcontrol_new alc_inv_dmic_sw = {
748 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
749 .name = "Inverted Internal Mic Capture Switch",
750 .info = snd_ctl_boolean_mono_info,
751 .get = alc_inv_dmic_sw_get,
752 .put = alc_inv_dmic_sw_put,
755 static int alc_add_inv_dmic_mixer(struct hda_codec *codec, hda_nid_t nid)
757 struct alc_spec *spec = codec->spec;
759 if (!snd_hda_gen_add_kctl(&spec->gen, NULL, &alc_inv_dmic_sw))
761 spec->inv_dmic_fixup = 1;
762 spec->inv_dmic_muted = 0;
763 spec->inv_dmic_pin = nid;
764 spec->gen.cap_sync_hook = alc_inv_dmic_hook;
768 /* typically the digital mic is put at node 0x12 */
769 static void alc_fixup_inv_dmic_0x12(struct hda_codec *codec,
770 const struct hda_fixup *fix, int action)
772 if (action == HDA_FIXUP_ACT_PROBE)
773 alc_add_inv_dmic_mixer(codec, 0x12);
777 #ifdef CONFIG_SND_HDA_INPUT_BEEP
778 /* additional beep mixers; the actual parameters are overwritten at build */
779 static const struct snd_kcontrol_new alc_beep_mixer[] = {
780 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
781 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
786 static int alc_build_controls(struct hda_codec *codec)
788 struct alc_spec *spec = codec->spec;
791 err = snd_hda_gen_build_controls(codec);
795 for (i = 0; i < spec->num_mixers; i++) {
796 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
801 #ifdef CONFIG_SND_HDA_INPUT_BEEP
802 /* create beep controls if needed */
803 if (spec->beep_amp) {
804 const struct snd_kcontrol_new *knew;
805 for (knew = alc_beep_mixer; knew->name; knew++) {
806 struct snd_kcontrol *kctl;
807 kctl = snd_ctl_new1(knew, codec);
810 kctl->private_value = spec->beep_amp;
811 err = snd_hda_ctl_add(codec, 0, kctl);
818 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
827 static int alc_init(struct hda_codec *codec)
829 struct alc_spec *spec = codec->spec;
832 spec->init_hook(codec);
835 alc_auto_init_amp(codec, spec->init_amp);
837 snd_hda_gen_init(codec);
839 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
844 static inline void alc_shutup(struct hda_codec *codec)
846 struct alc_spec *spec = codec->spec;
848 if (spec && spec->shutup)
851 snd_hda_shutup_pins(codec);
854 #define alc_free snd_hda_gen_free
857 static void alc_power_eapd(struct hda_codec *codec)
859 alc_auto_setup_eapd(codec, false);
862 static int alc_suspend(struct hda_codec *codec)
864 struct alc_spec *spec = codec->spec;
866 if (spec && spec->power_hook)
867 spec->power_hook(codec);
873 static int alc_resume(struct hda_codec *codec)
875 struct alc_spec *spec = codec->spec;
877 if (!spec->no_depop_delay)
878 msleep(150); /* to avoid pop noise */
879 codec->patch_ops.init(codec);
880 snd_hda_codec_resume_amp(codec);
881 snd_hda_codec_resume_cache(codec);
882 alc_inv_dmic_sync(codec, true);
883 hda_call_check_power_status(codec, 0x01);
890 static const struct hda_codec_ops alc_patch_ops = {
891 .build_controls = alc_build_controls,
892 .build_pcms = snd_hda_gen_build_pcms,
895 .unsol_event = snd_hda_jack_unsol_event,
897 .resume = alc_resume,
898 .suspend = alc_suspend,
899 .check_power_status = snd_hda_gen_check_power_status,
901 .reboot_notify = alc_shutup,
905 /* replace the codec chip_name with the given string */
906 static int alc_codec_rename(struct hda_codec *codec, const char *name)
908 kfree(codec->chip_name);
909 codec->chip_name = kstrdup(name, GFP_KERNEL);
910 if (!codec->chip_name) {
918 * Rename codecs appropriately from COEF value or subvendor id
920 struct alc_codec_rename_table {
921 unsigned int vendor_id;
922 unsigned short coef_mask;
923 unsigned short coef_bits;
927 struct alc_codec_rename_pci_table {
928 unsigned int codec_vendor_id;
929 unsigned short pci_subvendor;
930 unsigned short pci_subdevice;
934 static struct alc_codec_rename_table rename_tbl[] = {
935 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
936 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
937 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
938 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
939 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
940 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
941 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
942 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
943 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
944 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
945 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
946 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
947 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
948 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
949 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
950 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
951 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
955 static struct alc_codec_rename_pci_table rename_pci_tbl[] = {
956 { 0x10ec0280, 0x1028, 0, "ALC3220" },
957 { 0x10ec0282, 0x1028, 0, "ALC3221" },
958 { 0x10ec0283, 0x1028, 0, "ALC3223" },
959 { 0x10ec0288, 0x1028, 0, "ALC3263" },
960 { 0x10ec0292, 0x1028, 0, "ALC3226" },
961 { 0x10ec0293, 0x1028, 0, "ALC3235" },
962 { 0x10ec0255, 0x1028, 0, "ALC3234" },
963 { 0x10ec0668, 0x1028, 0, "ALC3661" },
964 { 0x10ec0275, 0x1028, 0, "ALC3260" },
965 { 0x10ec0899, 0x1028, 0, "ALC3861" },
966 { 0x10ec0670, 0x1025, 0, "ALC669X" },
967 { 0x10ec0676, 0x1025, 0, "ALC679X" },
968 { 0x10ec0282, 0x1043, 0, "ALC3229" },
969 { 0x10ec0233, 0x1043, 0, "ALC3236" },
970 { 0x10ec0280, 0x103c, 0, "ALC3228" },
971 { 0x10ec0282, 0x103c, 0, "ALC3227" },
972 { 0x10ec0286, 0x103c, 0, "ALC3242" },
973 { 0x10ec0290, 0x103c, 0, "ALC3241" },
974 { 0x10ec0668, 0x103c, 0, "ALC3662" },
975 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
976 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
980 static int alc_codec_rename_from_preset(struct hda_codec *codec)
982 const struct alc_codec_rename_table *p;
983 const struct alc_codec_rename_pci_table *q;
985 for (p = rename_tbl; p->vendor_id; p++) {
986 if (p->vendor_id != codec->vendor_id)
988 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
989 return alc_codec_rename(codec, p->name);
992 if (!codec->bus->pci)
994 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
995 if (q->codec_vendor_id != codec->vendor_id)
997 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
999 if (!q->pci_subdevice ||
1000 q->pci_subdevice == codec->bus->pci->subsystem_device)
1001 return alc_codec_rename(codec, q->name);
1009 * Digital-beep handlers
1011 #ifdef CONFIG_SND_HDA_INPUT_BEEP
1012 #define set_beep_amp(spec, nid, idx, dir) \
1013 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
1015 static const struct snd_pci_quirk beep_white_list[] = {
1016 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
1017 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
1018 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
1019 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
1020 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1021 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1022 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
1023 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
1024 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
1028 static inline int has_cdefine_beep(struct hda_codec *codec)
1030 struct alc_spec *spec = codec->spec;
1031 const struct snd_pci_quirk *q;
1032 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list);
1035 return spec->cdefine.enable_pcbeep;
1038 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
1039 #define has_cdefine_beep(codec) 0
1042 /* parse the BIOS configuration and set up the alc_spec */
1043 /* return 1 if successful, 0 if the proper config is not found,
1044 * or a negative error code
1046 static int alc_parse_auto_config(struct hda_codec *codec,
1047 const hda_nid_t *ignore_nids,
1048 const hda_nid_t *ssid_nids)
1050 struct alc_spec *spec = codec->spec;
1051 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
1054 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1060 alc_ssid_check(codec, ssid_nids);
1062 err = snd_hda_gen_parse_auto_config(codec, cfg);
1069 /* common preparation job for alc_spec */
1070 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1072 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1078 snd_hda_gen_spec_init(&spec->gen);
1079 spec->gen.mixer_nid = mixer_nid;
1080 spec->gen.own_eapd_ctl = 1;
1081 codec->single_adc_amp = 1;
1082 /* FIXME: do we need this for all Realtek codec models? */
1083 codec->spdif_status_reset = 1;
1085 err = alc_codec_rename_from_preset(codec);
1093 static int alc880_parse_auto_config(struct hda_codec *codec)
1095 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
1096 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
1097 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1106 ALC880_FIXUP_MEDION_RIM,
1108 ALC880_FIXUP_LG_LW25,
1110 ALC880_FIXUP_EAPD_COEF,
1111 ALC880_FIXUP_TCL_S700,
1112 ALC880_FIXUP_VOL_KNOB,
1113 ALC880_FIXUP_FUJITSU,
1115 ALC880_FIXUP_UNIWILL,
1116 ALC880_FIXUP_UNIWILL_DIG,
1118 ALC880_FIXUP_ASUS_W5A,
1119 ALC880_FIXUP_3ST_BASE,
1121 ALC880_FIXUP_3ST_DIG,
1122 ALC880_FIXUP_5ST_BASE,
1124 ALC880_FIXUP_5ST_DIG,
1125 ALC880_FIXUP_6ST_BASE,
1127 ALC880_FIXUP_6ST_DIG,
1128 ALC880_FIXUP_6ST_AUTOMUTE,
1131 /* enable the volume-knob widget support on NID 0x21 */
1132 static void alc880_fixup_vol_knob(struct hda_codec *codec,
1133 const struct hda_fixup *fix, int action)
1135 if (action == HDA_FIXUP_ACT_PROBE)
1136 snd_hda_jack_detect_enable_callback(codec, 0x21, ALC_DCVOL_EVENT, alc_update_knob_master);
1139 static const struct hda_fixup alc880_fixups[] = {
1140 [ALC880_FIXUP_GPIO1] = {
1141 .type = HDA_FIXUP_VERBS,
1142 .v.verbs = alc_gpio1_init_verbs,
1144 [ALC880_FIXUP_GPIO2] = {
1145 .type = HDA_FIXUP_VERBS,
1146 .v.verbs = alc_gpio2_init_verbs,
1148 [ALC880_FIXUP_MEDION_RIM] = {
1149 .type = HDA_FIXUP_VERBS,
1150 .v.verbs = (const struct hda_verb[]) {
1151 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1152 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1156 .chain_id = ALC880_FIXUP_GPIO2,
1158 [ALC880_FIXUP_LG] = {
1159 .type = HDA_FIXUP_PINS,
1160 .v.pins = (const struct hda_pintbl[]) {
1161 /* disable bogus unused pins */
1162 { 0x16, 0x411111f0 },
1163 { 0x18, 0x411111f0 },
1164 { 0x1a, 0x411111f0 },
1168 [ALC880_FIXUP_LG_LW25] = {
1169 .type = HDA_FIXUP_PINS,
1170 .v.pins = (const struct hda_pintbl[]) {
1171 { 0x1a, 0x0181344f }, /* line-in */
1172 { 0x1b, 0x0321403f }, /* headphone */
1176 [ALC880_FIXUP_W810] = {
1177 .type = HDA_FIXUP_PINS,
1178 .v.pins = (const struct hda_pintbl[]) {
1179 /* disable bogus unused pins */
1180 { 0x17, 0x411111f0 },
1184 .chain_id = ALC880_FIXUP_GPIO2,
1186 [ALC880_FIXUP_EAPD_COEF] = {
1187 .type = HDA_FIXUP_VERBS,
1188 .v.verbs = (const struct hda_verb[]) {
1189 /* change to EAPD mode */
1190 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1191 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1195 [ALC880_FIXUP_TCL_S700] = {
1196 .type = HDA_FIXUP_VERBS,
1197 .v.verbs = (const struct hda_verb[]) {
1198 /* change to EAPD mode */
1199 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1200 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1204 .chain_id = ALC880_FIXUP_GPIO2,
1206 [ALC880_FIXUP_VOL_KNOB] = {
1207 .type = HDA_FIXUP_FUNC,
1208 .v.func = alc880_fixup_vol_knob,
1210 [ALC880_FIXUP_FUJITSU] = {
1211 /* override all pins as BIOS on old Amilo is broken */
1212 .type = HDA_FIXUP_PINS,
1213 .v.pins = (const struct hda_pintbl[]) {
1214 { 0x14, 0x0121411f }, /* HP */
1215 { 0x15, 0x99030120 }, /* speaker */
1216 { 0x16, 0x99030130 }, /* bass speaker */
1217 { 0x17, 0x411111f0 }, /* N/A */
1218 { 0x18, 0x411111f0 }, /* N/A */
1219 { 0x19, 0x01a19950 }, /* mic-in */
1220 { 0x1a, 0x411111f0 }, /* N/A */
1221 { 0x1b, 0x411111f0 }, /* N/A */
1222 { 0x1c, 0x411111f0 }, /* N/A */
1223 { 0x1d, 0x411111f0 }, /* N/A */
1224 { 0x1e, 0x01454140 }, /* SPDIF out */
1228 .chain_id = ALC880_FIXUP_VOL_KNOB,
1230 [ALC880_FIXUP_F1734] = {
1231 /* almost compatible with FUJITSU, but no bass and SPDIF */
1232 .type = HDA_FIXUP_PINS,
1233 .v.pins = (const struct hda_pintbl[]) {
1234 { 0x14, 0x0121411f }, /* HP */
1235 { 0x15, 0x99030120 }, /* speaker */
1236 { 0x16, 0x411111f0 }, /* N/A */
1237 { 0x17, 0x411111f0 }, /* N/A */
1238 { 0x18, 0x411111f0 }, /* N/A */
1239 { 0x19, 0x01a19950 }, /* mic-in */
1240 { 0x1a, 0x411111f0 }, /* N/A */
1241 { 0x1b, 0x411111f0 }, /* N/A */
1242 { 0x1c, 0x411111f0 }, /* N/A */
1243 { 0x1d, 0x411111f0 }, /* N/A */
1244 { 0x1e, 0x411111f0 }, /* N/A */
1248 .chain_id = ALC880_FIXUP_VOL_KNOB,
1250 [ALC880_FIXUP_UNIWILL] = {
1251 /* need to fix HP and speaker pins to be parsed correctly */
1252 .type = HDA_FIXUP_PINS,
1253 .v.pins = (const struct hda_pintbl[]) {
1254 { 0x14, 0x0121411f }, /* HP */
1255 { 0x15, 0x99030120 }, /* speaker */
1256 { 0x16, 0x99030130 }, /* bass speaker */
1260 [ALC880_FIXUP_UNIWILL_DIG] = {
1261 .type = HDA_FIXUP_PINS,
1262 .v.pins = (const struct hda_pintbl[]) {
1263 /* disable bogus unused pins */
1264 { 0x17, 0x411111f0 },
1265 { 0x19, 0x411111f0 },
1266 { 0x1b, 0x411111f0 },
1267 { 0x1f, 0x411111f0 },
1271 [ALC880_FIXUP_Z71V] = {
1272 .type = HDA_FIXUP_PINS,
1273 .v.pins = (const struct hda_pintbl[]) {
1274 /* set up the whole pins as BIOS is utterly broken */
1275 { 0x14, 0x99030120 }, /* speaker */
1276 { 0x15, 0x0121411f }, /* HP */
1277 { 0x16, 0x411111f0 }, /* N/A */
1278 { 0x17, 0x411111f0 }, /* N/A */
1279 { 0x18, 0x01a19950 }, /* mic-in */
1280 { 0x19, 0x411111f0 }, /* N/A */
1281 { 0x1a, 0x01813031 }, /* line-in */
1282 { 0x1b, 0x411111f0 }, /* N/A */
1283 { 0x1c, 0x411111f0 }, /* N/A */
1284 { 0x1d, 0x411111f0 }, /* N/A */
1285 { 0x1e, 0x0144111e }, /* SPDIF */
1289 [ALC880_FIXUP_ASUS_W5A] = {
1290 .type = HDA_FIXUP_PINS,
1291 .v.pins = (const struct hda_pintbl[]) {
1292 /* set up the whole pins as BIOS is utterly broken */
1293 { 0x14, 0x0121411f }, /* HP */
1294 { 0x15, 0x411111f0 }, /* N/A */
1295 { 0x16, 0x411111f0 }, /* N/A */
1296 { 0x17, 0x411111f0 }, /* N/A */
1297 { 0x18, 0x90a60160 }, /* mic */
1298 { 0x19, 0x411111f0 }, /* N/A */
1299 { 0x1a, 0x411111f0 }, /* N/A */
1300 { 0x1b, 0x411111f0 }, /* N/A */
1301 { 0x1c, 0x411111f0 }, /* N/A */
1302 { 0x1d, 0x411111f0 }, /* N/A */
1303 { 0x1e, 0xb743111e }, /* SPDIF out */
1307 .chain_id = ALC880_FIXUP_GPIO1,
1309 [ALC880_FIXUP_3ST_BASE] = {
1310 .type = HDA_FIXUP_PINS,
1311 .v.pins = (const struct hda_pintbl[]) {
1312 { 0x14, 0x01014010 }, /* line-out */
1313 { 0x15, 0x411111f0 }, /* N/A */
1314 { 0x16, 0x411111f0 }, /* N/A */
1315 { 0x17, 0x411111f0 }, /* N/A */
1316 { 0x18, 0x01a19c30 }, /* mic-in */
1317 { 0x19, 0x0121411f }, /* HP */
1318 { 0x1a, 0x01813031 }, /* line-in */
1319 { 0x1b, 0x02a19c40 }, /* front-mic */
1320 { 0x1c, 0x411111f0 }, /* N/A */
1321 { 0x1d, 0x411111f0 }, /* N/A */
1322 /* 0x1e is filled in below */
1323 { 0x1f, 0x411111f0 }, /* N/A */
1327 [ALC880_FIXUP_3ST] = {
1328 .type = HDA_FIXUP_PINS,
1329 .v.pins = (const struct hda_pintbl[]) {
1330 { 0x1e, 0x411111f0 }, /* N/A */
1334 .chain_id = ALC880_FIXUP_3ST_BASE,
1336 [ALC880_FIXUP_3ST_DIG] = {
1337 .type = HDA_FIXUP_PINS,
1338 .v.pins = (const struct hda_pintbl[]) {
1339 { 0x1e, 0x0144111e }, /* SPDIF */
1343 .chain_id = ALC880_FIXUP_3ST_BASE,
1345 [ALC880_FIXUP_5ST_BASE] = {
1346 .type = HDA_FIXUP_PINS,
1347 .v.pins = (const struct hda_pintbl[]) {
1348 { 0x14, 0x01014010 }, /* front */
1349 { 0x15, 0x411111f0 }, /* N/A */
1350 { 0x16, 0x01011411 }, /* CLFE */
1351 { 0x17, 0x01016412 }, /* surr */
1352 { 0x18, 0x01a19c30 }, /* mic-in */
1353 { 0x19, 0x0121411f }, /* HP */
1354 { 0x1a, 0x01813031 }, /* line-in */
1355 { 0x1b, 0x02a19c40 }, /* front-mic */
1356 { 0x1c, 0x411111f0 }, /* N/A */
1357 { 0x1d, 0x411111f0 }, /* N/A */
1358 /* 0x1e is filled in below */
1359 { 0x1f, 0x411111f0 }, /* N/A */
1363 [ALC880_FIXUP_5ST] = {
1364 .type = HDA_FIXUP_PINS,
1365 .v.pins = (const struct hda_pintbl[]) {
1366 { 0x1e, 0x411111f0 }, /* N/A */
1370 .chain_id = ALC880_FIXUP_5ST_BASE,
1372 [ALC880_FIXUP_5ST_DIG] = {
1373 .type = HDA_FIXUP_PINS,
1374 .v.pins = (const struct hda_pintbl[]) {
1375 { 0x1e, 0x0144111e }, /* SPDIF */
1379 .chain_id = ALC880_FIXUP_5ST_BASE,
1381 [ALC880_FIXUP_6ST_BASE] = {
1382 .type = HDA_FIXUP_PINS,
1383 .v.pins = (const struct hda_pintbl[]) {
1384 { 0x14, 0x01014010 }, /* front */
1385 { 0x15, 0x01016412 }, /* surr */
1386 { 0x16, 0x01011411 }, /* CLFE */
1387 { 0x17, 0x01012414 }, /* side */
1388 { 0x18, 0x01a19c30 }, /* mic-in */
1389 { 0x19, 0x02a19c40 }, /* front-mic */
1390 { 0x1a, 0x01813031 }, /* line-in */
1391 { 0x1b, 0x0121411f }, /* HP */
1392 { 0x1c, 0x411111f0 }, /* N/A */
1393 { 0x1d, 0x411111f0 }, /* N/A */
1394 /* 0x1e is filled in below */
1395 { 0x1f, 0x411111f0 }, /* N/A */
1399 [ALC880_FIXUP_6ST] = {
1400 .type = HDA_FIXUP_PINS,
1401 .v.pins = (const struct hda_pintbl[]) {
1402 { 0x1e, 0x411111f0 }, /* N/A */
1406 .chain_id = ALC880_FIXUP_6ST_BASE,
1408 [ALC880_FIXUP_6ST_DIG] = {
1409 .type = HDA_FIXUP_PINS,
1410 .v.pins = (const struct hda_pintbl[]) {
1411 { 0x1e, 0x0144111e }, /* SPDIF */
1415 .chain_id = ALC880_FIXUP_6ST_BASE,
1417 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1418 .type = HDA_FIXUP_PINS,
1419 .v.pins = (const struct hda_pintbl[]) {
1420 { 0x1b, 0x0121401f }, /* HP with jack detect */
1423 .chained_before = true,
1424 .chain_id = ALC880_FIXUP_6ST_BASE,
1428 static const struct snd_pci_quirk alc880_fixup_tbl[] = {
1429 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
1430 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
1431 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
1432 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
1433 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
1434 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
1435 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
1436 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
1437 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
1438 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
1439 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
1440 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
1441 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
1442 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
1443 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_FIXUP_F1734),
1444 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
1445 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
1446 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
1447 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1448 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1449 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
1450 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
1451 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
1453 /* Below is the copied entries from alc880_quirks.c.
1454 * It's not quite sure whether BIOS sets the correct pin-config table
1455 * on these machines, thus they are kept to be compatible with
1456 * the old static quirks. Once when it's confirmed to work without
1457 * these overrides, it'd be better to remove.
1459 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1460 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1461 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1462 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1463 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1464 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1465 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1466 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1467 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1468 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1469 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1470 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1471 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1472 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1473 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1474 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1475 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1476 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1477 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1478 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1479 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1480 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1481 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1482 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1483 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1484 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1485 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1486 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1487 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1488 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1489 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1490 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1491 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1493 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1494 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1495 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1499 static const struct hda_model_fixup alc880_fixup_models[] = {
1500 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1501 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1502 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1503 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1504 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1505 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
1506 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
1512 * OK, here we have finally the patch for ALC880
1514 static int patch_alc880(struct hda_codec *codec)
1516 struct alc_spec *spec;
1519 err = alc_alloc_spec(codec, 0x0b);
1524 spec->gen.need_dac_fix = 1;
1525 spec->gen.beep_nid = 0x01;
1527 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
1529 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1531 /* automatic parse from the BIOS config */
1532 err = alc880_parse_auto_config(codec);
1536 if (!spec->gen.no_analog)
1537 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1539 codec->patch_ops = alc_patch_ops;
1540 codec->patch_ops.unsol_event = alc880_unsol_event;
1543 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1556 static int alc260_parse_auto_config(struct hda_codec *codec)
1558 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
1559 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1560 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
1567 ALC260_FIXUP_HP_DC5750,
1568 ALC260_FIXUP_HP_PIN_0F,
1571 ALC260_FIXUP_GPIO1_TOGGLE,
1572 ALC260_FIXUP_REPLACER,
1573 ALC260_FIXUP_HP_B1900,
1575 ALC260_FIXUP_FSC_S7020,
1576 ALC260_FIXUP_FSC_S7020_JWSE,
1577 ALC260_FIXUP_VAIO_PINS,
1580 static void alc260_gpio1_automute(struct hda_codec *codec)
1582 struct alc_spec *spec = codec->spec;
1583 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
1584 spec->gen.hp_jack_present);
1587 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1588 const struct hda_fixup *fix, int action)
1590 struct alc_spec *spec = codec->spec;
1591 if (action == HDA_FIXUP_ACT_PROBE) {
1592 /* although the machine has only one output pin, we need to
1593 * toggle GPIO1 according to the jack state
1595 spec->gen.automute_hook = alc260_gpio1_automute;
1596 spec->gen.detect_hp = 1;
1597 spec->gen.automute_speaker = 1;
1598 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
1599 snd_hda_jack_detect_enable_callback(codec, 0x0f, HDA_GEN_HP_EVENT,
1600 snd_hda_gen_hp_automute);
1601 snd_hda_add_verbs(codec, alc_gpio1_init_verbs);
1605 static void alc260_fixup_kn1(struct hda_codec *codec,
1606 const struct hda_fixup *fix, int action)
1608 struct alc_spec *spec = codec->spec;
1609 static const struct hda_pintbl pincfgs[] = {
1610 { 0x0f, 0x02214000 }, /* HP/speaker */
1611 { 0x12, 0x90a60160 }, /* int mic */
1612 { 0x13, 0x02a19000 }, /* ext mic */
1613 { 0x18, 0x01446000 }, /* SPDIF out */
1614 /* disable bogus I/O pins */
1615 { 0x10, 0x411111f0 },
1616 { 0x11, 0x411111f0 },
1617 { 0x14, 0x411111f0 },
1618 { 0x15, 0x411111f0 },
1619 { 0x16, 0x411111f0 },
1620 { 0x17, 0x411111f0 },
1621 { 0x19, 0x411111f0 },
1626 case HDA_FIXUP_ACT_PRE_PROBE:
1627 snd_hda_apply_pincfgs(codec, pincfgs);
1629 case HDA_FIXUP_ACT_PROBE:
1630 spec->init_amp = ALC_INIT_NONE;
1635 static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1636 const struct hda_fixup *fix, int action)
1638 struct alc_spec *spec = codec->spec;
1639 if (action == HDA_FIXUP_ACT_PROBE)
1640 spec->init_amp = ALC_INIT_NONE;
1643 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1644 const struct hda_fixup *fix, int action)
1646 struct alc_spec *spec = codec->spec;
1647 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1648 spec->gen.add_jack_modes = 1;
1649 spec->gen.hp_mic = 1;
1653 static const struct hda_fixup alc260_fixups[] = {
1654 [ALC260_FIXUP_HP_DC5750] = {
1655 .type = HDA_FIXUP_PINS,
1656 .v.pins = (const struct hda_pintbl[]) {
1657 { 0x11, 0x90130110 }, /* speaker */
1661 [ALC260_FIXUP_HP_PIN_0F] = {
1662 .type = HDA_FIXUP_PINS,
1663 .v.pins = (const struct hda_pintbl[]) {
1664 { 0x0f, 0x01214000 }, /* HP */
1668 [ALC260_FIXUP_COEF] = {
1669 .type = HDA_FIXUP_VERBS,
1670 .v.verbs = (const struct hda_verb[]) {
1671 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1672 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
1676 [ALC260_FIXUP_GPIO1] = {
1677 .type = HDA_FIXUP_VERBS,
1678 .v.verbs = alc_gpio1_init_verbs,
1680 [ALC260_FIXUP_GPIO1_TOGGLE] = {
1681 .type = HDA_FIXUP_FUNC,
1682 .v.func = alc260_fixup_gpio1_toggle,
1684 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1686 [ALC260_FIXUP_REPLACER] = {
1687 .type = HDA_FIXUP_VERBS,
1688 .v.verbs = (const struct hda_verb[]) {
1689 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1690 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
1694 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1696 [ALC260_FIXUP_HP_B1900] = {
1697 .type = HDA_FIXUP_FUNC,
1698 .v.func = alc260_fixup_gpio1_toggle,
1700 .chain_id = ALC260_FIXUP_COEF,
1702 [ALC260_FIXUP_KN1] = {
1703 .type = HDA_FIXUP_FUNC,
1704 .v.func = alc260_fixup_kn1,
1706 [ALC260_FIXUP_FSC_S7020] = {
1707 .type = HDA_FIXUP_FUNC,
1708 .v.func = alc260_fixup_fsc_s7020,
1710 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1711 .type = HDA_FIXUP_FUNC,
1712 .v.func = alc260_fixup_fsc_s7020_jwse,
1714 .chain_id = ALC260_FIXUP_FSC_S7020,
1716 [ALC260_FIXUP_VAIO_PINS] = {
1717 .type = HDA_FIXUP_PINS,
1718 .v.pins = (const struct hda_pintbl[]) {
1719 /* Pin configs are missing completely on some VAIOs */
1720 { 0x0f, 0x01211020 },
1721 { 0x10, 0x0001003f },
1722 { 0x11, 0x411111f0 },
1723 { 0x12, 0x01a15930 },
1724 { 0x13, 0x411111f0 },
1725 { 0x14, 0x411111f0 },
1726 { 0x15, 0x411111f0 },
1727 { 0x16, 0x411111f0 },
1728 { 0x17, 0x411111f0 },
1729 { 0x18, 0x411111f0 },
1730 { 0x19, 0x411111f0 },
1736 static const struct snd_pci_quirk alc260_fixup_tbl[] = {
1737 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
1738 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
1739 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
1740 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
1741 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
1742 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
1743 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
1744 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
1745 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
1746 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
1747 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
1748 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
1752 static const struct hda_model_fixup alc260_fixup_models[] = {
1753 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1754 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1755 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1756 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1762 static int patch_alc260(struct hda_codec *codec)
1764 struct alc_spec *spec;
1767 err = alc_alloc_spec(codec, 0x07);
1772 /* as quite a few machines require HP amp for speaker outputs,
1773 * it's easier to enable it unconditionally; even if it's unneeded,
1774 * it's almost harmless.
1776 spec->gen.prefer_hp_amp = 1;
1777 spec->gen.beep_nid = 0x01;
1779 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1781 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1783 /* automatic parse from the BIOS config */
1784 err = alc260_parse_auto_config(codec);
1788 if (!spec->gen.no_analog)
1789 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1791 codec->patch_ops = alc_patch_ops;
1792 spec->shutup = alc_eapd_shutup;
1794 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1805 * ALC882/883/885/888/889 support
1807 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1808 * configuration. Each pin widget can choose any input DACs and a mixer.
1809 * Each ADC is connected from a mixer of all inputs. This makes possible
1810 * 6-channel independent captures.
1812 * In addition, an independent DAC for the multi-playback (not used in this
1820 ALC882_FIXUP_ABIT_AW9D_MAX,
1821 ALC882_FIXUP_LENOVO_Y530,
1822 ALC882_FIXUP_PB_M5210,
1823 ALC882_FIXUP_ACER_ASPIRE_7736,
1824 ALC882_FIXUP_ASUS_W90V,
1826 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
1827 ALC889_FIXUP_VAIO_TT,
1828 ALC888_FIXUP_EEE1601,
1831 ALC883_FIXUP_ACER_EAPD,
1836 ALC882_FIXUP_ASUS_W2JC,
1837 ALC882_FIXUP_ACER_ASPIRE_4930G,
1838 ALC882_FIXUP_ACER_ASPIRE_8930G,
1839 ALC882_FIXUP_ASPIRE_8930G_VERBS,
1840 ALC885_FIXUP_MACPRO_GPIO,
1841 ALC889_FIXUP_DAC_ROUTE,
1842 ALC889_FIXUP_MBP_VREF,
1843 ALC889_FIXUP_IMAC91_VREF,
1844 ALC889_FIXUP_MBA11_VREF,
1845 ALC889_FIXUP_MBA21_VREF,
1846 ALC889_FIXUP_MP11_VREF,
1847 ALC882_FIXUP_INV_DMIC,
1848 ALC882_FIXUP_NO_PRIMARY_HP,
1849 ALC887_FIXUP_ASUS_BASS,
1850 ALC887_FIXUP_BASS_CHMAP,
1853 static void alc889_fixup_coef(struct hda_codec *codec,
1854 const struct hda_fixup *fix, int action)
1856 if (action != HDA_FIXUP_ACT_INIT)
1858 alc889_coef_init(codec);
1861 /* toggle speaker-output according to the hp-jack state */
1862 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
1864 unsigned int gpiostate, gpiomask, gpiodir;
1866 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
1867 AC_VERB_GET_GPIO_DATA, 0);
1870 gpiostate |= (1 << pin);
1872 gpiostate &= ~(1 << pin);
1874 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
1875 AC_VERB_GET_GPIO_MASK, 0);
1876 gpiomask |= (1 << pin);
1878 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
1879 AC_VERB_GET_GPIO_DIRECTION, 0);
1880 gpiodir |= (1 << pin);
1883 snd_hda_codec_write(codec, codec->afg, 0,
1884 AC_VERB_SET_GPIO_MASK, gpiomask);
1885 snd_hda_codec_write(codec, codec->afg, 0,
1886 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
1890 snd_hda_codec_write(codec, codec->afg, 0,
1891 AC_VERB_SET_GPIO_DATA, gpiostate);
1894 /* set up GPIO at initialization */
1895 static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
1896 const struct hda_fixup *fix, int action)
1898 if (action != HDA_FIXUP_ACT_INIT)
1900 alc882_gpio_mute(codec, 0, 0);
1901 alc882_gpio_mute(codec, 1, 0);
1904 /* Fix the connection of some pins for ALC889:
1905 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
1906 * work correctly (bko#42740)
1908 static void alc889_fixup_dac_route(struct hda_codec *codec,
1909 const struct hda_fixup *fix, int action)
1911 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1912 /* fake the connections during parsing the tree */
1913 hda_nid_t conn1[2] = { 0x0c, 0x0d };
1914 hda_nid_t conn2[2] = { 0x0e, 0x0f };
1915 snd_hda_override_conn_list(codec, 0x14, 2, conn1);
1916 snd_hda_override_conn_list(codec, 0x15, 2, conn1);
1917 snd_hda_override_conn_list(codec, 0x18, 2, conn2);
1918 snd_hda_override_conn_list(codec, 0x1a, 2, conn2);
1919 } else if (action == HDA_FIXUP_ACT_PROBE) {
1920 /* restore the connections */
1921 hda_nid_t conn[5] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
1922 snd_hda_override_conn_list(codec, 0x14, 5, conn);
1923 snd_hda_override_conn_list(codec, 0x15, 5, conn);
1924 snd_hda_override_conn_list(codec, 0x18, 5, conn);
1925 snd_hda_override_conn_list(codec, 0x1a, 5, conn);
1929 /* Set VREF on HP pin */
1930 static void alc889_fixup_mbp_vref(struct hda_codec *codec,
1931 const struct hda_fixup *fix, int action)
1933 struct alc_spec *spec = codec->spec;
1934 static hda_nid_t nids[2] = { 0x14, 0x15 };
1937 if (action != HDA_FIXUP_ACT_INIT)
1939 for (i = 0; i < ARRAY_SIZE(nids); i++) {
1940 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
1941 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
1943 val = snd_hda_codec_get_pin_target(codec, nids[i]);
1944 val |= AC_PINCTL_VREF_80;
1945 snd_hda_set_pin_ctl(codec, nids[i], val);
1946 spec->gen.keep_vref_in_automute = 1;
1951 static void alc889_fixup_mac_pins(struct hda_codec *codec,
1952 const hda_nid_t *nids, int num_nids)
1954 struct alc_spec *spec = codec->spec;
1957 for (i = 0; i < num_nids; i++) {
1959 val = snd_hda_codec_get_pin_target(codec, nids[i]);
1960 val |= AC_PINCTL_VREF_50;
1961 snd_hda_set_pin_ctl(codec, nids[i], val);
1963 spec->gen.keep_vref_in_automute = 1;
1966 /* Set VREF on speaker pins on imac91 */
1967 static void alc889_fixup_imac91_vref(struct hda_codec *codec,
1968 const struct hda_fixup *fix, int action)
1970 static hda_nid_t nids[2] = { 0x18, 0x1a };
1972 if (action == HDA_FIXUP_ACT_INIT)
1973 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1976 /* Set VREF on speaker pins on mba11 */
1977 static void alc889_fixup_mba11_vref(struct hda_codec *codec,
1978 const struct hda_fixup *fix, int action)
1980 static hda_nid_t nids[1] = { 0x18 };
1982 if (action == HDA_FIXUP_ACT_INIT)
1983 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1986 /* Set VREF on speaker pins on mba21 */
1987 static void alc889_fixup_mba21_vref(struct hda_codec *codec,
1988 const struct hda_fixup *fix, int action)
1990 static hda_nid_t nids[2] = { 0x18, 0x19 };
1992 if (action == HDA_FIXUP_ACT_INIT)
1993 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1996 /* Don't take HP output as primary
1997 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
1998 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
2000 static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
2001 const struct hda_fixup *fix, int action)
2003 struct alc_spec *spec = codec->spec;
2004 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2005 spec->gen.no_primary_hp = 1;
2006 spec->gen.no_multi_io = 1;
2010 static void alc_fixup_bass_chmap(struct hda_codec *codec,
2011 const struct hda_fixup *fix, int action);
2013 static const struct hda_fixup alc882_fixups[] = {
2014 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
2015 .type = HDA_FIXUP_PINS,
2016 .v.pins = (const struct hda_pintbl[]) {
2017 { 0x15, 0x01080104 }, /* side */
2018 { 0x16, 0x01011012 }, /* rear */
2019 { 0x17, 0x01016011 }, /* clfe */
2023 [ALC882_FIXUP_LENOVO_Y530] = {
2024 .type = HDA_FIXUP_PINS,
2025 .v.pins = (const struct hda_pintbl[]) {
2026 { 0x15, 0x99130112 }, /* rear int speakers */
2027 { 0x16, 0x99130111 }, /* subwoofer */
2031 [ALC882_FIXUP_PB_M5210] = {
2032 .type = HDA_FIXUP_PINCTLS,
2033 .v.pins = (const struct hda_pintbl[]) {
2034 { 0x19, PIN_VREF50 },
2038 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
2039 .type = HDA_FIXUP_FUNC,
2040 .v.func = alc_fixup_sku_ignore,
2042 [ALC882_FIXUP_ASUS_W90V] = {
2043 .type = HDA_FIXUP_PINS,
2044 .v.pins = (const struct hda_pintbl[]) {
2045 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
2049 [ALC889_FIXUP_CD] = {
2050 .type = HDA_FIXUP_PINS,
2051 .v.pins = (const struct hda_pintbl[]) {
2052 { 0x1c, 0x993301f0 }, /* CD */
2056 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2057 .type = HDA_FIXUP_PINS,
2058 .v.pins = (const struct hda_pintbl[]) {
2059 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2063 .chain_id = ALC889_FIXUP_CD,
2065 [ALC889_FIXUP_VAIO_TT] = {
2066 .type = HDA_FIXUP_PINS,
2067 .v.pins = (const struct hda_pintbl[]) {
2068 { 0x17, 0x90170111 }, /* hidden surround speaker */
2072 [ALC888_FIXUP_EEE1601] = {
2073 .type = HDA_FIXUP_VERBS,
2074 .v.verbs = (const struct hda_verb[]) {
2075 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2076 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
2080 [ALC882_FIXUP_EAPD] = {
2081 .type = HDA_FIXUP_VERBS,
2082 .v.verbs = (const struct hda_verb[]) {
2083 /* change to EAPD mode */
2084 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2085 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2089 [ALC883_FIXUP_EAPD] = {
2090 .type = HDA_FIXUP_VERBS,
2091 .v.verbs = (const struct hda_verb[]) {
2092 /* change to EAPD mode */
2093 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2094 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2098 [ALC883_FIXUP_ACER_EAPD] = {
2099 .type = HDA_FIXUP_VERBS,
2100 .v.verbs = (const struct hda_verb[]) {
2101 /* eanable EAPD on Acer laptops */
2102 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2103 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2107 [ALC882_FIXUP_GPIO1] = {
2108 .type = HDA_FIXUP_VERBS,
2109 .v.verbs = alc_gpio1_init_verbs,
2111 [ALC882_FIXUP_GPIO2] = {
2112 .type = HDA_FIXUP_VERBS,
2113 .v.verbs = alc_gpio2_init_verbs,
2115 [ALC882_FIXUP_GPIO3] = {
2116 .type = HDA_FIXUP_VERBS,
2117 .v.verbs = alc_gpio3_init_verbs,
2119 [ALC882_FIXUP_ASUS_W2JC] = {
2120 .type = HDA_FIXUP_VERBS,
2121 .v.verbs = alc_gpio1_init_verbs,
2123 .chain_id = ALC882_FIXUP_EAPD,
2125 [ALC889_FIXUP_COEF] = {
2126 .type = HDA_FIXUP_FUNC,
2127 .v.func = alc889_fixup_coef,
2129 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
2130 .type = HDA_FIXUP_PINS,
2131 .v.pins = (const struct hda_pintbl[]) {
2132 { 0x16, 0x99130111 }, /* CLFE speaker */
2133 { 0x17, 0x99130112 }, /* surround speaker */
2137 .chain_id = ALC882_FIXUP_GPIO1,
2139 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
2140 .type = HDA_FIXUP_PINS,
2141 .v.pins = (const struct hda_pintbl[]) {
2142 { 0x16, 0x99130111 }, /* CLFE speaker */
2143 { 0x1b, 0x99130112 }, /* surround speaker */
2147 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2149 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2150 /* additional init verbs for Acer Aspire 8930G */
2151 .type = HDA_FIXUP_VERBS,
2152 .v.verbs = (const struct hda_verb[]) {
2153 /* Enable all DACs */
2154 /* DAC DISABLE/MUTE 1? */
2155 /* setting bits 1-5 disables DAC nids 0x02-0x06
2156 * apparently. Init=0x38 */
2157 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2158 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2159 /* DAC DISABLE/MUTE 2? */
2160 /* some bit here disables the other DACs.
2162 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2163 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2165 * This laptop has a stereo digital microphone.
2166 * The mics are only 1cm apart which makes the stereo
2167 * useless. However, either the mic or the ALC889
2168 * makes the signal become a difference/sum signal
2169 * instead of standard stereo, which is annoying.
2170 * So instead we flip this bit which makes the
2171 * codec replicate the sum signal to both channels,
2172 * turning it into a normal mono mic.
2174 /* DMIC_CONTROL? Init value = 0x0001 */
2175 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2176 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2177 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2178 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2182 .chain_id = ALC882_FIXUP_GPIO1,
2184 [ALC885_FIXUP_MACPRO_GPIO] = {
2185 .type = HDA_FIXUP_FUNC,
2186 .v.func = alc885_fixup_macpro_gpio,
2188 [ALC889_FIXUP_DAC_ROUTE] = {
2189 .type = HDA_FIXUP_FUNC,
2190 .v.func = alc889_fixup_dac_route,
2192 [ALC889_FIXUP_MBP_VREF] = {
2193 .type = HDA_FIXUP_FUNC,
2194 .v.func = alc889_fixup_mbp_vref,
2196 .chain_id = ALC882_FIXUP_GPIO1,
2198 [ALC889_FIXUP_IMAC91_VREF] = {
2199 .type = HDA_FIXUP_FUNC,
2200 .v.func = alc889_fixup_imac91_vref,
2202 .chain_id = ALC882_FIXUP_GPIO1,
2204 [ALC889_FIXUP_MBA11_VREF] = {
2205 .type = HDA_FIXUP_FUNC,
2206 .v.func = alc889_fixup_mba11_vref,
2208 .chain_id = ALC889_FIXUP_MBP_VREF,
2210 [ALC889_FIXUP_MBA21_VREF] = {
2211 .type = HDA_FIXUP_FUNC,
2212 .v.func = alc889_fixup_mba21_vref,
2214 .chain_id = ALC889_FIXUP_MBP_VREF,
2216 [ALC889_FIXUP_MP11_VREF] = {
2217 .type = HDA_FIXUP_FUNC,
2218 .v.func = alc889_fixup_mba11_vref,
2220 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2222 [ALC882_FIXUP_INV_DMIC] = {
2223 .type = HDA_FIXUP_FUNC,
2224 .v.func = alc_fixup_inv_dmic_0x12,
2226 [ALC882_FIXUP_NO_PRIMARY_HP] = {
2227 .type = HDA_FIXUP_FUNC,
2228 .v.func = alc882_fixup_no_primary_hp,
2230 [ALC887_FIXUP_ASUS_BASS] = {
2231 .type = HDA_FIXUP_PINS,
2232 .v.pins = (const struct hda_pintbl[]) {
2233 {0x16, 0x99130130}, /* bass speaker */
2237 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2239 [ALC887_FIXUP_BASS_CHMAP] = {
2240 .type = HDA_FIXUP_FUNC,
2241 .v.func = alc_fixup_bass_chmap,
2245 static const struct snd_pci_quirk alc882_fixup_tbl[] = {
2246 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2247 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2248 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2249 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2250 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2251 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
2252 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2253 ALC882_FIXUP_ACER_ASPIRE_4930G),
2254 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2255 ALC882_FIXUP_ACER_ASPIRE_4930G),
2256 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2257 ALC882_FIXUP_ACER_ASPIRE_8930G),
2258 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2259 ALC882_FIXUP_ACER_ASPIRE_8930G),
2260 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2261 ALC882_FIXUP_ACER_ASPIRE_4930G),
2262 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2263 ALC882_FIXUP_ACER_ASPIRE_4930G),
2264 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2265 ALC882_FIXUP_ACER_ASPIRE_4930G),
2266 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
2267 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2268 ALC882_FIXUP_ACER_ASPIRE_4930G),
2269 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
2270 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
2271 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
2272 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
2273 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
2274 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
2275 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
2276 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
2277 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
2278 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
2279 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2281 /* All Apple entries are in codec SSIDs */
2282 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2283 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2284 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2285 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
2286 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2287 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
2288 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2289 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
2290 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
2291 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
2292 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
2293 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2294 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2295 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
2296 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2297 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2298 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
2299 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 5,1", ALC885_FIXUP_MACPRO_GPIO),
2300 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
2301 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2302 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
2303 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_IMAC91_VREF),
2305 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
2306 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
2307 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
2308 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
2309 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
2310 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2311 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
2312 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
2313 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
2317 static const struct hda_model_fixup alc882_fixup_models[] = {
2318 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2319 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2320 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
2321 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
2322 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
2327 * BIOS auto configuration
2329 /* almost identical with ALC880 parser... */
2330 static int alc882_parse_auto_config(struct hda_codec *codec)
2332 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
2333 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2334 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
2339 static int patch_alc882(struct hda_codec *codec)
2341 struct alc_spec *spec;
2344 err = alc_alloc_spec(codec, 0x0b);
2350 switch (codec->vendor_id) {
2355 /* ALC883 and variants */
2356 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2360 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
2362 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2364 alc_auto_parse_customize_define(codec);
2366 if (has_cdefine_beep(codec))
2367 spec->gen.beep_nid = 0x01;
2369 /* automatic parse from the BIOS config */
2370 err = alc882_parse_auto_config(codec);
2374 if (!spec->gen.no_analog && spec->gen.beep_nid)
2375 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2377 codec->patch_ops = alc_patch_ops;
2379 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2392 static int alc262_parse_auto_config(struct hda_codec *codec)
2394 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
2395 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2396 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
2403 ALC262_FIXUP_FSC_H270,
2404 ALC262_FIXUP_FSC_S7110,
2405 ALC262_FIXUP_HP_Z200,
2407 ALC262_FIXUP_LENOVO_3000,
2409 ALC262_FIXUP_BENQ_T31,
2410 ALC262_FIXUP_INV_DMIC,
2411 ALC262_FIXUP_INTEL_BAYLEYBAY,
2414 static const struct hda_fixup alc262_fixups[] = {
2415 [ALC262_FIXUP_FSC_H270] = {
2416 .type = HDA_FIXUP_PINS,
2417 .v.pins = (const struct hda_pintbl[]) {
2418 { 0x14, 0x99130110 }, /* speaker */
2419 { 0x15, 0x0221142f }, /* front HP */
2420 { 0x1b, 0x0121141f }, /* rear HP */
2424 [ALC262_FIXUP_FSC_S7110] = {
2425 .type = HDA_FIXUP_PINS,
2426 .v.pins = (const struct hda_pintbl[]) {
2427 { 0x15, 0x90170110 }, /* speaker */
2431 .chain_id = ALC262_FIXUP_BENQ,
2433 [ALC262_FIXUP_HP_Z200] = {
2434 .type = HDA_FIXUP_PINS,
2435 .v.pins = (const struct hda_pintbl[]) {
2436 { 0x16, 0x99130120 }, /* internal speaker */
2440 [ALC262_FIXUP_TYAN] = {
2441 .type = HDA_FIXUP_PINS,
2442 .v.pins = (const struct hda_pintbl[]) {
2443 { 0x14, 0x1993e1f0 }, /* int AUX */
2447 [ALC262_FIXUP_LENOVO_3000] = {
2448 .type = HDA_FIXUP_PINCTLS,
2449 .v.pins = (const struct hda_pintbl[]) {
2450 { 0x19, PIN_VREF50 },
2454 .chain_id = ALC262_FIXUP_BENQ,
2456 [ALC262_FIXUP_BENQ] = {
2457 .type = HDA_FIXUP_VERBS,
2458 .v.verbs = (const struct hda_verb[]) {
2459 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2460 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2464 [ALC262_FIXUP_BENQ_T31] = {
2465 .type = HDA_FIXUP_VERBS,
2466 .v.verbs = (const struct hda_verb[]) {
2467 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2468 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2472 [ALC262_FIXUP_INV_DMIC] = {
2473 .type = HDA_FIXUP_FUNC,
2474 .v.func = alc_fixup_inv_dmic_0x12,
2476 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2477 .type = HDA_FIXUP_FUNC,
2478 .v.func = alc_fixup_no_depop_delay,
2482 static const struct snd_pci_quirk alc262_fixup_tbl[] = {
2483 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
2484 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
2485 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
2486 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
2487 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
2488 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
2489 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2490 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
2491 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
2495 static const struct hda_model_fixup alc262_fixup_models[] = {
2496 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
2502 static int patch_alc262(struct hda_codec *codec)
2504 struct alc_spec *spec;
2507 err = alc_alloc_spec(codec, 0x0b);
2512 spec->gen.shared_mic_vref_pin = 0x18;
2515 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2520 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
2521 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
2522 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
2523 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
2526 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2528 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
2530 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2532 alc_auto_parse_customize_define(codec);
2534 if (has_cdefine_beep(codec))
2535 spec->gen.beep_nid = 0x01;
2537 /* automatic parse from the BIOS config */
2538 err = alc262_parse_auto_config(codec);
2542 if (!spec->gen.no_analog && spec->gen.beep_nid)
2543 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2545 codec->patch_ops = alc_patch_ops;
2546 spec->shutup = alc_eapd_shutup;
2548 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2560 /* bind Beep switches of both NID 0x0f and 0x10 */
2561 static const struct hda_bind_ctls alc268_bind_beep_sw = {
2562 .ops = &snd_hda_bind_sw,
2564 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
2565 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
2570 static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2571 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
2572 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
2576 /* set PCBEEP vol = 0, mute connections */
2577 static const struct hda_verb alc268_beep_init_verbs[] = {
2578 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2579 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2580 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2585 ALC268_FIXUP_INV_DMIC,
2586 ALC268_FIXUP_HP_EAPD,
2590 static const struct hda_fixup alc268_fixups[] = {
2591 [ALC268_FIXUP_INV_DMIC] = {
2592 .type = HDA_FIXUP_FUNC,
2593 .v.func = alc_fixup_inv_dmic_0x12,
2595 [ALC268_FIXUP_HP_EAPD] = {
2596 .type = HDA_FIXUP_VERBS,
2597 .v.verbs = (const struct hda_verb[]) {
2598 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
2602 [ALC268_FIXUP_SPDIF] = {
2603 .type = HDA_FIXUP_PINS,
2604 .v.pins = (const struct hda_pintbl[]) {
2605 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
2611 static const struct hda_model_fixup alc268_fixup_models[] = {
2612 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
2613 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
2617 static const struct snd_pci_quirk alc268_fixup_tbl[] = {
2618 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
2619 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
2620 /* below is codec SSID since multiple Toshiba laptops have the
2621 * same PCI SSID 1179:ff00
2623 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
2628 * BIOS auto configuration
2630 static int alc268_parse_auto_config(struct hda_codec *codec)
2632 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2633 return alc_parse_auto_config(codec, NULL, alc268_ssids);
2638 static int patch_alc268(struct hda_codec *codec)
2640 struct alc_spec *spec;
2643 /* ALC268 has no aa-loopback mixer */
2644 err = alc_alloc_spec(codec, 0);
2649 spec->gen.beep_nid = 0x01;
2651 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
2652 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2654 /* automatic parse from the BIOS config */
2655 err = alc268_parse_auto_config(codec);
2659 if (err > 0 && !spec->gen.no_analog &&
2660 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
2661 add_mixer(spec, alc268_beep_mixer);
2662 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
2663 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
2664 /* override the amp caps for beep generator */
2665 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
2666 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
2667 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
2668 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
2669 (0 << AC_AMPCAP_MUTE_SHIFT));
2672 codec->patch_ops = alc_patch_ops;
2673 spec->shutup = alc_eapd_shutup;
2675 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2688 static int playback_pcm_open(struct hda_pcm_stream *hinfo,
2689 struct hda_codec *codec,
2690 struct snd_pcm_substream *substream)
2692 struct hda_gen_spec *spec = codec->spec;
2693 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2697 static int playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2698 struct hda_codec *codec,
2699 unsigned int stream_tag,
2700 unsigned int format,
2701 struct snd_pcm_substream *substream)
2703 struct hda_gen_spec *spec = codec->spec;
2704 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2705 stream_tag, format, substream);
2708 static int playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2709 struct hda_codec *codec,
2710 struct snd_pcm_substream *substream)
2712 struct hda_gen_spec *spec = codec->spec;
2713 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2716 static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
2720 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
2721 /* NID is set in alc_build_pcms */
2723 .open = playback_pcm_open,
2724 .prepare = playback_pcm_prepare,
2725 .cleanup = playback_pcm_cleanup
2729 static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
2733 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
2734 /* NID is set in alc_build_pcms */
2737 /* different alc269-variants */
2739 ALC269_TYPE_ALC269VA,
2740 ALC269_TYPE_ALC269VB,
2741 ALC269_TYPE_ALC269VC,
2742 ALC269_TYPE_ALC269VD,
2753 * BIOS auto configuration
2755 static int alc269_parse_auto_config(struct hda_codec *codec)
2757 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
2758 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
2759 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2760 struct alc_spec *spec = codec->spec;
2761 const hda_nid_t *ssids;
2763 switch (spec->codec_variant) {
2764 case ALC269_TYPE_ALC269VA:
2765 case ALC269_TYPE_ALC269VC:
2766 case ALC269_TYPE_ALC280:
2767 case ALC269_TYPE_ALC284:
2768 case ALC269_TYPE_ALC285:
2769 ssids = alc269va_ssids;
2771 case ALC269_TYPE_ALC269VB:
2772 case ALC269_TYPE_ALC269VD:
2773 case ALC269_TYPE_ALC282:
2774 case ALC269_TYPE_ALC283:
2775 case ALC269_TYPE_ALC286:
2776 case ALC269_TYPE_ALC255:
2777 ssids = alc269_ssids;
2780 ssids = alc269_ssids;
2784 return alc_parse_auto_config(codec, alc269_ignore, ssids);
2787 static int find_ext_mic_pin(struct hda_codec *codec);
2789 static void alc286_shutup(struct hda_codec *codec)
2792 int mic_pin = find_ext_mic_pin(codec);
2793 /* don't shut up pins when unloading the driver; otherwise it breaks
2794 * the default pin setup at the next load of the driver
2796 if (codec->bus->shutdown)
2798 for (i = 0; i < codec->init_pins.used; i++) {
2799 struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i);
2800 /* use read here for syncing after issuing each verb */
2801 if (pin->nid != mic_pin)
2802 snd_hda_codec_read(codec, pin->nid, 0,
2803 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
2805 codec->pins_shutup = 1;
2808 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
2810 int val = alc_read_coef_idx(codec, 0x04);
2817 alc_write_coef_idx(codec, 0x04, val);
2820 static void alc269_shutup(struct hda_codec *codec)
2822 struct alc_spec *spec = codec->spec;
2824 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
2825 alc269vb_toggle_power_output(codec, 0);
2826 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
2827 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
2830 snd_hda_shutup_pins(codec);
2833 static void alc282_restore_default_value(struct hda_codec *codec)
2837 /* Power Down Control */
2838 alc_write_coef_idx(codec, 0x03, 0x0002);
2839 /* FIFO and filter clock */
2840 alc_write_coef_idx(codec, 0x05, 0x0700);
2842 alc_write_coef_idx(codec, 0x07, 0x0200);
2844 val = alc_read_coef_idx(codec, 0x06);
2845 alc_write_coef_idx(codec, 0x06, (val & ~0x00f0) | 0x0);
2847 val = alc_read_coef_idx(codec, 0x08);
2848 alc_write_coef_idx(codec, 0x08, (val & ~0xfffc) | 0x0c2c);
2850 alc_write_coef_idx(codec, 0x0a, 0xcccc);
2852 alc_write_coef_idx(codec, 0x0b, 0xcccc);
2853 /* LDO1/2/3, DAC/ADC */
2854 alc_write_coef_idx(codec, 0x0e, 0x6e00);
2856 val = alc_read_coef_idx(codec, 0x0f);
2857 alc_write_coef_idx(codec, 0x0f, (val & ~0xf800) | 0x1000);
2859 val = alc_read_coef_idx(codec, 0x10);
2860 alc_write_coef_idx(codec, 0x10, (val & ~0xfc00) | 0x0c00);
2861 /* Class D test 4 */
2862 alc_write_coef_idx(codec, 0x6f, 0x0);
2863 /* IO power down directly */
2864 val = alc_read_coef_idx(codec, 0x0c);
2865 alc_write_coef_idx(codec, 0x0c, (val & ~0xfe00) | 0x0);
2867 alc_write_coef_idx(codec, 0x34, 0xa0c0);
2869 val = alc_read_coef_idx(codec, 0x16);
2870 alc_write_coef_idx(codec, 0x16, (val & ~0x0008) | 0x0);
2871 /* DAC simple content protection */
2872 val = alc_read_coef_idx(codec, 0x1d);
2873 alc_write_coef_idx(codec, 0x1d, (val & ~0x00e0) | 0x0);
2874 /* ADC simple content protection */
2875 val = alc_read_coef_idx(codec, 0x1f);
2876 alc_write_coef_idx(codec, 0x1f, (val & ~0x00e0) | 0x0);
2877 /* DAC ADC Zero Detection */
2878 alc_write_coef_idx(codec, 0x21, 0x8804);
2880 alc_write_coef_idx(codec, 0x63, 0x2902);
2881 /* capless control 2 */
2882 alc_write_coef_idx(codec, 0x68, 0xa080);
2883 /* capless control 3 */
2884 alc_write_coef_idx(codec, 0x69, 0x3400);
2885 /* capless control 4 */
2886 alc_write_coef_idx(codec, 0x6a, 0x2f3e);
2887 /* capless control 5 */
2888 alc_write_coef_idx(codec, 0x6b, 0x0);
2889 /* class D test 2 */
2890 val = alc_read_coef_idx(codec, 0x6d);
2891 alc_write_coef_idx(codec, 0x6d, (val & ~0x0fff) | 0x0900);
2892 /* class D test 3 */
2893 alc_write_coef_idx(codec, 0x6e, 0x110a);
2894 /* class D test 5 */
2895 val = alc_read_coef_idx(codec, 0x70);
2896 alc_write_coef_idx(codec, 0x70, (val & ~0x00f8) | 0x00d8);
2897 /* class D test 6 */
2898 alc_write_coef_idx(codec, 0x71, 0x0014);
2900 alc_write_coef_idx(codec, 0x72, 0xc2ba);
2901 /* classD pure DC test */
2902 val = alc_read_coef_idx(codec, 0x77);
2903 alc_write_coef_idx(codec, 0x77, (val & ~0x0f80) | 0x0);
2904 /* Class D amp control */
2905 alc_write_coef_idx(codec, 0x6c, 0xfc06);
2908 static void alc282_init(struct hda_codec *codec)
2910 struct alc_spec *spec = codec->spec;
2911 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
2915 alc282_restore_default_value(codec);
2919 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
2920 coef78 = alc_read_coef_idx(codec, 0x78);
2922 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
2923 /* Headphone capless set to high power mode */
2924 alc_write_coef_idx(codec, 0x78, 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);
2941 /* Headphone capless set to normal mode */
2942 alc_write_coef_idx(codec, 0x78, coef78);
2945 static void alc282_shutup(struct hda_codec *codec)
2947 struct alc_spec *spec = codec->spec;
2948 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
2953 alc269_shutup(codec);
2957 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
2958 coef78 = alc_read_coef_idx(codec, 0x78);
2959 alc_write_coef_idx(codec, 0x78, 0x9004);
2964 snd_hda_codec_write(codec, hp_pin, 0,
2965 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
2970 snd_hda_codec_write(codec, hp_pin, 0,
2971 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
2976 alc_auto_setup_eapd(codec, false);
2977 snd_hda_shutup_pins(codec);
2978 alc_write_coef_idx(codec, 0x78, coef78);
2981 static void alc283_restore_default_value(struct hda_codec *codec)
2985 /* Power Down Control */
2986 alc_write_coef_idx(codec, 0x03, 0x0002);
2987 /* FIFO and filter clock */
2988 alc_write_coef_idx(codec, 0x05, 0x0700);
2990 alc_write_coef_idx(codec, 0x07, 0x0200);
2992 val = alc_read_coef_idx(codec, 0x06);
2993 alc_write_coef_idx(codec, 0x06, (val & ~0x00f0) | 0x0);
2995 val = alc_read_coef_idx(codec, 0x08);
2996 alc_write_coef_idx(codec, 0x08, (val & ~0xfffc) | 0x0c2c);
2998 alc_write_coef_idx(codec, 0x0a, 0xcccc);
3000 alc_write_coef_idx(codec, 0x0b, 0xcccc);
3001 /* LDO1/2/3, DAC/ADC */
3002 alc_write_coef_idx(codec, 0x0e, 0x6fc0);
3004 val = alc_read_coef_idx(codec, 0x0f);
3005 alc_write_coef_idx(codec, 0x0f, (val & ~0xf800) | 0x1000);
3007 val = alc_read_coef_idx(codec, 0x10);
3008 alc_write_coef_idx(codec, 0x10, (val & ~0xfc00) | 0x0c00);
3009 /* Class D test 4 */
3010 alc_write_coef_idx(codec, 0x3a, 0x0);
3011 /* IO power down directly */
3012 val = alc_read_coef_idx(codec, 0x0c);
3013 alc_write_coef_idx(codec, 0x0c, (val & ~0xfe00) | 0x0);
3015 alc_write_coef_idx(codec, 0x22, 0xa0c0);
3017 val = alc_read_coefex_idx(codec, 0x53, 0x01);
3018 alc_write_coefex_idx(codec, 0x53, 0x01, (val & ~0x000f) | 0x0008);
3019 /* DAC simple content protection */
3020 val = alc_read_coef_idx(codec, 0x1d);
3021 alc_write_coef_idx(codec, 0x1d, (val & ~0x00e0) | 0x0);
3022 /* ADC simple content protection */
3023 val = alc_read_coef_idx(codec, 0x1f);
3024 alc_write_coef_idx(codec, 0x1f, (val & ~0x00e0) | 0x0);
3025 /* DAC ADC Zero Detection */
3026 alc_write_coef_idx(codec, 0x21, 0x8804);
3028 alc_write_coef_idx(codec, 0x2e, 0x2902);
3029 /* capless control 2 */
3030 alc_write_coef_idx(codec, 0x33, 0xa080);
3031 /* capless control 3 */
3032 alc_write_coef_idx(codec, 0x34, 0x3400);
3033 /* capless control 4 */
3034 alc_write_coef_idx(codec, 0x35, 0x2f3e);
3035 /* capless control 5 */
3036 alc_write_coef_idx(codec, 0x36, 0x0);
3037 /* class D test 2 */
3038 val = alc_read_coef_idx(codec, 0x38);
3039 alc_write_coef_idx(codec, 0x38, (val & ~0x0fff) | 0x0900);
3040 /* class D test 3 */
3041 alc_write_coef_idx(codec, 0x39, 0x110a);
3042 /* class D test 5 */
3043 val = alc_read_coef_idx(codec, 0x3b);
3044 alc_write_coef_idx(codec, 0x3b, (val & ~0x00f8) | 0x00d8);
3045 /* class D test 6 */
3046 alc_write_coef_idx(codec, 0x3c, 0x0014);
3048 alc_write_coef_idx(codec, 0x3d, 0xc2ba);
3049 /* classD pure DC test */
3050 val = alc_read_coef_idx(codec, 0x42);
3051 alc_write_coef_idx(codec, 0x42, (val & ~0x0f80) | 0x0);
3053 alc_write_coef_idx(codec, 0x49, 0x0);
3054 /* Class D DC enable */
3055 val = alc_read_coef_idx(codec, 0x40);
3056 alc_write_coef_idx(codec, 0x40, (val & ~0xf800) | 0x9800);
3058 val = alc_read_coef_idx(codec, 0x42);
3059 alc_write_coef_idx(codec, 0x42, (val & ~0xf000) | 0x2000);
3060 /* Class D amp control */
3061 alc_write_coef_idx(codec, 0x37, 0xfc06);
3064 static void alc283_init(struct hda_codec *codec)
3066 struct alc_spec *spec = codec->spec;
3067 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3071 if (!spec->gen.autocfg.hp_outs) {
3072 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
3073 hp_pin = spec->gen.autocfg.line_out_pins[0];
3076 alc283_restore_default_value(codec);
3080 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3082 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3083 /* Headphone capless set to high power mode */
3084 alc_write_coef_idx(codec, 0x43, 0x9004);
3086 snd_hda_codec_write(codec, hp_pin, 0,
3087 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3092 snd_hda_codec_write(codec, hp_pin, 0,
3093 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3097 /* Index 0x46 Combo jack auto switch control 2 */
3098 /* 3k pull low control for Headset jack. */
3099 val = alc_read_coef_idx(codec, 0x46);
3100 alc_write_coef_idx(codec, 0x46, val & ~(3 << 12));
3101 /* Headphone capless set to normal mode */
3102 alc_write_coef_idx(codec, 0x43, 0x9614);
3105 static void alc283_shutup(struct hda_codec *codec)
3107 struct alc_spec *spec = codec->spec;
3108 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3112 if (!spec->gen.autocfg.hp_outs) {
3113 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
3114 hp_pin = spec->gen.autocfg.line_out_pins[0];
3118 alc269_shutup(codec);
3122 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3124 alc_write_coef_idx(codec, 0x43, 0x9004);
3126 snd_hda_codec_write(codec, hp_pin, 0,
3127 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3132 snd_hda_codec_write(codec, hp_pin, 0,
3133 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3135 val = alc_read_coef_idx(codec, 0x46);
3136 alc_write_coef_idx(codec, 0x46, val | (3 << 12));
3140 alc_auto_setup_eapd(codec, false);
3141 snd_hda_shutup_pins(codec);
3142 alc_write_coef_idx(codec, 0x43, 0x9614);
3145 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3148 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3149 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3150 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3153 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3157 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3158 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3160 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3165 static void alc5505_dsp_halt(struct hda_codec *codec)
3169 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3170 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3171 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3172 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3173 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3174 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3175 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3176 val = alc5505_coef_get(codec, 0x6220);
3177 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3180 static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3182 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3183 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3184 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3185 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3186 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3187 alc5505_coef_set(codec, 0x880c, 0x00000004);
3190 static void alc5505_dsp_init(struct hda_codec *codec)
3194 alc5505_dsp_halt(codec);
3195 alc5505_dsp_back_from_halt(codec);
3196 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3197 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3198 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3199 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3200 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3201 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3202 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3203 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3204 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3205 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3206 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3207 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3208 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3210 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3212 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3214 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3216 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3217 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3218 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3219 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3220 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3221 alc5505_coef_set(codec, 0x880c, 0x00000003);
3222 alc5505_coef_set(codec, 0x880c, 0x00000010);
3224 #ifdef HALT_REALTEK_ALC5505
3225 alc5505_dsp_halt(codec);
3229 #ifdef HALT_REALTEK_ALC5505
3230 #define alc5505_dsp_suspend(codec) /* NOP */
3231 #define alc5505_dsp_resume(codec) /* NOP */
3233 #define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
3234 #define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
3238 static int alc269_suspend(struct hda_codec *codec)
3240 struct alc_spec *spec = codec->spec;
3242 if (spec->has_alc5505_dsp)
3243 alc5505_dsp_suspend(codec);
3244 return alc_suspend(codec);
3247 static int alc269_resume(struct hda_codec *codec)
3249 struct alc_spec *spec = codec->spec;
3251 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3252 alc269vb_toggle_power_output(codec, 0);
3253 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3254 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
3258 codec->patch_ops.init(codec);
3260 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3261 alc269vb_toggle_power_output(codec, 1);
3262 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3263 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
3267 snd_hda_codec_resume_amp(codec);
3268 snd_hda_codec_resume_cache(codec);
3269 alc_inv_dmic_sync(codec, true);
3270 hda_call_check_power_status(codec, 0x01);
3272 /* on some machine, the BIOS will clear the codec gpio data when enter
3273 * suspend, and won't restore the data after resume, so we restore it
3277 snd_hda_codec_write(codec, codec->afg, 0, AC_VERB_SET_GPIO_DATA,
3280 if (spec->has_alc5505_dsp)
3281 alc5505_dsp_resume(codec);
3285 #endif /* CONFIG_PM */
3287 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
3288 const struct hda_fixup *fix, int action)
3290 struct alc_spec *spec = codec->spec;
3292 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3293 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
3296 static void alc269_fixup_hweq(struct hda_codec *codec,
3297 const struct hda_fixup *fix, int action)
3301 if (action != HDA_FIXUP_ACT_INIT)
3303 coef = alc_read_coef_idx(codec, 0x1e);
3304 alc_write_coef_idx(codec, 0x1e, coef | 0x80);
3307 static void alc269_fixup_headset_mic(struct hda_codec *codec,
3308 const struct hda_fixup *fix, int action)
3310 struct alc_spec *spec = codec->spec;
3312 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3313 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3316 static void alc271_fixup_dmic(struct hda_codec *codec,
3317 const struct hda_fixup *fix, int action)
3319 static const struct hda_verb verbs[] = {
3320 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
3321 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
3326 if (strcmp(codec->chip_name, "ALC271X") &&
3327 strcmp(codec->chip_name, "ALC269VB"))
3329 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
3330 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
3331 snd_hda_sequence_write(codec, verbs);
3334 static void alc269_fixup_pcm_44k(struct hda_codec *codec,
3335 const struct hda_fixup *fix, int action)
3337 struct alc_spec *spec = codec->spec;
3339 if (action != HDA_FIXUP_ACT_PROBE)
3342 /* Due to a hardware problem on Lenovo Ideadpad, we need to
3343 * fix the sample rate of analog I/O to 44.1kHz
3345 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
3346 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
3349 static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
3350 const struct hda_fixup *fix, int action)
3354 if (action != HDA_FIXUP_ACT_INIT)
3356 /* The digital-mic unit sends PDM (differential signal) instead of
3357 * the standard PCM, thus you can't record a valid mono stream as is.
3358 * Below is a workaround specific to ALC269 to control the dmic
3359 * signal source as mono.
3361 coef = alc_read_coef_idx(codec, 0x07);
3362 alc_write_coef_idx(codec, 0x07, coef | 0x80);
3365 static void alc269_quanta_automute(struct hda_codec *codec)
3367 snd_hda_gen_update_outputs(codec);
3369 snd_hda_codec_write(codec, 0x20, 0,
3370 AC_VERB_SET_COEF_INDEX, 0x0c);
3371 snd_hda_codec_write(codec, 0x20, 0,
3372 AC_VERB_SET_PROC_COEF, 0x680);
3374 snd_hda_codec_write(codec, 0x20, 0,
3375 AC_VERB_SET_COEF_INDEX, 0x0c);
3376 snd_hda_codec_write(codec, 0x20, 0,
3377 AC_VERB_SET_PROC_COEF, 0x480);
3380 static void alc269_fixup_quanta_mute(struct hda_codec *codec,
3381 const struct hda_fixup *fix, int action)
3383 struct alc_spec *spec = codec->spec;
3384 if (action != HDA_FIXUP_ACT_PROBE)
3386 spec->gen.automute_hook = alc269_quanta_automute;
3389 static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
3390 struct hda_jack_tbl *jack)
3392 struct alc_spec *spec = codec->spec;
3395 snd_hda_gen_hp_automute(codec, jack);
3397 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
3399 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3402 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3406 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
3407 const struct hda_fixup *fix, int action)
3409 struct alc_spec *spec = codec->spec;
3410 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3411 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3412 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
3417 /* update mute-LED according to the speaker mute state via mic VREF pin */
3418 static void alc269_fixup_mic_mute_hook(void *private_data, int enabled)
3420 struct hda_codec *codec = private_data;
3421 struct alc_spec *spec = codec->spec;
3422 unsigned int pinval;
3424 if (spec->mute_led_polarity)
3426 pinval = snd_hda_codec_get_pin_target(codec, spec->mute_led_nid);
3427 pinval &= ~AC_PINCTL_VREFEN;
3428 pinval |= enabled ? AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80;
3429 if (spec->mute_led_nid)
3430 snd_hda_set_pin_ctl_cache(codec, spec->mute_led_nid, pinval);
3433 /* Make sure the led works even in runtime suspend */
3434 static unsigned int led_power_filter(struct hda_codec *codec,
3436 unsigned int power_state)
3438 struct alc_spec *spec = codec->spec;
3440 if (power_state != AC_PWRST_D3 || nid == 0 ||
3441 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
3444 /* Set pin ctl again, it might have just been set to 0 */
3445 snd_hda_set_pin_ctl(codec, nid,
3446 snd_hda_codec_get_pin_target(codec, nid));
3451 static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
3452 const struct hda_fixup *fix, int action)
3454 struct alc_spec *spec = codec->spec;
3455 const struct dmi_device *dev = NULL;
3457 if (action != HDA_FIXUP_ACT_PRE_PROBE)
3460 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
3462 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
3464 if (pin < 0x0a || pin >= 0x10)
3466 spec->mute_led_polarity = pol;
3467 spec->mute_led_nid = pin - 0x0a + 0x18;
3468 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3469 spec->gen.vmaster_mute_enum = 1;
3470 codec->power_filter = led_power_filter;
3472 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
3473 spec->mute_led_polarity);
3478 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
3479 const struct hda_fixup *fix, int action)
3481 struct alc_spec *spec = codec->spec;
3482 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3483 spec->mute_led_polarity = 0;
3484 spec->mute_led_nid = 0x18;
3485 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3486 spec->gen.vmaster_mute_enum = 1;
3487 codec->power_filter = led_power_filter;
3491 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
3492 const struct hda_fixup *fix, int action)
3494 struct alc_spec *spec = codec->spec;
3495 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3496 spec->mute_led_polarity = 0;
3497 spec->mute_led_nid = 0x19;
3498 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3499 spec->gen.vmaster_mute_enum = 1;
3500 codec->power_filter = led_power_filter;
3504 /* turn on/off mute LED per vmaster hook */
3505 static void alc269_fixup_hp_gpio_mute_hook(void *private_data, int enabled)
3507 struct hda_codec *codec = private_data;
3508 struct alc_spec *spec = codec->spec;
3509 unsigned int oldval = spec->gpio_led;
3512 spec->gpio_led &= ~0x08;
3514 spec->gpio_led |= 0x08;
3515 if (spec->gpio_led != oldval)
3516 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
3520 /* turn on/off mic-mute LED per capture hook */
3521 static void alc269_fixup_hp_gpio_mic_mute_hook(struct hda_codec *codec,
3522 struct snd_kcontrol *kcontrol,
3523 struct snd_ctl_elem_value *ucontrol)
3525 struct alc_spec *spec = codec->spec;
3526 unsigned int oldval = spec->gpio_led;
3531 if (ucontrol->value.integer.value[0] ||
3532 ucontrol->value.integer.value[1])
3533 spec->gpio_led &= ~0x10;
3535 spec->gpio_led |= 0x10;
3536 if (spec->gpio_led != oldval)
3537 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
3541 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
3542 const struct hda_fixup *fix, int action)
3544 struct alc_spec *spec = codec->spec;
3545 static const struct hda_verb gpio_init[] = {
3546 { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 },
3547 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 },
3551 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3552 spec->gen.vmaster_mute.hook = alc269_fixup_hp_gpio_mute_hook;
3553 spec->gen.cap_sync_hook = alc269_fixup_hp_gpio_mic_mute_hook;
3555 snd_hda_add_verbs(codec, gpio_init);
3559 /* turn on/off mic-mute LED per capture hook */
3560 static void alc269_fixup_hp_cap_mic_mute_hook(struct hda_codec *codec,
3561 struct snd_kcontrol *kcontrol,
3562 struct snd_ctl_elem_value *ucontrol)
3564 struct alc_spec *spec = codec->spec;
3565 unsigned int pinval, enable, disable;
3567 pinval = snd_hda_codec_get_pin_target(codec, spec->cap_mute_led_nid);
3568 pinval &= ~AC_PINCTL_VREFEN;
3569 enable = pinval | AC_PINCTL_VREF_80;
3570 disable = pinval | AC_PINCTL_VREF_HIZ;
3575 if (ucontrol->value.integer.value[0] ||
3576 ucontrol->value.integer.value[1])
3581 if (spec->cap_mute_led_nid)
3582 snd_hda_set_pin_ctl_cache(codec, spec->cap_mute_led_nid, pinval);
3585 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
3586 const struct hda_fixup *fix, int action)
3588 struct alc_spec *spec = codec->spec;
3589 static const struct hda_verb gpio_init[] = {
3590 { 0x01, AC_VERB_SET_GPIO_MASK, 0x08 },
3591 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x08 },
3595 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3596 spec->gen.vmaster_mute.hook = alc269_fixup_hp_gpio_mute_hook;
3597 spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook;
3599 spec->cap_mute_led_nid = 0x18;
3600 snd_hda_add_verbs(codec, gpio_init);
3601 codec->power_filter = led_power_filter;
3605 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
3606 const struct hda_fixup *fix, int action)
3608 struct alc_spec *spec = codec->spec;
3610 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3611 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3612 spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook;
3613 spec->mute_led_polarity = 0;
3614 spec->mute_led_nid = 0x1a;
3615 spec->cap_mute_led_nid = 0x18;
3616 spec->gen.vmaster_mute_enum = 1;
3617 codec->power_filter = led_power_filter;
3621 static void alc_headset_mode_unplugged(struct hda_codec *codec)
3625 switch (codec->vendor_id) {
3627 /* LDO and MISC control */
3628 alc_write_coef_idx(codec, 0x1b, 0x0c0b);
3629 /* UAJ function set to menual mode */
3630 alc_write_coef_idx(codec, 0x45, 0xd089);
3631 /* Direct Drive HP Amp control(Set to verb control)*/
3632 val = alc_read_coefex_idx(codec, 0x57, 0x05);
3633 alc_write_coefex_idx(codec, 0x57, 0x05, val & ~(1<<14));
3634 /* Set MIC2 Vref gate with HP */
3635 alc_write_coef_idx(codec, 0x06, 0x6104);
3636 /* Direct Drive HP Amp control */
3637 alc_write_coefex_idx(codec, 0x57, 0x03, 0x8aa6);
3641 alc_write_coef_idx(codec, 0x1b, 0x0c0b);
3642 alc_write_coef_idx(codec, 0x45, 0xc429);
3643 val = alc_read_coef_idx(codec, 0x35);
3644 alc_write_coef_idx(codec, 0x35, val & 0xbfff);
3645 alc_write_coef_idx(codec, 0x06, 0x2104);
3646 alc_write_coef_idx(codec, 0x1a, 0x0001);
3647 alc_write_coef_idx(codec, 0x26, 0x0004);
3648 alc_write_coef_idx(codec, 0x32, 0x42a3);
3651 alc_write_coef_idx(codec, 0x76, 0x000e);
3652 alc_write_coef_idx(codec, 0x6c, 0x2400);
3653 alc_write_coef_idx(codec, 0x18, 0x7308);
3654 alc_write_coef_idx(codec, 0x6b, 0xc429);
3657 /* SET Line1 JD to 0 */
3658 val = alc_read_coef_idx(codec, 0x10);
3659 alc_write_coef_idx(codec, 0x10, (val & ~(7<<8)) | 6<<8);
3660 /* SET charge pump by verb */
3661 val = alc_read_coefex_idx(codec, 0x57, 0x05);
3662 alc_write_coefex_idx(codec, 0x57, 0x05, (val & ~(1<<15|1<<13)) | 0x0);
3663 /* SET EN_OSW to 1 */
3664 val = alc_read_coefex_idx(codec, 0x57, 0x03);
3665 alc_write_coefex_idx(codec, 0x57, 0x03, (val & ~(1<<10)) | (1<<10) );
3666 /* Combo JD gating with LINE1-VREFO */
3667 val = alc_read_coef_idx(codec, 0x1a);
3668 alc_write_coef_idx(codec, 0x1a, (val & ~(1<<3)) | (1<<3));
3669 /* Set to TRS type */
3670 alc_write_coef_idx(codec, 0x45, 0xc429);
3671 /* Combo Jack auto detect */
3672 val = alc_read_coef_idx(codec, 0x4a);
3673 alc_write_coef_idx(codec, 0x4a, (val & 0xfff0) | 0x000e);
3676 alc_write_coef_idx(codec, 0x15, 0x0d40);
3677 alc_write_coef_idx(codec, 0xb7, 0x802b);
3680 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
3684 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
3689 switch (codec->vendor_id) {
3691 alc_write_coef_idx(codec, 0x45, 0xc489);
3692 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
3693 alc_write_coefex_idx(codec, 0x57, 0x03, 0x8aa6);
3694 /* Set MIC2 Vref gate to normal */
3695 alc_write_coef_idx(codec, 0x06, 0x6100);
3696 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
3700 alc_write_coef_idx(codec, 0x45, 0xc429);
3701 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
3702 val = alc_read_coef_idx(codec, 0x35);
3703 alc_write_coef_idx(codec, 0x35, val | 1<<14);
3704 alc_write_coef_idx(codec, 0x06, 0x2100);
3705 alc_write_coef_idx(codec, 0x1a, 0x0021);
3706 alc_write_coef_idx(codec, 0x26, 0x008c);
3707 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
3710 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
3711 alc_write_coef_idx(codec, 0x19, 0xa208);
3712 alc_write_coef_idx(codec, 0x2e, 0xacf0);
3715 /* Set to TRS mode */
3716 alc_write_coef_idx(codec, 0x45, 0xc429);
3717 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
3718 /* SET charge pump by verb */
3719 val = alc_read_coefex_idx(codec, 0x57, 0x05);
3720 alc_write_coefex_idx(codec, 0x57, 0x05, (val & ~(1<<15|1<<13)) | (1<<15|1<<13));
3721 /* SET EN_OSW to 0 */
3722 val = alc_read_coefex_idx(codec, 0x57, 0x03);
3723 alc_write_coefex_idx(codec, 0x57, 0x03, (val & ~(1<<10)) | 0x0);
3724 /* Combo JD gating without LINE1-VREFO */
3725 val = alc_read_coef_idx(codec, 0x1a);
3726 alc_write_coef_idx(codec, 0x1a, (val & ~(1<<3)) | 0x0);
3727 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
3730 alc_write_coef_idx(codec, 0x11, 0x0001);
3731 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
3732 alc_write_coef_idx(codec, 0xb7, 0x802b);
3733 alc_write_coef_idx(codec, 0xb5, 0x1040);
3734 val = alc_read_coef_idx(codec, 0xc3);
3735 alc_write_coef_idx(codec, 0xc3, val | 1<<12);
3736 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
3739 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
3742 static void alc_headset_mode_default(struct hda_codec *codec)
3746 switch (codec->vendor_id) {
3748 alc_write_coef_idx(codec, 0x45, 0xc089);
3749 alc_write_coef_idx(codec, 0x45, 0xc489);
3750 alc_write_coefex_idx(codec, 0x57, 0x03, 0x8ea6);
3751 alc_write_coef_idx(codec, 0x49, 0x0049);
3755 alc_write_coef_idx(codec, 0x06, 0x2100);
3756 alc_write_coef_idx(codec, 0x32, 0x4ea3);
3759 alc_write_coef_idx(codec, 0x76, 0x000e);
3760 alc_write_coef_idx(codec, 0x6c, 0x2400);
3761 alc_write_coef_idx(codec, 0x6b, 0xc429);
3762 alc_write_coef_idx(codec, 0x18, 0x7308);
3765 /* Combo Jack auto detect */
3766 val = alc_read_coef_idx(codec, 0x4a);
3767 alc_write_coef_idx(codec, 0x4a, (val & 0xfff0) | 0x000e);
3768 /* Set to TRS type */
3769 alc_write_coef_idx(codec, 0x45, 0xC429);
3770 /* Combo JD gating without LINE1-VREFO */
3771 val = alc_read_coef_idx(codec, 0x1a);
3772 alc_write_coef_idx(codec, 0x1a, (val & ~(1<<3)) | 0x0);
3775 alc_write_coef_idx(codec, 0x11, 0x0041);
3776 alc_write_coef_idx(codec, 0x15, 0x0d40);
3777 alc_write_coef_idx(codec, 0xb7, 0x802b);
3780 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
3784 static void alc_headset_mode_ctia(struct hda_codec *codec)
3788 switch (codec->vendor_id) {
3790 /* Set to CTIA type */
3791 alc_write_coef_idx(codec, 0x45, 0xd489);
3792 alc_write_coef_idx(codec, 0x1b, 0x0c2b);
3793 alc_write_coefex_idx(codec, 0x57, 0x03, 0x8ea6);
3797 alc_write_coef_idx(codec, 0x45, 0xd429);
3798 alc_write_coef_idx(codec, 0x1b, 0x0c2b);
3799 alc_write_coef_idx(codec, 0x32, 0x4ea3);
3802 alc_write_coef_idx(codec, 0x6b, 0xd429);
3803 alc_write_coef_idx(codec, 0x76, 0x0008);
3804 alc_write_coef_idx(codec, 0x18, 0x7388);
3807 /* Set to ctia type */
3808 alc_write_coef_idx(codec, 0x45, 0xd429);
3809 /* SET Line1 JD to 1 */
3810 val = alc_read_coef_idx(codec, 0x10);
3811 alc_write_coef_idx(codec, 0x10, (val & ~(7<<8)) | 7<<8);
3814 alc_write_coef_idx(codec, 0x11, 0x0001);
3815 alc_write_coef_idx(codec, 0x15, 0x0d60);
3816 alc_write_coef_idx(codec, 0xc3, 0x0000);
3819 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
3823 static void alc_headset_mode_omtp(struct hda_codec *codec)
3827 switch (codec->vendor_id) {
3829 /* Set to OMTP Type */
3830 alc_write_coef_idx(codec, 0x45, 0xe489);
3831 alc_write_coef_idx(codec, 0x1b, 0x0c2b);
3832 alc_write_coefex_idx(codec, 0x57, 0x03, 0x8ea6);
3836 alc_write_coef_idx(codec, 0x45, 0xe429);
3837 alc_write_coef_idx(codec, 0x1b, 0x0c2b);
3838 alc_write_coef_idx(codec, 0x32, 0x4ea3);
3841 alc_write_coef_idx(codec, 0x6b, 0xe429);
3842 alc_write_coef_idx(codec, 0x76, 0x0008);
3843 alc_write_coef_idx(codec, 0x18, 0x7388);
3846 /* Set to omtp type */
3847 alc_write_coef_idx(codec, 0x45, 0xe429);
3848 /* SET Line1 JD to 1 */
3849 val = alc_read_coef_idx(codec, 0x10);
3850 alc_write_coef_idx(codec, 0x10, (val & ~(7<<8)) | 7<<8);
3853 alc_write_coef_idx(codec, 0x11, 0x0001);
3854 alc_write_coef_idx(codec, 0x15, 0x0d50);
3855 alc_write_coef_idx(codec, 0xc3, 0x0000);
3858 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
3861 static void alc_determine_headset_type(struct hda_codec *codec)
3864 bool is_ctia = false;
3865 struct alc_spec *spec = codec->spec;
3867 switch (codec->vendor_id) {
3869 /* combo jack auto switch control(Check type)*/
3870 alc_write_coef_idx(codec, 0x45, 0xd089);
3871 /* combo jack auto switch control(Vref conteol) */
3872 alc_write_coef_idx(codec, 0x49, 0x0149);
3874 val = alc_read_coef_idx(codec, 0x46);
3875 is_ctia = (val & 0x0070) == 0x0070;
3879 alc_write_coef_idx(codec, 0x45, 0xd029);
3881 val = alc_read_coef_idx(codec, 0x46);
3882 is_ctia = (val & 0x0070) == 0x0070;
3885 alc_write_coef_idx(codec, 0x6b, 0xd429);
3887 val = alc_read_coef_idx(codec, 0x6c);
3888 is_ctia = (val & 0x001c) == 0x001c;
3891 /* Combo Jack auto detect */
3892 val = alc_read_coef_idx(codec, 0x4a);
3893 alc_write_coef_idx(codec, 0x4a, (val & 0xfff0) | 0x0008);
3894 /* Set to ctia type */
3895 alc_write_coef_idx(codec, 0x45, 0xD429);
3897 val = alc_read_coef_idx(codec, 0x46);
3898 is_ctia = (val & 0x0070) == 0x0070;
3901 alc_write_coef_idx(codec, 0x11, 0x0001);
3902 alc_write_coef_idx(codec, 0xb7, 0x802b);
3903 alc_write_coef_idx(codec, 0x15, 0x0d60);
3904 alc_write_coef_idx(codec, 0xc3, 0x0c00);
3906 val = alc_read_coef_idx(codec, 0xbe);
3907 is_ctia = (val & 0x1c02) == 0x1c02;
3911 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
3912 is_ctia ? "yes" : "no");
3913 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
3916 static void alc_update_headset_mode(struct hda_codec *codec)
3918 struct alc_spec *spec = codec->spec;
3920 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
3921 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3923 int new_headset_mode;
3925 if (!snd_hda_jack_detect(codec, hp_pin))
3926 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
3927 else if (mux_pin == spec->headset_mic_pin)
3928 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
3929 else if (mux_pin == spec->headphone_mic_pin)
3930 new_headset_mode = ALC_HEADSET_MODE_MIC;
3932 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
3934 if (new_headset_mode == spec->current_headset_mode) {
3935 snd_hda_gen_update_outputs(codec);
3939 switch (new_headset_mode) {
3940 case ALC_HEADSET_MODE_UNPLUGGED:
3941 alc_headset_mode_unplugged(codec);
3942 spec->gen.hp_jack_present = false;
3944 case ALC_HEADSET_MODE_HEADSET:
3945 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
3946 alc_determine_headset_type(codec);
3947 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
3948 alc_headset_mode_ctia(codec);
3949 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
3950 alc_headset_mode_omtp(codec);
3951 spec->gen.hp_jack_present = true;
3953 case ALC_HEADSET_MODE_MIC:
3954 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
3955 spec->gen.hp_jack_present = false;
3957 case ALC_HEADSET_MODE_HEADPHONE:
3958 alc_headset_mode_default(codec);
3959 spec->gen.hp_jack_present = true;
3962 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
3963 snd_hda_set_pin_ctl_cache(codec, hp_pin,
3964 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
3965 if (spec->headphone_mic_pin)
3966 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
3969 spec->current_headset_mode = new_headset_mode;
3971 snd_hda_gen_update_outputs(codec);
3974 static void alc_update_headset_mode_hook(struct hda_codec *codec,
3975 struct snd_kcontrol *kcontrol,
3976 struct snd_ctl_elem_value *ucontrol)
3978 alc_update_headset_mode(codec);
3981 static void alc_update_headset_jack_cb(struct hda_codec *codec, struct hda_jack_tbl *jack)
3983 struct alc_spec *spec = codec->spec;
3984 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
3985 snd_hda_gen_hp_automute(codec, jack);
3988 static void alc_probe_headset_mode(struct hda_codec *codec)
3991 struct alc_spec *spec = codec->spec;
3992 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
3995 for (i = 0; i < cfg->num_inputs; i++) {
3996 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
3997 spec->headset_mic_pin = cfg->inputs[i].pin;
3998 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
3999 spec->headphone_mic_pin = cfg->inputs[i].pin;
4002 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
4003 spec->gen.automute_hook = alc_update_headset_mode;
4004 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
4007 static void alc_fixup_headset_mode(struct hda_codec *codec,
4008 const struct hda_fixup *fix, int action)
4010 struct alc_spec *spec = codec->spec;
4013 case HDA_FIXUP_ACT_PRE_PROBE:
4014 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
4016 case HDA_FIXUP_ACT_PROBE:
4017 alc_probe_headset_mode(codec);
4019 case HDA_FIXUP_ACT_INIT:
4020 spec->current_headset_mode = 0;
4021 alc_update_headset_mode(codec);
4026 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
4027 const struct hda_fixup *fix, int action)
4029 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4030 struct alc_spec *spec = codec->spec;
4031 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4034 alc_fixup_headset_mode(codec, fix, action);
4037 static void alc255_set_default_jack_type(struct hda_codec *codec)
4039 /* Set to iphone type */
4040 alc_write_coef_idx(codec, 0x1b, 0x880b);
4041 alc_write_coef_idx(codec, 0x45, 0xd089);
4042 alc_write_coef_idx(codec, 0x1b, 0x080b);
4043 alc_write_coef_idx(codec, 0x46, 0x0004);
4044 alc_write_coef_idx(codec, 0x1b, 0x0c0b);
4048 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
4049 const struct hda_fixup *fix, int action)
4051 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4052 alc255_set_default_jack_type(codec);
4054 alc_fixup_headset_mode(codec, fix, action);
4057 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
4058 const struct hda_fixup *fix, int action)
4060 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4061 struct alc_spec *spec = codec->spec;
4062 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4063 alc255_set_default_jack_type(codec);
4066 alc_fixup_headset_mode(codec, fix, action);
4069 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
4070 const struct hda_fixup *fix, int action)
4072 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4073 struct alc_spec *spec = codec->spec;
4074 spec->gen.auto_mute_via_amp = 1;
4078 static void alc_no_shutup(struct hda_codec *codec)
4082 static void alc_fixup_no_shutup(struct hda_codec *codec,
4083 const struct hda_fixup *fix, int action)
4085 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4086 struct alc_spec *spec = codec->spec;
4087 spec->shutup = alc_no_shutup;
4091 static void alc_fixup_disable_aamix(struct hda_codec *codec,
4092 const struct hda_fixup *fix, int action)
4094 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4095 struct alc_spec *spec = codec->spec;
4096 /* Disable AA-loopback as it causes white noise */
4097 spec->gen.mixer_nid = 0;
4101 static unsigned int alc_power_filter_xps13(struct hda_codec *codec,
4103 unsigned int power_state)
4105 struct alc_spec *spec = codec->spec;
4107 /* Avoid pop noises when headphones are plugged in */
4108 if (spec->gen.hp_jack_present)
4109 if (nid == codec->afg || nid == 0x02 || nid == 0x15)
4114 static void alc_fixup_dell_xps13(struct hda_codec *codec,
4115 const struct hda_fixup *fix, int action)
4117 if (action == HDA_FIXUP_ACT_PROBE) {
4118 struct alc_spec *spec = codec->spec;
4119 struct hda_input_mux *imux = &spec->gen.input_mux;
4122 spec->shutup = alc_no_shutup;
4123 codec->power_filter = alc_power_filter_xps13;
4125 /* Make the internal mic the default input source. */
4126 for (i = 0; i < imux->num_items; i++) {
4127 if (spec->gen.imux_pins[i] == 0x12) {
4128 spec->gen.cur_mux[0] = i;
4135 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
4136 const struct hda_fixup *fix, int action)
4138 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4140 alc_write_coef_idx(codec, 0xc4, 0x8000);
4141 val = alc_read_coef_idx(codec, 0xc2);
4142 alc_write_coef_idx(codec, 0xc2, val & 0xfe);
4143 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
4145 alc_fixup_headset_mode(codec, fix, action);
4148 /* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
4149 static int find_ext_mic_pin(struct hda_codec *codec)
4151 struct alc_spec *spec = codec->spec;
4152 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
4154 unsigned int defcfg;
4157 for (i = 0; i < cfg->num_inputs; i++) {
4158 if (cfg->inputs[i].type != AUTO_PIN_MIC)
4160 nid = cfg->inputs[i].pin;
4161 defcfg = snd_hda_codec_get_pincfg(codec, nid);
4162 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
4170 static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
4171 const struct hda_fixup *fix,
4174 struct alc_spec *spec = codec->spec;
4176 if (action == HDA_FIXUP_ACT_PROBE) {
4177 int mic_pin = find_ext_mic_pin(codec);
4178 int hp_pin = spec->gen.autocfg.hp_pins[0];
4180 if (snd_BUG_ON(!mic_pin || !hp_pin))
4182 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
4186 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
4187 const struct hda_fixup *fix,
4190 struct alc_spec *spec = codec->spec;
4191 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
4194 /* The mic boosts on level 2 and 3 are too noisy
4195 on the internal mic input.
4196 Therefore limit the boost to 0 or 1. */
4198 if (action != HDA_FIXUP_ACT_PROBE)
4201 for (i = 0; i < cfg->num_inputs; i++) {
4202 hda_nid_t nid = cfg->inputs[i].pin;
4203 unsigned int defcfg;
4204 if (cfg->inputs[i].type != AUTO_PIN_MIC)
4206 defcfg = snd_hda_codec_get_pincfg(codec, nid);
4207 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
4210 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
4211 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
4212 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
4213 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
4214 (0 << AC_AMPCAP_MUTE_SHIFT));
4218 static void alc283_hp_automute_hook(struct hda_codec *codec,
4219 struct hda_jack_tbl *jack)
4221 struct alc_spec *spec = codec->spec;
4225 snd_hda_gen_hp_automute(codec, jack);
4227 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4230 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4234 static void alc283_fixup_chromebook(struct hda_codec *codec,
4235 const struct hda_fixup *fix, int action)
4237 struct alc_spec *spec = codec->spec;
4241 case HDA_FIXUP_ACT_PRE_PROBE:
4242 snd_hda_override_wcaps(codec, 0x03, 0);
4243 /* Disable AA-loopback as it causes white noise */
4244 spec->gen.mixer_nid = 0;
4246 case HDA_FIXUP_ACT_INIT:
4247 /* MIC2-VREF control */
4248 /* Set to manual mode */
4249 val = alc_read_coef_idx(codec, 0x06);
4250 alc_write_coef_idx(codec, 0x06, val & ~0x000c);
4251 /* Enable Line1 input control by verb */
4252 val = alc_read_coef_idx(codec, 0x1a);
4253 alc_write_coef_idx(codec, 0x1a, val | (1 << 4));
4258 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
4259 const struct hda_fixup *fix, int action)
4261 struct alc_spec *spec = codec->spec;
4265 case HDA_FIXUP_ACT_PRE_PROBE:
4266 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
4268 case HDA_FIXUP_ACT_INIT:
4269 /* MIC2-VREF control */
4270 /* Set to manual mode */
4271 val = alc_read_coef_idx(codec, 0x06);
4272 alc_write_coef_idx(codec, 0x06, val & ~0x000c);
4277 /* mute tablet speaker pin (0x14) via dock plugging in addition */
4278 static void asus_tx300_automute(struct hda_codec *codec)
4280 struct alc_spec *spec = codec->spec;
4281 snd_hda_gen_update_outputs(codec);
4282 if (snd_hda_jack_detect(codec, 0x1b))
4283 spec->gen.mute_bits |= (1ULL << 0x14);
4286 static void alc282_fixup_asus_tx300(struct hda_codec *codec,
4287 const struct hda_fixup *fix, int action)
4289 struct alc_spec *spec = codec->spec;
4290 /* TX300 needs to set up GPIO2 for the speaker amp */
4291 static const struct hda_verb gpio2_verbs[] = {
4292 { 0x01, AC_VERB_SET_GPIO_MASK, 0x04 },
4293 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04 },
4294 { 0x01, AC_VERB_SET_GPIO_DATA, 0x04 },
4297 static const struct hda_pintbl dock_pins[] = {
4298 { 0x1b, 0x21114000 }, /* dock speaker pin */
4301 struct snd_kcontrol *kctl;
4304 case HDA_FIXUP_ACT_PRE_PROBE:
4305 snd_hda_add_verbs(codec, gpio2_verbs);
4306 snd_hda_apply_pincfgs(codec, dock_pins);
4307 spec->gen.auto_mute_via_amp = 1;
4308 spec->gen.automute_hook = asus_tx300_automute;
4309 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4311 snd_hda_gen_hp_automute);
4313 case HDA_FIXUP_ACT_BUILD:
4314 /* this is a bit tricky; give more sane names for the main
4315 * (tablet) speaker and the dock speaker, respectively
4317 kctl = snd_hda_find_mixer_ctl(codec, "Speaker Playback Switch");
4319 strcpy(kctl->id.name, "Dock Speaker Playback Switch");
4320 kctl = snd_hda_find_mixer_ctl(codec, "Bass Speaker Playback Switch");
4322 strcpy(kctl->id.name, "Speaker Playback Switch");
4327 static void alc290_fixup_mono_speakers(struct hda_codec *codec,
4328 const struct hda_fixup *fix, int action)
4330 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4331 /* DAC node 0x03 is giving mono output. We therefore want to
4332 make sure 0x14 (front speaker) and 0x15 (headphones) use the
4333 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
4334 hda_nid_t conn1[2] = { 0x0c };
4335 snd_hda_override_conn_list(codec, 0x14, 1, conn1);
4336 snd_hda_override_conn_list(codec, 0x15, 1, conn1);
4340 /* for hda_fixup_thinkpad_acpi() */
4341 #include "thinkpad_helper.c"
4343 /* for dell wmi mic mute led */
4344 #include "dell_wmi_helper.c"
4347 ALC269_FIXUP_SONY_VAIO,
4348 ALC275_FIXUP_SONY_VAIO_GPIO2,
4349 ALC269_FIXUP_DELL_M101Z,
4350 ALC269_FIXUP_SKU_IGNORE,
4351 ALC269_FIXUP_ASUS_G73JW,
4352 ALC269_FIXUP_LENOVO_EAPD,
4353 ALC275_FIXUP_SONY_HWEQ,
4354 ALC275_FIXUP_SONY_DISABLE_AAMIX,
4356 ALC269_FIXUP_PCM_44K,
4357 ALC269_FIXUP_STEREO_DMIC,
4358 ALC269_FIXUP_HEADSET_MIC,
4359 ALC269_FIXUP_QUANTA_MUTE,
4360 ALC269_FIXUP_LIFEBOOK,
4361 ALC269_FIXUP_LIFEBOOK_EXTMIC,
4364 ALC269VB_FIXUP_AMIC,
4365 ALC269VB_FIXUP_DMIC,
4366 ALC269_FIXUP_HP_MUTE_LED,
4367 ALC269_FIXUP_HP_MUTE_LED_MIC1,
4368 ALC269_FIXUP_HP_MUTE_LED_MIC2,
4369 ALC269_FIXUP_HP_GPIO_LED,
4370 ALC269_FIXUP_HP_GPIO_MIC1_LED,
4371 ALC269_FIXUP_HP_LINE1_MIC1_LED,
4372 ALC269_FIXUP_INV_DMIC,
4373 ALC269_FIXUP_LENOVO_DOCK,
4374 ALC269_FIXUP_NO_SHUTUP,
4375 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
4376 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
4377 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
4378 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
4379 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
4380 ALC269_FIXUP_HEADSET_MODE,
4381 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
4382 ALC269_FIXUP_ASUS_X101_FUNC,
4383 ALC269_FIXUP_ASUS_X101_VERB,
4384 ALC269_FIXUP_ASUS_X101,
4385 ALC271_FIXUP_AMIC_MIC2,
4386 ALC271_FIXUP_HP_GATE_MIC_JACK,
4387 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
4388 ALC269_FIXUP_ACER_AC700,
4389 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
4390 ALC269VB_FIXUP_ASUS_ZENBOOK,
4391 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
4392 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
4393 ALC269VB_FIXUP_ORDISSIMO_EVE2,
4394 ALC283_FIXUP_CHROME_BOOK,
4395 ALC283_FIXUP_SENSE_COMBO_JACK,
4396 ALC282_FIXUP_ASUS_TX300,
4397 ALC283_FIXUP_INT_MIC,
4398 ALC290_FIXUP_MONO_SPEAKERS,
4399 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
4400 ALC290_FIXUP_SUBWOOFER,
4401 ALC290_FIXUP_SUBWOOFER_HSJACK,
4402 ALC269_FIXUP_THINKPAD_ACPI,
4403 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
4404 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
4405 ALC255_FIXUP_HEADSET_MODE,
4406 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
4407 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
4408 ALC292_FIXUP_TPT440_DOCK,
4409 ALC283_FIXUP_BXBT2807_MIC,
4410 ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED,
4413 static const struct hda_fixup alc269_fixups[] = {
4414 [ALC269_FIXUP_SONY_VAIO] = {
4415 .type = HDA_FIXUP_PINCTLS,
4416 .v.pins = (const struct hda_pintbl[]) {
4417 {0x19, PIN_VREFGRD},
4421 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
4422 .type = HDA_FIXUP_VERBS,
4423 .v.verbs = (const struct hda_verb[]) {
4424 {0x01, AC_VERB_SET_GPIO_MASK, 0x04},
4425 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04},
4426 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4430 .chain_id = ALC269_FIXUP_SONY_VAIO
4432 [ALC269_FIXUP_DELL_M101Z] = {
4433 .type = HDA_FIXUP_VERBS,
4434 .v.verbs = (const struct hda_verb[]) {
4435 /* Enables internal speaker */
4436 {0x20, AC_VERB_SET_COEF_INDEX, 13},
4437 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
4441 [ALC269_FIXUP_SKU_IGNORE] = {
4442 .type = HDA_FIXUP_FUNC,
4443 .v.func = alc_fixup_sku_ignore,
4445 [ALC269_FIXUP_ASUS_G73JW] = {
4446 .type = HDA_FIXUP_PINS,
4447 .v.pins = (const struct hda_pintbl[]) {
4448 { 0x17, 0x99130111 }, /* subwoofer */
4452 [ALC269_FIXUP_LENOVO_EAPD] = {
4453 .type = HDA_FIXUP_VERBS,
4454 .v.verbs = (const struct hda_verb[]) {
4455 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
4459 [ALC275_FIXUP_SONY_HWEQ] = {
4460 .type = HDA_FIXUP_FUNC,
4461 .v.func = alc269_fixup_hweq,
4463 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
4465 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
4466 .type = HDA_FIXUP_FUNC,
4467 .v.func = alc_fixup_disable_aamix,
4469 .chain_id = ALC269_FIXUP_SONY_VAIO
4471 [ALC271_FIXUP_DMIC] = {
4472 .type = HDA_FIXUP_FUNC,
4473 .v.func = alc271_fixup_dmic,
4475 [ALC269_FIXUP_PCM_44K] = {
4476 .type = HDA_FIXUP_FUNC,
4477 .v.func = alc269_fixup_pcm_44k,
4479 .chain_id = ALC269_FIXUP_QUANTA_MUTE
4481 [ALC269_FIXUP_STEREO_DMIC] = {
4482 .type = HDA_FIXUP_FUNC,
4483 .v.func = alc269_fixup_stereo_dmic,
4485 [ALC269_FIXUP_HEADSET_MIC] = {
4486 .type = HDA_FIXUP_FUNC,
4487 .v.func = alc269_fixup_headset_mic,
4489 [ALC269_FIXUP_QUANTA_MUTE] = {
4490 .type = HDA_FIXUP_FUNC,
4491 .v.func = alc269_fixup_quanta_mute,
4493 [ALC269_FIXUP_LIFEBOOK] = {
4494 .type = HDA_FIXUP_PINS,
4495 .v.pins = (const struct hda_pintbl[]) {
4496 { 0x1a, 0x2101103f }, /* dock line-out */
4497 { 0x1b, 0x23a11040 }, /* dock mic-in */
4501 .chain_id = ALC269_FIXUP_QUANTA_MUTE
4503 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
4504 .type = HDA_FIXUP_PINS,
4505 .v.pins = (const struct hda_pintbl[]) {
4506 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
4510 [ALC269_FIXUP_AMIC] = {
4511 .type = HDA_FIXUP_PINS,
4512 .v.pins = (const struct hda_pintbl[]) {
4513 { 0x14, 0x99130110 }, /* speaker */
4514 { 0x15, 0x0121401f }, /* HP out */
4515 { 0x18, 0x01a19c20 }, /* mic */
4516 { 0x19, 0x99a3092f }, /* int-mic */
4520 [ALC269_FIXUP_DMIC] = {
4521 .type = HDA_FIXUP_PINS,
4522 .v.pins = (const struct hda_pintbl[]) {
4523 { 0x12, 0x99a3092f }, /* int-mic */
4524 { 0x14, 0x99130110 }, /* speaker */
4525 { 0x15, 0x0121401f }, /* HP out */
4526 { 0x18, 0x01a19c20 }, /* mic */
4530 [ALC269VB_FIXUP_AMIC] = {
4531 .type = HDA_FIXUP_PINS,
4532 .v.pins = (const struct hda_pintbl[]) {
4533 { 0x14, 0x99130110 }, /* speaker */
4534 { 0x18, 0x01a19c20 }, /* mic */
4535 { 0x19, 0x99a3092f }, /* int-mic */
4536 { 0x21, 0x0121401f }, /* HP out */
4540 [ALC269VB_FIXUP_DMIC] = {
4541 .type = HDA_FIXUP_PINS,
4542 .v.pins = (const struct hda_pintbl[]) {
4543 { 0x12, 0x99a3092f }, /* int-mic */
4544 { 0x14, 0x99130110 }, /* speaker */
4545 { 0x18, 0x01a19c20 }, /* mic */
4546 { 0x21, 0x0121401f }, /* HP out */
4550 [ALC269_FIXUP_HP_MUTE_LED] = {
4551 .type = HDA_FIXUP_FUNC,
4552 .v.func = alc269_fixup_hp_mute_led,
4554 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
4555 .type = HDA_FIXUP_FUNC,
4556 .v.func = alc269_fixup_hp_mute_led_mic1,
4558 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
4559 .type = HDA_FIXUP_FUNC,
4560 .v.func = alc269_fixup_hp_mute_led_mic2,
4562 [ALC269_FIXUP_HP_GPIO_LED] = {
4563 .type = HDA_FIXUP_FUNC,
4564 .v.func = alc269_fixup_hp_gpio_led,
4566 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
4567 .type = HDA_FIXUP_FUNC,
4568 .v.func = alc269_fixup_hp_gpio_mic1_led,
4570 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
4571 .type = HDA_FIXUP_FUNC,
4572 .v.func = alc269_fixup_hp_line1_mic1_led,
4574 [ALC269_FIXUP_INV_DMIC] = {
4575 .type = HDA_FIXUP_FUNC,
4576 .v.func = alc_fixup_inv_dmic_0x12,
4578 [ALC269_FIXUP_NO_SHUTUP] = {
4579 .type = HDA_FIXUP_FUNC,
4580 .v.func = alc_fixup_no_shutup,
4582 [ALC269_FIXUP_LENOVO_DOCK] = {
4583 .type = HDA_FIXUP_PINS,
4584 .v.pins = (const struct hda_pintbl[]) {
4585 { 0x19, 0x23a11040 }, /* dock mic */
4586 { 0x1b, 0x2121103f }, /* dock headphone */
4590 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
4592 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
4593 .type = HDA_FIXUP_FUNC,
4594 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
4596 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
4598 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
4599 .type = HDA_FIXUP_PINS,
4600 .v.pins = (const struct hda_pintbl[]) {
4601 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4602 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
4606 .chain_id = ALC269_FIXUP_HEADSET_MODE
4608 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
4609 .type = HDA_FIXUP_PINS,
4610 .v.pins = (const struct hda_pintbl[]) {
4611 { 0x16, 0x21014020 }, /* dock line out */
4612 { 0x19, 0x21a19030 }, /* dock mic */
4613 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4617 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
4619 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
4620 .type = HDA_FIXUP_PINS,
4621 .v.pins = (const struct hda_pintbl[]) {
4622 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4626 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
4628 [ALC269_FIXUP_HEADSET_MODE] = {
4629 .type = HDA_FIXUP_FUNC,
4630 .v.func = alc_fixup_headset_mode,
4632 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
4633 .type = HDA_FIXUP_FUNC,
4634 .v.func = alc_fixup_headset_mode_no_hp_mic,
4636 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
4637 .type = HDA_FIXUP_PINS,
4638 .v.pins = (const struct hda_pintbl[]) {
4639 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4643 .chain_id = ALC269_FIXUP_HEADSET_MIC
4645 [ALC269_FIXUP_ASUS_X101_FUNC] = {
4646 .type = HDA_FIXUP_FUNC,
4647 .v.func = alc269_fixup_x101_headset_mic,
4649 [ALC269_FIXUP_ASUS_X101_VERB] = {
4650 .type = HDA_FIXUP_VERBS,
4651 .v.verbs = (const struct hda_verb[]) {
4652 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4653 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
4654 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
4658 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
4660 [ALC269_FIXUP_ASUS_X101] = {
4661 .type = HDA_FIXUP_PINS,
4662 .v.pins = (const struct hda_pintbl[]) {
4663 { 0x18, 0x04a1182c }, /* Headset mic */
4667 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
4669 [ALC271_FIXUP_AMIC_MIC2] = {
4670 .type = HDA_FIXUP_PINS,
4671 .v.pins = (const struct hda_pintbl[]) {
4672 { 0x14, 0x99130110 }, /* speaker */
4673 { 0x19, 0x01a19c20 }, /* mic */
4674 { 0x1b, 0x99a7012f }, /* int-mic */
4675 { 0x21, 0x0121401f }, /* HP out */
4679 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
4680 .type = HDA_FIXUP_FUNC,
4681 .v.func = alc271_hp_gate_mic_jack,
4683 .chain_id = ALC271_FIXUP_AMIC_MIC2,
4685 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
4686 .type = HDA_FIXUP_FUNC,
4687 .v.func = alc269_fixup_limit_int_mic_boost,
4689 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
4691 [ALC269_FIXUP_ACER_AC700] = {
4692 .type = HDA_FIXUP_PINS,
4693 .v.pins = (const struct hda_pintbl[]) {
4694 { 0x12, 0x99a3092f }, /* int-mic */
4695 { 0x14, 0x99130110 }, /* speaker */
4696 { 0x18, 0x03a11c20 }, /* mic */
4697 { 0x1e, 0x0346101e }, /* SPDIF1 */
4698 { 0x21, 0x0321101f }, /* HP out */
4702 .chain_id = ALC271_FIXUP_DMIC,
4704 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
4705 .type = HDA_FIXUP_FUNC,
4706 .v.func = alc269_fixup_limit_int_mic_boost,
4708 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
4710 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
4711 .type = HDA_FIXUP_FUNC,
4712 .v.func = alc269_fixup_limit_int_mic_boost,
4714 .chain_id = ALC269VB_FIXUP_DMIC,
4716 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
4717 .type = HDA_FIXUP_VERBS,
4718 .v.verbs = (const struct hda_verb[]) {
4719 /* class-D output amp +5dB */
4720 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
4721 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
4725 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
4727 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
4728 .type = HDA_FIXUP_FUNC,
4729 .v.func = alc269_fixup_limit_int_mic_boost,
4731 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
4733 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
4734 .type = HDA_FIXUP_PINS,
4735 .v.pins = (const struct hda_pintbl[]) {
4736 { 0x12, 0x99a3092f }, /* int-mic */
4737 { 0x18, 0x03a11d20 }, /* mic */
4738 { 0x19, 0x411111f0 }, /* Unused bogus pin */
4742 [ALC283_FIXUP_CHROME_BOOK] = {
4743 .type = HDA_FIXUP_FUNC,
4744 .v.func = alc283_fixup_chromebook,
4746 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
4747 .type = HDA_FIXUP_FUNC,
4748 .v.func = alc283_fixup_sense_combo_jack,
4750 .chain_id = ALC283_FIXUP_CHROME_BOOK,
4752 [ALC282_FIXUP_ASUS_TX300] = {
4753 .type = HDA_FIXUP_FUNC,
4754 .v.func = alc282_fixup_asus_tx300,
4756 [ALC283_FIXUP_INT_MIC] = {
4757 .type = HDA_FIXUP_VERBS,
4758 .v.verbs = (const struct hda_verb[]) {
4759 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
4760 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
4764 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
4766 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
4767 .type = HDA_FIXUP_PINS,
4768 .v.pins = (const struct hda_pintbl[]) {
4769 { 0x17, 0x90170112 }, /* subwoofer */
4773 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
4775 [ALC290_FIXUP_SUBWOOFER] = {
4776 .type = HDA_FIXUP_PINS,
4777 .v.pins = (const struct hda_pintbl[]) {
4778 { 0x17, 0x90170112 }, /* subwoofer */
4782 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
4784 [ALC290_FIXUP_MONO_SPEAKERS] = {
4785 .type = HDA_FIXUP_FUNC,
4786 .v.func = alc290_fixup_mono_speakers,
4788 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
4789 .type = HDA_FIXUP_FUNC,
4790 .v.func = alc290_fixup_mono_speakers,
4792 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
4794 [ALC269_FIXUP_THINKPAD_ACPI] = {
4795 .type = HDA_FIXUP_FUNC,
4796 .v.func = hda_fixup_thinkpad_acpi,
4798 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
4799 .type = HDA_FIXUP_PINS,
4800 .v.pins = (const struct hda_pintbl[]) {
4801 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4802 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
4806 .chain_id = ALC255_FIXUP_HEADSET_MODE
4808 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
4809 .type = HDA_FIXUP_PINS,
4810 .v.pins = (const struct hda_pintbl[]) {
4811 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4815 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
4817 [ALC255_FIXUP_HEADSET_MODE] = {
4818 .type = HDA_FIXUP_FUNC,
4819 .v.func = alc_fixup_headset_mode_alc255,
4821 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
4822 .type = HDA_FIXUP_FUNC,
4823 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
4825 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
4826 .type = HDA_FIXUP_PINS,
4827 .v.pins = (const struct hda_pintbl[]) {
4828 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
4829 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4833 .chain_id = ALC269_FIXUP_HEADSET_MODE
4835 [ALC292_FIXUP_TPT440_DOCK] = {
4836 .type = HDA_FIXUP_PINS,
4837 .v.pins = (const struct hda_pintbl[]) {
4838 { 0x16, 0x21211010 }, /* dock headphone */
4839 { 0x19, 0x21a11010 }, /* dock mic */
4843 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
4845 [ALC283_FIXUP_BXBT2807_MIC] = {
4846 .type = HDA_FIXUP_PINS,
4847 .v.pins = (const struct hda_pintbl[]) {
4848 { 0x19, 0x04a110f0 },
4852 [ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED] = {
4853 .type = HDA_FIXUP_FUNC,
4854 .v.func = alc_fixup_dell_wmi,
4855 .chained_before = true,
4856 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
4861 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
4862 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
4863 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
4864 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
4865 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
4866 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
4867 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
4868 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
4869 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
4870 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
4871 SND_PCI_QUIRK(0x1028, 0x05be, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
4872 SND_PCI_QUIRK(0x1028, 0x05c4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4873 SND_PCI_QUIRK(0x1028, 0x05c5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4874 SND_PCI_QUIRK(0x1028, 0x05c6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4875 SND_PCI_QUIRK(0x1028, 0x05c7, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4876 SND_PCI_QUIRK(0x1028, 0x05c8, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4877 SND_PCI_QUIRK(0x1028, 0x05c9, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4878 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
4879 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
4880 SND_PCI_QUIRK(0x1028, 0x05cc, "Dell X5 Precision", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
4881 SND_PCI_QUIRK(0x1028, 0x05cd, "Dell X5 Precision", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
4882 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
4883 SND_PCI_QUIRK(0x1028, 0x05de, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
4884 SND_PCI_QUIRK(0x1028, 0x05e0, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
4885 SND_PCI_QUIRK(0x1028, 0x05e9, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4886 SND_PCI_QUIRK(0x1028, 0x05ea, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4887 SND_PCI_QUIRK(0x1028, 0x05eb, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4888 SND_PCI_QUIRK(0x1028, 0x05ec, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4889 SND_PCI_QUIRK(0x1028, 0x05ed, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4890 SND_PCI_QUIRK(0x1028, 0x05ee, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4891 SND_PCI_QUIRK(0x1028, 0x05f3, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4892 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4893 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4894 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4895 SND_PCI_QUIRK(0x1028, 0x05f8, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4896 SND_PCI_QUIRK(0x1028, 0x05f9, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4897 SND_PCI_QUIRK(0x1028, 0x05fb, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4898 SND_PCI_QUIRK(0x1028, 0x0606, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4899 SND_PCI_QUIRK(0x1028, 0x0608, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4900 SND_PCI_QUIRK(0x1028, 0x0609, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4901 SND_PCI_QUIRK(0x1028, 0x0610, "Dell", ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED),
4902 SND_PCI_QUIRK(0x1028, 0x0613, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4903 SND_PCI_QUIRK(0x1028, 0x0614, "Dell Inspiron 3135", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4904 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
4905 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
4906 SND_PCI_QUIRK(0x1028, 0x061f, "Dell", ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED),
4907 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
4908 SND_PCI_QUIRK(0x1028, 0x063f, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
4909 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
4910 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
4911 SND_PCI_QUIRK(0x1028, 0x0668, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE),
4912 SND_PCI_QUIRK(0x1028, 0x0669, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE),
4913 SND_PCI_QUIRK(0x1028, 0x0684, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
4914 SND_PCI_QUIRK(0x1028, 0x15cc, "Dell X5 Precision", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
4915 SND_PCI_QUIRK(0x1028, 0x15cd, "Dell X5 Precision", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
4916 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
4917 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
4918 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
4919 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
4920 SND_PCI_QUIRK(0x103c, 0x1973, "HP Pavilion", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4921 SND_PCI_QUIRK(0x103c, 0x1983, "HP Pavilion", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4922 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
4924 SND_PCI_QUIRK(0x103c, 0x21f8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4925 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4926 SND_PCI_QUIRK(0x103c, 0x220d, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4927 SND_PCI_QUIRK(0x103c, 0x220e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4928 SND_PCI_QUIRK(0x103c, 0x220f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4929 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4930 SND_PCI_QUIRK(0x103c, 0x2211, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4931 SND_PCI_QUIRK(0x103c, 0x2212, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4932 SND_PCI_QUIRK(0x103c, 0x2213, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4933 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4934 SND_PCI_QUIRK(0x103c, 0x2234, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4935 SND_PCI_QUIRK(0x103c, 0x2235, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4936 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4937 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4938 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4939 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4940 SND_PCI_QUIRK(0x103c, 0x2246, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4941 SND_PCI_QUIRK(0x103c, 0x2247, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4942 SND_PCI_QUIRK(0x103c, 0x2248, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4943 SND_PCI_QUIRK(0x103c, 0x2249, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4944 SND_PCI_QUIRK(0x103c, 0x224a, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4945 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4946 SND_PCI_QUIRK(0x103c, 0x224c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4947 SND_PCI_QUIRK(0x103c, 0x224d, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4948 SND_PCI_QUIRK(0x103c, 0x2266, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4949 SND_PCI_QUIRK(0x103c, 0x2267, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4950 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4951 SND_PCI_QUIRK(0x103c, 0x2269, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4952 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4953 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4954 SND_PCI_QUIRK(0x103c, 0x226c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4955 SND_PCI_QUIRK(0x103c, 0x226d, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4956 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4957 SND_PCI_QUIRK(0x103c, 0x226f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4958 SND_PCI_QUIRK(0x103c, 0x227a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4959 SND_PCI_QUIRK(0x103c, 0x227b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4960 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4961 SND_PCI_QUIRK(0x103c, 0x22a0, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4962 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4963 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4964 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4965 SND_PCI_QUIRK(0x103c, 0x22c0, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4966 SND_PCI_QUIRK(0x103c, 0x22c1, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4967 SND_PCI_QUIRK(0x103c, 0x22c2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4968 SND_PCI_QUIRK(0x103c, 0x22cd, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4969 SND_PCI_QUIRK(0x103c, 0x22ce, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4970 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4971 SND_PCI_QUIRK(0x103c, 0x22d0, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4972 SND_PCI_QUIRK(0x103c, 0x22da, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4973 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4974 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4975 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4976 SND_PCI_QUIRK(0x103c, 0x8004, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4978 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4979 SND_PCI_QUIRK(0x103c, 0x221c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4980 SND_PCI_QUIRK(0x103c, 0x221d, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4981 SND_PCI_QUIRK(0x103c, 0x2220, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4982 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4983 SND_PCI_QUIRK(0x103c, 0x2222, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4984 SND_PCI_QUIRK(0x103c, 0x2223, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4985 SND_PCI_QUIRK(0x103c, 0x2224, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4986 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4987 SND_PCI_QUIRK(0x103c, 0x2246, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4988 SND_PCI_QUIRK(0x103c, 0x2247, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4989 SND_PCI_QUIRK(0x103c, 0x2248, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4990 SND_PCI_QUIRK(0x103c, 0x2249, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4991 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4992 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4993 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4994 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4995 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4996 SND_PCI_QUIRK(0x103c, 0x2258, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4997 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4998 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4999 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5000 SND_PCI_QUIRK(0x103c, 0x2261, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5001 SND_PCI_QUIRK(0x103c, 0x2262, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5002 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5003 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5004 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5005 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5006 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5007 SND_PCI_QUIRK(0x103c, 0x2277, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5008 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5009 SND_PCI_QUIRK(0x103c, 0x227d, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5010 SND_PCI_QUIRK(0x103c, 0x227e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5011 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5012 SND_PCI_QUIRK(0x103c, 0x2280, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5013 SND_PCI_QUIRK(0x103c, 0x2281, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5014 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5015 SND_PCI_QUIRK(0x103c, 0x2289, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5016 SND_PCI_QUIRK(0x103c, 0x228a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5017 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5018 SND_PCI_QUIRK(0x103c, 0x228c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5019 SND_PCI_QUIRK(0x103c, 0x228d, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5020 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5021 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5022 SND_PCI_QUIRK(0x103c, 0x22c6, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5023 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5024 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5025 SND_PCI_QUIRK(0x103c, 0x22c3, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5026 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5027 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5028 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5029 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5030 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5031 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
5032 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
5033 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
5034 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
5035 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
5036 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
5037 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
5038 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
5039 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
5040 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
5041 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
5042 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
5043 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
5044 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
5045 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
5046 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
5047 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
5048 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
5049 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
5050 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
5051 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
5052 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
5053 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_BXBT2807_MIC),
5054 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
5055 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
5056 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
5057 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
5058 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
5059 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK),
5060 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
5061 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
5062 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
5063 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
5064 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
5065 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440_DOCK),
5066 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
5067 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
5068 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
5069 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
5070 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
5071 SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP),
5072 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
5073 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
5074 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
5075 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
5076 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
5077 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
5078 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
5081 /* Below is a quirk table taken from the old code.
5082 * Basically the device should work as is without the fixup table.
5083 * If BIOS doesn't give a proper info, enable the corresponding
5086 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
5088 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
5089 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
5090 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
5091 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
5092 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
5093 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
5094 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
5095 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
5096 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
5097 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
5098 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
5099 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
5100 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
5101 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
5102 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
5103 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
5104 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
5105 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
5106 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
5107 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
5108 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
5109 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
5110 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
5111 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
5112 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
5113 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
5114 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
5115 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
5116 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
5117 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
5118 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
5119 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
5120 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
5121 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
5122 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
5123 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
5124 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
5125 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
5126 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
5131 static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
5132 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
5133 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
5134 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
5135 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
5139 static const struct hda_model_fixup alc269_fixup_models[] = {
5140 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
5141 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
5142 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
5143 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
5144 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
5145 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
5146 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
5147 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
5148 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
5149 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
5150 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
5151 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
5152 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
5156 static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
5157 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5167 {0x21, 0x02211020}),
5168 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5178 {0x21, 0x02211030}),
5179 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5189 {0x21, 0x0321102f}),
5190 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5200 {0x21, 0x02211040}),
5201 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5211 {0x21, 0x02211050}),
5212 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5222 {0x21, 0x02211030}),
5223 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5233 {0x21, 0x02211040}),
5234 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
5244 {0x21, 0x0321101f}),
5245 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
5255 {0x21, 0x0321101f}),
5256 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
5266 {0x21, 0x02211030}),
5267 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
5278 {0x1e, 0x411111f0}),
5279 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
5290 {0x1e, 0x411111f0}),
5291 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
5302 {0x1e, 0x411111f0}),
5306 static void alc269_fill_coef(struct hda_codec *codec)
5308 struct alc_spec *spec = codec->spec;
5311 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
5314 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
5315 alc_write_coef_idx(codec, 0xf, 0x960b);
5316 alc_write_coef_idx(codec, 0xe, 0x8817);
5319 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
5320 alc_write_coef_idx(codec, 0xf, 0x960b);
5321 alc_write_coef_idx(codec, 0xe, 0x8814);
5324 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
5325 val = alc_read_coef_idx(codec, 0x04);
5326 /* Power up output pin */
5328 alc_write_coef_idx(codec, 0x04, val | (1<<11));
5331 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
5332 val = alc_read_coef_idx(codec, 0xd);
5333 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
5334 /* Capless ramp up clock control */
5335 alc_write_coef_idx(codec, 0xd, val | (1<<10));
5337 val = alc_read_coef_idx(codec, 0x17);
5338 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
5339 /* Class D power on reset */
5340 alc_write_coef_idx(codec, 0x17, val | (1<<7));
5344 val = alc_read_coef_idx(codec, 0xd); /* Class D */
5346 alc_write_coef_idx(codec, 0xd, val | (1<<14));
5348 val = alc_read_coef_idx(codec, 0x4); /* HP */
5350 alc_write_coef_idx(codec, 0x4, val | (1<<11));
5355 static int patch_alc269(struct hda_codec *codec)
5357 struct alc_spec *spec;
5360 err = alc_alloc_spec(codec, 0x0b);
5365 spec->gen.shared_mic_vref_pin = 0x18;
5367 snd_hda_pick_fixup(codec, alc269_fixup_models,
5368 alc269_fixup_tbl, alc269_fixups);
5369 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups);
5370 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
5372 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
5374 alc_auto_parse_customize_define(codec);
5376 if (has_cdefine_beep(codec))
5377 spec->gen.beep_nid = 0x01;
5379 switch (codec->vendor_id) {
5381 spec->codec_variant = ALC269_TYPE_ALC269VA;
5382 switch (alc_get_coef0(codec) & 0x00f0) {
5384 if (codec->bus->pci &&
5385 codec->bus->pci->subsystem_vendor == 0x1025 &&
5386 spec->cdefine.platform_type == 1)
5387 err = alc_codec_rename(codec, "ALC271X");
5388 spec->codec_variant = ALC269_TYPE_ALC269VB;
5391 if (codec->bus->pci &&
5392 codec->bus->pci->subsystem_vendor == 0x17aa &&
5393 codec->bus->pci->subsystem_device == 0x21f3)
5394 err = alc_codec_rename(codec, "ALC3202");
5395 spec->codec_variant = ALC269_TYPE_ALC269VC;
5398 spec->codec_variant = ALC269_TYPE_ALC269VD;
5401 alc_fix_pll_init(codec, 0x20, 0x04, 15);
5405 spec->init_hook = alc269_fill_coef;
5406 alc269_fill_coef(codec);
5411 spec->codec_variant = ALC269_TYPE_ALC280;
5414 spec->codec_variant = ALC269_TYPE_ALC282;
5415 spec->shutup = alc282_shutup;
5416 spec->init_hook = alc282_init;
5420 spec->codec_variant = ALC269_TYPE_ALC283;
5421 spec->shutup = alc283_shutup;
5422 spec->init_hook = alc283_init;
5426 spec->codec_variant = ALC269_TYPE_ALC284;
5430 spec->codec_variant = ALC269_TYPE_ALC285;
5434 spec->codec_variant = ALC269_TYPE_ALC286;
5435 spec->shutup = alc286_shutup;
5438 spec->codec_variant = ALC269_TYPE_ALC255;
5442 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
5443 spec->has_alc5505_dsp = 1;
5444 spec->init_hook = alc5505_dsp_init;
5447 /* automatic parse from the BIOS config */
5448 err = alc269_parse_auto_config(codec);
5452 if (!spec->gen.no_analog && spec->gen.beep_nid)
5453 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
5455 codec->patch_ops = alc_patch_ops;
5457 codec->patch_ops.suspend = alc269_suspend;
5458 codec->patch_ops.resume = alc269_resume;
5461 spec->shutup = alc269_shutup;
5463 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
5476 static int alc861_parse_auto_config(struct hda_codec *codec)
5478 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
5479 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
5480 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
5483 /* Pin config fixes */
5485 ALC861_FIXUP_FSC_AMILO_PI1505,
5486 ALC861_FIXUP_AMP_VREF_0F,
5487 ALC861_FIXUP_NO_JACK_DETECT,
5488 ALC861_FIXUP_ASUS_A6RP,
5489 ALC660_FIXUP_ASUS_W7J,
5492 /* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
5493 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
5494 const struct hda_fixup *fix, int action)
5496 struct alc_spec *spec = codec->spec;
5499 if (action != HDA_FIXUP_ACT_INIT)
5501 val = snd_hda_codec_get_pin_target(codec, 0x0f);
5502 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
5503 val |= AC_PINCTL_IN_EN;
5504 val |= AC_PINCTL_VREF_50;
5505 snd_hda_set_pin_ctl(codec, 0x0f, val);
5506 spec->gen.keep_vref_in_automute = 1;
5509 /* suppress the jack-detection */
5510 static void alc_fixup_no_jack_detect(struct hda_codec *codec,
5511 const struct hda_fixup *fix, int action)
5513 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5514 codec->no_jack_detect = 1;
5517 static const struct hda_fixup alc861_fixups[] = {
5518 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
5519 .type = HDA_FIXUP_PINS,
5520 .v.pins = (const struct hda_pintbl[]) {
5521 { 0x0b, 0x0221101f }, /* HP */
5522 { 0x0f, 0x90170310 }, /* speaker */
5526 [ALC861_FIXUP_AMP_VREF_0F] = {
5527 .type = HDA_FIXUP_FUNC,
5528 .v.func = alc861_fixup_asus_amp_vref_0f,
5530 [ALC861_FIXUP_NO_JACK_DETECT] = {
5531 .type = HDA_FIXUP_FUNC,
5532 .v.func = alc_fixup_no_jack_detect,
5534 [ALC861_FIXUP_ASUS_A6RP] = {
5535 .type = HDA_FIXUP_FUNC,
5536 .v.func = alc861_fixup_asus_amp_vref_0f,
5538 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
5540 [ALC660_FIXUP_ASUS_W7J] = {
5541 .type = HDA_FIXUP_VERBS,
5542 .v.verbs = (const struct hda_verb[]) {
5543 /* ASUS W7J needs a magic pin setup on unused NID 0x10
5544 * for enabling outputs
5546 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5552 static const struct snd_pci_quirk alc861_fixup_tbl[] = {
5553 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
5554 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
5555 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
5556 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
5557 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
5558 SND_PCI_QUIRK(0x1584, 0x2b01, "Haier W18", ALC861_FIXUP_AMP_VREF_0F),
5559 SND_PCI_QUIRK(0x1584, 0x0000, "Uniwill ECS M31EI", ALC861_FIXUP_AMP_VREF_0F),
5560 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
5566 static int patch_alc861(struct hda_codec *codec)
5568 struct alc_spec *spec;
5571 err = alc_alloc_spec(codec, 0x15);
5576 spec->gen.beep_nid = 0x23;
5578 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
5579 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
5581 /* automatic parse from the BIOS config */
5582 err = alc861_parse_auto_config(codec);
5586 if (!spec->gen.no_analog)
5587 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
5589 codec->patch_ops = alc_patch_ops;
5591 spec->power_hook = alc_power_eapd;
5594 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
5608 * In addition, an independent DAC
5610 static int alc861vd_parse_auto_config(struct hda_codec *codec)
5612 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
5613 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
5614 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
5618 ALC660VD_FIX_ASUS_GPIO1,
5619 ALC861VD_FIX_DALLAS,
5622 /* exclude VREF80 */
5623 static void alc861vd_fixup_dallas(struct hda_codec *codec,
5624 const struct hda_fixup *fix, int action)
5626 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5627 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
5628 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
5632 static const struct hda_fixup alc861vd_fixups[] = {
5633 [ALC660VD_FIX_ASUS_GPIO1] = {
5634 .type = HDA_FIXUP_VERBS,
5635 .v.verbs = (const struct hda_verb[]) {
5637 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
5638 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5639 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5643 [ALC861VD_FIX_DALLAS] = {
5644 .type = HDA_FIXUP_FUNC,
5645 .v.func = alc861vd_fixup_dallas,
5649 static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
5650 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
5651 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
5652 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
5658 static int patch_alc861vd(struct hda_codec *codec)
5660 struct alc_spec *spec;
5663 err = alc_alloc_spec(codec, 0x0b);
5668 spec->gen.beep_nid = 0x23;
5670 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
5671 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
5673 /* automatic parse from the BIOS config */
5674 err = alc861vd_parse_auto_config(codec);
5678 if (!spec->gen.no_analog)
5679 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5681 codec->patch_ops = alc_patch_ops;
5683 spec->shutup = alc_eapd_shutup;
5685 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
5697 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
5698 * configuration. Each pin widget can choose any input DACs and a mixer.
5699 * Each ADC is connected from a mixer of all inputs. This makes possible
5700 * 6-channel independent captures.
5702 * In addition, an independent DAC for the multi-playback (not used in this
5707 * BIOS auto configuration
5710 static int alc662_parse_auto_config(struct hda_codec *codec)
5712 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
5713 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
5714 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
5715 const hda_nid_t *ssids;
5717 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
5718 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670 ||
5719 codec->vendor_id == 0x10ec0671)
5720 ssids = alc663_ssids;
5722 ssids = alc662_ssids;
5723 return alc_parse_auto_config(codec, alc662_ignore, ssids);
5726 static void alc272_fixup_mario(struct hda_codec *codec,
5727 const struct hda_fixup *fix, int action)
5729 if (action != HDA_FIXUP_ACT_PRE_PROBE)
5731 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
5732 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
5733 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
5734 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
5735 (0 << AC_AMPCAP_MUTE_SHIFT)))
5736 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
5739 static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
5741 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
5743 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
5744 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
5748 /* override the 2.1 chmap */
5749 static void alc_fixup_bass_chmap(struct hda_codec *codec,
5750 const struct hda_fixup *fix, int action)
5752 if (action == HDA_FIXUP_ACT_BUILD) {
5753 struct alc_spec *spec = codec->spec;
5754 spec->gen.pcm_rec[0].stream[0].chmap = asus_pcm_2_1_chmaps;
5758 /* turn on/off mute LED per vmaster hook */
5759 static void alc662_led_gpio1_mute_hook(void *private_data, int enabled)
5761 struct hda_codec *codec = private_data;
5762 struct alc_spec *spec = codec->spec;
5763 unsigned int oldval = spec->gpio_led;
5766 spec->gpio_led &= ~0x01;
5768 spec->gpio_led |= 0x01;
5769 if (spec->gpio_led != oldval)
5770 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
5774 /* avoid D3 for keeping GPIO up */
5775 static unsigned int gpio_led_power_filter(struct hda_codec *codec,
5777 unsigned int power_state)
5779 struct alc_spec *spec = codec->spec;
5780 if (nid == codec->afg && power_state == AC_PWRST_D3 && spec->gpio_led)
5785 static void alc662_fixup_led_gpio1(struct hda_codec *codec,
5786 const struct hda_fixup *fix, int action)
5788 struct alc_spec *spec = codec->spec;
5789 static const struct hda_verb gpio_init[] = {
5790 { 0x01, AC_VERB_SET_GPIO_MASK, 0x01 },
5791 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01 },
5795 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5796 spec->gen.vmaster_mute.hook = alc662_led_gpio1_mute_hook;
5798 snd_hda_add_verbs(codec, gpio_init);
5799 codec->power_filter = gpio_led_power_filter;
5804 ALC662_FIXUP_ASPIRE,
5805 ALC662_FIXUP_LED_GPIO1,
5806 ALC662_FIXUP_IDEAPAD,
5808 ALC662_FIXUP_CZC_P10T,
5809 ALC662_FIXUP_SKU_IGNORE,
5810 ALC662_FIXUP_HP_RP5800,
5811 ALC662_FIXUP_ASUS_MODE1,
5812 ALC662_FIXUP_ASUS_MODE2,
5813 ALC662_FIXUP_ASUS_MODE3,
5814 ALC662_FIXUP_ASUS_MODE4,
5815 ALC662_FIXUP_ASUS_MODE5,
5816 ALC662_FIXUP_ASUS_MODE6,
5817 ALC662_FIXUP_ASUS_MODE7,
5818 ALC662_FIXUP_ASUS_MODE8,
5819 ALC662_FIXUP_NO_JACK_DETECT,
5820 ALC662_FIXUP_ZOTAC_Z68,
5821 ALC662_FIXUP_INV_DMIC,
5822 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
5823 ALC668_FIXUP_HEADSET_MODE,
5824 ALC662_FIXUP_BASS_MODE4_CHMAP,
5825 ALC662_FIXUP_BASS_16,
5826 ALC662_FIXUP_BASS_1A,
5827 ALC662_FIXUP_BASS_CHMAP,
5828 ALC668_FIXUP_AUTO_MUTE,
5829 ALC668_FIXUP_DELL_DISABLE_AAMIX,
5830 ALC668_FIXUP_DELL_XPS13,
5833 static const struct hda_fixup alc662_fixups[] = {
5834 [ALC662_FIXUP_ASPIRE] = {
5835 .type = HDA_FIXUP_PINS,
5836 .v.pins = (const struct hda_pintbl[]) {
5837 { 0x15, 0x99130112 }, /* subwoofer */
5841 [ALC662_FIXUP_LED_GPIO1] = {
5842 .type = HDA_FIXUP_FUNC,
5843 .v.func = alc662_fixup_led_gpio1,
5845 [ALC662_FIXUP_IDEAPAD] = {
5846 .type = HDA_FIXUP_PINS,
5847 .v.pins = (const struct hda_pintbl[]) {
5848 { 0x17, 0x99130112 }, /* subwoofer */
5852 .chain_id = ALC662_FIXUP_LED_GPIO1,
5854 [ALC272_FIXUP_MARIO] = {
5855 .type = HDA_FIXUP_FUNC,
5856 .v.func = alc272_fixup_mario,
5858 [ALC662_FIXUP_CZC_P10T] = {
5859 .type = HDA_FIXUP_VERBS,
5860 .v.verbs = (const struct hda_verb[]) {
5861 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
5865 [ALC662_FIXUP_SKU_IGNORE] = {
5866 .type = HDA_FIXUP_FUNC,
5867 .v.func = alc_fixup_sku_ignore,
5869 [ALC662_FIXUP_HP_RP5800] = {
5870 .type = HDA_FIXUP_PINS,
5871 .v.pins = (const struct hda_pintbl[]) {
5872 { 0x14, 0x0221201f }, /* HP out */
5876 .chain_id = ALC662_FIXUP_SKU_IGNORE
5878 [ALC662_FIXUP_ASUS_MODE1] = {
5879 .type = HDA_FIXUP_PINS,
5880 .v.pins = (const struct hda_pintbl[]) {
5881 { 0x14, 0x99130110 }, /* speaker */
5882 { 0x18, 0x01a19c20 }, /* mic */
5883 { 0x19, 0x99a3092f }, /* int-mic */
5884 { 0x21, 0x0121401f }, /* HP out */
5888 .chain_id = ALC662_FIXUP_SKU_IGNORE
5890 [ALC662_FIXUP_ASUS_MODE2] = {
5891 .type = HDA_FIXUP_PINS,
5892 .v.pins = (const struct hda_pintbl[]) {
5893 { 0x14, 0x99130110 }, /* speaker */
5894 { 0x18, 0x01a19820 }, /* mic */
5895 { 0x19, 0x99a3092f }, /* int-mic */
5896 { 0x1b, 0x0121401f }, /* HP out */
5900 .chain_id = ALC662_FIXUP_SKU_IGNORE
5902 [ALC662_FIXUP_ASUS_MODE3] = {
5903 .type = HDA_FIXUP_PINS,
5904 .v.pins = (const struct hda_pintbl[]) {
5905 { 0x14, 0x99130110 }, /* speaker */
5906 { 0x15, 0x0121441f }, /* HP */
5907 { 0x18, 0x01a19840 }, /* mic */
5908 { 0x19, 0x99a3094f }, /* int-mic */
5909 { 0x21, 0x01211420 }, /* HP2 */
5913 .chain_id = ALC662_FIXUP_SKU_IGNORE
5915 [ALC662_FIXUP_ASUS_MODE4] = {
5916 .type = HDA_FIXUP_PINS,
5917 .v.pins = (const struct hda_pintbl[]) {
5918 { 0x14, 0x99130110 }, /* speaker */
5919 { 0x16, 0x99130111 }, /* speaker */
5920 { 0x18, 0x01a19840 }, /* mic */
5921 { 0x19, 0x99a3094f }, /* int-mic */
5922 { 0x21, 0x0121441f }, /* HP */
5926 .chain_id = ALC662_FIXUP_SKU_IGNORE
5928 [ALC662_FIXUP_ASUS_MODE5] = {
5929 .type = HDA_FIXUP_PINS,
5930 .v.pins = (const struct hda_pintbl[]) {
5931 { 0x14, 0x99130110 }, /* speaker */
5932 { 0x15, 0x0121441f }, /* HP */
5933 { 0x16, 0x99130111 }, /* speaker */
5934 { 0x18, 0x01a19840 }, /* mic */
5935 { 0x19, 0x99a3094f }, /* int-mic */
5939 .chain_id = ALC662_FIXUP_SKU_IGNORE
5941 [ALC662_FIXUP_ASUS_MODE6] = {
5942 .type = HDA_FIXUP_PINS,
5943 .v.pins = (const struct hda_pintbl[]) {
5944 { 0x14, 0x99130110 }, /* speaker */
5945 { 0x15, 0x01211420 }, /* HP2 */
5946 { 0x18, 0x01a19840 }, /* mic */
5947 { 0x19, 0x99a3094f }, /* int-mic */
5948 { 0x1b, 0x0121441f }, /* HP */
5952 .chain_id = ALC662_FIXUP_SKU_IGNORE
5954 [ALC662_FIXUP_ASUS_MODE7] = {
5955 .type = HDA_FIXUP_PINS,
5956 .v.pins = (const struct hda_pintbl[]) {
5957 { 0x14, 0x99130110 }, /* speaker */
5958 { 0x17, 0x99130111 }, /* speaker */
5959 { 0x18, 0x01a19840 }, /* mic */
5960 { 0x19, 0x99a3094f }, /* int-mic */
5961 { 0x1b, 0x01214020 }, /* HP */
5962 { 0x21, 0x0121401f }, /* HP */
5966 .chain_id = ALC662_FIXUP_SKU_IGNORE
5968 [ALC662_FIXUP_ASUS_MODE8] = {
5969 .type = HDA_FIXUP_PINS,
5970 .v.pins = (const struct hda_pintbl[]) {
5971 { 0x14, 0x99130110 }, /* speaker */
5972 { 0x12, 0x99a30970 }, /* int-mic */
5973 { 0x15, 0x01214020 }, /* HP */
5974 { 0x17, 0x99130111 }, /* speaker */
5975 { 0x18, 0x01a19840 }, /* mic */
5976 { 0x21, 0x0121401f }, /* HP */
5980 .chain_id = ALC662_FIXUP_SKU_IGNORE
5982 [ALC662_FIXUP_NO_JACK_DETECT] = {
5983 .type = HDA_FIXUP_FUNC,
5984 .v.func = alc_fixup_no_jack_detect,
5986 [ALC662_FIXUP_ZOTAC_Z68] = {
5987 .type = HDA_FIXUP_PINS,
5988 .v.pins = (const struct hda_pintbl[]) {
5989 { 0x1b, 0x02214020 }, /* Front HP */
5993 [ALC662_FIXUP_INV_DMIC] = {
5994 .type = HDA_FIXUP_FUNC,
5995 .v.func = alc_fixup_inv_dmic_0x12,
5997 [ALC668_FIXUP_DELL_XPS13] = {
5998 .type = HDA_FIXUP_FUNC,
5999 .v.func = alc_fixup_dell_xps13,
6001 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
6003 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
6004 .type = HDA_FIXUP_FUNC,
6005 .v.func = alc_fixup_disable_aamix,
6007 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
6009 [ALC668_FIXUP_AUTO_MUTE] = {
6010 .type = HDA_FIXUP_FUNC,
6011 .v.func = alc_fixup_auto_mute_via_amp,
6013 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
6015 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
6016 .type = HDA_FIXUP_PINS,
6017 .v.pins = (const struct hda_pintbl[]) {
6018 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
6019 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
6023 .chain_id = ALC668_FIXUP_HEADSET_MODE
6025 [ALC668_FIXUP_HEADSET_MODE] = {
6026 .type = HDA_FIXUP_FUNC,
6027 .v.func = alc_fixup_headset_mode_alc668,
6029 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
6030 .type = HDA_FIXUP_FUNC,
6031 .v.func = alc_fixup_bass_chmap,
6033 .chain_id = ALC662_FIXUP_ASUS_MODE4
6035 [ALC662_FIXUP_BASS_16] = {
6036 .type = HDA_FIXUP_PINS,
6037 .v.pins = (const struct hda_pintbl[]) {
6038 {0x16, 0x80106111}, /* bass speaker */
6042 .chain_id = ALC662_FIXUP_BASS_CHMAP,
6044 [ALC662_FIXUP_BASS_1A] = {
6045 .type = HDA_FIXUP_PINS,
6046 .v.pins = (const struct hda_pintbl[]) {
6047 {0x1a, 0x80106111}, /* bass speaker */
6051 .chain_id = ALC662_FIXUP_BASS_CHMAP,
6053 [ALC662_FIXUP_BASS_CHMAP] = {
6054 .type = HDA_FIXUP_FUNC,
6055 .v.func = alc_fixup_bass_chmap,
6059 static const struct snd_pci_quirk alc662_fixup_tbl[] = {
6060 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
6061 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
6062 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
6063 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
6064 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
6065 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
6066 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
6067 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
6068 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
6069 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
6070 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
6071 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
6072 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
6073 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
6074 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
6075 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
6076 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_BASS_1A),
6077 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
6078 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
6079 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
6080 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
6081 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
6082 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
6083 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
6084 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
6085 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
6086 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
6087 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
6090 /* Below is a quirk table taken from the old code.
6091 * Basically the device should work as is without the fixup table.
6092 * If BIOS doesn't give a proper info, enable the corresponding
6095 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
6096 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
6097 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
6098 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
6099 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
6100 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6101 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
6102 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
6103 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
6104 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6105 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
6106 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
6107 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
6108 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
6109 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
6110 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6111 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
6112 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
6113 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6114 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
6115 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
6116 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6117 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
6118 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
6119 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
6120 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6121 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
6122 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
6123 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6124 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
6125 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6126 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6127 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
6128 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
6129 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
6130 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
6131 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
6132 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
6133 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
6134 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6135 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
6136 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
6137 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
6138 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
6139 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
6140 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
6141 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
6142 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
6143 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
6144 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
6149 static const struct hda_model_fixup alc662_fixup_models[] = {
6150 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
6151 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
6152 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
6153 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
6154 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
6155 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
6156 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
6157 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
6158 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
6159 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
6160 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
6164 static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
6165 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
6176 {0x1f, 0x411111f0}),
6177 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
6188 {0x1f, 0x411111f0}),
6189 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
6200 {0x1f, 0x411111f0}),
6201 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
6212 {0x1f, 0x411111f0}),
6213 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
6224 {0x1f, 0x411111f0}),
6228 static void alc662_fill_coef(struct hda_codec *codec)
6232 coef = alc_get_coef0(codec);
6234 switch (codec->vendor_id) {
6236 if ((coef & 0x00f0) == 0x0030) {
6237 val = alc_read_coef_idx(codec, 0x4); /* EAPD Ctrl */
6238 alc_write_coef_idx(codec, 0x4, val & ~(1<<10));
6248 val = alc_read_coef_idx(codec, 0xd); /* EAPD Ctrl */
6249 alc_write_coef_idx(codec, 0xd, val | (1<<14));
6256 static int patch_alc662(struct hda_codec *codec)
6258 struct alc_spec *spec;
6261 err = alc_alloc_spec(codec, 0x0b);
6267 /* handle multiple HPs as is */
6268 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
6270 alc_fix_pll_init(codec, 0x20, 0x04, 15);
6272 spec->init_hook = alc662_fill_coef;
6273 alc662_fill_coef(codec);
6275 snd_hda_pick_fixup(codec, alc662_fixup_models,
6276 alc662_fixup_tbl, alc662_fixups);
6277 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups);
6278 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
6280 alc_auto_parse_customize_define(codec);
6282 if (has_cdefine_beep(codec))
6283 spec->gen.beep_nid = 0x01;
6285 if ((alc_get_coef0(codec) & (1 << 14)) &&
6286 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
6287 spec->cdefine.platform_type == 1) {
6288 err = alc_codec_rename(codec, "ALC272X");
6293 /* automatic parse from the BIOS config */
6294 err = alc662_parse_auto_config(codec);
6298 if (!spec->gen.no_analog && spec->gen.beep_nid) {
6299 switch (codec->vendor_id) {
6301 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
6307 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
6310 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
6315 codec->patch_ops = alc_patch_ops;
6316 spec->shutup = alc_eapd_shutup;
6318 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
6331 static int alc680_parse_auto_config(struct hda_codec *codec)
6333 return alc_parse_auto_config(codec, NULL, NULL);
6338 static int patch_alc680(struct hda_codec *codec)
6342 /* ALC680 has no aa-loopback mixer */
6343 err = alc_alloc_spec(codec, 0);
6347 /* automatic parse from the BIOS config */
6348 err = alc680_parse_auto_config(codec);
6354 codec->patch_ops = alc_patch_ops;
6362 static const struct hda_codec_preset snd_hda_preset_realtek[] = {
6363 { .id = 0x10ec0221, .name = "ALC221", .patch = patch_alc269 },
6364 { .id = 0x10ec0231, .name = "ALC231", .patch = patch_alc269 },
6365 { .id = 0x10ec0233, .name = "ALC233", .patch = patch_alc269 },
6366 { .id = 0x10ec0235, .name = "ALC233", .patch = patch_alc269 },
6367 { .id = 0x10ec0255, .name = "ALC255", .patch = patch_alc269 },
6368 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
6369 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
6370 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
6371 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
6372 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
6373 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
6374 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
6375 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
6376 { .id = 0x10ec0276, .name = "ALC276", .patch = patch_alc269 },
6377 { .id = 0x10ec0280, .name = "ALC280", .patch = patch_alc269 },
6378 { .id = 0x10ec0282, .name = "ALC282", .patch = patch_alc269 },
6379 { .id = 0x10ec0283, .name = "ALC283", .patch = patch_alc269 },
6380 { .id = 0x10ec0284, .name = "ALC284", .patch = patch_alc269 },
6381 { .id = 0x10ec0285, .name = "ALC285", .patch = patch_alc269 },
6382 { .id = 0x10ec0286, .name = "ALC286", .patch = patch_alc269 },
6383 { .id = 0x10ec0288, .name = "ALC288", .patch = patch_alc269 },
6384 { .id = 0x10ec0290, .name = "ALC290", .patch = patch_alc269 },
6385 { .id = 0x10ec0292, .name = "ALC292", .patch = patch_alc269 },
6386 { .id = 0x10ec0293, .name = "ALC293", .patch = patch_alc269 },
6387 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
6388 .patch = patch_alc861 },
6389 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
6390 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
6391 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
6392 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
6393 .patch = patch_alc882 },
6394 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
6395 .patch = patch_alc662 },
6396 { .id = 0x10ec0662, .rev = 0x100300, .name = "ALC662 rev3",
6397 .patch = patch_alc662 },
6398 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
6399 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
6400 { .id = 0x10ec0667, .name = "ALC667", .patch = patch_alc662 },
6401 { .id = 0x10ec0668, .name = "ALC668", .patch = patch_alc662 },
6402 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
6403 { .id = 0x10ec0671, .name = "ALC671", .patch = patch_alc662 },
6404 { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
6405 { .id = 0x10ec0867, .name = "ALC891", .patch = patch_alc882 },
6406 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
6407 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
6408 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
6409 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
6410 .patch = patch_alc882 },
6411 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
6412 .patch = patch_alc882 },
6413 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
6414 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
6415 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
6416 .patch = patch_alc882 },
6417 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc882 },
6418 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
6419 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
6420 { .id = 0x10ec0899, .name = "ALC898", .patch = patch_alc882 },
6421 { .id = 0x10ec0900, .name = "ALC1150", .patch = patch_alc882 },
6425 MODULE_ALIAS("snd-hda-codec-id:10ec*");
6427 MODULE_LICENSE("GPL");
6428 MODULE_DESCRIPTION("Realtek HD-audio codec");
6430 static struct hda_codec_preset_list realtek_list = {
6431 .preset = snd_hda_preset_realtek,
6432 .owner = THIS_MODULE,
6435 static int __init patch_realtek_init(void)
6437 return snd_hda_add_codec_preset(&realtek_list);
6440 static void __exit patch_realtek_exit(void)
6442 snd_hda_delete_codec_preset(&realtek_list);
6445 module_init(patch_realtek_init)
6446 module_exit(patch_realtek_exit)